:root {
  --ink: #f5eee3;
  --ink-rgb: 245 238 227;
  --muted: rgb(245 238 227 / 0.68);
  --faint: rgb(245 238 227 / 0.14);
  --gold: #d8b57c;
  --gold-rgb: 216 181 124;
  --ground: #110c07;
  --ground-rgb: 17 12 7;
  --paper: #ece2d1;
  --paper-ink: #241a10;
  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: clamp(24px, 5.5vw, 96px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html { background: var(--ground); overflow-anchor: none; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

html[data-studio] *, html[data-studio] *::before, html[data-studio] *::after { transition: none !important; animation: none !important; }
html[data-studio] .loader { display: none; }

.skip {
  position: fixed;
  top: 12px;
  left: -999px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ground);
  font-size: 13px;
}
.skip:focus { left: 12px; }

/* ---------- layers ---------- */
#gl {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  opacity: 0;
  pointer-events: none;
}
main, .site-foot { position: relative; z-index: 1; }
.grain {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--ground);
  transition: opacity 0.8s var(--ease), visibility 0s linear 0.8s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-mark { font-family: var(--serif); font-size: 28px; letter-spacing: 0.42em; margin-right: -0.42em; }
.loader-mark span, .wordmark span { color: var(--gold); }
.loader-pct { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 64px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}
.nav.solid {
  background: rgb(var(--ground-rgb) / 0.55);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom-color: rgb(var(--ink-rgb) / 0.08);
}
.wordmark { font-family: var(--serif); font-size: 20px; letter-spacing: 0.4em; }
.nav-links { display: flex; gap: 32px; }
.nav-links a { position: relative; font-size: 13px; color: var(--muted); transition: color 160ms var(--ease); }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--gold);
}
.nav-cta { justify-self: end; height: 40px; padding: 0 18px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease), color 160ms var(--ease);
  user-select: none;
  -webkit-user-select: none;
}
.btn i { font-style: normal; transition: transform 160ms var(--ease); }
.btn:hover i { transform: translateX(3px); }
.btn-primary { background: var(--ink); color: var(--ground); }
.btn-primary:hover { background: #fffaf2; }
.btn-ghost { background: transparent; color: var(--ink); border-color: rgb(var(--ink-rgb) / 0.28); }
.btn-ghost:hover { border-color: rgb(var(--ink-rgb) / 0.6); }

/* ---------- shared type ---------- */
.eyebrow {
  margin-bottom: 18px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}
.idx { margin-right: 12px; font-family: var(--mono); letter-spacing: 0.08em; color: var(--gold); }
.display {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(56px, 7vw, 116px);
  line-height: 0.92;
  letter-spacing: -0.01em;
}
.lede { max-width: 38ch; margin-top: 24px; font-size: 16px; line-height: 1.7; color: rgb(var(--ink-rgb) / 0.8); }
[data-reveal] { opacity: 0; transform: translate3d(0, 48px, 0); will-change: transform, opacity; }

.hud {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hud dt { opacity: 0.7; margin-bottom: 6px; }
.hud dd { color: var(--ink); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }

/* ---------- 01 origin film ---------- */
.scrub { position: relative; height: 900vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--ground); }
#film { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 45%, rgb(var(--ground-rgb) / 0.55) 100%),
    linear-gradient(to right, rgb(var(--ground-rgb) / 0.42), transparent 34%, transparent 66%, rgb(var(--ground-rgb) / 0.42)),
    linear-gradient(to bottom, rgb(var(--ground-rgb) / 0.35), transparent 18%, transparent 70%, rgb(var(--ground-rgb) / 0.5));
}
.beat {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, transform, filter;
  text-shadow: 0 2px 30px rgb(40 24 8 / 0.35);
}
.beat-hero {
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 12vh;
  text-align: center;
}
.hero-title {
  margin-right: -0.14em;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(72px, 15vw, 240px);
  line-height: 0.9;
  letter-spacing: 0.14em;
}
.lede-hero { margin-top: 22px; font-family: var(--serif); font-style: italic; font-size: clamp(20px, 2.2vw, 32px); }
.scroll-cue {
  position: absolute;
  bottom: 12vh;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}
