/* Homepage title screen (index.html only).
   The hero is a game title screen: a menu that routes each visitor in one
   click, plus a "Coming soon" section for the upcoming Steam releases. */

/* Darkens the left side of the showreel so the menu stays readable. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(5, 9, 19, 0.88) 0%, rgba(5, 9, 19, 0.58) 40%, rgba(5, 9, 19, 0) 68%);
}

.hero h1 {
  font-size: 4.6rem;
}

.title-menu ul {
  display: grid;
  gap: 4px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
}

.title-menu a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 18px;
  width: fit-content;
  min-width: min(100%, 560px);
  padding: 9px 22px 9px 60px;
  color: rgba(255, 255, 255, 0.66);
  transition: color 120ms ease, background 120ms ease;
}

.title-menu-label {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
  text-transform: uppercase;
}

.title-menu-sub {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.title-menu a.is-selected {
  color: #fff;
  background: linear-gradient(90deg, rgba(22, 139, 255, 0.36), rgba(22, 139, 255, 0) 92%);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.title-menu a.is-selected .title-menu-label {
  text-shadow: 0 0 18px rgba(40, 215, 255, 0.45), 0 3px 22px rgba(0, 0, 0, 0.72);
}

.title-menu a.is-selected .title-menu-sub {
  color: var(--cyan);
}

/* The Fantastico star as the menu cursor, with a two-frame retro bob. */
.title-menu a.is-selected::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 18px;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  background: url("assets/images/star-cursor.svg") center / contain no-repeat;
  animation: title-cursor 0.8s steps(2, jump-none) infinite;
}

.title-menu a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@keyframes title-cursor {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(5px);
  }
}

.title-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 26px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
  text-shadow: none;
}

.title-hint-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.title-hint-controls[hidden] {
  display: none;
}

.title-hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid rgba(152, 191, 255, 0.45);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(5, 9, 19, 0.72);
  color: #fff;
  font: 700 0.7rem/1 var(--font-body);
}

.title-hint-note {
  margin-left: 10px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.title-hint .pixel-icon {
  width: 21px;
  height: 21px;
  filter: brightness(0) invert(1);
}

.title-sound {
  padding: 5px 12px;
  border: 1px solid var(--line);
  background: rgba(5, 9, 19, 0.72);
  color: var(--muted);
  font: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

.title-sound::before {
  content: "\266A";
  margin-right: 6px;
}

.title-sound:hover,
.title-sound[aria-pressed="true"] {
  border-color: var(--cyan);
  color: #fff;
}

/* Backdrops: one layer per menu entry, crossfaded by title-screen.js. */
.title-backdrops {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.title-backdrop {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 500ms ease;
}

.title-backdrop.is-active {
  opacity: 1;
}

/* NEW GAME: screenshots of the upcoming games, with a slow zoom-out. */
.title-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: brightness(0.62);
  transform: scale(1.06);
  transition: opacity 900ms ease, transform 6s linear;
}

.title-slide.is-active {
  opacity: 1;
  transform: scale(1);
}

/* LOAD GAME: a tilted wall of covers drifting upward. The covers are listed
   twice, so moving by half its height loops without a jump: this needs the
   cover count to be a multiple of the 4 columns (32 today), and the bottom
   padding equal to the gap. */
.cover-wall {
  position: absolute;
  top: -20%;
  left: 46%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: 70%;
  padding-bottom: 14px;
  opacity: 0.6;
  transform: rotate(-9deg);
  animation: cover-wall 70s linear infinite;
}

.title-backdrop:not(.is-active) .cover-wall {
  animation-play-state: paused;
}

.cover-wall img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
}

@keyframes cover-wall {
  from {
    transform: rotate(-9deg) translateY(0);
  }

  to {
    transform: rotate(-9deg) translateY(-50%);
  }
}

/* CO-OP: the isometric studio world, framed like the social preview image.
   Anchored to the bottom so it stays clear of the first line of the title. */
.title-art {
  position: absolute;
  right: max(4%, calc((100vw - 1351px) / 2));
  bottom: 72px;
  width: min(50%, 800px);
  border: 2px solid rgba(152, 191, 255, 0.4);
  border-radius: 18px;
  box-shadow: 0 0 90px rgba(40, 215, 255, 0.25);
  animation: title-float 6s ease-in-out infinite alternate;
}

/* CREDITS: the pixel portraits of the founders. */
.portrait-wall {
  position: absolute;
  top: 50%;
  right: max(6%, calc((100vw - 1351px) / 2 + 40px));
  display: grid;
  grid-template-columns: repeat(2, clamp(120px, 15vw, 230px));
  gap: 18px;
  transform: translateY(-50%) rotate(3deg);
}

.portrait-wall img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* CONTACT: the Fantastico star, large. */
.title-star {
  position: absolute;
  top: 50%;
  right: max(9%, calc((100vw - 1351px) / 2 + 80px));
  width: clamp(220px, 27vw, 420px);
  filter: drop-shadow(0 0 46px rgba(40, 215, 255, 0.35));
  transform: translateY(-50%) rotate(-8deg);
  animation: title-float 6s ease-in-out infinite alternate;
}

@keyframes title-float {
  from {
    translate: 0 -8px;
  }

  to {
    translate: 0 8px;
  }
}

.title-backdrop-caption {
  position: absolute;
  right: max(clamp(24px, 7vw, 128px), calc((100vw - 1351.11px) / 2 + 64px));
  bottom: 34px;
  z-index: 3;
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
}

.upcoming-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.upcoming-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 27, 52, 0.86), rgba(5, 10, 20, 0.88));
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.upcoming-card:hover {
  border-color: rgba(88, 169, 255, 0.78);
  box-shadow: 0 22px 70px rgba(22, 139, 255, 0.18), var(--shadow);
  transform: translateY(-3px);
}

