/* After Earth X site. Direction and reasons: DESIGN.md (palette from the game's ui_theme.gd). */

:root {
  --bg: #101214;
  --panel: #1b1e22;
  --panel-2: #23272c;
  --line: #3a3f45;
  --line-strong: #8c939b;
  --text: #e8e6e1;
  --text-dim: #a8adb3;
  --rust: #d9622b;
  --echo: #2fd3e6;
  --black: #050607;

  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --font-text: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-readout: "Barlow Semi Condensed", "Barlow", "Arial Narrow", sans-serif;

  --radius: 2px;
  --wrap: 78rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --side: max(var(--gutter), calc((100% - var(--wrap)) / 2));
  --bar-h: 3.75rem;
  --lb: clamp(3.75rem, 10vh, 6.5rem);
  --space-section: clamp(4.5rem, 10vw, 9.5rem);
  color-scheme: dark;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 1rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--font-text);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--rust);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--rust); }

:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.92;
  text-transform: uppercase;
  text-wrap: balance;
}
h2 { font-size: clamp(2.75rem, 7.5vw, 6.25rem); }
h3 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); }
h4 { font-size: 1.25rem; letter-spacing: 0.02em; }

p { margin: 0 0 1em; max-width: 66ch; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0; padding: 0; }

.lead { font-size: clamp(1.125rem, 1.8vw, 1.375rem); line-height: 1.5; color: var(--text); }

.x { color: var(--rust); }
.tnum { font-variant-numeric: tabular-nums; }
.echo { color: var(--echo); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  top: 0.75rem; left: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--bg);
  font: 600 1rem/1 var(--font-readout);
  border-radius: var(--radius);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }

/* The game's objective marker: an orange diamond with a dark outline. */
.wp {
  display: inline-block;
  flex: none;
  width: 0.6em;
  height: 0.6em;
  margin: 0 0.75em 0 0.2em;
  vertical-align: 0.06em;
  background: var(--rust);
  outline: 1.5px solid #000;
  transform: rotate(45deg);
}

/* HUD-style readouts: when and where a frame was taken, in the game's own format. */
.readout {
  display: block;
  margin: 0;
  font: 600 0.9375rem/1.35 var(--font-readout);
  color: var(--text-dim);
}
.readout__sep { margin: 0 0.5em; color: var(--line-strong); }

/* ---------- top bar ---------- */

.bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  border-bottom: 1px solid transparent;
}
.bar[data-solid] { background: rgba(16, 18, 20, 0.96); border-bottom-color: var(--line); }

.wordmark {
  font: 900 1.6rem/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text);
  padding: 0.6rem 0;
}
.wordmark:hover { color: var(--text); }

.menu-btn {
  display: none;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: 600 1.0625rem/1 var(--font-readout);
  cursor: pointer;
}
.menu-btn[aria-expanded="true"] { border-color: var(--text); background: var(--panel); }

.nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.35rem; list-style: none; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font: 600 1rem/1 var(--font-readout);
  color: var(--text-dim);
  text-decoration: none;
}
.nav a:hover, .nav a[aria-current] { color: var(--text); }
.nav a[aria-current]::before {
  content: "";
  width: 0.5em; height: 0.5em;
  margin-right: 0.55em;
  background: var(--rust);
  outline: 1.5px solid #000;
  transform: rotate(45deg);
}

@media (max-width: 1179px) {
  .js .menu-btn { display: inline-flex; align-items: center; }
  .js .nav {
    position: fixed;
    top: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
    left: 0; right: 0;
    max-height: calc(100dvh - var(--bar-h));
    overflow-y: auto;
    padding: 0.5rem var(--gutter) 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .js .nav[hidden] { display: none; }
  .js .nav ul { flex-direction: column; gap: 0; }
  .js .nav li + li { border-top: 1px solid var(--line); }
  .js .nav a { min-height: 3.25rem; width: 100%; font-size: 1.25rem; }
  /* Without JS the links stay in reach: a sideways-scrolling row under the wordmark. */
  .no-js .bar { height: auto; flex-wrap: wrap; padding-bottom: 0.25rem; background: var(--bg); }
  .no-js .nav { width: 100%; overflow-x: auto; }
  .no-js .nav ul { flex-wrap: nowrap; }
}

/* ---------- hero ---------- */

/* Poster layout: the title in the sky, the frame's subjects on the horizon left clear,
   the details on the dark ground below. */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: max(38rem, 100svh);
  overflow: hidden;
  background: var(--black);
}

