:root {
  /* DESIGN FONT TOKENS: IBM Plex Mono* Mono** only as a sparing accent; IBM Plex Sans Condensed* Condensed** in Medium and SemiBold; Interface labels. */
  --polar-vellum: #F3EFE4;
  --deep-carbon: #14213D;
  --lichen-aurora: #7FAF8B;
  --tanned-ledger: #6B4A34;
  --frost-blue: #C8D7D2;
  --lamp-amber: #D8A94E;
  --display: "Fraunces", Georgia, serif;
  --interface: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --body: "Literata", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--deep-carbon);
  background:
    radial-gradient(circle at 12% 18%, rgba(200, 215, 210, .72), transparent 30%),
    radial-gradient(circle at 78% 8%, rgba(127, 175, 139, .18), transparent 26%),
    linear-gradient(135deg, var(--polar-vellum), #ebe4d5 62%, var(--frost-blue));
  font-family: var(--body);
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: .16;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, rgba(20,33,61,.28) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(115deg, rgba(107,74,52,.18) 0 1px, transparent 1px 9px);
  mix-blend-mode: multiply;
}

.aurora-field {
  position: fixed;
  inset: -20vh -20vw;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora {
  position: absolute;
  width: 120vw;
  height: 13vh;
  border-radius: 999px;
  filter: blur(18px);
  opacity: .44;
  transform: rotate(-14deg);
  background: linear-gradient(90deg, transparent, rgba(127,175,139,.78), rgba(200,215,210,.58), rgba(216,169,78,.22), transparent);
  animation: driftAurora 24s ease-in-out infinite alternate;
}

.ribbon-one { top: 20vh; left: -18vw; }
.ribbon-two { top: 52vh; left: -8vw; animation-duration: 32s; opacity: .27; }
.ribbon-three { top: 78vh; left: -24vw; animation-duration: 38s; opacity: .2; }

.top-rail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 54px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(20,33,61,.22);
  background: rgba(243, 239, 228, .72);
  backdrop-filter: blur(12px);
  font-family: var(--interface);
  text-transform: uppercase;
  letter-spacing: .13em;
  font-size: 12px;
}

.wordmark { font-weight: 600; }
.chapter-indicator { color: var(--tanned-ledger); }
.market-tick { justify-self: end; display: flex; gap: 9px; align-items: center; font-family: var(--mono); font-size: 11px; }
.tick-light { width: 7px; height: 7px; border-radius: 50%; background: var(--lichen-aurora); box-shadow: 0 0 16px var(--lichen-aurora); animation: pulseTick 2.4s infinite; }

main { position: relative; z-index: 2; }

.scene {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  padding: 86px clamp(20px, 5vw, 76px) 54px;
  border-bottom: 1px solid rgba(20,33,61,.13);
  isolation: isolate;
}

.scene::before {
  content: "";
  position: absolute;
  inset: 72px clamp(16px, 4vw, 64px) 34px;
  border-left: 1px solid rgba(20,33,61,.14);
  border-right: 1px solid rgba(20,33,61,.08);
  pointer-events: none;
}

.scene-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .82fr);
  gap: clamp(34px, 6vw, 92px);
  align-items: center;
}

.clearing-grid { grid-template-columns: minmax(320px, .9fr) minmax(0, 1fr); }

.kicker, .card-label, .folio-tab, .marginalia, .archive-slip span {
  font-family: var(--interface);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 600;
}

.kicker { font-size: clamp(12px, 1.2vw, 15px); color: var(--tanned-ledger); margin: 0 0 26px; }

.domain-title, .chapter-title {
  font-family: var(--display);
  font-weight: 800;
  line-height: .88;
  letter-spacing: -.055em;
  margin: 0;
  color: var(--deep-carbon);
}

.domain-title { font-size: clamp(58px, 12vw, 184px); transform: translateY(5vh); }
.chapter-title { font-size: clamp(54px, 9vw, 142px); }

.kinetic-line {
  max-width: 760px;
  display: flex;
  flex-wrap: wrap;
  gap: .14em .28em;
  margin: 9vh 0 30px;
  font-family: var(--display);
  font-size: clamp(31px, 4.5vw, 72px);
  line-height: 1;
  letter-spacing: -.035em;
}

