/* =====================================================================
   CITY / 18 — A Film in Nine Chapters
   Unofficial fan demo. Cinematic "film" stylesheet.
   Layers (z): canvas 0 · vignette 5 · story 10 · letterbox 30 ·
               hud/rail 40 · loader 100 · grain 110
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* palette */
  --ink: #0a0908;
  --ink-2: #12100e;
  --ink-3: #1b1815;
  --paper: #ece6dc;
  --paper-dim: rgba(236, 230, 220, 0.72);
  --paper-mute: rgba(236, 230, 220, 0.5);
  --paper-faint: rgba(236, 230, 220, 0.14);
  --hair: rgba(236, 230, 220, 0.16);
  --red: #c4202e;
  --red-hot: #e2303f;
  --red-glow: rgba(196, 32, 46, 0.45);
  --amber: #e8a33d;
  --amber-dim: rgba(232, 163, 61, 0.7);

  /* type */
  --f-display: "Big Shoulders Display", "Oswald", "Arial Narrow", Impact, sans-serif;
  --f-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* layout */
  --gutter: clamp(16px, 4.5vw, 72px);
  --hud-h: 64px;
  --lb: 6vh;                     /* letterbox bar height — ui.js may animate */
  --copy-w: 34rem;
  --sticky-top: 22vh;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);      /* expo-ish */
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 0.35s;
  --t-slow: 0.9s;

  color-scheme: dark;
}

/* ---------- 2. Reset / base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: auto;                /* Lenis owns smoothing */
  overflow-x: clip;                     /* clip (not hidden) keeps position:sticky working */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ink);
  scrollbar-width: thin;
  scrollbar-color: var(--red) var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-body);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img, canvas, svg { display: block; max-width: 100%; }

::selection { background: var(--red); color: var(--paper); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--red), #7d1520);
  border-radius: 8px;
  border: 2px solid var(--ink);
}
::-webkit-scrollbar-thumb:hover { background: var(--red-hot); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 4px;
}

/* Lenis recommended rules */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- 3. Loader ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background:
    radial-gradient(120% 80% at 50% 110%, rgba(196, 32, 46, 0.14), transparent 60%),
    var(--ink);
  transition: opacity 1.1s var(--ease-io), visibility 0s linear 1.1s;
}
/* no-JS: never block the page */
html:not(.js) #loader { display: none; }

body.is-loaded #loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, 2vh, 1.4rem);
  text-align: center;
  transition: transform 1.1s var(--ease-out), letter-spacing 1.1s var(--ease-out);
}
body.is-loaded .loader__inner { transform: scale(1.06); }

.loader__kicker {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--amber);
}

.loader__title {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(6rem, 30vw, 24rem);
  line-height: 0.78;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--paper);
  background: linear-gradient(180deg, var(--paper) 55%, rgba(236, 230, 220, 0.35));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 80px rgba(196, 32, 46, 0.12);
}

.loader__bar {
  position: relative;
  width: min(22rem, 70vw);
  height: 1px;
  background: var(--paper-faint);
  overflow: hidden;
}
.loader__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--red), var(--amber));
  transform: scaleX(0);
  transform-origin: left center;
  box-shadow: 0 0 12px var(--red-glow);
}

.loader__pct {
  font-family: var(--f-mono);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

/* ---------- 4. Fixed cinematic layers ---------- */
#scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

/* no-WebGL fallback: atmospheric studio backdrop */
html.no-webgl #scene { display: none; }
html.no-webgl body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 50% 78%, rgba(196, 32, 46, 0.28), transparent 70%),
    radial-gradient(90% 55% at 50% 100%, rgba(232, 163, 61, 0.10), transparent 70%),
    linear-gradient(180deg, transparent 62%, rgba(236, 230, 220, 0.05) 62.2%, transparent 63%),
    radial-gradient(120% 90% at 50% 20%, #1d1916 0%, var(--ink) 70%);
}
html.no-webgl body::after {
  content: "";
  position: fixed;
  left: 50%;
  bottom: 30vh;
  z-index: 0;
  width: min(70vw, 52rem);
  aspect-ratio: 4.44 / 1;
  transform: translateX(-50%);
  pointer-events: none;
  /* abstract light sweep where the car would sit */
  background:
    radial-gradient(50% 18% at 50% 100%, rgba(0, 0, 0, 0.7), transparent 80%),
    linear-gradient(100deg, transparent 20%, rgba(236, 230, 220, 0.08) 45%, transparent 55%);
  filter: blur(2px);
}

