:root {
  --bg: #0b0b0d;
  --frame: #121215;
  --ink: #efe8dc;
  --ink-dim: rgba(239, 232, 220, 0.72);
  --ink-faint: rgba(239, 232, 220, 0.44);
  --line: rgba(239, 232, 220, 0.16);
  --amber: #d99a3a;
  --shadow: rgba(6, 6, 8, 0.6);
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(20px, 4.2vw, 68px);
  --inset: clamp(0px, 0.9vw, 10px);
  --radius: clamp(0px, 1.2vw, 14px);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* scroll track: N clips × 140vh (app.js sets the exact height from the SCENES array; 26 × 140vh here as the no-JS fallback) */
.track { height: 3640vh; }

/* ---------- the screen: thin dark frame holding the footage ---------- */
.screen {
  position: fixed; inset: var(--inset); z-index: 0;
  border-radius: var(--radius); overflow: hidden;
  background: var(--frame);
  box-shadow: 0 0 0 1px rgba(239, 232, 220, 0.07), 0 30px 90px rgba(0, 0, 0, 0.6);
}
.stage { position: absolute; inset: 0; background: var(--frame); }
.shade {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background:
    linear-gradient(to bottom, rgba(6, 6, 8, 0.46), rgba(6, 6, 8, 0) 22%, rgba(6, 6, 8, 0) 66%, rgba(6, 6, 8, 0.66));
}
.grain {
  position: absolute; inset: -50%; pointer-events: none; opacity: 0.05; z-index: 4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.4s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); } 60% { transform: translate(-1%, 3%); }
  80% { transform: translate(3%, 1%); } 100% { transform: translate(0, 0); }
}

