/* Anthropic Trade — editorial "Editions" design language
   Every section is a chapter: sticky painting opener (zooms out as you scroll, giant word drifts sideways)
   → torn-paper edge → content page with paintings that wipe in and drift. Fixed roman-numeral side index. */

:root {
  --paper: #dcd8cb;
  --paper-2: #d3d4c4;
  --ink: #111110;
  --ink-2: rgba(17, 17, 16, .5);
  --ink-line: rgba(17, 17, 16, .14);
  --night: #0a0a0a;
  --bone: #f7f7ee;
  --bone-2: rgba(247, 247, 238, .58);
  --bone-line: rgba(247, 247, 238, .16);
  --amber: #f2a33a;
  --amber-ink: #9a5a12;

  --f-sans: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --f-serif: "Instrument Serif", ui-serif, Georgia, serif;
  --f-script: "Imperial Script", "Instrument Serif", cursive;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --side: clamp(220px, 20vw, 336px);
  --pad: clamp(16px, 2.2vw, 32px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  --tear-h: clamp(70px, 10vw, 150px);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--night); color: var(--ink);
  font: 500 15px/1.22 var(--f-sans); letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden;
}
a { color: inherit; }
svg { display: block; }
code { font-family: var(--f-mono); font-size: .86em; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 999; background: var(--bone); color: var(--ink); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ───────── header ───────── */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 50; height: 50px;
  display: flex; align-items: center; gap: 28px; padding: 0 12px 0 var(--pad);
  color: var(--bone); transition: color .35s var(--ease), background-color .35s var(--ease);
}
.topbar::before {
  content: ""; position: absolute; inset: 0 0 -30px; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, .55), transparent); transition: opacity .35s;
}
.topbar[data-theme="light"] { color: var(--ink); }
.topbar[data-theme="light"]::before, .topbar.scrolled::before { opacity: 0; }
.topbar.scrolled[data-theme="light"] { background: color-mix(in srgb, var(--paper) 84%, transparent); backdrop-filter: blur(10px); }
.topbar.scrolled[data-theme="dark"] { background: color-mix(in srgb, var(--night) 70%, transparent); backdrop-filter: blur(10px); }
.brand { font-weight: 700; font-size: 16px; letter-spacing: -.02em; text-decoration: none; }
.topnav { display: flex; gap: 22px; margin-left: 24px; }
.topnav a, .toplink { text-decoration: none; font-size: 15px; }
.topnav a:hover, .toplink:hover { opacity: .6; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.pill {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--bone); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform .2s var(--ease), opacity .2s;
}
.topbar[data-theme="light"] .pill { background: var(--ink); color: var(--bone); }
.pill:hover { transform: translateY(-1px); opacity: .88; }
.pill--lg { height: 42px; padding: 0 20px; font-size: 16px; }

/* ───────── side index ───────── */
.sideindex {
  position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: var(--side);
  padding: 62px var(--pad) 14px; display: flex; flex-direction: column;
  color: var(--bone); pointer-events: none; transition: color .35s var(--ease);
}
.sideindex a { pointer-events: auto; }
.sideindex[data-theme="light"] { color: var(--ink); }
.wordmark { color: var(--bone); font: 700 22px/.9 var(--f-sans); letter-spacing: -.045em; text-decoration: none; transition: color .35s var(--ease); }
.wordmark[data-theme="light"] { color: var(--ink); }
.topbar .wordmark, .topbar .wordmark[data-theme] { color: inherit; }   /* logo lives in the top bar: follow its colour */
.wordmark i, .statement .cap { font-family: var(--f-script); font-style: normal; font-weight: 400; letter-spacing: 0; }
.wordmark i { font-size: 1.12em; line-height: 0; }
.index { list-style: none; margin: auto 0 0; padding: 0; }
.index li a {
  display: flex; align-items: baseline; gap: 6px; text-decoration: none;
  font: 700 20px/.86 var(--f-sans); letter-spacing: -.035em; opacity: .4; transition: opacity .25s;
}
.index li a::after { content: ""; flex: 1; border-bottom: 1px dotted currentColor; opacity: 0; transform: translateY(-3px); transition: opacity .25s; }
.index li a .num { font: 400 13px/1 var(--f-serif); letter-spacing: 0; order: 2; min-width: 22px; text-align: right; }
.index li a:hover, .index li.active a { opacity: 1; }
.index li.active a::after { opacity: .7; }
.sideindex[data-hero] .index li a { opacity: 1; }
/* Side index hidden on the hero, fades in once you scroll past it */
.sideindex .index, .sideindex .side-foot { transition: opacity .45s var(--ease), visibility .45s; }
.sideindex[data-hero] .index, .sideindex[data-hero] .side-foot { opacity: 0; visibility: hidden; }
.side-foot { margin: 34px 0 0; font: 400 12px/1.15 var(--f-serif); }
.side-foot a { text-decoration: none; }

