:root {
  --bg: #070c08;
  --moss: #1b2f1c;
  --ink: #eef0e4;
  --ink-dim: rgba(238, 240, 228, 0.7);
  --ink-faint: rgba(238, 240, 228, 0.42);
  --line: rgba(238, 240, 228, 0.16);
  --gold: #d9c27a;
  --shadow: rgba(4, 10, 6, 0.55);
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(20px, 4.2vw, 68px);
  --inset: clamp(0px, 1.1vw, 14px);
  --radius: clamp(0px, 1.6vw, 20px);
}

* { 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; 15 × 140vh here as the no-JS fallback) */
.track { height: 3920vh; }

/* ---------- the screen: dark frame holding the footage ---------- */
.screen {
  position: fixed; inset: var(--inset); z-index: 0;
  border-radius: var(--radius); overflow: hidden;
  background: var(--moss);
  box-shadow: 0 0 0 1px rgba(238, 240, 228, 0.08), 0 30px 90px rgba(0, 0, 0, 0.6);
}
.stage { position: absolute; inset: 0; }
.shade {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background:
    linear-gradient(to bottom, rgba(4, 10, 6, 0.42), rgba(4, 10, 6, 0) 24%, rgba(4, 10, 6, 0) 70%, rgba(4, 10, 6, 0.6));
}
.grain {
  position: absolute; inset: -50%; pointer-events: none; opacity: 0.06; 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(--gold); 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(--gold);
  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(45deg); }
.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) ---------- */
.index {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  background: rgba(5, 10, 6, 0.78);
  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; overflow-y: auto; }
.index-kicker, .index-foot {
  margin: 0 0 26px; font-size: 10px; font-weight: 500; letter-spacing: 0.34em; text-transform: uppercase; color: var(--ink-dim);
}
.index-foot { margin: 30px 0 0; color: var(--ink-faint); }
.index-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.index-list button {
  display: inline-flex; align-items: baseline; gap: 18px;
  /* sized against the viewport height as well, so the whole list fits with fifteen or twenty scenes */
  font-family: var(--serif); font-weight: 300; font-size: clamp(16px, min(4.2vw, 3.0vh), 44px); line-height: 1.12;
  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(--gold); width: 2.4em; text-align: right; }
.index-list button:hover, .index-list button.on { color: var(--gold); transform: translateX(6px); }
.index-list button.on i { color: var(--ink); }

/* ---------- 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 3px 30px 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(4, 10, 6, 0.55), rgba(4, 10, 6, 0.22) 38%, rgba(4, 10, 6, 0) 62%); }
.align-right::before { background: linear-gradient(270deg, rgba(4, 10, 6, 0.55), rgba(4, 10, 6, 0.22) 38%, rgba(4, 10, 6, 0) 62%); }
.align-center::before { background: radial-gradient(60% 55% at 50% 72%, rgba(4, 10, 6, 0.5), rgba(4, 10, 6, 0.18) 55%, rgba(4, 10, 6, 0) 85%); }
.c0::before { background: linear-gradient(90deg, rgba(4, 10, 6, 0.64), rgba(4, 10, 6, 0.3) 42%, rgba(4, 10, 6, 0) 66%); }
/* pale, misty footage: heavier local scrim */
.bright.align-left::before { background: linear-gradient(90deg, rgba(4, 10, 6, 0.74), rgba(4, 10, 6, 0.38) 40%, rgba(4, 10, 6, 0) 66%); }
.bright.align-right::before { background: linear-gradient(270deg, rgba(4, 10, 6, 0.74), rgba(4, 10, 6, 0.38) 40%, rgba(4, 10, 6, 0) 66%); }
.bright.align-center::before { background: radial-gradient(64% 58% at 50% 72%, rgba(4, 10, 6, 0.68), rgba(4, 10, 6, 0.3) 55%, rgba(4, 10, 6, 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; justify-content: flex-end; padding-bottom: 22vh; }

.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: 640px;
  font-family: var(--serif); font-weight: 300; line-height: 0.98;
  font-size: clamp(46px, 5.7vw, 84px);
  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: #fff8e6; }
.statement {
  margin: 0; max-width: 16ch;
  font-family: var(--serif); font-weight: 300; line-height: 1;
  font-size: clamp(34px, 4.6vw, 68px);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.align-center .statement { max-width: 22ch; }

/* ---------- 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: 11ch; white-space: nowrap; transition: opacity 0.4s; }
.scrub-label.swap { opacity: 0; }
.scrub-line { position: relative; width: 250px; height: 1px; background: var(--line); }
.scrub-line i { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--gold); }
.scrub-dots { position: absolute; inset: 0; }
.scrub-dots button {
  position: absolute; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%);
  display: grid; place-items: center;
}
.scrub-dots button::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); opacity: 0.45;
  box-shadow: 0 0 0 3px 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(--gold); opacity: 1; }
.scrub-dots button.on::before { transform: scale(1.6); }
.scrub-dots button:hover::before { opacity: 1; transform: scale(1.6); }
.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); }

/* ---------- 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(--gold); 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) + 62px);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px 30px; flex-wrap: wrap;
  text-shadow: 0 1px 14px rgba(4, 10, 6, 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; }
.link {
  position: relative; padding-bottom: 5px;
  font-size: 10px; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold);
}
.link::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; background: currentColor; opacity: 0.5; transition: opacity 0.4s; }
.link:hover::after { opacity: 1; }
.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(40px, 11.5vw, 72px); }
  .statement { font-size: clamp(30px, 8.6vw, 56px); max-width: 12ch; }
  .align-center .statement { max-width: 14ch; }
  .align-left::before { background: linear-gradient(to top, rgba(4, 10, 6, 0.6), rgba(4, 10, 6, 0.25) 45%, rgba(4, 10, 6, 0) 70%); }
  .align-right::before { background: linear-gradient(to top, rgba(4, 10, 6, 0.6), rgba(4, 10, 6, 0.25) 45%, rgba(4, 10, 6, 0) 70%); }
  .align-left, .align-right { justify-content: flex-end; padding-bottom: 22vh; }
  .bright.align-left::before, .bright.align-right::before { background: linear-gradient(to top, rgba(4, 10, 6, 0.76), rgba(4, 10, 6, 0.4) 45%, rgba(4, 10, 6, 0) 72%); }
}
@media (max-width: 480px) {
  .scrub { gap: 12px; bottom: calc(var(--inset) + 24px); }
  .scrub-label { min-width: 0; }
  .scrub-line { width: 150px; }
  .readout { display: none; }
  .hint { right: auto; left: calc(var(--inset) + var(--pad)); bottom: calc(var(--inset) + 60px); }
  .hint em { height: 24px; }
  .foot { flex-direction: column; gap: 8px; bottom: calc(var(--inset) + 64px); }
}

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