/* ---------- nav ---------- */
.nav {
  position: fixed; z-index: 20;
  top: var(--inset); left: var(--inset); right: var(--inset);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 22px var(--pad) 0;
  font-size: 10px; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--ink); text-shadow: 0 1px 14px var(--shadow);
}
.nav-group { display: flex; gap: clamp(18px, 2.4vw, 34px); }
.nav-right { justify-content: flex-end; }
.nav a { position: relative; padding-bottom: 4px; opacity: 0.86; transition: opacity 0.4s; }
.nav a:hover, .nav a.on { opacity: 1; }
.nav-group a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--amber); transform: scaleX(0); transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.nav-group a:hover::after, .nav-group a.on::after { transform: scaleX(1); }
.mark {
  display: inline-flex; align-items: center; gap: 10px; color: var(--amber);
  letter-spacing: inherit; text-transform: inherit; font-size: inherit; font-weight: inherit;
  padding: 6px 8px; margin: -6px -8px; transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.mark svg { transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.mark:hover svg, .mark[aria-expanded="true"] svg { transform: rotate(90deg); }
.mark-word { display: none; color: var(--ink); }
@media (max-width: 720px) {
  .nav { grid-template-columns: auto 1fr; padding-top: 18px; gap: 16px; }
  .nav-left { display: none; }
  .mark-word { display: inline; }
  .nav-right a:not(:last-child) { display: none; }
}

/* ---------- scene index (from the centre mark): era + date, two columns ---------- */
.index {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  background: rgba(11, 11, 13, 0.82);
  backdrop-filter: blur(18px) saturate(1.1); -webkit-backdrop-filter: blur(18px) saturate(1.1);
  animation: fade 0.45s ease;
}
.index[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.index-inner { text-align: center; padding: 24px var(--pad); max-height: 100vh; max-width: 100vw; overflow-y: auto; }
.index-kicker, .index-foot {
  margin: 0 0 24px; font-size: 10px; font-weight: 500; letter-spacing: 0.34em; text-transform: uppercase; color: var(--ink-dim);
}
.index-foot { margin: 26px 0 0; color: var(--ink-faint); }
.index-list {
  list-style: none; margin: 0 auto; padding: 0;
  display: grid; grid-template-columns: repeat(2, auto); grid-auto-flow: column;
  grid-template-rows: repeat(13, auto); column-gap: clamp(28px, 5vw, 80px); row-gap: 1px;
  text-align: left; width: max-content; max-width: 100%;
}
.index-list button {
  display: grid; grid-template-columns: 2.6em 1fr auto; align-items: baseline; column-gap: 16px; width: 100%;
  /* sized against the viewport height so twenty-six rows in two columns fit at 1440 × 900 */
  font-family: var(--serif); font-weight: 300; font-size: clamp(15px, min(2.1vw, 3.5vh), 32px); line-height: 1.16;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink);
  transition: color 0.4s, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.index-list button i { font-family: var(--sans); font-style: normal; font-size: 10px; letter-spacing: 0.3em; color: var(--amber); text-align: right; }
.index-list button b { font-weight: 300; font-size: 0.62em; letter-spacing: 0.12em; color: var(--ink-faint); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 10px; }
.index-list button:hover, .index-list button.on { color: var(--amber); transform: translateX(6px); }
.index-list button.on i { color: var(--ink); }
.index-list button.on b { color: var(--ink-dim); }

/* ---------- chapter overlays ---------- */
.overlay { position: fixed; inset: var(--inset); z-index: 5; pointer-events: none; }
.chapter {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  padding: 0 var(--pad); opacity: 0; will-change: opacity, transform;
  text-shadow: 0 2px 6px rgba(6, 6, 8, 0.55), 0 6px 34px var(--shadow);
}
.chapter > * { position: relative; }
/* soft local scrim, only where the text sits */
.chapter::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: var(--radius); }
.align-left::before { background: linear-gradient(90deg, rgba(6, 6, 8, 0.58), rgba(6, 6, 8, 0.24) 38%, rgba(6, 6, 8, 0) 62%); }
.align-right::before { background: linear-gradient(270deg, rgba(6, 6, 8, 0.58), rgba(6, 6, 8, 0.24) 38%, rgba(6, 6, 8, 0) 62%); }
.align-center::before { background: radial-gradient(60% 52% at 50% 60%, rgba(6, 6, 8, 0.52), rgba(6, 6, 8, 0.2) 55%, rgba(6, 6, 8, 0) 85%); }
.c0::before { background: linear-gradient(90deg, rgba(6, 6, 8, 0.66), rgba(6, 6, 8, 0.32) 42%, rgba(6, 6, 8, 0) 66%); }
/* pale footage and bright skies: heavier local scrim */
.bright.align-left::before { background: linear-gradient(90deg, rgba(6, 6, 8, 0.78), rgba(6, 6, 8, 0.42) 40%, rgba(6, 6, 8, 0) 66%); }
.bright.align-right::before { background: linear-gradient(270deg, rgba(6, 6, 8, 0.78), rgba(6, 6, 8, 0.42) 40%, rgba(6, 6, 8, 0) 66%); }
.bright.align-center::before { background: radial-gradient(64% 56% at 50% 60%, rgba(6, 6, 8, 0.72), rgba(6, 6, 8, 0.32) 55%, rgba(6, 6, 8, 0) 88%); }
.align-left { align-items: flex-start; text-align: left; }
.align-right { align-items: flex-end; text-align: right; }
.align-center { align-items: center; text-align: center; }

.kicker {
  margin: 0 0 20px;
  font-size: 10px; font-weight: 500; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--ink-dim);
}
.headline {
  margin: 0; max-width: 700px;
  font-family: var(--serif); font-weight: 300; line-height: 0.98;
  font-size: clamp(44px, 5.4vw, 80px);
  letter-spacing: 0.02em; text-transform: uppercase;
}
.headline span { display: block; white-space: nowrap; }
.headline em, .statement em { font-style: italic; font-weight: 300; color: #fff6e4; }
.statement {
  margin: 0; max-width: 17ch;
  font-family: var(--serif); font-weight: 300; line-height: 1;
  font-size: clamp(32px, 4.3vw, 64px);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.align-center .statement { max-width: 22ch; }

/* ---------- the year counter (bottom centre) ---------- */
.year {
  position: fixed; z-index: 20; left: 50%; bottom: calc(var(--inset) + 18px); transform: translateX(-50%);
  pointer-events: none; text-align: center; white-space: nowrap;
  text-shadow: 0 1px 4px rgba(6, 6, 8, 0.6), 0 4px 28px var(--shadow);
}
.year-value {
  display: block;
  font-family: var(--serif); font-weight: 300; font-size: clamp(30px, 3.4vw, 50px); line-height: 1;
  letter-spacing: 0.08em; color: var(--ink); font-variant-numeric: tabular-nums lining-nums;
  transition: letter-spacing 0.6s;
}
.year.word .year-value { letter-spacing: 0.3em; color: var(--amber); text-transform: uppercase; }

/* ---------- scrub rail (bottom left) ---------- */
.scrub {
  position: fixed; z-index: 20; left: calc(var(--inset) + var(--pad)); bottom: calc(var(--inset) + 26px);
  display: flex; align-items: center; gap: 16px;
  font-size: 9px; font-weight: 500; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ink-dim);
  text-shadow: 0 1px 12px var(--shadow);
}
.scrub-label { min-width: 13ch; white-space: nowrap; transition: opacity 0.4s; }
.scrub-label.swap { opacity: 0; }
.scrub-line { position: relative; width: clamp(140px, 16vw, 250px); height: 1px; background: var(--line); }
.scrub-line i { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--amber); }
.scrub-dots { position: absolute; inset: 0; }
.scrub-dots button {
  position: absolute; top: 50%; width: 18px; height: 22px; transform: translate(-50%, -50%);
  display: grid; place-items: center;
}
.scrub-dots button::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); opacity: 0.45;
  box-shadow: 0 0 0 2px var(--bg);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.35s, background 0.35s;
}
.scrub-dots button.on::before, .scrub-dots button.done::before { background: var(--amber); opacity: 1; }
.scrub-dots button.on::before { transform: scale(1.7); }
.scrub-dots button:hover::before { opacity: 1; transform: scale(1.7); }
.scrub-dots button::after {
  content: attr(data-label); position: absolute; left: 50%; bottom: calc(100% + 2px); transform: translate(-50%, 4px);
  white-space: nowrap; font-size: 9px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink);
  opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.scrub-dots button:hover::after, .scrub-dots button:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.readout { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-faint); }