.grain {
  position: fixed;
  inset: -50%;
  z-index: 110;            /* over everything, loader included */
  width: 200%;
  height: 200%;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.4 -0.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  animation: grain 0.9s steps(8) infinite;
  will-change: transform;
}


@keyframes grain {
  0%   { transform: translate(0, 0); }
  12%  { transform: translate(-4%, -6%); }
  25%  { transform: translate(-11%, 3%); }
  37%  { transform: translate(6%, -12%); }
  50%  { transform: translate(-7%, 11%); }
  62%  { transform: translate(-13%, -2%); }
  75%  { transform: translate(9%, 7%); }
  87%  { transform: translate(2%, -9%); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 95% at 50% 50%, transparent 52%, rgba(5, 4, 3, 0.55) 82%, rgba(5, 4, 3, 0.9) 100%);
}

.letterbox {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--lb);
  background: #000;
  pointer-events: none;
}
.letterbox--top {
  top: 0;
  box-shadow: 0 1px 0 rgba(236, 230, 220, 0.04);
}
.letterbox--bottom {
  bottom: 0;
  box-shadow: 0 -1px 0 rgba(236, 230, 220, 0.04);
}

/* ---------- 5. HUD ---------- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--hud-h);
  padding: 0 var(--gutter);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
}

.hud__brand {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--paper);
  transition: opacity var(--t-fast);
}
.hud__brand span {
  color: var(--red);
  margin-left: 0.04em;
}
.hud__brand:hover { opacity: 0.8; }

.hud__nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.2vw, 2.25rem);
}
.hud__nav a {
  position: relative;
  padding: 0.5rem 0;
  color: var(--paper-dim);
  transition: color var(--t-fast);
}
.hud__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.2rem;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.5s var(--ease-out);
}
.hud__nav a:hover,
.hud__nav a:focus-visible,
.hud__nav a.is-active { color: var(--paper); }
.hud__nav a:hover::after,
.hud__nav a:focus-visible::after,
.hud__nav a.is-active::after {
  transform: scaleX(1);
  transform-origin: left center;
}

.hud__timecode {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  white-space: nowrap;
}
#timecode { min-width: 11ch; }

.rec {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-hot);
  box-shadow: 0 0 10px var(--red-glow);
  animation: rec 1.2s steps(1, end) infinite;
}
@keyframes rec {
  0%   { opacity: 1; }
  50%  { opacity: 0.12; }
}

/* ---------- 6. Chapter rail ---------- */
.chapter-rail {
  position: fixed;
  top: 50%;
  right: calc(var(--gutter) * 0.45);
  z-index: 40;
  width: 1px;
  height: 42vh;
  transform: translateY(-50%);
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(236, 230, 220, 0.35) 0 1px, transparent 1px calc(100% / 9)),
    var(--paper-faint);
}
.chapter-rail::before,
.chapter-rail::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 7px;
  height: 1px;
  background: var(--paper-mute);
  transform: translateX(-50%);
}
.chapter-rail::before { top: -6px; }
.chapter-rail::after { bottom: -6px; }

.chapter-rail__fill {
  position: absolute;
  inset: 0;
  display: block;
  background: linear-gradient(180deg, var(--amber), var(--red));
  box-shadow: 0 0 10px var(--red-glow);
  transform: scaleY(0);
  transform-origin: top center;
}

/* ---------- 7. Story & chapters ---------- */
#story {
  position: relative;
  z-index: 10;
}

.chapter {
  position: relative;
  z-index: 10;
  min-height: 160vh;
  padding: 0 var(--gutter);
}
#hero { min-height: 200vh; }

.chapter__copy {
  position: sticky;
  top: var(--sticky-top);
  isolation: isolate;
  max-width: var(--copy-w);
  padding: 2rem 0 3rem;
  margin-top: 30vh;
}

/* soft scrim for legibility over the 3D scene */
.chapter__copy::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -6rem -10rem -6rem calc(-1 * var(--gutter) - 2rem);
  pointer-events: none;
  background:
    radial-gradient(closest-side, rgba(10, 9, 8, 0.78), rgba(10, 9, 8, 0.45) 55%, transparent);
  filter: blur(6px);
}

