:root {
  --bone: #F5F2EA;
  --ink: #04001E;
  --obsidian: #07060D;
  --champagne: #E3C77A;
  --satin: #C9B36A;
  --bronze: #82714E;
  --platinum: #D8D5CE;

  --beat: 625ms;
  --half: 312ms;
  --quarter: 156ms;
  --settle: 1250ms;
  --ease: cubic-bezier(.22, 1, .36, 1);

  --f-display: "Fraunces", "Times New Roman", serif;
  --f-body: "Geist", system-ui, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, monospace;

  /* starting geometry of the hero window (read by thread.js) */
  --w-scale0: .74;
  --w-y0: 31vh;
  --gutter: clamp(16px, 2.4vw, 36px);
}

@media (max-width: 760px) {
  :root { --w-scale0: .9; --w-y0: 46vh; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bone); color: var(--ink); }
body {
  font-family: var(--f-body); font-size: 1rem; line-height: 1.55;
  background: var(--bone); -webkit-font-smoothing: antialiased;
}
ol, ul { list-style: none; }

.mono { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }
.display {
  font-family: var(--f-display); font-optical-sizing: auto; font-weight: 340;
  font-size: clamp(2.1rem, 5.2vw, 4.7rem); line-height: 1.02; letter-spacing: -.02em;
  text-wrap: balance;
}
.display em { font-style: italic; font-weight: 300; }
.body { font-size: clamp(1rem, 1.15vw, 1.12rem); max-width: 52ch; color: rgba(4, 0, 30, .76); }
.light { color: var(--bone); }
.body.light { color: rgba(245, 242, 234, .74); }
.eyebrow { margin-bottom: 18px; color: var(--bronze); }
.eyebrow.light { color: var(--satin); }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px var(--gutter); transition: color var(--beat) var(--ease);
}
.wordmark { font-family: var(--f-display); font-size: 1.35rem; font-weight: 400; color: inherit; text-decoration: none; }
.wordmark em { font-style: italic; font-weight: 300; }
.nav-label { opacity: .7; }
.btn {
  display: inline-block;
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: inherit; text-decoration: none; padding: 11px 18px;
  border: 1px solid var(--bronze); border-radius: 999px;
  transition: transform var(--quarter) var(--ease), box-shadow var(--quarter) var(--ease), border-color var(--beat) var(--ease);
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 10px 24px -12px rgba(130, 113, 78, .55); }
.btn:active { transform: translateY(-1px); }
.btn.light { color: var(--bone); border-color: rgba(227, 199, 122, .6); }
.btn.big { font-size: .82rem; padding: 16px 28px; }
.btn:focus-visible, .wordmark:focus-visible, .door:focus-visible { outline: 2px solid var(--satin); outline-offset: 4px; }
.nav.is-dark { color: var(--bone); }
.nav.is-dark .btn { border-color: rgba(227, 199, 122, .6); }
@media (max-width: 760px) { .nav-label { display: none; } }

/* masked line reveal */
.ml { display: block; overflow: clip; padding-bottom: .06em; }
.ml > span { display: inline-block; }
.hero-copy .ml > span { animation: rise-line var(--beat) var(--ease) both; }
.hero-copy .ml:nth-child(2) > span { animation-delay: 90ms; }
@keyframes rise-line { from { transform: translateY(105%); } to { transform: none; } }

/* ================= WORLD I · THE MIND ================= */
.act { position: relative; height: 1050vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: clip; }

.hero-copy {
  position: absolute; z-index: 1; top: clamp(84px, 12vh, 130px); left: 50%;
  width: min(1100px, calc(100% - 2 * var(--gutter))); transform: translateX(-50%); text-align: center;
}
.lede { max-width: 54ch; margin: 18px auto 0; font-size: clamp(.92rem, 1.1vw, 1.05rem); color: rgba(4, 0, 30, .72); }
@media (max-height: 760px) and (min-width: 761px) { .lede { display: none; } }
@media (max-width: 760px) { .hero-copy .display { font-size: 2.15rem; } .lede { font-size: .9rem; } }