@media (max-width: 1180px) { .scrub-label { display: none; } }

/* ---------- first-screen hint (bottom right, mirrors the rail) ---------- */
.hint {
  position: fixed; z-index: 20; right: calc(var(--inset) + var(--pad)); bottom: calc(var(--inset) + 26px);
  display: flex; align-items: center; gap: 14px;
  font-size: 9px; font-weight: 500; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ink-dim);
  text-shadow: 0 1px 12px var(--shadow); transition: opacity 0.6s; pointer-events: none;
}
.hint em { width: 1px; height: 34px; background: var(--line); position: relative; overflow: hidden; }
.hint em::after { content: ""; position: absolute; left: 0; top: -100%; width: 100%; height: 100%; background: var(--amber); animation: drip 2.2s cubic-bezier(0.6, 0, 0.3, 1) infinite; }
@keyframes drip { to { top: 100%; } }

/* ---------- footer, only at the very end ---------- */
.foot {
  position: fixed; z-index: 6; left: calc(var(--inset) + var(--pad)); right: calc(var(--inset) + var(--pad));
  bottom: calc(var(--inset) + 92px);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px 30px; flex-wrap: wrap;
  text-shadow: 0 1px 14px rgba(6, 6, 8, 0.85);
  opacity: 0; transition: opacity 0.7s; pointer-events: none;
}
.foot.on { opacity: 1; pointer-events: auto; }
.foot-brand { font-family: var(--serif); font-weight: 300; font-size: 24px; letter-spacing: 0.06em; text-transform: uppercase; }
.fine { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-dim); line-height: 1.7; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .headline { font-size: clamp(32px, 8.8vw, 72px); }
  .headline span { white-space: normal; }
  .statement { font-size: clamp(30px, 8.4vw, 56px); max-width: 12ch; }
  .align-center .statement { max-width: 14ch; }
  .align-left::before, .align-right::before, .align-center::before { background: linear-gradient(to top, rgba(6, 6, 8, 0.66), rgba(6, 6, 8, 0.3) 46%, rgba(6, 6, 8, 0) 70%); }
  .align-left, .align-right, .align-center { justify-content: flex-end; padding-bottom: 24vh; }
  .bright.align-left::before, .bright.align-right::before, .bright.align-center::before { background: linear-gradient(to top, rgba(6, 6, 8, 0.8), rgba(6, 6, 8, 0.44) 46%, rgba(6, 6, 8, 0) 74%); }
  .year { bottom: calc(var(--inset) + 70px); }
  .year-value { font-size: clamp(28px, 8vw, 40px); }
  .index-list { grid-template-rows: repeat(13, auto); column-gap: 20px; }
  .index-list button { font-size: clamp(12px, 3.2vw, 16px); column-gap: 8px; grid-template-columns: 2em 1fr auto; }
  .index-list button b { padding-left: 4px; }
}
@media (max-width: 480px) {
  .scrub { gap: 12px; bottom: calc(var(--inset) + 24px); }
  .scrub-line { width: 150px; }
  .hint { right: auto; left: calc(var(--inset) + var(--pad)); bottom: calc(var(--inset) + 118px); }
  .hint em { height: 24px; }
  .foot { flex-direction: column; gap: 8px; bottom: calc(var(--inset) + 124px); }
  .index-list { grid-template-rows: repeat(26, auto); grid-template-columns: 1fr; }
  .index-list button { font-size: clamp(13px, 3.6vw, 16px); }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .hint em::after { animation: none; top: 0; }
  .index { animation: none; }
  .chapter { transform: none !important; }
  .year-value { transition: none; }
}