.hero__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 58%;
}

/* Scrims under the words only: the sky behind the title, the ground behind the details.
   The horizon band in the middle, where the buggy and Kai stand, stays as rendered. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(5, 6, 7, 0.88) 0%, rgba(5, 6, 7, 0.76) 32%, rgba(5, 6, 7, 0) 52%),
    linear-gradient(to top, rgba(5, 6, 7, 0.92) 0%, rgba(5, 6, 7, 0.72) 22%, rgba(5, 6, 7, 0) 40%);
}

.hero__top {
  position: relative;
  z-index: 1;
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin: calc(var(--lb) + clamp(0.75rem, 4vh, 2.75rem)) auto 0;
}

/* The letterbox: a black band top and bottom, as on a film frame. */
.hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--lb);
  z-index: 1;
  background: var(--black);
}

.hero__body {
  position: relative;
  z-index: 1;
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin: auto auto 0;
  padding: 2rem 0 clamp(1.25rem, 3.5vh, 2.75rem);
}

.hero__title {
  margin: 0 0 0 -0.04em;
  font-size: clamp(4rem, 13.5vw, 12.5rem);
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: -0.005em;
  color: var(--text);
  -webkit-mask-image: url("../img/wear-mask.png");
  mask-image: url("../img/wear-mask.png");
  -webkit-mask-size: 26rem;
  mask-size: 26rem;
}
/* White with a cold metal fall-off (GDD 18: "white/metallic title and a red/orange X"). */
.hero__title-word {
  background: linear-gradient(180deg, #f7f5f1 35%, #b6babf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@media (forced-colors: active) {
  .hero__title-word { background: none; color: CanvasText; }
}

.hero__lead {
  max-width: 34ch;
  margin-bottom: 1rem;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  font-weight: 500;
  line-height: 1.4;
}

.hero__facts {
  margin-bottom: 1.1rem;
  font: 600 1rem/1.4 var(--font-readout);
  color: var(--text-dim);
}
.hero__facts span { margin: 0 0.4em; color: var(--line-strong); }

.hero__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  font: 600 1rem/1.3 var(--font-readout);
}
.hero__status a { display: inline-flex; align-items: center; min-height: 2.75rem; }
/* The page's one filled button, since the browser build went online (2026-11-12). Rust means
   "where to go", as on the game's objective marker. */
.hero__status .play-link {
  padding: 0 1.1rem;
  background: var(--rust);
  color: var(--bg);
  border-radius: var(--radius);
  text-decoration: none;
}
.hero__status .play-link:hover { background: #e4733d; color: var(--bg); }

.status-label {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
}

.hero__bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  min-height: var(--lb);
  padding: 0.65rem var(--gutter) calc(0.65rem + env(safe-area-inset-bottom, 0px));
  background: var(--black);
}
.hero__note { margin: 0; font: 500 0.875rem/1.3 var(--font-readout); color: var(--text-dim); }

/* One opening per visit: the frame opens out from the middle, then the title settles. */
.hero__shutter { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .hero__shutter {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
  }
  .hero__shutter::before, .hero__shutter::after {
    content: "";
    position: absolute;
    left: 0; right: 0;
    height: 50.5%;
    background: var(--black);
    animation: shutter 1.25s cubic-bezier(0.65, 0, 0.2, 1) 0.15s both;
  }
  .hero__shutter::before { top: 0; transform-origin: top; }
  .hero__shutter::after { bottom: 0; transform-origin: bottom; }
  .hero__top, .hero__body { animation: settle 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.95s both; }
  .hero__body { animation-delay: 1.15s; }
}
@keyframes shutter { to { transform: scaleY(0); } }
@keyframes settle { from { opacity: 0; transform: translateY(1.25rem); } }