.window {
  position: absolute; z-index: 2; inset: 0; transform-origin: 50% 50%;
  transform: translateY(var(--w-y0)) scale(var(--w-scale0)); will-change: transform;
}
.window-inner {
  position: absolute; inset: 0; border-radius: 28px; overflow: clip;
  background: radial-gradient(120% 90% at 50% 40%, #12101c 0%, var(--obsidian) 62%);
  box-shadow: 0 40px 90px -40px rgba(4, 0, 30, .55);
}
.gl, .thread-static { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.thread-static { display: none; }

/* four-layer texture: scrim and vignette here, bloom lives in the matcap, grain on ::after */
.texture, .grain { position: absolute; inset: 0; pointer-events: none; }
.texture {
  background:
    linear-gradient(to top, rgba(7, 6, 13, .55), transparent 38%),
    radial-gradient(130% 100% at 50% 45%, transparent 55%, rgba(0, 0, 0, .55) 100%);
}
.texture::after, .grain::after, .world-obsidian::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: 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='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay; opacity: .1;
}

.reg { position: absolute; color: var(--platinum); opacity: .35; font-family: var(--f-mono); font-size: 14px; line-height: 1; }
.reg.tl { top: 18px; left: 20px; } .reg.tr { top: 18px; right: 20px; }
.reg.bl { bottom: 18px; left: 20px; } .reg.br { bottom: 18px; right: 20px; }

.frag-label {
  position: absolute; top: 0; left: 0; color: var(--platinum); font-size: .64rem;
  padding-left: 14px; white-space: nowrap; opacity: 0; transition: opacity var(--beat) var(--ease); will-change: transform;
}
.frag-label::before { content: ""; position: absolute; left: 0; top: 50%; width: 9px; height: 1px; background: var(--satin); }
.frag-labels.is-in .frag-label { opacity: .85; }

/* the human judgment ring's label */
.ring-label {
  position: absolute; top: 0; left: 0; display: grid; gap: 6px; max-width: 220px;
  padding-left: 18px; border-left: 1px solid rgba(227, 199, 122, .5);
  opacity: 0; transition: opacity var(--beat) var(--ease); will-change: transform;
}
.ring-label.is-in { opacity: 1; }
@media (max-width: 760px) { .ring-label { max-width: 200px; } }
.ring-name { color: var(--champagne); font-size: .7rem; }
.ring-state { color: rgba(216, 213, 206, .62); font-size: .6rem; line-height: 1.6; text-transform: none; letter-spacing: .06em; }
.ring-state b { font-weight: 500; color: var(--platinum); transition: color var(--half) var(--ease); }
.ring-label.is-deciding .ring-state b { color: var(--champagne); }

/* act copy blocks, one per state, in the lower third of the window */
.act-copy {
  position: absolute; left: var(--gutter); bottom: clamp(56px, 10vh, 110px);
  max-width: min(1040px, calc(100% - 2 * var(--gutter)));
}
.act-copy .display { font-size: clamp(1.9rem, 4vw, 3.6rem); text-wrap: wrap; }
.has-motion .act-copy { pointer-events: none; }
.has-motion .act-copy .eyebrow, .has-motion .act-copy .rail { opacity: 0; transition: opacity var(--beat) var(--ease); }
.has-motion .act-copy .ml > span { transform: translateY(105%); transition: transform var(--beat) var(--ease); }
.has-motion .act-copy .ml:nth-child(2) > span { transition-delay: 90ms; }
.has-motion .act-copy.is-in .eyebrow, .has-motion .act-copy.is-in .rail { opacity: 1; }
.has-motion .act-copy.is-in .ml > span { transform: none; }

.rail { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 26px; color: rgba(216, 213, 206, .4); font-size: .66rem; }
.rail li { position: relative; padding-left: 16px; transition: color var(--beat) var(--ease); }
.rail li::before { content: ""; position: absolute; left: 0; top: 50%; width: 7px; height: 7px; margin-top: -4px; border-radius: 50%; border: 1px solid currentColor; transition: background var(--beat) var(--ease); }
.rail li.is-lit { color: var(--champagne); }
.rail li.is-lit::before { background: var(--champagne); }

.cue { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); color: var(--platinum); opacity: .6; transition: opacity var(--beat) var(--ease); }
.cue.is-out { opacity: 0; }

/* ================= the thread through the worlds ================= */
.worlds { position: relative; }
.world-thread { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; overflow: visible; }
.world-thread path { fill: none; stroke: var(--champagne); stroke-width: 1.4; stroke-linecap: round; opacity: .7; }
.world-bone { background: var(--bone); position: relative; }
.world-obsidian { background: var(--obsidian); color: var(--bone); position: relative; }

/* ================= WORLD II · 2028 ================= */
.absurd { height: 520vh; }
.absurd-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: clip; display: grid; grid-template-rows: auto 1fr auto; padding: 110px var(--gutter) 40px; }
.absurd-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 0 24px; }
.absurd-head .eyebrow { grid-column: 1 / -1; }
.absurd-head .display { font-size: clamp(2rem, 4.4vw, 4rem); }
.absurd-count { color: var(--bronze); }
.absurd-track { display: flex; align-items: center; gap: 6vw; will-change: transform; }
.absurd-track li { flex: 0 0 min(78vw, 1100px); display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: start; }
.absurd-track li span { color: var(--bronze); padding-top: 1.1em; }
.absurd-track p {
  font-family: var(--f-display); font-weight: 300; font-size: clamp(2rem, 5.4vw, 5.6rem);
  line-height: 1.04; letter-spacing: -.025em; text-wrap: balance;
}
.absurd-bar { height: 1px; background: rgba(130, 113, 78, .25); }
.absurd-bar i { display: block; height: 100%; background: var(--satin); transform-origin: 0 50%; transform: scaleX(0); }