.chapter--right .chapter__copy {
  margin-left: auto;
  text-align: left;
}
.chapter--right .chapter__copy::before {
  inset: -6rem calc(-1 * var(--gutter) - 2rem) -6rem -10rem;
}
.chapter--right .kicker { justify-content: flex-start; }

/* Hero: oversized, anchored lower-left, full-screen sticky frame */
.chapter__copy--hero {
  top: 0;
  margin-top: 0;
  max-width: min(100%, 78rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(var(--hud-h) + var(--lb)) 0 calc(var(--lb) + 9vh);
}
.chapter__copy--hero::before {
  inset: 30% -20% -4% calc(-1 * var(--gutter));
  background:
    radial-gradient(ellipse 70% 70% at 20% 85%, rgba(10, 9, 8, 0.82), rgba(10, 9, 8, 0.35) 60%, transparent 85%);
  filter: none;
}
.chapter__copy--hero .kicker { margin-bottom: 1.25rem; }
.chapter__copy--hero .lede { margin-top: 1.75rem; max-width: 30rem; }

/* ---------- 8. Type ---------- */
.kicker {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--amber);
}
.kicker::before {
  content: "";
  flex: none;
  width: 2.25rem;
  height: 1px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}

.display {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(3.2rem, 11.5vw, 14vw);
  line-height: 0.84;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  color: var(--paper);
  text-wrap: balance;
}
.display + .display { margin-top: 0.06em; }

.display--outline {
  font-weight: 800;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1px var(--paper);
  paint-order: stroke fill;
}
/* fallback when text-stroke is unsupported */
@supports not (-webkit-text-stroke: 1px black) {
  .display--outline { color: var(--paper-mute); -webkit-text-fill-color: currentColor; }
}

.headline {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 7vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--paper);
  text-wrap: balance;
  margin-bottom: 1.5rem;
}

.lede {
  font-size: clamp(1.1rem, 1rem + 0.55vw, 1.4rem);
  line-height: 1.5;
  font-weight: 500;
  color: var(--paper);
  max-width: 34ch;
}

.body {
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  line-height: 1.7;
  color: var(--paper-dim);
  max-width: 44ch;
}

/* ---------- 9. Split text (spans created by ui.js) ---------- */
.split { font-kerning: none; }
.split .w {
  display: inline-block;
  overflow: clip;
  overflow-clip-margin: 0.08em;
  vertical-align: top;
  padding-bottom: 0.04em;
  margin-bottom: -0.04em;
}
.split .c {
  display: inline-block;
  will-change: transform;
}

/* ---------- 10. JS-only initial (hidden) states ----------
   Only applied when ui.js has added html.js. ui.js must tween TO the
   visible state (gsap.to / fromTo), e.g. {y:0, opacity:1}.            */
/* transform is NOT set here: GSAP would read it as a px offset and never clear it.
   ui.js sets the yPercent start state inline. */
html.js .split .c {
  opacity: 0;
}
html.js .reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
}

/* ---------- 11. Scroll cue ---------- */
.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 2.5rem;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--paper-mute);
}
.scroll-cue span {
  position: relative;
  display: block;
  width: 1px;
  height: 3.25rem;
  overflow: hidden;
  background: var(--paper-faint);
}
.scroll-cue span::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--red-hot));
  transform: translateY(-100%);
  animation: cue 2.2s var(--ease-io) infinite;
}
@keyframes cue {
  0%   { transform: translateY(-100%); }
  60%  { transform: translateY(100%); }
  100% { transform: translateY(100%); }
}

/* ---------- 12. Stats ---------- */
.mini-stats,
.big-stats {
  display: grid;
  margin-top: 2rem;
  border-top: 1px solid var(--hair);
}
.mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 26rem; }
.big-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mini-stats > div,
.big-stats > div {
  padding: 1rem 1rem 0 0;
  border-right: 1px solid var(--hair);
}
.mini-stats > div + div,
.big-stats > div + div { padding-left: 1rem; }
.mini-stats > div:last-child,
.big-stats > div:last-child { border-right: 0; }

.mini-stats dt,
.big-stats dt {
  font-family: var(--f-mono);
  font-size: 0.64rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--paper-mute);
  margin-bottom: 0.4rem;
}
.mini-stats dt::before,
.big-stats dt::before {
  content: "■ ";
  color: var(--red);
  font-size: 0.6em;
  vertical-align: 0.15em;
}