/* ---------- shared pieces ---------- */

section { position: relative; }

.section-head { display: grid; gap: 1.25rem; margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }
@media (min-width: 960px) {
  .section-head { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; gap: 3rem; }
  .section-head .lead { margin-bottom: 0.4rem; }
}

.frame { margin: 0; }
.frame img { width: 100%; background: var(--panel); }
.frame figcaption { margin-top: 0.75rem; }
.frame--ui img { border: 1px solid var(--line); }
.is-broken img { visibility: hidden; }
.is-broken { position: relative; min-height: 6rem; }
.is-broken::after {
  content: "This frame did not load. Reload the page to try again.";
  position: absolute;
  top: 1rem; left: 1rem; right: 1rem;
  font: 600 1rem/1.3 var(--font-readout);
  color: var(--text-dim);
}

.table-scroll { overflow-x: auto; }

/* Grid and flex children may shrink below their content, so wide tables and the map scroll
   inside their own boxes instead of widening the page. */
.story__grid > *, .place > *, .weather > *, .section-head > *, .choices > *, .cast__card > *,
.survival__grid > *, .craft > *, .buggy > *, .coop__grid > *, .status__grid > *, .route > * {
  min-width: 0;
}

.plain { list-style: none; }
.plain li { padding: 0.65rem 0; border-top: 1px solid var(--line); }
.plain li:last-child { border-bottom: 1px solid var(--line); }

/* Reveal once on the way down (MOTION 2): fade and rise, nothing else. */
.js .reveal { opacity: 0; transform: translateY(1.5rem); }
.js .reveal.is-in { opacity: 1; transform: none; transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}

/* Radio buttons drawn as the game's own buttons (cast picker, time and weather). */
.viewer__controls label, .cast__picker label { position: relative; display: inline-flex; }
.viewer__controls input, .cast__picker input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.viewer__controls span, .cast__picker span {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-dim);
  font: 600 1rem/1 var(--font-readout);
  white-space: nowrap;
}
.viewer__controls label:hover span, .cast__picker label:hover span { color: var(--text); border-color: var(--text); }
.viewer__controls input:checked + span, .cast__picker input:checked + span {
  color: var(--text);
  border-color: var(--text);
  background: var(--panel-2);
}
.viewer__controls input:checked + span::before, .cast__picker input:checked + span::before {
  content: "";
  width: 0.5em; height: 0.5em;
  margin-right: 0.6em;
  background: var(--rust);
  outline: 1.5px solid #000;
  transform: rotate(45deg);
}
.viewer__controls input:focus-visible + span, .cast__picker input:focus-visible + span {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }

/* ---------- story ---------- */

.story { padding-block: var(--space-section); }
.story__grid { display: grid; gap: clamp(2.5rem, 5vw, 4rem); }
.story__text h2 { margin-bottom: 2.25rem; max-width: 9ch; }