/* ───────── chapter openers (scroll-driven: --p = 0 → 1 while the chapter crosses the viewport) ───────── */
.chapter { position: relative; background: #0b0a08; color: var(--bone); overflow-x: clip; --p: .5; }
.ch-bg { position: sticky; top: 0; height: 100svh; margin-bottom: -100svh; overflow: hidden; }
.ch-bg > div {
  position: absolute; inset: -4% 0; background: var(--img) var(--pos, 50% 50%) / cover no-repeat;
  transform: translate3d(0, calc((var(--p) - .5) * -6%), 0) scale(calc(1.24 - var(--p) * .24));
  will-change: transform;
}
.ch-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .2) 0%, rgba(0, 0, 0, .05) 30%, rgba(0, 0, 0, .4) 72%, rgba(0, 0, 0, .65) 100%);
}
.ch-content {
  position: relative; z-index: 2;
  padding: 52svh var(--pad) calc(var(--tear-h) + 26svh) calc(var(--side) + var(--pad));
}
/* Hero: compact, everything fits in the first viewport */
.chapter--hero .ch-content {
  min-height: calc(100svh + var(--tear-h)); box-sizing: border-box;   /* paper's torn edge starts just below the fold */
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "mega" "stmt" "acts" "token"; align-content: end; justify-items: center; text-align: center;
  padding: 84px var(--pad) calc(var(--tear-h) + 22px);   /* full width: side index is hidden here; room for the paper's torn edge */
}
/* Title stays in the HTML for screen readers / SEO, hidden visually */
.chapter--hero .mega { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.chapter--hero .statement { grid-area: stmt; max-width: 720px; margin: 0; font-size: clamp(22px, 2.4vw, 40px); }
.chapter--hero .hero-actions { grid-area: acts; margin-top: 22px; justify-content: center; }
.chapter--hero .token { grid-area: token; width: 100%; max-width: 640px; margin-top: 26px; padding-top: 16px; }
.chapter--hero .ca { justify-content: center; margin-bottom: 12px; }
.chapter--hero .token-note { font-size: clamp(17px, 1.35vw, 21px); color: var(--bone); }

/* CA "coming soon" pill with live animation */
.ca-pill {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 18px 0 14px; border-radius: 999px;
  border: 1px solid rgba(247, 247, 238, .28); background: rgba(247, 247, 238, .08); backdrop-filter: blur(6px);
}
.ca-pill::after {                       /* light sweep across the pill */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(247, 247, 238, .22) 50%, transparent 70%);
  transform: translateX(-100%); animation: ca-sweep 2.6s var(--ease) infinite;
}
.ca-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #7cf29a; }
.ca-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit;
  animation: ca-ping 1.6s ease-out infinite;
}
.ca-label { font: 600 12px/1 var(--f-sans); letter-spacing: .14em; opacity: .62; }
.ca-soon { font: 500 15px/1 var(--f-mono, monospace); letter-spacing: .02em; }
.ca-dots i { font-style: normal; animation: ca-blink 1.4s infinite both; }
.ca-dots i:nth-child(2) { animation-delay: .2s; }
.ca-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes ca-sweep { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes ca-ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3); opacity: 0; } }
@keyframes ca-blink { 0%, 80%, 100% { opacity: .15; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ca-pill::after, .ca-dot::after, .ca-dots i { animation: none; } }
.chapter--hero .token .eyebrow { margin-bottom: 8px; }
.chapter--hero .token-links { margin: 10px 0 8px; }
.ch-num {
  margin: 0 0 6px; font: 400 clamp(22px, 2vw, 30px)/1 var(--f-serif);
  opacity: calc(.4 + var(--p) * .6);
}
.mega {
  margin: 0 0 0 -.04em; font: 700 clamp(84px, 13.4vw, 230px)/.86 var(--f-sans); letter-spacing: -.05em;
  transform: translate3d(calc((.45 - var(--p)) * 10vw), 0, 0); will-change: transform;
}
.mega--ch { font-size: clamp(64px, 11.5vw, 200px); }
.statement {
  max-width: 940px; margin: clamp(44px, 8vh, 100px) 0 0;
  font: 400 clamp(32px, 3.9vw, 60px)/.98 var(--f-serif); letter-spacing: -.03em; text-wrap: balance;
}
.statement .cap { font-size: 1.9em; line-height: 0; position: relative; top: .08em; margin-right: -.03em; }
.statement em { font-style: italic; }
.statement--xl { font-size: clamp(48px, 7vw, 120px); max-width: 1100px; margin-top: 0; }
.chapter--end .ch-content { padding-top: 46svh; padding-bottom: 30svh; }
.end-lead { margin: 30px 0 28px; max-width: 560px; font: 500 19px/1.22 var(--f-sans); letter-spacing: -.02em; color: rgba(247, 247, 238, .85); }

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 44px; }
.hero-link { font-size: 15px; text-decoration: none; border-bottom: 1px solid var(--bone-line); padding-bottom: 2px; }
.hero-link:hover { border-color: currentColor; }
.token { max-width: 640px; margin-top: 64px; padding-top: 16px; border-top: 1px solid var(--bone-line); }
.ca { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ca code { font-size: clamp(12px, 1.25vw, 16px); word-break: break-all; }
.token-links { display: flex; gap: 8px; margin: 14px 0 12px; }
.token-note { margin: 0; font: 400 15px/1.2 var(--f-serif); color: var(--bone-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--bone-line);
  background: rgba(247, 247, 238, .08); font: 600 12px/1.2 var(--f-sans); text-decoration: none; border-radius: 2px; white-space: nowrap;
  backdrop-filter: blur(6px);
}
.chip span { font-size: 10px; }
.chip:hover { background: rgba(247, 247, 238, .18); }

/* ───────── content pages ───────── */
.sec { position: relative; z-index: 3; padding: 90px var(--pad) 150px calc(var(--side) + var(--pad)); }
.paper { background: var(--paper) var(--grain); color: var(--ink); }
.paper--alt { background-color: var(--paper-2); }
.dark { background: var(--night); color: var(--bone); }
.dark::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .5; mix-blend-mode: screen; pointer-events: none; }
.golden { position: absolute; inset: 0; width: 100%; height: 100%; color: rgba(247, 247, 238, .07); pointer-events: none; }
.golden--flip { transform: scaleX(-1); }