[data-kinetic] span {
  display: inline-block;
  transform: translateY(18px);
  opacity: .2;
  transition: transform 1s cubic-bezier(.2,.8,.2,1), opacity 1s, letter-spacing 1.2s;
}

.is-active [data-kinetic] span, [data-kinetic].settled span {
  transform: translateY(var(--lift, 0));
  opacity: 1;
  letter-spacing: -.012em;
}

.body-copy {
  max-width: 620px;
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.58;
  color: rgba(20,33,61,.84);
}

.ledger-inscription {
  border: 0;
  border-bottom: 1px solid var(--deep-carbon);
  background: transparent;
  color: var(--deep-carbon);
  padding: 8px 2px;
  font-family: var(--interface);
  text-transform: uppercase;
  letter-spacing: .18em;
  cursor: pointer;
}

.folio-object, .index-card, .map-folio, .archive-slip, .citation-bracket, .marginalia {
  position: relative;
}

[data-border]::before, [data-border]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: clip-path 1.1s cubic-bezier(.19,1,.22,1), opacity .8s;
  opacity: .35;
}

[data-border]::before { border-top: 1px solid var(--deep-carbon); border-bottom: 1px solid var(--deep-carbon); clip-path: inset(0 100% 0 0); }
[data-border]::after { border-left: 1px solid var(--deep-carbon); border-right: 1px solid var(--deep-carbon); clip-path: inset(100% 0 0 0); }
.is-active [data-border]::before, .is-active [data-border]::after, [data-border]:hover::before, [data-border]:hover::after { clip-path: inset(0); opacity: .72; }