.mini-stats dd,
.big-stats dd {
  font-family: var(--f-display);
  font-weight: 800;
  line-height: 0.95;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mini-stats dd { font-size: clamp(2rem, 3.4vw, 2.9rem); }
.big-stats dd { font-size: clamp(2.8rem, 6.4vw, 5.6rem); line-height: 0.88; }

.count { display: inline-block; min-width: 1ch; }

.big-stats small {
  display: inline-block;
  margin-left: 0.35em;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--amber);
  vertical-align: 0.25em;
}

/* ---------- 13. Colour swatches ---------- */
.chapter--colors .chapter__copy { max-width: 30rem; }

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0;
}
.swatches li { display: block; }

.swatch {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.55), transparent 38%),
    radial-gradient(circle at 70% 80%, rgba(0, 0, 0, 0.45), transparent 60%),
    var(--c, #888);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 6px 18px rgba(0, 0, 0, 0.55);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.swatch::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid var(--paper);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.4s var(--ease-out), transform 0.5s var(--ease-out);
}
.swatch:hover { transform: scale(1.08); }
.swatch:hover::after { opacity: 0.35; transform: scale(1); }

.swatch.is-active,
.swatch[aria-checked="true"] {
  transform: scale(1.12);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.25),
    0 0 0 0 transparent,
    0 10px 30px rgba(0, 0, 0, 0.6),
    0 0 26px color-mix(in srgb, var(--c, #888) 55%, transparent);
}
.swatch.is-active::after,
.swatch[aria-checked="true"]::after {
  opacity: 1;
  transform: scale(1);
  border-color: var(--paper);
}

.swatch:focus { outline: none; }
.swatch:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 10px;
}

.swatch-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper);
  min-height: 1.6em;
}
.swatch-name::before {
  content: "GRADE";
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--amber-dim);
  border-radius: 2px;
  font-size: 0.6rem;
  color: var(--amber);
}

/* ---------- 14. Specs / end credits ---------- */
.chapter--specs {
  min-height: auto;
  padding-top: 22vh;
  padding-bottom: 22vh;
}

.specs {
  position: relative;
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(1.75rem, 4vw, 3.5rem);
  background:
    linear-gradient(180deg, rgba(18, 16, 14, 0.86), rgba(10, 9, 8, 0.92));
  border: 1px solid var(--hair);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
}
/* film-slate corner marks */
.specs::before,
.specs::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 0 solid var(--red);
  pointer-events: none;
}
.specs::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.specs::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

.specs .headline { margin-bottom: clamp(1.75rem, 4vw, 3rem); }

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1px;
  background: var(--hair);          /* hairlines via 1px gaps */
  border: 1px solid var(--hair);
}

.spec {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.25rem 1.25rem 1.4rem;
  background: var(--ink-2);
  transition: background var(--t-fast);
}
.spec:hover { background: var(--ink-3); }

.spec span {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-mute);
}
.spec b {
  font-family: var(--f-body);
  font-weight: 600;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.18rem);
  line-height: 1.35;
  color: var(--paper);
}

.fineprint {
  margin-top: 1.5rem;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: var(--paper-mute);
}
.fineprint::before { content: "* "; color: var(--red); }

/* ---------- 15. Finale ---------- */
.chapter--finale { min-height: 160vh; }

.chapter--finale .chapter__copy--hero {
  max-width: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: calc(var(--lb) + 4vh);
}
.chapter--finale .chapter__copy--hero::before {
  inset: 10% -10%;
  background: radial-gradient(ellipse 50% 45% at 50% 50%, rgba(10, 9, 8, 0.7), transparent 75%);
}
.chapter--finale .kicker { justify-content: center; }
.chapter--finale .kicker::after {
  content: "";
  flex: none;
  width: 2.25rem;
  height: 1px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}
.chapter--finale .display {
  font-size: clamp(5rem, 22vw, 20rem);
  line-height: 0.8;
}