/* ================= WORLD III · THE ARCHITECT ================= */
.architect { height: 380vh; }
.architect-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: clip;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 5vw; align-items: center;
  padding: 100px var(--gutter) 48px;
}
.architect-copy { display: grid; gap: 22px; align-content: center; }
.architect-copy .display { font-size: clamp(2rem, 4.2vw, 3.9rem); }
.creds { display: flex; flex-wrap: wrap; gap: 8px; }
.creds li { padding: 8px 12px; border: 1px solid rgba(130, 113, 78, .4); border-radius: 999px; font-size: .64rem; }
.origin { font-family: var(--f-display); font-size: clamp(1.2rem, 1.7vw, 1.55rem); line-height: 1.3; font-weight: 300; max-width: 34ch; }
.origin em { font-style: italic; }
.architect-caption { color: var(--bronze); }
.architect-media { position: relative; height: min(76vh, 820px); aspect-ratio: 4 / 5; justify-self: center; transform-origin: 50% 100%; will-change: transform; }
.architect-media .slot { position: absolute; inset: 0; clip-path: inset(100% 0 0 0 round 22px); transition: clip-path var(--settle) var(--ease); }
.architect-media .slot.is-shown { clip-path: inset(0 0 0 0 round 22px); }
.architect-media .slot:first-child { clip-path: inset(0 0 0 0 round 22px); }
@media (max-width: 860px) {
  .architect-stage { grid-template-columns: 1fr; align-content: start; gap: 24px; padding-top: 90px; }
  .architect-copy .body, .architect-copy .origin { display: none; }
  .architect-media { height: 48vh; }
}

/* ---------- material slots (Stacy's photos and video drop in here) ---------- */
.slot { position: relative; overflow: clip; border-radius: 22px; background: #15121d; }
.slot-fill, .slot img, .slot video { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; display: block; }
.slot-fill {
  background:
    radial-gradient(60% 50% at 30% 30%, rgba(227, 199, 122, .35), transparent 70%),
    radial-gradient(70% 60% at 75% 80%, rgba(130, 113, 78, .45), transparent 70%),
    linear-gradient(160deg, #2a2236, #0c0a13);
  animation: drift 14s var(--ease) infinite alternate;
}
.slot-fill.alt { background: radial-gradient(55% 45% at 70% 30%, rgba(216, 213, 206, .3), transparent 70%), radial-gradient(60% 60% at 20% 80%, rgba(227, 199, 122, .3), transparent 70%), linear-gradient(200deg, #1d1a27, #08070c); }
.slot-fill.alt2 { background: radial-gradient(50% 50% at 50% 40%, rgba(201, 179, 106, .32), transparent 70%), linear-gradient(120deg, #241d18, #0b0a10 70%); }
@keyframes drift { to { transform: translate3d(3%, -2%, 0) scale(1.04); } }
.slot::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); mix-blend-mode: overlay; opacity: .12; }
.slot-label { position: absolute; left: 16px; bottom: 14px; right: 16px; z-index: 2; color: rgba(245, 242, 234, .78); font-size: .6rem; }
.slot.has-media .slot-label { display: none; }

/* ================= WORLD IV · THE SEALED CHAMBER ================= */
.chamber { height: 260vh; }
.chamber-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: clip;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5vw; align-items: center; padding: 100px var(--gutter) 48px;
}
.chamber-copy { display: grid; gap: 24px; justify-items: start; }
.chamber-copy .display { font-size: clamp(2rem, 4.2vw, 3.8rem); }
.chamber-glass {
  position: relative; aspect-ratio: 1; width: min(100%, 72vh); justify-self: center; border-radius: 32px;
  background: linear-gradient(150deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015));
  border: 1px solid rgba(216, 213, 206, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 50px 120px -60px rgba(227, 199, 122, .35);
  backdrop-filter: blur(6px) saturate(1.4); display: grid; place-items: center;
}
.loop { width: 86%; height: 86%; overflow: visible; }
.loop-track { fill: none; stroke: rgba(216, 213, 206, .14); stroke-width: 1; }
.loop-run { fill: none; stroke: var(--champagne); stroke-width: 1.4; stroke-linecap: round; transform: rotate(-90deg); }
.loop-dot { fill: var(--champagne); }
.loop-core { fill: none; stroke: var(--champagne); stroke-width: 2; }
.loop-core-label { font-family: var(--f-mono); font-size: 9px; letter-spacing: .2em; fill: rgba(227, 199, 122, .8); }
.loop-station text { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .14em; fill: rgba(216, 213, 206, .5); transition: fill var(--half) var(--ease); }
.loop-station circle { fill: var(--obsidian); stroke: rgba(216, 213, 206, .35); stroke-width: 1; transition: stroke var(--half) var(--ease), fill var(--half) var(--ease); }
.loop-station.is-on text { fill: var(--champagne); }
.loop-station.is-on circle { stroke: var(--champagne); fill: rgba(227, 199, 122, .25); }
.chamber-tag { position: absolute; bottom: 18px; left: 22px; color: rgba(216, 213, 206, .45); font-size: .6rem; }
@media (max-width: 860px) {
  .chamber-stage { grid-template-columns: 1fr; gap: 20px; padding-top: 90px; align-content: start; }
  .chamber-copy .body { display: none; }
  .chamber-glass { width: min(100%, 46vh); }
}

/* ================= WORLD V · THREE DOORS ================= */
.doors { padding: 160px var(--gutter) 140px; }
.doors .display { margin-bottom: 56px; }
.door-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); }
.door {
  display: grid; gap: 12px; color: inherit; text-decoration: none;
  transition: transform var(--quarter) var(--ease);
}
.door .slot { aspect-ratio: 3 / 4; transition: box-shadow var(--quarter) var(--ease); }
.door:hover { transform: translateY(-3px); }
.door:hover .slot { box-shadow: 0 30px 60px -30px rgba(130, 113, 78, .6); }
.door-num { color: var(--bronze); margin-top: 8px; }
.door-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.6rem, 2.4vw, 2.2rem); letter-spacing: -.01em; }
.door p { color: rgba(4, 0, 30, .7); max-width: 38ch; }
@media (max-width: 860px) { .door-row { grid-template-columns: 1fr; } .door .slot { aspect-ratio: 16 / 10; } }

