/* ---------------------------------------------------------------------------
   couch-page.css — More info: a game's page, sliding up over the home screen
   like a console's store page. Stills on the left, the game on the right,
   rows to browse sideways underneath.
--------------------------------------------------------------------------- */

.page {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--stage);
  scrollbar-width: none;
}

.page::-webkit-scrollbar {
  display: none;
}

.page[hidden] {
  display: none;
}

.page.is-entering {
  animation: page-up 0.46s var(--ease) both;
}

.page.is-leaving {
  animation: page-down 0.36s var(--ease-in) both;
}

@keyframes page-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes page-down {
  to {
    transform: translateY(100%);
  }
}

.page__sheet {
  position: relative;
  min-height: 100%;
  padding: 0 var(--gutter) 8vh;
}

/* The game's cover, blown up and out of focus, as the light the page sits in. */
.page__glow {
  position: absolute;
  inset: 0 0 auto;
  height: 92vh;
  overflow: hidden;
  pointer-events: none;
}

.page__glow img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.25);
  filter: blur(70px) saturate(1.3);
  opacity: 0.42;
}

.page__glow::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 70% at 18% 0%, color-mix(in srgb, var(--g-glow) 22%, transparent), transparent 70%),
    linear-gradient(180deg, rgb(5 6 10 / 0.35), var(--stage) 96%);
}

.page__top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--bar-h);
}

.page__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: clamp(38px, 5.2vh, 60px);
  padding-block: 0 0; padding-inline: 0.7em 1em;
  border-radius: 999px;
  background: var(--glass);
  font-size: var(--type-m);
  font-weight: 600;
  font-variation-settings: 'wdth' 98, 'wght' 620;
  transition:
    transform var(--focus-ms) var(--ease),
    background-color 0.15s;
}

.page__back svg {
  width: 1.1em;
  height: 1.1em;
}

.page__back:hover {
  background: var(--glass-hi);
}

.page__back:focus {
  outline: none;
  background: #fff;
  color: var(--stage);
  transform: scale(1.05);
}

.page__main {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 60fr) minmax(0, 40fr);
  gap: clamp(20px, 3.4vw, 80px);
  align-items: start;
}

/* --- the gallery -------------------------------------------------------- */

.gallery {
  position: sticky;
  top: 2vh;
}

.gallery__stage {
  position: relative;
  /* On a wide screen the stills would grow taller than the page: cap them by height. */
  width: min(100%, 64vh * 16 / 9);
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius) * 1.6);
  overflow: hidden;
  background: var(--g-deep);
  box-shadow: 0 2.5vh 6vh -2vh rgb(0 0 0 / 0.8);
  transition:
    box-shadow var(--focus-ms) var(--ease),
    transform var(--focus-ms) var(--ease);
}

.gallery__stage:focus {
  outline: none;
  box-shadow:
    0 0 0 3px #fff,
    0 1.5vh 6vh -1vh var(--g-glow);
}

.gallery__shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.gallery__shot.is-on {
  opacity: 1;
}

.gallery__count,
.gallery__hint {
  position: absolute;
  bottom: 1.1em;
  padding: 0.3em 0.7em;
  border-radius: 999px;
  background: rgb(5 6 10 / 0.72);
  font-size: var(--type-s);
  font-variation-settings: 'wdth' 100, 'wght' 600;
  font-variant-numeric: tabular-nums;
}

.gallery__count {
  inset-inline-end: 1.1em;
}

.gallery__hint {
  inset-inline-start: 1.1em;
  display: none;
  gap: 0.3em;
  padding: 0.3em;
}

.gallery__stage:focus .gallery__hint {
  display: inline-flex;
}

.gallery__thumbs {
  display: flex;
  gap: clamp(8px, 1vw, 18px);
  margin-top: 1.8vh;
}

.thumb {
  position: relative;
  width: min(30%, 12vw);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb:hover,
.thumb.is-on {
  opacity: 1;
}

.thumb__bar {
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: rgb(255 255 255 / 0.22);
}

.thumb.is-on .thumb__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--g-light);
  transform-origin: left;
  animation: fill 5s linear both;
}
.thumb.is-on .thumb__bar:dir(rtl)::after {
  transform-origin: right;
}


/* --- the information column ---------------------------------------------- */

.page__info {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vh, 22px);
  min-width: 0;
}

.page__eyebrow {
  font-size: var(--type-s);
  font-weight: 600;
  font-variation-settings: 'wdth' 100, 'wght' 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.page__name {
  font-size: clamp(2rem, min(4.3vw, 8vh), 7rem);
  line-height: 0.9;
  font-weight: 800;
  font-variation-settings: 'wdth' 68, 'wght' 860;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.page__tagline {
  font-size: var(--type-l);
  line-height: 1.25;
  font-weight: 500;
  font-variation-settings: 'wdth' 92, 'wght' 540;
}

.page__blurb {
  max-width: 60ch;
  color: var(--ink-2);
  line-height: 1.6;
}

.page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 0.9vw, 16px);
  padding-block: 0.6vh;
}

.page__label {
  margin-bottom: 1.2vh;
  font-size: var(--type-s);
  font-weight: 600;
  font-variation-settings: 'wdth' 100, 'wght' 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.howto,
.facts,
.builds {
  padding-top: clamp(12px, 2vh, 26px);
  border-top: 1px solid var(--line);
}

/* One grid for every row, so what the keys do lines up down the page. */
.howto__rows {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 0.8vh 1.4em;
  align-items: center;
  font-size: var(--type-m);
}

.howto__row {
  display: contents;
}

.howto__row dt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25em;
  max-width: 16em;
}

.howto__row dd {
  color: var(--ink-2);
}

.howto__row dd .cap {
  margin-inline: 0.15em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr));
  gap: 1.8vh 1.6vw;
}

.facts dt {
  font-size: var(--type-s);
  font-weight: 600;
  font-variation-settings: 'wdth' 100, 'wght' 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.facts dd {
  font-weight: 500;
  font-variation-settings: 'wdth' 98, 'wght' 560;
}

.facts__note {
  display: block;
  font-size: var(--type-s);
  color: var(--ink-3);
  font-variation-settings: 'wdth' 100, 'wght' 440;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
}

.tag {
  padding: 0.25em 0.75em;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: var(--type-s);
}

.builds__list {
  display: grid;
  gap: 0.6vh;
}

.build {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1.2em;
  align-items: center;
  padding: 0.65em 1em;
  border-radius: calc(var(--radius) * 1.2);
  background: var(--glass);
  text-align: start;
}

.build:focus {
  outline: none;
  background: #fff;
  color: var(--stage);
}

.build__name {
  font-weight: 600;
  font-variation-settings: 'wdth' 96, 'wght' 650;
}

.build__meta {
  font-size: var(--type-s);
  opacity: 0.75;
}

/* --- rows to browse sideways ------------------------------------------- */

.page__rail {
  position: relative;
  margin-top: 5vh;
}

.page__rail .page__label {
  margin-bottom: 0;
}

/* Its room to grow is borrowed from the gap below, not from the title. */
.page__rail .rail__track {
  margin: 0 calc(-1 * var(--gutter)) calc(-1 * var(--track-pad));
  padding-top: calc(var(--tile-h) * 0.07);
}

/* --- a phone: one column -------------------------------------------------- */

@media (max-width: 46rem), (max-aspect-ratio: 1/1) {
  .page__main {
    grid-template-columns: minmax(0, 1fr);
  }

  .gallery {
    position: relative;
    top: 0;
  }

  .thumb {
    width: 30%;
  }
}