.chapter-beat { top: 50%; width: min(30vw, 420px); margin-top: -12vh; }
.beat-left { left: var(--gutter); }
.beat-right { right: var(--gutter); text-align: right; }
.numeral { margin-bottom: 6px; font-family: var(--serif); font-style: italic; font-size: 24px; color: var(--gold); }
.chapter-beat h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(56px, 7.5vw, 128px); line-height: 0.92; }
.copy { max-width: 30ch; margin-top: 22px; font-size: 16px; line-height: 1.7; color: rgb(var(--ink-rgb) / 0.9); text-shadow: 0 1px 14px rgb(30 18 6 / 0.55); }
.beat-right .copy { margin-left: auto; }
.hud-film { position: absolute; top: 88px; right: var(--gutter); }
.chapters {
  position: absolute;
  left: 50%;
  bottom: 32px;
  display: flex;
  gap: clamp(16px, 3vw, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateX(-50%);
}
.chapter { width: clamp(72px, 9vw, 120px); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); transition: color 0.4s; }
.chapter.active { color: var(--ink); }
.ch-num { margin-right: 8px; font-family: var(--serif); font-style: italic; font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--gold); }
.bar { position: relative; display: block; height: 1px; margin-top: 10px; overflow: hidden; background: rgb(var(--ink-rgb) / 0.22); }
.bar::after { content: ""; position: absolute; inset: 0; background: var(--ink); transform: scaleX(var(--fill, 0)); transform-origin: left; }

/* ---------- pinned chapters ---------- */
.pinned { position: relative; }
.vessel, .notes { height: 320vh; }
.pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

/* ---------- 02 vessel ---------- */
.vessel-head { position: absolute; left: var(--gutter); bottom: 9vh; max-width: 34rem; }
.hud-vessel { position: absolute; right: var(--gutter); bottom: 9vh; }
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.leaders g { opacity: 0; }
.leaders path { fill: none; stroke: rgb(var(--ink-rgb) / 0.4); stroke-width: 1; }
.leaders circle { fill: var(--gold); }
.parts { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.part { position: absolute; top: 0; left: 0; width: max-content; max-width: 16rem; opacity: 0; will-change: transform, opacity; }
.part.side-left { text-align: right; }
.part-no { display: block; margin-bottom: 4px; font-family: var(--mono); font-size: 11px; color: var(--gold); }
.part strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1; }
.part span:last-child { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }

/* ---------- proof strip ---------- */
.proof { padding: 16vh var(--gutter) 22vh; }
.proof-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.figure { padding: 8px 24px 0; border-left: 1px solid var(--faint); }
.fig-value { display: flex; align-items: baseline; gap: 8px; }
.fig-value b { font-family: var(--serif); font-weight: 300; font-size: clamp(56px, 6vw, 96px); line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.fig-value small { font-size: 18px; color: var(--muted); }
.fig-label { margin-top: 14px; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }

/* ---------- 03 notes ---------- */
.notes-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: center;
  column-gap: 20px;
  padding: 12vh var(--gutter) 14vh;
}
.notes-head, .note-cards { grid-column: 7 / span 6; }
.notes-head .display { font-size: clamp(48px, 5.6vw, 92px); }
.notes-head .lede { margin-top: 16px; }
.note-cards { display: grid; gap: 10px; margin: 3.5vh 0 0; padding: 0; list-style: none; }
.note-card {
  position: relative;
  padding: 14px 22px 18px;
  border: 1px solid rgb(var(--ink-rgb) / 0.1);
  border-radius: 16px;
  background: rgb(var(--ground-rgb) / 0.42);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 30px 60px -30px rgb(0 0 0 / 0.6);
  cursor: pointer;
  transition: border-color 160ms var(--ease);
}
.note-card:hover, .note-card.active { border-color: rgb(var(--gold-rgb) / 0.55); }
.note-tier { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.note-card strong { display: block; margin-top: 6px; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.05; }
.note-card p { margin-top: 6px; font-size: 14px; color: var(--muted); }
.note-meter { position: absolute; left: 24px; right: 24px; bottom: 0; height: 1px; background: var(--faint); overflow: hidden; }
.note-meter i { display: block; height: 100%; background: var(--gold); transform: scaleX(var(--m, 0)); transform-origin: left; }
.hud-notes { position: absolute; left: var(--gutter); bottom: 9vh; }

/* ---------- 04 trace (light interlude) ---------- */
.trace { background: var(--paper); color: var(--paper-ink); padding: 18vh var(--gutter); }
.trace-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 4vw; align-items: center; }
.trace .eyebrow, .trace .hud { color: rgb(36 26 16 / 0.62); }
.trace .idx { color: #9a7440; }
.trace .lede { color: rgb(36 26 16 / 0.78); }
.trace .hud dd { color: var(--paper-ink); }
.trace .btn-primary { background: var(--paper-ink); color: var(--paper); }
.trace .btn-primary:hover { background: #3a2a1a; }
.trace .btn-ghost { color: var(--paper-ink); border-color: rgb(36 26 16 / 0.3); }
.trace .btn-ghost:hover { border-color: rgb(36 26 16 / 0.65); }
.trace-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 36px 0 30px; }
#spray.spraying { background: #9a7440; }
.garden { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 18px; box-shadow: 0 40px 80px -40px rgb(36 26 16 / 0.45), inset 0 0 0 1px rgb(36 26 16 / 0.08); }
#sand { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }

/* ---------- 05 ritual ---------- */
.ritual { background: var(--ground); padding: 18vh var(--gutter); }
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: minmax(260px, auto); gap: 20px; margin-top: 7vh; }
.card {
  display: flex;
  flex-direction: column;
  grid-column: span 6;
  padding: 24px;
  border: 1px solid rgb(var(--ink-rgb) / 0.1);
  border-radius: 16px;
  background: rgb(var(--ink-rgb) / 0.03);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05);
}
.card-wide { grid-row: span 2; }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.05; }
.card p { max-width: 40ch; margin-top: 10px; font-size: 14px; line-height: 1.65; color: var(--muted); }
.card-art { position: relative; flex: 1; min-height: 140px; margin-bottom: 20px; overflow: hidden; }
.art-pulse i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 180px;
  margin: -90px 0 0 -90px;
  border: 1px solid rgb(var(--gold-rgb) / 0.55);
  border-radius: 50%;
  opacity: 0;
}
.art-pulse b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 40px 12px rgb(var(--gold-rgb) / 0.35);
}
.art-distance svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.art-distance .bottle { fill: rgb(var(--ink-rgb) / 0.08); stroke: rgb(var(--ink-rgb) / 0.5); }
.art-distance .cap { fill: rgb(var(--gold-rgb) / 0.8); }
.art-distance .ruler { stroke: rgb(var(--ink-rgb) / 0.35); stroke-dasharray: 3 5; }
.art-distance .tick { stroke: rgb(var(--ink-rgb) / 0.5); }
.art-distance text { fill: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; }
.art-distance .mist { fill: var(--ink); opacity: 0; }
.art-settle { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 0 12%; }
.art-settle span { display: block; height: 22px; border-radius: 6px; }
.art-settle span:nth-child(1) { background: linear-gradient(90deg, transparent, #f1dfa4 30%, #f1dfa4 70%, transparent); }
.art-settle span:nth-child(2) { background: linear-gradient(90deg, transparent, #e0a792 30%, #e0a792 70%, transparent); }
.art-settle span:nth-child(3) { height: 34px; background: linear-gradient(90deg, transparent, #b8742e 30%, #b8742e 70%, transparent); }

/* ---------- 06 finale ---------- */
.finale { position: relative; height: 120vh; }
.finale-inner { position: absolute; left: 0; right: 0; bottom: 7vh; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 var(--gutter); }
.finale-title { font-family: var(--serif); font-weight: 300; font-size: clamp(40px, 4.4vw, 72px); line-height: 1; }
.finale-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }

/* ---------- footer ---------- */
.site-foot { background: var(--ground); padding: 12vh var(--gutter) 40px; border-top: 1px solid rgb(var(--ink-rgb) / 0.08); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 2fr) minmax(0, 3fr); gap: 40px; }
.foot-brand p { max-width: 42ch; margin-top: 18px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.foot-col { display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--muted); }
.foot-col h3 { margin-bottom: 6px; font-size: 11px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: rgb(var(--ink-rgb) / 0.5); }
.foot-col a:hover { color: var(--ink); }
.foot-base { display: flex; justify-content: space-between; margin-top: 10vh; padding-top: 24px; border-top: 1px solid rgb(var(--ink-rgb) / 0.08); font-size: 12px; color: rgb(var(--ink-rgb) / 0.5); }

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .nav { grid-template-columns: 1fr auto; }
  .nav-links { display: none; }
  .chapter-beat { top: auto; left: 24px; right: 24px; bottom: 18vh; width: auto; margin: 0; text-align: left; }
  .beat-right .copy { margin-left: 0; }
  .hud-film { top: 76px; left: 24px; right: auto; gap: 16px; }
  .chapter { width: 56px; }
  .ch-name { display: none; }
  .vessel-head { bottom: 7vh; }
  .hud-vessel { top: 76px; bottom: auto; left: var(--gutter); right: auto; }
  .part strong { font-size: 20px; }
  .part span:last-child { display: none; }
  .proof-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 48px; }
  .notes-grid { align-content: end; padding-bottom: 6vh; }
  .notes-head, .note-cards { grid-column: 1 / -1; }
  .notes-head .lede { display: none; }
  .note-card { padding: 12px 18px 14px; }
  .note-card p { display: none; }
  .hud-notes { top: 76px; bottom: auto; }
  .trace-grid { grid-template-columns: 1fr; }
  .card, .card-wide { grid-column: 1 / -1; grid-row: auto; }
  .foot-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
}

/* the footer links were 17–19px tall, which is under what a finger can reliably hit */
@media (pointer: coarse), (max-width: 860px) {
  .foot-col a, .foot-base a { display: inline-flex; align-items: center; min-height: 44px; }
}