/* ================= WORLD VI · THE CLOSE ================= */
.close { min-height: 100vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 36px; padding: 140px var(--gutter) 60px; }
.close .display { font-size: clamp(2.2rem, 5vw, 4.6rem); }
.mark { width: min(640px, 90vw); height: auto; overflow: visible; }
.mark path { fill: none; stroke: var(--champagne); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.foot { color: rgba(216, 213, 206, .4); margin-top: 40px; font-size: .6rem; }

.proto-badge {
  position: fixed; right: var(--gutter); bottom: 16px; z-index: 40; font-size: .6rem; color: var(--bronze);
  background: var(--bone); padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(130, 113, 78, .35);
}

/* ================= review mode (?review): show what is draft and what needs material ================= */
.is-review [data-draft] { text-decoration: underline dotted rgba(201, 179, 106, .9); text-underline-offset: .2em; }
.is-review .slot { outline: 1px dashed rgba(227, 199, 122, .7); outline-offset: 4px; }

/* review screenshots (?p=): states without transitions */
.is-frozen *, .is-frozen *::before { transition: none !important; }

/* ================= static / reduced-motion composition ================= */
.is-static .act { height: auto; }
.is-static .stage { position: relative; height: auto; overflow: visible; padding: 120px var(--gutter) 60px; }
.is-static .hero-copy { position: relative; top: 0; left: 0; transform: none; width: auto; margin: 0 auto 48px; max-width: 1100px; }
.is-static .window { position: relative; transform: none; max-width: 1400px; margin: 0 auto; }
.is-static .window-inner { position: relative; padding-bottom: 56px; }
.is-static .gl, .is-static .cue, .is-static .ring-label, .is-static .frag-labels { display: none; }
.is-static .thread-static { display: block; position: relative; height: min(60vh, 600px); }
.is-static .act-copy { position: relative; left: auto; bottom: auto; padding: 32px var(--gutter) 24px; }
.is-static .absurd, .is-static .architect, .is-static .chamber { height: auto; }
.is-static .absurd-stage, .is-static .architect-stage, .is-static .chamber-stage { position: relative; height: auto; overflow: visible; }
.is-static .absurd-track { flex-direction: column; align-items: stretch; gap: 48px; padding: 48px 0; }
.is-static .absurd-track li { flex: none; }
.is-static .absurd-count, .is-static .absurd-bar { display: none; }
.is-static .architect-media { height: auto; aspect-ratio: auto; display: grid; gap: 16px; width: 100%; }
.is-static .architect-media .slot { position: relative; clip-path: none; aspect-ratio: 4 / 5; }
.is-static .architect-caption { display: none; }
.is-static .slot-fill { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .hero-copy .ml > span { animation: none; }
  *, *::before, *::after { transition-duration: 0ms !important; animation: none !important; }
}

/* static: a quiet solid nav, no chapter label */
.is-static .nav { background: var(--bone); color: var(--ink); }
.is-static .nav-label { display: none; }
