:root {
  --bg: #0a0908;
  --bg-2: #13110f;
  --ink: #f4ede4;
  --muted: #b3a798;
  --dim: #7d7266;
  --gold: #d9a660;
  --gold-soft: rgba(217, 166, 96, 0.38);
  --line: rgba(232, 184, 112, 0.92);
  --card: rgba(16, 13, 11, 0.74);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 3.2vw, 48px);
  --ease: cubic-bezier(.22, .8, .24, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
em { font-style: italic; color: var(--gold); }

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--gold);
}
.lede { margin: 0; color: var(--muted); font-size: 16px; max-width: 46ch; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 22px;
  border-radius: 999px;
  font-size: 14px; font-weight: 600; letter-spacing: .02em;
  transition: background-color .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.btn-gold { background: var(--gold); color: #17110a; }
.btn-gold:hover { background: #e8bb7b; }
.btn-ghost { border: 1px solid rgba(244, 237, 228, .28); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn:focus-visible, .brand:focus-visible, .chapters-nav button:focus-visible, .contact-card:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  height: 72px; padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(10, 9, 8, .78), rgba(10, 9, 8, 0));
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .34em; font-size: 14px; }
.brand-mark { width: 26px; height: 26px; color: var(--gold); }
.topnav { display: flex; align-items: center; gap: 22px; font-size: 14px; font-weight: 500; }
.topnav > a:not(.btn) { color: var(--muted); transition: color .2s; }
.topnav > a:not(.btn):hover { color: var(--ink); }
.topnav .btn { height: 38px; padding: 0 18px; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: rgba(244, 237, 228, .08); }
.progress span { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- Story / stage ---------- */
.story { position: relative; height: 1700vh; } /* real height is set from the timeline in app.js */
.stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: var(--bg);
}
.poster, .frames { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster { object-fit: cover; }
.frames { display: block; }
.js .poster { visibility: hidden; }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(10, 9, 8, .55) 100%),
    linear-gradient(to bottom, rgba(10, 9, 8, .35), transparent 22%, transparent 78%, rgba(10, 9, 8, .5));
}
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.leaders path { fill: none; stroke: var(--line); stroke-width: 1.2; }
.leaders circle { fill: var(--gold); }

[data-overlay], .chapter-head, .hotspot, .card { will-change: opacity, transform; }

/* Hero */
.hero {
  position: absolute; left: 50%; top: clamp(96px, 13vh, 150px);
  width: min(92vw, 820px);
  transform: translateX(-50%);
  text-align: center;
}
.hero h1, .outro h2, .contact h2 {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(44px, 7.4vw, 104px);
  line-height: .98;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.hero::before {
  content: ""; position: absolute; inset: -70px -140px -90px; z-index: -1;
  background: radial-gradient(closest-side, rgba(10, 9, 8, .74), rgba(10, 9, 8, 0));
}
.hero .lede { margin: 0 auto; color: #cfc4b6; }
.scroll-cue {
  position: absolute; left: 50%; bottom: clamp(20px, 4vh, 40px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.cue-line { width: 1px; height: 46px; background: linear-gradient(var(--gold), transparent); animation: cue 2.2s var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
.loader { font-size: 11px; letter-spacing: .14em; color: var(--dim); min-height: 1em; }

/* Chapter headings */
.chapter-head {
  position: absolute;
  width: min(380px, calc(100vw - 2 * var(--gutter)));
  opacity: 0;
  pointer-events: none;
}
.chapter-head::before {
  content: ""; position: absolute; inset: -40px -60px -40px -60px; z-index: -1;
  background: radial-gradient(closest-side, rgba(10, 9, 8, .72), rgba(10, 9, 8, 0));
}
.chapter-head[data-pos="tl"] { left: var(--gutter); top: 104px; }
.chapter-head[data-pos="tr"] { right: var(--gutter); top: 104px; }
.chapter-head[data-pos="bl"] { left: var(--gutter); bottom: 48px; }
.chapter-head[data-pos="br"] { right: var(--gutter); bottom: 48px; }
.chapter-head .num {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--gold);
}
.chapter-head .num::after { content: ""; width: 42px; height: 1px; background: var(--gold-soft); }
.chapter-head h2 {
  margin: 10px 0 10px;
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(34px, 3.6vw, 52px); line-height: 1;
}
.chapter-head p { margin: 0; color: var(--muted); font-size: 15px; }

/* Hotspots */
.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hotspot {
  position: absolute; left: 0; top: 0;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  opacity: 0;
}
.hotspot i {
  position: absolute; inset: 4px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(10, 9, 8, .55), 0 0 18px rgba(232, 184, 112, .9);
}
.hotspot::before, .hotspot::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px solid var(--line);
  animation: pulse 2.4s var(--ease) infinite;
}
.hotspot::after { animation-delay: 1.2s; }
@keyframes pulse { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.9); opacity: 0; } }
.hotspot b {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 10px; font-weight: 700; color: #17110a; display: none;
}

.card {
  position: absolute; left: 0; top: 0;
  width: 270px;
  padding: 16px 18px 17px;
  background: var(--card);
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .8);
  opacity: 0;
}
.card .tag { display: block; margin-bottom: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; letter-spacing: .005em; line-height: 1.3; }
.card p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

/* Outro */
.outro {
  position: absolute; left: 50%; bottom: clamp(56px, 11vh, 120px);
  width: min(92vw, 760px);
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
}
.outro::before {
  content: ""; position: absolute; inset: -80px -120px; z-index: -1;
  background: radial-gradient(closest-side, rgba(10, 9, 8, .78), rgba(10, 9, 8, 0));
}
.outro .lede { margin: 0 auto 26px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Chapter nav */
.chapters-nav {
  position: absolute; right: calc(var(--gutter) - 6px); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px;
  transition: opacity .4s var(--ease);
}
.chapters-nav button {
  all: unset; cursor: pointer;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 8px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: var(--dim);
}
.chapters-nav button span { opacity: 0; transform: translateX(6px); transition: opacity .3s var(--ease), transform .3s var(--ease); white-space: nowrap; }
.chapters-nav button::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid currentColor; transition: background-color .3s, transform .3s;
}
.chapters-nav button:hover span, .chapters-nav button.is-active span { opacity: 1; transform: none; }
.chapters-nav button.is-active { color: var(--gold); }
.chapters-nav button.is-active::after { background: var(--gold); transform: scale(1.25); }

/* ---------- Contact ---------- */
.contact {
  position: relative;
  padding: clamp(96px, 16vh, 180px) var(--gutter) clamp(80px, 12vh, 140px);
  background: radial-gradient(80% 60% at 50% 0%, #1a140e 0%, var(--bg) 70%);
}
.contact-inner { max-width: 1080px; margin: 0 auto; }
.contact h2 { font-size: clamp(40px, 5.6vw, 76px); max-width: 16ch; }
.contact-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
  margin-top: 48px;
}
.contact-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 24px 24px 26px;
  border: 1px solid rgba(244, 237, 228, .12);
  border-radius: 4px;
  background: var(--bg-2);
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.contact-card:hover { border-color: var(--gold-soft); transform: translateY(-2px); }
.contact-card .label { font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.contact-card .value { font-size: 18px; font-weight: 500; overflow-wrap: anywhere; }

.footer {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 28px var(--gutter);
  border-top: 1px solid rgba(244, 237, 228, .08);
  font-size: 13px; color: var(--dim);
}

/* ---------- Portrait / phones (keep in sync with `compact` in app.js) ---------- */
@media (max-width: 760px) and (min-height: 520px), (orientation: portrait) and (max-width: 1024px) {
  .topbar { height: 60px; }
  .topnav > a:not(.btn) { display: none; }
  .hero { top: 92px; }
  .hero .lede { font-size: 15px; }
  .chapters-nav { display: none; }

  .chapter-head, .chapter-head[data-pos] { left: var(--gutter); right: var(--gutter); top: 78px; bottom: auto; width: auto; }
  .chapter-head h2 { font-size: 34px; margin: 8px 0 6px; }
  .chapter-head p { font-size: 14px; }

  .hotspot b { display: block; }
  /* Docked card; a solid fill instead of backdrop blur keeps scrolling smooth on phones */
  .card {
    left: var(--gutter) !important; right: var(--gutter);
    width: auto;
    top: auto !important; bottom: calc(24px + env(safe-area-inset-bottom));
    background: rgba(16, 13, 11, .94);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .outro { bottom: calc(40px + env(safe-area-inset-bottom)); }
  .contact-grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; gap: 4px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
}

/* ---------- Short landscape (phones on their side) ---------- */
@media (orientation: landscape) and (max-height: 519px) {
  .topbar { height: 52px; }
  .topnav .btn { height: 34px; padding: 0 14px; }
  .hero { top: 62px; }
  .hero h1 { font-size: clamp(34px, 6vw, 48px); margin-bottom: 10px; }
  .hero .lede { font-size: 14px; }
  .scroll-cue { bottom: 12px; gap: 6px; }
  .cue-line { height: 24px; }
  .chapter-head { width: min(320px, 42vw); }
  .chapter-head[data-pos="tl"], .chapter-head[data-pos="tr"] { top: 62px; }
  .chapter-head[data-pos="bl"], .chapter-head[data-pos="br"] { bottom: 18px; }
  .chapter-head h2 { font-size: 28px; margin: 6px 0 0; }
  .chapter-head p { display: none; }
  .card { width: 236px; padding: 12px 14px 13px; }
  .card h3 { font-size: 14.5px; }
  .card p { font-size: 12.5px; line-height: 1.5; }
  .outro { bottom: 24px; }
  .outro h2 { font-size: clamp(34px, 6vw, 48px); margin-bottom: 10px; }
  .outro .lede { margin-bottom: 16px; }
  .chapters-nav button { padding: 5px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .cue-line, .hotspot::before, .hotspot::after { animation: none; }
}