.upcoming-card img {
  width: 100%;
  aspect-ratio: 460 / 215;
  object-fit: cover;
}

.upcoming-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px 22px;
}

.upcoming-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.upcoming-body .upcoming-when {
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.upcoming-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1;
  text-transform: uppercase;
}

.upcoming-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: auto;
  padding-top: 8px;
}

.upcoming-link {
  color: #58a9ff;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.upcoming-link:hover {
  color: #fff;
}

@media (max-width: 1180px) {
  .hero h1 {
    font-size: 4rem;
  }
}

@media (max-width: 760px) {
  .hero::before {
    background: linear-gradient(180deg, rgba(5, 9, 19, 0) 35%, rgba(5, 9, 19, 0.82) 62%);
  }

  /* On phones the backdrop fills the 16:9 band above the menu, where the video used to be. */
  .title-backdrops {
    top: 74px;
    bottom: auto;
    height: 56.25vw;
  }

  .title-slide {
    filter: brightness(0.85);
  }

  .title-backdrop-caption {
    display: none;
  }

  .hero h1 {
    font-size: 2.6rem;
  }

  .title-menu ul {
    gap: 8px;
    margin-top: 24px;
  }

  .title-menu a {
    display: grid;
    gap: 4px;
    width: 100%;
    min-width: 0;
    padding: 12px 16px 12px 54px;
    border: 1px solid var(--line);
    background: rgba(8, 16, 31, 0.78);
  }

  .title-menu a.is-selected {
    background: linear-gradient(90deg, rgba(22, 139, 255, 0.36), rgba(8, 16, 31, 0.78));
  }

  .title-menu a.is-selected::before {
    left: 16px;
    width: 24px;
    height: 24px;
    margin-top: -12px;
  }

  .title-menu-label {
    font-size: 1.6rem;
  }

  .title-menu-sub {
    font-size: 0.86rem;
  }

  .title-hint {
    display: none;
  }

  .upcoming-grid {
    grid-template-columns: 1fr;
  }
}