/* torn edge: drawn with the page's own background, masked to a torn shape (tools/make-torn.mjs) */
.tear { position: absolute; left: 0; right: 0; bottom: calc(100% - 1px); height: var(--tear-h); pointer-events: none; }
.tear::before, .tear::after { content: ""; position: absolute; inset: 0; -webkit-mask: var(--m) 0 0 / 100% 100% no-repeat; mask: var(--m) 0 0 / 100% 100% no-repeat; }
.tear::before { background: #efebe1; }              /* pale paper fibre peeking above the tear */
.dark .tear::before { background: #34312c; }
.tear::after { background: var(--tear-bg); }        /* same fill as the page below */
.tear--1::before { --m: url(assets/torn-fiber-1.svg); } .tear--1::after { --m: url(assets/torn-paper-1.svg); }
.tear--2::before { --m: url(assets/torn-fiber-2.svg); } .tear--2::after { --m: url(assets/torn-paper-2.svg); }
.tear--3::before { --m: url(assets/torn-fiber-3.svg); } .tear--3::after { --m: url(assets/torn-paper-3.svg); }
.paper .tear { --tear-bg: var(--paper) var(--grain); }
.paper--alt .tear { --tear-bg: var(--paper-2) var(--grain); }
.dark .tear { --tear-bg: var(--night); }
.tear--bottom { bottom: auto; top: calc(100% - 1px); transform: scaleY(-1); }  /* page torn at its foot too */
.chapter--stacked { z-index: 3; }                   /* an opener that follows another opener tears over it */
.tear--ink { --tear-bg: #0b0a08; height: calc(var(--tear-h) * .55); bottom: calc(100% - var(--tear-h) * .3); }
.tear--ink::before { background: #34312c; }

/* chapter heading set directly on a page (no painting opener) */
.sec-head { position: relative; margin: 0 0 72px; }
.sec-head .ch-num { opacity: .55; }
.sec-title { margin: 0 0 0 -.04em; font: 700 clamp(56px, 9vw, 150px)/.86 var(--f-sans); letter-spacing: -.05em; }
.sec-head .statement { margin-top: clamp(24px, 4vh, 44px); font-size: clamp(28px, 3.2vw, 50px); }

.lead { position: relative; max-width: 700px; margin: 0 0 80px; font: 500 clamp(19px, 1.6vw, 24px)/1.2 var(--f-sans); letter-spacing: -.025em; }
.lead code, .flow code, .mode code { padding: 1px 6px; border-radius: 5px; background: rgba(17, 17, 16, .08); }
.dark .lead { color: rgba(247, 247, 238, .82); }
.eyebrow { margin: 0 0 12px; font: 600 12px/1 var(--f-sans); letter-spacing: .14em; text-transform: uppercase; opacity: .62; }

/* paintings inside pages: wipe in from below, then drift with scroll */
.art { position: relative; margin: 0 0 18px; aspect-ratio: 4 / 3; overflow: hidden; background: #1a1712; --p: .5; }
.art--wide { aspect-ratio: 16 / 9; }
.art::before {
  content: ""; position: absolute; inset: -10% 0; background: var(--img) var(--pos, 50% 50%) / var(--size, cover) no-repeat;
  translate: 0 calc((var(--p) - .5) * -12%); scale: 1.18; transition: scale 1.6s var(--ease);
}
.art::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
[data-reveal="art"] { clip-path: inset(100% 0 0 0); transition: clip-path 1.25s var(--ease); }
[data-reveal="art"].in { clip-path: inset(0 0 0 0); }
.art.in::before { scale: 1.04; }

/* flow / feature columns */
.flow { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 28px; align-items: start; }
.flow > li:nth-child(3), .flow--plain > div:nth-child(2) { transition-delay: .12s; }
.flow > li:nth-child(5), .flow--plain > div:nth-child(3) { transition-delay: .24s; }
.flow .arrow { padding-top: 36%; font: 400 40px/1 var(--f-serif); color: var(--ink-2); }
.flow h3 { margin: 0 0 10px; font: 700 clamp(22px, 2vw, 30px)/1 var(--f-sans); letter-spacing: -.04em; }
.flow p { margin: 0; color: var(--ink-2); font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.flow .step { margin: 0 0 10px; color: var(--amber-ink); font: 600 11px/1 var(--f-sans); letter-spacing: .12em; text-transform: uppercase; }
.flow--plain { grid-template-columns: repeat(3, 1fr); gap: 28px; }

/* list rows (title | grey description) */
.list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 44px; margin-top: 110px; }
.row { display: grid; grid-template-columns: minmax(150px, 1fr) 1.6fr; gap: 16px; padding: 18px 0; border-top: 1px solid var(--ink-line); }
.row h3 { margin: 0; font: 700 15px/1.12 var(--f-sans); letter-spacing: -.02em; }
.row p { margin: 0; color: var(--ink-2); font-weight: 600; letter-spacing: -.02em; }

/* rules */
.rules { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 56px; }
.rule { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start; padding: 26px 0; border-top: 1px solid var(--bone-line); }
.rule:nth-child(even) { transition-delay: .1s; }
.rule--wide { grid-column: 1 / -1; }
.big { margin: 0; font: 400 76px/.8 var(--f-serif); letter-spacing: -.04em; }
.big small { display: block; margin-top: 10px; font: 600 12px/1 var(--f-sans); letter-spacing: .02em; color: var(--bone-2); }
.big--word { font-style: italic; }
.rule code { display: inline-block; color: var(--amber); font-size: 13px; margin-bottom: 8px; }
.rule p { margin: 0; color: var(--bone-2); font-weight: 600; letter-spacing: -.02em; max-width: 420px; }

/* demo: terminal over a painting */
.media { position: relative; margin: 0; aspect-ratio: 16 / 8; overflow: hidden; display: grid; place-items: center; isolation: isolate; --p: .5; }
.media::before {
  content: ""; position: absolute; inset: -10% 0; z-index: -2; background: url(assets/athens.jpg) 50% 35% / cover no-repeat;
  translate: 0 calc((var(--p) - .5) * -12%);
}
.media::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(30, 24, 14, .3), rgba(20, 16, 10, .55)); mix-blend-mode: multiply; }
.terminal {
  width: min(86%, 780px); border-radius: 12px; padding: 0 16px 16px; color: var(--bone);
  background: rgba(14, 13, 12, .82); backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .1) inset;
  transform: translateY(30px); opacity: 0; transition: transform 1s .5s var(--ease), opacity 1s .5s var(--ease);
}
.media.in .terminal { transform: none; opacity: 1; }
.term-bar { display: flex; align-items: center; gap: 7px; height: 36px; margin: 0 -16px 12px; padding: 0 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot--amber { background: var(--amber); } .dot--green { background: #3fae6c; } .dot--red { background: #e2553f; }
.term-title { margin-left: 8px; font: 500 12px/1 var(--f-mono); opacity: .7; }
.replay { margin-left: auto; border: 0; background: rgba(255, 255, 255, .08); border-radius: 6px; padding: 4px 8px; font-size: 11px; }
.replay:hover { background: rgba(255, 255, 255, .16); }
.terminal pre { margin: 0; min-height: 300px; font: 13px/1.6 var(--f-mono); white-space: pre-wrap; }
.t-cmd b { color: var(--amber); font-weight: 500; }
.t-ok { color: #66c48c; } .t-no { color: #f07a62; } .t-cm { color: rgba(247, 247, 238, .38); }
.caret { display: inline-block; width: .6em; height: 1.1em; vertical-align: -.2em; background: var(--amber); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* install */
.codes { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.code { min-width: 0; border: 1px solid var(--bone-line); background: rgba(247, 247, 238, .035); border-radius: 10px; padding: 16px 18px 18px; }
.code:nth-child(even) { transition-delay: .1s; }
.code:last-child:nth-child(odd) { grid-column: 1 / -1; }
.code header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.code h3 { margin: 0; font: 700 15px/1 var(--f-sans); letter-spacing: -.02em; }
.code pre { margin: 0; overflow-x: auto; font: 13px/1.65 var(--f-mono); }
.code .c { color: rgba(247, 247, 238, .4); }
.copy { border: 1px solid var(--bone-line); background: transparent; border-radius: 6px; padding: 5px 9px; font: 600 11px/1 var(--f-sans); color: var(--bone); }
.copy:hover { background: rgba(247, 247, 238, .1); }
.copy.done { color: #66c48c; border-color: rgba(102, 196, 140, .4); }
.tools { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 28px 0 0; color: var(--bone-2); font-weight: 600; }
.tools code { padding: 4px 7px; border: 1px solid var(--bone-line); border-radius: 5px; color: var(--bone); }
.tools a { color: var(--amber); text-decoration: none; }

/* modes */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.mode:nth-child(2) { transition-delay: .12s; }
.mode p { max-width: 560px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.muted { color: var(--bone-2); }
.paper .muted { color: var(--ink-2); }
.tag { display: inline-block; margin: 6px 0 10px; padding: 4px 8px; border: 1px solid var(--ink-line); font: 600 11px/1 var(--f-sans); letter-spacing: .1em; text-transform: uppercase; }
.tag--exp { color: var(--amber-ink); border-color: rgba(154, 90, 18, .35); }
.mode-title { margin: 0 0 14px; font: 400 64px/.9 var(--f-serif); letter-spacing: -.035em; }
blockquote { margin: 22px 0 0; padding: 16px 18px; background: rgba(255, 255, 255, .4); border-left: 2px solid var(--amber-ink); font: 400 21px/1.2 var(--f-serif); }
blockquote q { font-style: italic; }

/* footer */
.foot { position: relative; z-index: 3; padding: 22px var(--pad) 40px calc(var(--side) + var(--pad)); background: var(--night); color: var(--bone); border-top: 1px solid var(--bone-line); font: 400 14px/1.4 var(--f-serif); }
.foot p { margin: 0 0 4px; }
.foot a { text-decoration: none; border-bottom: 1px solid var(--bone-line); }

/* reveal */
[data-reveal]:not([data-reveal="art"]) { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
[data-reveal].in:not([data-reveal="art"]) { opacity: 1; transform: none; }
.chapter--hero .ch-content > * { opacity: 0; transform: translateY(24px); animation: rise 1s var(--ease) forwards; }
.chapter--hero .ch-content > :nth-child(2) { animation-delay: .15s; }
.chapter--hero .ch-content > :nth-child(3) { animation-delay: .3s; }
.chapter--hero .ch-content > :nth-child(4) { animation-delay: .45s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.chapter:not(.chapter--hero) .statement, .chapter:not(.chapter--hero) .ch-num { opacity: 0; transform: translateY(30px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.chapter.seen .statement, .chapter.seen .ch-num { opacity: 1; transform: none; }
.chapter.seen .ch-num { opacity: calc(.4 + var(--p) * .6); }

/* ───────── responsive ───────── */
@media (max-width: 1100px) {
  .rules, .list { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr 1fr; gap: 40px 28px; }
  .flow .arrow { display: none; }
  .flow--plain { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sideindex { display: none; }
  .sec { padding: 60px 16px 110px; }
  .ch-content { padding: 46svh 16px calc(var(--tear-h) + 20svh); }
  .chapter--hero .ch-content { padding: 72px 16px calc(var(--tear-h) + 18px); grid-template-columns: minmax(0, 1fr); grid-template-areas: "mega" "stmt" "acts" "token"; }
  .chapter--hero .token { margin-top: 24px; }  .foot { padding: 22px 16px 40px; }
  .topnav, .toplink { display: none; }
  .codes, .modes { grid-template-columns: minmax(0, 1fr); }
  .modes { gap: 56px; }
  .media { aspect-ratio: 4 / 5; }
  .terminal { width: 92%; }
  .terminal pre { font-size: 11.5px; min-height: 360px; }
}
@media (max-width: 640px) {
  .mega { font-size: 19.5vw; }
  .chapter--hero .mega { font-size: 11.5vw; }
  .mega--ch { font-size: 17vw; }
  .statement { font-size: 34px; }
  .statement--xl { font-size: 46px; }
  .flow, .flow--plain { grid-template-columns: 1fr; }
  .rule { grid-template-columns: 1fr; gap: 12px; }
  .big { font-size: 64px; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .mode-title { font-size: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ch-bg > div, .mega, .art::before, .media::before { transform: none !important; translate: none !important; scale: 1 !important; }
  [data-reveal], .chapter--hero .ch-content > *, .chapter .statement, .chapter .ch-num, .terminal { opacity: 1 !important; transform: none !important; transition: none !important; animation: none !important; clip-path: none !important; }
  .caret { animation: none; }
}