.timeline {
  list-style: none;
  margin: 0 0 2.25rem 0.35rem;
  padding-left: 1.6rem;
  border-left: 1px solid var(--line);
}
.timeline li { position: relative; padding-bottom: 1.5rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1.6rem - 0.32rem);
  top: 0.6rem;
  width: 0.62rem; height: 0.62rem;
  background: var(--line-strong);
  outline: 1.5px solid var(--bg);
  transform: rotate(45deg);
}
.timeline__now::before { background: var(--rust) !important; outline-color: #000 !important; }
.timeline__year {
  display: block;
  font: 800 clamp(2.25rem, 4.5vw, 3.25rem)/1 var(--font-display);
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.timeline__now .timeline__year { color: var(--text); }
.timeline p { margin: 0.35rem 0 0; }

@media (min-width: 960px) {
  .story .wrap.story__grid {
    width: auto;
    margin: 0;
    padding-left: var(--side);
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
  }
  .story__frame figcaption { padding-right: var(--gutter); }
}

/* ---------- world ---------- */

.world { padding-block: 0 var(--space-section); }

.map { margin: 0 0 clamp(3rem, 7vw, 5.5rem); }
.map__scroll {
  overflow-x: auto;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.map__svg { display: block; width: 100%; min-width: 60rem; height: auto; }
.map__forest { fill: #161a1c; stroke: var(--line); }
.map__city { fill: #202328; stroke: var(--line); }
.map__haven { fill: #2a2e33; stroke: var(--line-strong); }
.map__plot { fill: none; stroke: var(--text-dim); stroke-dasharray: 4 3; }
.map__toxic { stroke: var(--line-strong); stroke-width: 1; }
.map__road { fill: none; stroke: #4a5057; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.map__road--thin { stroke-width: 6; }
.map__vault { fill: #31353b; stroke: var(--line-strong); }
.map__route { fill: none; stroke: var(--rust); stroke-width: 2.5; stroke-dasharray: 8 6; stroke-linejoin: round; }
.map__labels text { font: 600 13px var(--font-readout); fill: var(--text-dim); }
.map__labels .map__area { font: 800 19px var(--font-display); fill: var(--text); text-transform: uppercase; letter-spacing: 0.03em; }
.map__points circle { fill: var(--text-dim); }
.map__missions rect { fill: var(--rust); stroke: #000; stroke-width: 1.5; }
.map__missions text { font: 700 12px var(--font-readout); fill: var(--bg); text-anchor: middle; }
.map__caption { margin-top: 0.85rem; font: 500 0.9375rem/1.4 var(--font-readout); color: var(--text-dim); }
@media (min-width: 61rem) { .map__hint { display: none; } }

.places { list-style: none; display: grid; gap: clamp(3.5rem, 8vw, 7rem); }
.place { display: grid; gap: 1.5rem; }
.place__text h3 { margin-bottom: 0.9rem; }

@media (min-width: 960px) {
  .place { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2.5rem; align-items: end; }
  .place--city .frame { grid-column: 1 / 9; }
  .place--city .place__text { grid-column: 9 / 13; padding-bottom: 2.5rem; }
  .place--road .frame { grid-column: 6 / 13; grid-row: 1; }
  .place--road .place__text { grid-column: 1 / 6; grid-row: 1; align-self: start; padding-top: 3rem; }
  .place--haven .frame { grid-column: 1 / 13; grid-row: 1; }
  /* The panel sits in the empty sky, top right, clear of the people and the fire. */
  .place--haven .place__text {
    grid-column: 8 / 13;
    grid-row: 1;
    align-self: start;
    margin: 1.5rem 1.5rem 0 0;
    padding: 1.75rem 1.75rem 1.5rem;
    background: rgba(16, 18, 20, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
}

/* time and weather viewer */
.weather {
  display: grid;
  gap: 2rem;
  margin-top: clamp(4.5rem, 10vw, 8rem);
  padding-top: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--line);
}
.weather__text h3 { margin-bottom: 1.1rem; font-size: clamp(2.25rem, 5vw, 4rem); }
@media (min-width: 1100px) {
  .weather { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 3rem; align-items: start; }
}

.viewer__controls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.viewer__controls legend { width: 100%; margin-bottom: 0.65rem; font: 600 1rem/1 var(--font-readout); color: var(--text-dim); }
.viewer__frames { display: grid; }
/* The old frame leaves quickly, the new one comes in a beat later, so captions never overlap. */
.viewer__frame {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.viewer:has(input[value="morning"]:checked) [data-wx="morning"],
.viewer:has(input[value="noon"]:checked) [data-wx="noon"],
.viewer:has(input[value="dusk"]:checked) [data-wx="dusk"],
.viewer:has(input[value="night"]:checked) [data-wx="night"],
.viewer:has(input[value="rain"]:checked) [data-wx="rain"],
.viewer:has(input[value="dust"]:checked) [data-wx="dust"],
.viewer:has(input[value="fog"]:checked) [data-wx="fog"],
.viewer[data-active="morning"] [data-wx="morning"],
.viewer[data-active="noon"] [data-wx="noon"],
.viewer[data-active="dusk"] [data-wx="dusk"],
.viewer[data-active="night"] [data-wx="night"],
.viewer[data-active="rain"] [data-wx="rain"],
.viewer[data-active="dust"] [data-wx="dust"],
.viewer[data-active="fog"] [data-wx="fog"] {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease 0.15s, visibility 0s;
}
@media (prefers-reduced-motion: reduce) { .viewer__frame { transition: none !important; } }

/* ---------- missions ---------- */

.missions { padding-block: var(--space-section); background: var(--panel); border-block: 1px solid var(--line); }

.route { list-style: none; display: grid; gap: 2.75rem; padding-left: 1.6rem; border-left: 2px dashed var(--rust); margin-left: 0.4rem; }
.route__stop { position: relative; display: flex; flex-direction: column; }
.route__stop details { margin-top: auto; }
.route__stop > p:not(.route__meta) { margin-bottom: 1rem; }
.route__meta { position: relative; margin-bottom: 0.75rem; font: 600 0.9375rem/1.3 var(--font-readout); color: var(--text-dim); }
.route__meta .wp { position: absolute; left: calc(-1.6rem - 0.4rem - 0.3em - 1px); top: 0.3em; margin: 0; }
.route__meta span[aria-hidden] { margin: 0 0.35em; color: var(--line-strong); }
.route__stop h3 { margin-bottom: 0.8rem; }
.route__stop > p { color: var(--text); }

@media (min-width: 1180px) {
  .route { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.75rem; padding: 2.25rem 0 0; margin: 0; border-left: 0; border-top: 2px dashed var(--rust); }
  .route__meta .wp { left: 0; top: calc(-2.25rem - 0.3em - 1px); }
  .route__stop h3 { font-size: clamp(1.9rem, 2.4vw, 2.4rem); }
}

details { margin-top: 1rem; border-top: 1px solid var(--line); }
summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.75rem;
  font: 600 1rem/1.2 var(--font-readout);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font: 600 1.35rem/1 var(--font-readout); color: var(--text-dim); }
details[open] summary::after { content: "\2212"; }
summary:hover { color: var(--rust); }
.objectives { padding: 0.25rem 0 0.5rem 1.25rem; color: var(--text-dim); font-size: 0.975rem; }
.objectives li { padding: 0.3rem 0; }
.objectives li::marker { color: var(--line-strong); font-family: var(--font-readout); font-weight: 600; }
.objectives__note { display: block; font: italic 500 0.9rem/1.3 var(--font-text); color: var(--text-dim); }

.route__keys { margin: 2.5rem 0 0; font: 500 0.9375rem/1.4 var(--font-readout); color: var(--text-dim); }

.choices { display: grid; gap: 2rem; margin-top: clamp(4rem, 9vw, 7rem); }
.choices__text h3 { margin-bottom: 1rem; }
@media (min-width: 960px) {
  .choices { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: 3.5rem; }
}

/* ---------- people ---------- */

.people { padding-block: var(--space-section); overflow: hidden; }

.cast__picker { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.cast__stage { display: grid; }
.cast__card {
  grid-area: 1 / 1;
  display: grid;
  gap: 1.5rem;
  align-items: end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}
.cast:has(input[value="kai"]:checked) [data-who="kai"],
.cast:has(input[value="ara7"]:checked) [data-who="ara7"],
.cast:has(input[value="hal"]:checked) [data-who="hal"],
.cast:has(input[value="darius"]:checked) [data-who="darius"],
.cast:has(input[value="lyra"]:checked) [data-who="lyra"],
.cast:has(input[value="raiders"]:checked) [data-who="raiders"],
.cast:has(input[value="drone"]:checked) [data-who="drone"],
.cast[data-active="kai"] [data-who="kai"],
.cast[data-active="ara7"] [data-who="ara7"],
.cast[data-active="hal"] [data-who="hal"],
.cast[data-active="darius"] [data-who="darius"],
.cast[data-active="lyra"] [data-who="lyra"],
.cast[data-active="raiders"] [data-who="raiders"],
.cast[data-active="drone"] [data-who="drone"] {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease 0.15s, visibility 0s;
}
@media (prefers-reduced-motion: reduce) { .cast__card { transition: none !important; } }

.cast__figure {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  min-height: 18rem;
  border-bottom: 1px solid var(--line-strong);
}
.cast__figure img { width: min(100%, 26rem); }
.cast__card--pair .cast__figure img { width: min(50%, 18rem); }
.cast__card--pair .cast__figure img + img { margin-left: -2.5rem; }

.cast__role { margin-bottom: 0.5rem; font: 600 1rem/1.3 var(--font-readout); color: var(--text-dim); }
.cast__role--echo { color: var(--echo); }
.cast__text h3 { margin-bottom: 1.1rem; font-size: clamp(2.5rem, 5.5vw, 4.75rem); }

.line { margin: 0 0 1.25rem; }
.line p {
  position: relative;
  max-width: 34ch;
  font: italic 500 clamp(1.2rem, 1.9vw, 1.5rem)/1.4 var(--font-text);
  color: var(--text);
  text-indent: -0.45em;
}
.line p::before { content: "\201C"; }
.line p::after { content: "\201D"; }

.cast__note { margin: 2rem 0 0; font: 500 0.9375rem/1.4 var(--font-readout); color: var(--text-dim); }

@media (min-width: 900px) {
  .cast__card { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 3rem; }
  .cast__text { padding-bottom: 2.5rem; }
}

/* ---------- survival ---------- */

.survival { padding-block: var(--space-section); }
.survival__grid { display: grid; gap: 3rem; }
.survival__head h2 { margin-bottom: 1.25rem; }
.survival__hud { margin-top: 2rem; max-width: 24rem; }
.survival__hud img { image-rendering: auto; }

.rules { list-style: none; display: grid; gap: 0; }
.rules li { padding: 1.25rem 0; border-top: 1px solid var(--line); }
.rules h3 { margin-bottom: 0.5rem; font-size: 1.5rem; }
.rules p { color: var(--text-dim); }

@media (min-width: 720px) {
  .rules { grid-template-columns: 1fr 1fr; column-gap: 2rem; }
  .rules li:nth-child(4) { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .survival__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 4rem; align-items: start; }
  .survival__head { position: sticky; top: calc(var(--bar-h) + 2rem); }
}

.kit { margin-top: clamp(4rem, 9vw, 7rem); }
.kit__title { font-size: clamp(2.25rem, 5vw, 4rem); margin-bottom: 0.75rem; }
.kit__intro { color: var(--text-dim); margin-bottom: 2rem; }
.kit__groups { display: grid; gap: 2rem 2rem; }
.kit__group h4 { margin: 0 0 0.6rem; padding-top: 1rem; color: var(--text-dim); }
.kit__group h4:not(:first-child) { margin-top: 1.5rem; }
.kit__group dl { margin: 0; }
.kit__group dl > div { padding: 0.7rem 0.85rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.kit__group dl > div + div { margin-top: 0.4rem; }
.kit__group dt { font: 600 1.0625rem/1.3 var(--font-readout); color: var(--text); }
.kit__group dt.echo { color: var(--echo); }
.kit__group dd { margin: 0.2rem 0 0; font-size: 0.95rem; line-height: 1.45; color: var(--text-dim); }
@media (min-width: 640px) { .kit__groups { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .kit__groups { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- build and drive ---------- */

.build { padding-block: var(--space-section); background: var(--panel); border-block: 1px solid var(--line); }
.build h3 { margin-bottom: 0.9rem; }

.craft { display: grid; gap: 2.5rem; }
.craft__table > p { color: var(--text-dim); }
@media (min-width: 1100px) {
  .craft { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 3rem; align-items: start; }
  .craft__ui { margin-top: 5.5rem; }
}

.recipes, .credit-table { width: 100%; border-collapse: collapse; font-size: 0.975rem; }
.recipes { min-width: 34rem; margin-top: 1.25rem; }
.recipes th, .recipes td, .credit-table th, .credit-table td { padding: 0.6rem 0.75rem 0.6rem 0; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.recipes thead th, .credit-table thead th { font: 600 0.9375rem/1.2 var(--font-readout); color: var(--text-dim); border-top: 0; }
.recipes tbody th[scope="row"] { font: 600 1.0625rem/1.3 var(--font-readout); color: var(--text); }
.recipes td { color: var(--text-dim); }
.recipes__place th {
  padding-top: 1.25rem;
  font: 800 1.15rem/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
  border-top-color: var(--line-strong);
}
.power {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--echo);
  border-radius: var(--radius);
  font: 600 0.8125rem/1.4 var(--font-readout);
  color: var(--echo);
  white-space: nowrap;
}

.parts { margin-top: clamp(4rem, 8vw, 6rem); }
.parts > p { color: var(--text-dim); }
.parts__ui { margin: 1.75rem 0; }
.parts__list { list-style: none; display: grid; gap: 0 2rem; }
.parts__list li { padding: 0.6rem 0; border-top: 1px solid var(--line); color: var(--text-dim); font-size: 0.975rem; }
.parts__list span { display: inline-block; min-width: 9.5rem; font: 600 1.0625rem/1.3 var(--font-readout); color: var(--text); }
@media (min-width: 720px) { .parts__list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .parts__list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.buggy { display: grid; gap: 1.5rem; margin-top: clamp(4.5rem, 9vw, 7rem); }
.buggy__figure { margin: 0; }
.buggy__text > p { color: var(--text-dim); }
.specs { display: grid; gap: 0; margin: 1.5rem 0 2rem; }
.specs div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.65rem 0; border-top: 1px solid var(--line); }
.specs div:last-child { border-bottom: 1px solid var(--line); }
.specs dt { font: 600 1rem/1.3 var(--font-readout); color: var(--text-dim); }
.specs dd { margin: 0; font: 600 1.0625rem/1.3 var(--font-readout); color: var(--text); }
@media (min-width: 960px) {
  .buggy { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 3rem; align-items: center; }
  .buggy__figure { margin-left: -4%; }
}

/* ---------- co-op ---------- */

.coop { padding-block: var(--space-section); }
.coop__grid { display: grid; gap: 3rem; }
.coop__main h2 { margin-bottom: 1.5rem; }
.coop__main p:not(.lead) { color: var(--text-dim); }
.coop__side h3 { margin: 2rem 0 0.9rem; font-size: 1.6rem; }
.coop__side h3:first-child { margin-top: 0; }
.coop__side .plain li { color: var(--text-dim); }
.coop__side > p { color: var(--text-dim); }

.keys { display: grid; grid-template-columns: 1fr; gap: 0.4rem 1.5rem; margin: 0; }
.keys div { display: flex; align-items: baseline; gap: 0.75rem; }
.keys dt {
  flex: none;
  min-width: 2.4rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  font: 600 0.9375rem/1.3 var(--font-readout);
  text-align: center;
}
.keys dd { margin: 0; color: var(--text-dim); }
@media (min-width: 520px) { .keys { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) {
  .coop__grid { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 5rem; align-items: start; }
  .coop__main h2 { font-size: clamp(3.5rem, 8vw, 7.5rem); }
}

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

.gallery { padding-block: var(--space-section); background: var(--black); border-top: 1px solid var(--line); }
.strip {
  list-style: none;
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--side);
  padding: 0 var(--side) 1.25rem;
  scrollbar-color: var(--line-strong) transparent;
}
.strip li { flex: 0 0 min(85%, 34rem); scroll-snap-align: start; }
.strip__item { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.strip__item img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--panel); transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.strip__item:hover { border-color: var(--text); }
@media (prefers-reduced-motion: no-preference) {
  .strip__item:hover img, .strip__item:focus-visible img { transform: scale(1.03); }
}
.strip__hint { margin-top: 0.75rem; font: 500 0.9375rem/1.4 var(--font-readout); color: var(--text-dim); }

/* ---------- status ---------- */

.status { padding-block: var(--space-section); border-top: 1px solid var(--line); }
.status__grid { display: grid; gap: 3rem; }
.status__main h2 { margin-bottom: 1.5rem; }
.status__main > p:not(.lead) { color: var(--text-dim); }
.state { margin: 2rem 0; }
.state div { display: grid; gap: 0.25rem; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.state div:last-child { border-bottom: 1px solid var(--line); }
.state dt { font: 600 1rem/1.3 var(--font-readout); color: var(--text-dim); }
.state dd { margin: 0; font-size: 1.0625rem; }
.status__side h3 { margin-bottom: 1rem; font-size: 1.75rem; }
.status__side li { color: var(--text-dim); }
@media (min-width: 640px) { .state div { grid-template-columns: 10rem minmax(0, 1fr); gap: 1.5rem; } }
@media (min-width: 1100px) {
  .status__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 5rem; align-items: start; }
  .status__side { padding-top: 7.5rem; }
}

/* ---------- credits ---------- */

.credits { padding-block: clamp(3.5rem, 7vw, 6rem); background: var(--panel); border-top: 1px solid var(--line); }
.credits h2 { font-size: clamp(2.25rem, 5vw, 3.75rem); margin-bottom: 1rem; }
.credits__intro { color: var(--text-dim); margin-bottom: 2rem; }
.credit-table { min-width: 40rem; }
.credit-table tbody th { font: 600 1rem/1.35 var(--font-readout); color: var(--text); width: 26%; }
.credit-table td { color: var(--text-dim); }
.credit-table td:last-child { width: 22%; }

/* ---------- footer ---------- */

.foot { padding: clamp(3rem, 7vw, 5rem) 0 calc(2.5rem + env(safe-area-inset-bottom, 0px)); background: var(--black); border-top: 1px solid var(--line); }
.foot__grid { display: grid; gap: 1.5rem; }
.foot__mark { margin: 0; font: 900 clamp(3.25rem, 11vw, 8rem)/0.8 var(--font-display); text-transform: uppercase; color: var(--text-dim); }
.foot__line { color: var(--text-dim); }
.foot__nav { list-style: none; display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.foot__nav a { display: inline-flex; align-items: center; min-height: 2.75rem; font: 600 1rem/1 var(--font-readout); color: var(--text-dim); text-decoration: none; }
.foot__nav a:hover { color: var(--text); }

/* ---------- lightbox ---------- */

.lightbox {
  width: min(100% - 2rem, 112rem);
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 1rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.lightbox::backdrop { background: rgba(5, 6, 7, 0.92); }
.lightbox__frame { position: relative; display: grid; place-items: center; min-height: 12rem; background: var(--black); }
.lightbox__frame img { width: 100%; max-height: calc(100dvh - 11rem); object-fit: contain; }
.lightbox__state { position: absolute; margin: 0; font: 600 1rem/1.3 var(--font-readout); color: var(--text-dim); }
.lightbox__state[hidden] { display: none; }
.lightbox__caption { margin: 0.85rem 0 0.75rem; color: var(--text); }
.lightbox__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.lightbox__controls button {
  min-height: 2.75rem;
  padding: 0 1.1rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: 600 1rem/1 var(--font-readout);
  cursor: pointer;
}
.lightbox__controls button:hover { border-color: var(--text); }
.lightbox__count { min-width: 4.5rem; text-align: center; font: 600 1rem/1 var(--font-readout); color: var(--text-dim); }
.lightbox__close { margin-left: auto; }

/* ---------- small screens ---------- */

@media (max-width: 599px) {
  body { font-size: 1rem; }
  .hero__img { object-position: 66% 58%; }
  .hero__facts span { margin: 0 0.25em; }
  .hero__note { display: none; }
  .cast__figure { min-height: 14rem; }
  .cast__figure img { width: min(78%, 20rem); }
  .lightbox { width: 100%; max-height: 100dvh; padding: 0.75rem; }
}