.leather-ledger {
  min-height: 520px;
  padding: 34px;
  border-radius: 22px 34px 24px 16px;
  color: var(--polar-vellum);
  background:
    radial-gradient(circle at 18% 12%, rgba(216,169,78,.22), transparent 24%),
    repeating-linear-gradient(35deg, rgba(243,239,228,.035) 0 1px, transparent 1px 8px),
    linear-gradient(135deg, #7a563d, var(--tanned-ledger) 52%, #4f3627);
  box-shadow: 0 38px 80px rgba(20,33,61,.25), inset 0 0 0 1px rgba(243,239,228,.15);
  transform: rotate(2deg);
  transition: transform 1.2s cubic-bezier(.19,1,.22,1);
}

.hero.opened .leather-ledger { transform: rotate(-1deg) translateX(-20px); }
.folio-tab { color: var(--lamp-amber); font-size: 13px; }
.debossed-seal { margin: 82px auto 44px; width: 150px; height: 150px; border: 1px solid rgba(243,239,228,.34); border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 38px; box-shadow: inset 0 0 28px rgba(20,33,61,.32); }
.stitch-row { height: 1px; background: repeating-linear-gradient(90deg, rgba(243,239,228,.58) 0 8px, transparent 8px 15px); }
.folio-note { font-size: 20px; line-height: 1.55; }
.receipt-strip { margin-top: 38px; padding: 16px; color: var(--deep-carbon); background: rgba(243,239,228,.82); font-family: var(--mono); display: flex; justify-content: space-between; gap: 20px; font-size: 12px; }

.marginalia { position: absolute; padding: 12px 16px; font-size: 11px; color: var(--tanned-ledger); background: rgba(243,239,228,.56); }
.bottom-left { left: 7vw; bottom: 38px; }
.right-note { right: 5vw; top: 22vh; writing-mode: vertical-rl; }
.bottom-right { right: 8vw; bottom: 44px; }

.method-table { position: relative; min-height: 560px; }
.index-card { width: min(360px, 88vw); padding: 28px; background: rgba(243,239,228,.75); box-shadow: 0 22px 60px rgba(20,33,61,.14); backdrop-filter: blur(4px); }
.index-card.rotated { transform: rotate(-6deg) translate(20px, 30px); background: rgba(200,215,210,.68); }
.index-card:not(.rotated) { transform: rotate(5deg) translate(145px, 108px); }
.index-card strong { display: block; font-family: var(--mono); font-size: 52px; color: var(--deep-carbon); margin: 24px 0 8px; }
.birch-ruler { position: absolute; left: 6%; right: 0; bottom: 58px; height: 30px; border-top: 4px solid rgba(216,169,78,.7); display: flex; justify-content: space-between; transform: rotate(-2deg); }
.birch-ruler span { width: 1px; height: 22px; background: var(--deep-carbon); opacity: .42; }
.citation-bracket { margin-top: 34px; padding: 18px 22px; max-width: 520px; color: var(--tanned-ledger); background: rgba(200,215,210,.3); font-family: var(--interface); letter-spacing: .08em; text-transform: uppercase; }

.map-folio { min-height: 560px; border-radius: 18px; background: linear-gradient(145deg, rgba(200,215,210,.55), rgba(243,239,228,.7)); box-shadow: inset 0 0 0 1px rgba(20,33,61,.08), 0 28px 70px rgba(20,33,61,.12); overflow: hidden; }
.contour-map { width: 100%; height: 100%; min-height: 520px; }
.contour-map path, .contour-map circle { fill: none; stroke: var(--deep-carbon); stroke-width: 1.2; opacity: .36; stroke-dasharray: 720; stroke-dashoffset: 720; transition: stroke-dashoffset 2.4s ease; }
.is-active .contour-map path, .is-active .contour-map circle { stroke-dashoffset: 0; }
.clearing-band { position: absolute; inset: 40% -20%; height: 90px; transform: rotate(-16deg); background: linear-gradient(90deg, transparent, rgba(127,175,139,.5), rgba(216,169,78,.18), transparent); filter: blur(10px); animation: bandSweep 8s ease-in-out infinite alternate; }
.seal-ring { position: absolute; right: 32px; bottom: 28px; width: 130px; height: 130px; border-radius: 50%; border: 1px solid var(--tanned-ledger); display: grid; place-items: center; text-align: center; color: var(--tanned-ledger); font-family: var(--interface); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; background: rgba(243,239,228,.54); }
.seal-ring span { color: var(--deep-carbon); }

.archive-stack { display: grid; gap: 18px; transform: rotate(1.5deg); }
.archive-slip { padding: 28px 30px; min-height: 112px; background: rgba(243,239,228,.76); font-size: clamp(22px, 2.7vw, 36px); font-family: var(--display); box-shadow: 0 18px 55px rgba(20,33,61,.12); }
.archive-slip span { display: block; margin-bottom: 12px; color: var(--tanned-ledger); font-size: 12px; font-family: var(--interface); }
.archive-slip.amber { background: rgba(216,169,78,.24); }
.archive-slip.blue { background: rgba(200,215,210,.58); }
.folio-footer { position: absolute; left: 5vw; right: 5vw; bottom: 18px; border-top: 1px solid rgba(20,33,61,.18); padding-top: 14px; font-family: var(--mono); font-size: 11px; color: rgba(20,33,61,.58); }

@keyframes driftAurora { from { transform: translateX(-8vw) rotate(-14deg) scaleX(.92); } to { transform: translateX(22vw) rotate(-11deg) scaleX(1.08); } }
@keyframes pulseTick { 0%,100% { opacity: .45; transform: scale(.78); } 50% { opacity: 1; transform: scale(1.18); } }
@keyframes bandSweep { from { transform: translateX(-6%) rotate(-16deg); opacity: .28; } to { transform: translateX(12%) rotate(-16deg); opacity: .68; } }

@media (max-width: 860px) {
  .top-rail { grid-template-columns: 1fr; gap: 2px; height: auto; padding-top: 8px; padding-bottom: 8px; }
  .chapter-indicator, .market-tick { justify-self: start; }
  .scene-grid, .clearing-grid { grid-template-columns: 1fr; }
  .domain-title { transform: none; }
  .leather-ledger { min-height: 420px; }
  .right-note { writing-mode: horizontal-tb; top: auto; bottom: 18px; right: 20px; }
  .index-card:not(.rotated), .index-card.rotated { transform: none; margin-bottom: 18px; }
}