.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: clamp(2rem, 5vh, 3.5rem);
  padding: 1.05rem 2rem;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--paper);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--paper);
  transition: color 0.5s var(--ease-out), border-color 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--red);
  transform: translateY(101%);
  transition: transform 0.6s var(--ease-out);
}
.cta::after {
  content: "\21BA";                 /* rewind arrow */
  font-size: 1rem;
  letter-spacing: 0;
  transition: transform 0.6s var(--ease-out);
}
.cta:hover,
.cta:focus-visible {
  border-color: var(--red);
  box-shadow: 0 0 40px var(--red-glow);
}
.cta:hover::before,
.cta:focus-visible::before { transform: translateY(0); }
.cta:hover::after,
.cta:focus-visible::after { transform: rotate(-360deg); }

/* ---------- 16. Footer ---------- */
.footer {
  position: relative;
  z-index: 35;                      /* above letterbox for legibility */
  padding: 2.5rem var(--gutter) calc(2.5rem + var(--lb));
  background: #050404;
  border-top: 1px solid var(--hair);
}
.footer p {
  max-width: 64rem;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  line-height: 1.8;
  letter-spacing: 0.04em;
  color: var(--paper-mute);
}

/* ---------- 17. Responsive ---------- */
@media (max-width: 1024px) {
  :root { --copy-w: 30rem; }
  .big-stats dd { font-size: clamp(2.6rem, 8vw, 4.4rem); }
}

@media (max-width: 759px) {
  :root {
    --gutter: 16px;
    --hud-h: 52px;
    --lb: 3.5vh;
    --sticky-top: 16vh;
    --copy-w: 100%;
  }

  .hud { gap: 0.75rem; }
  .hud__nav { display: none; }
  .hud__brand { font-size: 1.35rem; }
  .hud__timecode { font-size: 0.64rem; gap: 0.45rem; }

  .chapter-rail { right: 6px; height: 30vh; }

  .chapter { min-height: 150vh; }
  #hero { min-height: 180vh; }

  .chapter__copy {
    max-width: 100%;
    margin-top: 40vh;
    padding-right: 10px;            /* keep clear of the rail */
  }
  .chapter__copy::before,
  .chapter--right .chapter__copy::before {
    inset: -3rem -16px;
    background: linear-gradient(180deg, transparent, rgba(10, 9, 8, 0.78) 18%, rgba(10, 9, 8, 0.78) 82%, transparent);
    filter: none;
  }
  .chapter__copy--hero { margin-top: 0; padding-bottom: calc(var(--lb) + 7vh); }
  .chapter__copy--hero::before {
    inset: 35% -16px -2%;
    background: linear-gradient(180deg, transparent, rgba(10, 9, 8, 0.82) 40%);
  }

  .display { font-size: clamp(3.2rem, 15vw, 5.5rem); }
  .headline { font-size: clamp(2.4rem, 12vw, 3.6rem); }

  .big-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .big-stats > div,
  .mini-stats > div { padding-right: 0.6rem; }
  .big-stats > div + div,
  .mini-stats > div + div { padding-left: 0.6rem; }
  .big-stats dd { font-size: clamp(2.1rem, 10.5vw, 3rem); }
  .big-stats small { display: block; margin: 0.35rem 0 0; vertical-align: baseline; font-size: 0.6rem; }

  .swatches { gap: 0.9rem; }
  .swatch { width: 44px; height: 44px; }

  .chapter--specs { padding-top: 14vh; padding-bottom: 14vh; }
  .specs { padding: 1.25rem; }
  .spec { padding: 1rem; }

  .chapter--finale .display { font-size: clamp(5rem, 34vw, 9rem); }
  .cta { padding: 0.95rem 1.5rem; }
}

@media (max-width: 380px) {
  .hud__brand { font-size: 1.2rem; }
  .hud__timecode { letter-spacing: 0.06em; }
}

/* ---------- 18. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .rec { animation: none; opacity: 1; }
  .scroll-cue span::after { animation: none; transform: none; }
  .letterbox,
  .loader__inner,
  #loader { transition-duration: 0.01s; }
  .swatch,
  .swatch::after,
  .cta,
  .cta::before,
  .cta::after,
  .hud__nav a::after { transition-duration: 0.01s; }
}

/* ---------- 19. Print (keep it readable) ---------- */
@media print {
  #scene, .grain, .vignette, .letterbox, .hud, .chapter-rail, #loader { display: none !important; }
  body { background: #fff; color: #000; }
  .chapter { min-height: 0; }
  .chapter__copy { position: static; margin-top: 2rem; }
  html.js .reveal, html.js .split .c { opacity: 1; transform: none; }
}
