/* AI Agents, Engineered — book website. Every value here comes from DESIGN.md. */

/* ---------------------------------------------------------------- fonts */
@font-face { font-family: "Inter Display"; font-weight: 800; font-display: swap; src: url(fonts/inter-display-extrabold.woff2) format("woff2"); }
@font-face { font-family: "Inter Display"; font-weight: 700; font-display: swap; src: url(fonts/inter-display-bold.woff2) format("woff2"); }
@font-face { font-family: "Inter Display"; font-weight: 600; font-display: swap; src: url(fonts/inter-display-semibold.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-display: swap; src: url(fonts/source-serif-4-400.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: italic; font-display: swap; src: url(fonts/source-serif-4-400i.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-display: swap; src: url(fonts/source-serif-4-600.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 700; font-display: swap; src: url(fonts/source-serif-4-700.woff2) format("woff2"); }
@font-face { font-family: "Source Code Pro"; font-weight: 400; font-display: swap; src: url(fonts/source-code-pro-400.woff2) format("woff2"); }

/* metric-matched fallbacks: keep the hero from reflowing when the web fonts land */
@font-face { font-family: "Inter Display Fallback"; src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans"); size-adjust: 104%; ascent-override: 93%; descent-override: 23%; line-gap-override: 0%; }
@font-face { font-family: "Source Serif Fallback"; src: local("Georgia"), local("DejaVu Serif"); size-adjust: 97%; ascent-override: 95%; descent-override: 30%; line-gap-override: 0%; }

/* ---------------------------------------------------------------- tokens */
:root {
  --paper: #EFE1C4;
  --paper-deep: #E6D5B2;
  --ink: #2E302F;
  --ink-soft: #5B5A52;
  --ochre: #C29434;
  --ochre-hover: #CDA24A;   /* ochre lifted toward ochre-light: ink on it 5.6:1 */
  --ochre-print: #B88C2E;
  --ochre-light: #E2B966;
  --teal: #2F6161;
  --teal-deep: #1F4545;
  --teal-light: #8FBDB8;   /* teal ring on teal-deep: art only */
  --paper-light: #FBF6EC;  /* raised cards, figures, inputs */
  --rule: #D3C3A2;
  --alert: #F2B6A4;        /* errors, on dark grounds only */

  --f-display: "Inter Display", "Inter Display Fallback", system-ui, sans-serif;
  --f-body: "Source Serif 4", "Source Serif Fallback", Georgia, serif;
  --f-mono: "Source Code Pro", ui-monospace, Menlo, monospace;

  --max: 1240px;
  --gutter: 24px;
  --side: clamp(20px, 5vw, 64px);
  --section: clamp(96px, 14vw, 176px);
  --radius: 2px;
  --nav-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: light;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
/* smooth only after load, so deep links (/#buy) jump instead of crawling the page */
@media (prefers-reduced-motion: no-preference) { html.is-ready { scroll-behavior: smooth; } }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.1875rem/1.6 var(--f-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
/* print grain over the whole page (4%) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3 { font-family: var(--f-display); color: var(--ink); margin: 0; letter-spacing: -0.035em; text-wrap: balance; }
h1 { font-weight: 800; line-height: .95; }
h2 { font-weight: 800; font-size: clamp(2rem, 4.2vw, 3.4rem); line-height: .95; }
h3 { font-weight: 700; font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.015em; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: var(--teal); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-thickness .15s; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
main:focus { outline: none; }
::selection { background: var(--ochre-light); color: var(--ink); }

.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--side)); margin-inline: auto; padding-inline: var(--side); }
.label { font: 400 .8125rem/1.45 var(--f-mono); letter-spacing: .02em; color: var(--ink-soft); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: 0; z-index: 200; transform: translateY(-150%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); text-decoration: none; }
.skip:focus { transform: translateY(12px); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 52px; padding: 8px 22px; max-width: 100%;
  font: 600 1rem/1.2 var(--f-display); letter-spacing: -0.005em; text-align: center;
  color: var(--ink); text-decoration: none;
  border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: transparent; cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), transform .08s;
}
.btn:not([disabled]):hover { text-decoration: none; background: color-mix(in srgb, var(--ink) 7%, transparent); box-shadow: inset 0 0 0 1px var(--ink); }
.btn:not([disabled]):active { transform: translateY(1px); }
.btn--primary { background: var(--ochre); }
.btn--primary:not([disabled]):hover { background: var(--ochre-hover); }
.btn--sm { min-height: 44px; padding: 0 16px; font-size: .9375rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------------- nav */
.nav {
  position: sticky; top: 0; z-index: 50; min-height: var(--nav-h);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.nav.is-scrolled { border-bottom-color: var(--rule); }
.nav__inner { min-height: var(--nav-h); max-width: calc(var(--max) + 2 * var(--side)); margin-inline: auto; padding-inline: var(--side); display: flex; align-items: center; gap: 24px; }
.nav__brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 1.0625rem/1 var(--f-display); letter-spacing: -0.02em; margin-right: auto; min-height: 44px; min-width: 0; }
.nav__brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__mark { width: 28px; height: 28px; flex: none; }
.nav__menu { display: flex; align-items: center; gap: 28px; }
.nav__menu a:not(.btn) { color: var(--ink); text-decoration: none; font: 600 .9375rem/1 var(--f-display); padding: 14px 0; background: linear-gradient(var(--ink), var(--ink)) 0 calc(100% - 8px) / 0 1.5px no-repeat; transition: background-size .2s var(--ease); }
.nav__menu a:not(.btn):hover { background-size: 100% 1.5px; }
.nav__toggle { display: none; }
.nav__icon-close { display: none; }
.nav.is-open .nav__icon-open { display: none; }
.nav.is-open .nav__icon-close { display: block; }

@media (max-width: 860px) {
  /* without JS the menu simply wraps under the brand; JS turns it into a drawer */
  html:not(.js) .nav__inner { flex-wrap: wrap; padding-block: 8px; row-gap: 0; }
  html:not(.js) .nav__menu { width: 100%; flex-wrap: wrap; gap: 4px 20px; }
  .js .nav__toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -10px;
    border: 0; background: none; color: var(--ink); cursor: pointer; border-radius: var(--radius);
  }
  .js .nav__menu {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    max-height: calc(100dvh - var(--nav-h)); overflow-y: auto; overscroll-behavior: contain;
    padding: 8px var(--side) 24px; background: var(--paper); border-bottom: 1px solid var(--rule);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s .2s;
  }
  .js .nav.is-open .nav__menu { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  /* a scrim catches the "tap outside to close" so it can't also follow a link underneath */
  .js .nav.is-open::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 100dvh; z-index: -1; background: color-mix(in srgb, var(--ink) 25%, transparent); }
  .js .nav__menu a:not(.btn) { padding: 16px 0; font-size: 1.125rem; border-bottom: 1px solid var(--rule); background: none; }
  .js .nav__menu .btn { margin-top: 20px; min-height: 52px; }
}

/* ---------------------------------------------------------------- sections */
section { position: relative; }
.section-head { max-width: 760px; margin-bottom: clamp(48px, 6vw, 80px); }
.section-head p { color: var(--ink-soft); margin-top: 20px; max-width: 56ch; }

[data-reveal] { transition: opacity .2s var(--ease), transform .2s var(--ease); }
@media print { .js [data-reveal] { opacity: 1 !important; transform: none !important; } }
.js [data-reveal]:not(.is-in) { opacity: 0; transform: translateY(12px); }

/* ---------------------------------------------------------------- hero */
.hero { padding-block: clamp(40px, 7vw, 104px) clamp(80px, 10vw, 144px); overflow: clip; isolation: isolate; }
.hero__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: center; }
.hero__text { grid-column: 1 / span 7; position: relative; z-index: 2; }
.hero__title { font-size: clamp(2.6rem, 8.5vw, 7.5rem); margin-bottom: clamp(24px, 3vw, 40px); overflow-wrap: anywhere; }
.hero__lede { font-size: clamp(1.25rem, 1.9vw, 1.5rem); line-height: 1.4; max-width: 30ch; margin-bottom: 12px; }
.hero__for { color: var(--ink-soft); max-width: 44ch; margin-bottom: 32px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.hero__proof { margin-bottom: 8px; }
.hero__proof span { white-space: nowrap; }
.hero__proof span:last-child { white-space: normal; }
@media (max-width: 400px) { .hero__proof span { white-space: normal; } }
.hero__byline { font-size: 1rem; color: var(--ink-soft); max-width: 62ch; margin: 0; }
.hero__byline strong { color: var(--ink); font-weight: 600; }
.hero__book { grid-column: 8 / span 5; position: relative; z-index: 1; perspective: 1800px; padding: 24px 0 48px; display: flex; justify-content: center; }

.rings { position: absolute; pointer-events: none; overflow: visible; }
/* rotate the whole (composited) svg layer, never the filtered group inside it */
.rings--hero { z-index: -1; width: min(1300px, 125vw); right: max(-26vw, -340px); top: 50%; transform: translateY(-50%) rotate(var(--ring-rot, 0deg)); will-change: transform; }
.ring { fill: none; stroke-width: 58; opacity: .78; mix-blend-mode: multiply; }
.ring--ochre { stroke: var(--ochre-print); }
.ring--teal { stroke: var(--teal); }
.ring--ink { stroke: var(--ink); }

/* the 3D book */
.book {
  --w: min(360px, 68vw); --h: calc(var(--w) * 1.5); --d: calc(var(--w) * .19);
  position: relative; width: var(--w); height: var(--h);
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 4deg)) rotateY(var(--ry, -24deg));
  transition: transform .6s var(--ease);
}
.book.is-tracking { transition: transform .12s linear; }
.book__face { position: absolute; top: 0; }
.book__front { inset: 0; transform: translateZ(calc(var(--d) / 2)); overflow: hidden; border-radius: 0 2px 2px 0; }
.book__front img { width: 100%; height: 100%; object-fit: cover; }
.book__front::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(255,255,255,0) 40%, rgba(255,255,255,.18) 55%, rgba(255,255,255,0) 70%); pointer-events: none; }
.book__spine {
  left: 0; width: var(--d); height: var(--h);
  transform: translateX(calc(var(--d) / -2)) rotateY(-90deg);
  background: linear-gradient(90deg, var(--paper-deep), var(--paper) 30%, var(--paper-deep));
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 18px 0;
  writing-mode: vertical-rl; font: 800 calc(var(--w) * .042)/1 var(--f-display); letter-spacing: -0.02em; color: var(--ink);
}
.book__spine span:last-child { font-weight: 600; color: var(--teal); }
.book__pages {
  right: 0; width: var(--d); height: calc(var(--h) - 6px); top: 3px;
  transform: translateX(calc(var(--d) / 2)) rotateY(90deg);
  background: repeating-linear-gradient(90deg, var(--paper-light) 0 1px, var(--paper-deep) 1px 2px);
}
.book__back { inset: 0; transform: translateZ(calc(var(--d) / -2)) rotateY(180deg); background: var(--paper-deep); }
.book__shadow { position: absolute; bottom: 18px; left: 50%; width: calc(min(360px, 68vw) * 1.05); height: 36px; transform: translateX(-46%); background: radial-gradient(closest-side, rgba(46,48,47,.32), rgba(46,48,47,0)); filter: blur(6px); z-index: -1; }

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr); }
  .hero__text, .hero__book { grid-column: 1; }
  .hero__book { order: -1; padding: 0 0 28px; }
  .book { --w: min(168px, 42vw); }
  .book__shadow { width: calc(min(168px, 42vw) * 1.05); bottom: 10px; }
  .rings--hero { width: 190vw; right: auto; left: -105vw; top: -40px; transform: none; opacity: .55; }
}

/* ---------------------------------------------------------------- letter */
.letter { padding-block: var(--section); border-top: 1px solid var(--rule); }
.letter__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.letter__quote { grid-column: 1 / span 5; margin: 0; }
.letter__quote p { font: 800 clamp(2rem, 3.6vw, 3rem)/1.02 var(--f-display); letter-spacing: -0.035em; position: sticky; top: calc(var(--nav-h) + 48px); text-wrap: balance; }
.letter__body { grid-column: 7 / span 6; max-width: 64ch; }
.letter__thesis { font-size: 1.375rem; line-height: 1.45; padding-left: 20px; border-left: 3px solid var(--teal); margin-block: 1.6em; }
.letter__thesis em { font-style: italic; }
.letter__sign { font-style: italic; color: var(--ink-soft); }
@media (max-width: 860px) {
  .letter__quote, .letter__body { grid-column: 1 / -1; }
  .letter__quote p { position: static; margin-bottom: 40px; }
}

/* ---------------------------------------------------------------- loop (signature) */
.loop { background: var(--teal-deep); color: var(--paper); }
.loop__sticky { padding-block: var(--section); }
/* scroll-scrubbed only with JS, on screens tall enough to hold the whole panel */
@media (min-width: 861px) and (min-height: 640px) and (prefers-reduced-motion: no-preference) {
  .js .loop { height: 320vh; }
  .js .loop__sticky { position: sticky; top: var(--nav-h); height: calc(100svh - var(--nav-h)); padding-block: 0; display: flex; align-items: center; overflow: hidden; }
  .js .beat:not(.is-on) .beat__name, .js .beat:not(.is-on) .beat__text { color: color-mix(in srgb, var(--paper) 72%, var(--teal-deep)); } /* 5.0:1 */
}
@media (min-width: 861px) and (max-height: 820px) {
  .loop__title { font-size: clamp(1.8rem, 3.2vw, 2.6rem); }
  .loop__intro { display: none; }
}
.loop__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: center; }
.loop__copy { grid-column: 1 / span 6; }
.loop__eyebrow { color: var(--ochre-light); margin-bottom: 16px; }
.loop__title { color: var(--paper); margin-bottom: 16px; }
.loop__intro { color: color-mix(in srgb, var(--paper) 82%, var(--teal-deep)); max-width: 44ch; margin-bottom: 28px; }
.beats { list-style: none; margin: 0; padding: 0; border-top: 1px solid color-mix(in srgb, var(--paper) 18%, transparent); }
.beat { display: grid; grid-template-columns: 7.5rem 1fr; column-gap: 20px; padding: 11px 0; border-bottom: 1px solid color-mix(in srgb, var(--paper) 18%, transparent); }
.beat__name, .beat__text, .beat__ref { transition: color .3s var(--ease), opacity .3s var(--ease); }
.beat__head { display: flex; flex-direction: column; }
.beat__name { font: 700 1.0625rem/1.4 var(--f-display); letter-spacing: -0.01em; }
.beat__text { font-size: 1rem; line-height: 1.5; }
.beat__ref { color: var(--ochre-light); margin-top: 2px; }
.beat--gate .beat__name { color: var(--ochre-light); }

.loop__stage { grid-column: 7 / span 6; display: flex; justify-content: center; }
.loop__svg { width: min(100%, 72vh, 560px); overflow: visible; }
.lring { fill: none; stroke-width: 26; opacity: .9; transform-box: view-box; transform-origin: 300px 300px; transition: none; }
.lring--ochre { stroke: var(--ochre-light); transform: translate(calc(var(--spread, 1) * -70px), calc(var(--spread, 1) * -40px)) scale(calc(1 - var(--spread, 1) * .25)); }
.lring--teal  { stroke: var(--teal-light); transform: translate(calc(var(--spread, 1) * 70px),  calc(var(--spread, 1) * -20px)) scale(calc(1 - var(--spread, 1) * .25)); }
.lring--ink   { stroke: var(--paper);      transform: translate(calc(var(--spread, 1) * 10px),  calc(var(--spread, 1) * 70px)) scale(calc(1 - var(--spread, 1) * .25)); }
.loop__rings { opacity: calc(.25 + var(--spread, 1) * .65); }
.loop__track { fill: none; stroke: var(--ochre-light); stroke-width: 6; stroke-linecap: round; stroke-dasharray: var(--trace, 0) 100; transform: rotate(-90deg); transform-origin: 300px 300px; opacity: .95; }
.node circle { fill: var(--teal-deep); stroke: var(--paper); stroke-width: 3; transition: fill .3s, transform .3s var(--ease); }
.node text, .gate__label { fill: var(--paper); font: 400 17px var(--f-mono); letter-spacing: .02em; opacity: .75; transition: opacity .3s; }
.node.is-on circle { fill: var(--ochre-light); stroke: var(--ochre-light); }
.node.is-on text { opacity: 1; }
.gate__disc { fill: none; stroke: color-mix(in srgb, var(--paper) 30%, transparent); stroke-width: 3; stroke-dasharray: 6 8; transition: fill .4s, stroke .4s; }
.gate__check { fill: none; stroke: var(--teal-deep); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 80; stroke-dashoffset: 80; transition: stroke-dashoffset .5s var(--ease) .1s; }
.gate.is-on .gate__disc { fill: var(--ochre-light); stroke: var(--ochre-light); stroke-dasharray: none; }
.gate.is-on .gate__check { stroke-dashoffset: 0; }
.gate.is-on .gate__label { opacity: 1; fill: var(--ochre-light); }

@media (max-width: 860px) {
  .loop__copy, .loop__stage { grid-column: 1 / -1; }
  .loop__stage { order: -1; margin-bottom: 32px; }
  .loop__svg { width: min(78vw, 340px); }
  .node text, .gate__label { font-size: 30px; }
  .beat { grid-template-columns: 1fr; }
  .beat__head { flex-direction: row; align-items: baseline; gap: 12px; }
}

/* ---------------------------------------------------------------- inside */
.inside { padding-block: var(--section); }
.parts { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.part { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); padding: 36px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.part__head { grid-column: 1 / span 4; display: grid; grid-template-columns: 3.2rem 1fr; row-gap: 12px; align-items: baseline; }
.part__num { font: 800 1.35rem/1.2 var(--f-display); color: var(--teal); letter-spacing: -0.015em; }
.part__name { font-size: 1.5rem; letter-spacing: -0.015em; }
.tag { grid-column: 2; justify-self: start; font: 400 .8125rem/1 var(--f-mono); letter-spacing: .02em; color: var(--ink-soft); padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--radius); }
.tag--free { color: var(--ink); background: var(--ochre-light); border-color: var(--ochre-light); }
.part__chapters { grid-column: 5 / span 5; list-style: none; margin: 0; padding: 0; }
.part__chapters li { display: grid; grid-template-columns: 2.4rem 1fr; align-items: baseline; font-size: 1.0625rem; line-height: 1.45; }
.part__chapters li > span:not(.label), .part__chapters li > a { display: block; padding-block: 5px; }
.part__chapters li > a { padding-block: 10px; margin-block: -5px; }
.part__fig { grid-column: 10 / span 3; margin: 0; background: var(--paper-light); border: 1px solid var(--rule); padding: 14px; aspect-ratio: 4 / 3; display: flex; flex-direction: column; }
.part__fig img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.part__fig figcaption { margin-top: 8px; }
.inside__appx { margin-top: 28px; }
@media (max-width: 1024px) {
  .part__head { grid-column: 1 / span 5; }
  .part__chapters { grid-column: 6 / -1; }
  .part__fig { display: none; }
}
@media (max-width: 640px) {
  .part { grid-template-columns: minmax(0, 1fr); row-gap: 16px; padding: 28px 0; }
  .part__head { grid-template-columns: 2.6rem minmax(0, 1fr); }
  .part__head, .part__chapters { grid-column: 1; }
}

/* ---------------------------------------------------------------- diagrams strip */
.figs { padding-block: var(--section); background: var(--paper-deep); }
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(260px, 30vw, 380px); gap: var(--gutter);
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding: 8px max(var(--side), calc((100vw - var(--max)) / 2)) 24px;
  scroll-padding-inline: max(var(--side), calc((100vw - var(--max)) / 2));
  scrollbar-width: thin; scrollbar-color: var(--ink-soft) transparent;
}
.strip:focus-visible { outline-offset: -3px; }
.strip__item {
  scroll-snap-align: start; position: relative; display: flex; flex-direction: column; gap: 12px; text-align: left;
  background: var(--paper-light); border: 1px solid var(--rule); padding: 16px; cursor: zoom-in; color: inherit; font: inherit; text-decoration: none;
  transition: border-color .15s, transform .2s var(--ease);
}
@media (hover: hover) { .strip__item:hover { border-color: var(--ink); transform: translateY(-2px); } }
.strip__item:active { transform: translateY(0); }
.strip__item:focus-visible { outline-offset: -3px; }
.strip__item img { aspect-ratio: 4 / 3; width: 100%; object-fit: contain; }
.strip__cap { color: var(--ink-soft); }

.figdlg { border: 0; padding: 0; background: var(--paper-light); color: var(--ink); max-width: min(1100px, 94vw); max-height: 92vh; width: 100%; overflow: auto; }
.figdlg::backdrop { background: color-mix(in srgb, var(--teal-deep) 82%, transparent); }
.figdlg[open] { animation: dlg .2s var(--ease); }
@keyframes dlg { from { opacity: 0; transform: translateY(8px); } }
.figdlg__img { width: 100%; max-height: calc(92vh - 150px); object-fit: contain; padding: clamp(16px, 4vw, 40px); }
.figdlg__cap { font-size: 1rem; line-height: 1.5; color: var(--ink-soft); padding: 0 clamp(16px, 4vw, 40px) clamp(16px, 3vw, 32px); margin: 0; max-width: 80ch; }
.figdlg__cap strong { color: var(--ink); font-family: var(--f-mono); font-weight: 400; font-size: .8125rem; margin-right: .5em; }
.figdlg__close { position: sticky; top: 0; float: right; width: 48px; height: 48px; border: 0; background: transparent; font: 400 2rem/1 var(--f-display); color: var(--ink); cursor: pointer; z-index: 1; }
.figdlg__close:hover { color: var(--teal); }
.figdlg__close:focus-visible { outline-offset: -3px; }

/* ---------------------------------------------------------------- sample */
.sample { padding-block: var(--section); }
.sample__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: start; }
.sample__head { grid-column: 1 / span 4; position: sticky; top: calc(var(--nav-h) + 48px); }
.sample__head h2 { margin: 12px 0 20px; }
.sample__head p:not(.label) { color: var(--ink-soft); margin-bottom: 28px; }
.sample__page {
  grid-column: 6 / span 7; position: relative;
  background: var(--paper-light); border: 1px solid var(--rule); padding: clamp(28px, 5vw, 64px);
  max-height: 640px; overflow: hidden;
}
.sample__page::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 180px; background: linear-gradient(color-mix(in srgb, var(--paper-light) 0%, transparent), var(--paper-light) 85%); }
.sample__page p { max-width: 64ch; hyphens: auto; }
.sample__page p:first-child::first-letter { float: left; font: 800 4.1em/.8 var(--f-display); margin: .08em .08em 0 0; color: var(--teal); }
@media (max-width: 860px) {
  .sample__head, .sample__page { grid-column: 1 / -1; }
  .sample__head { position: static; margin-bottom: 40px; }
  .sample__page { max-height: 520px; }
}

/* ---------------------------------------------------------------- buy */
.buy { padding-block: clamp(64px, 8vw, 112px) var(--section); border-top: 1px solid var(--rule); }
.buy .section-head { margin-bottom: 40px; }
.formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.format { display: flex; flex-direction: column; padding: clamp(20px, 6vw, 32px); border: 1px solid var(--rule); background: var(--paper-light); }
.format--lead { border: 1.5px solid var(--ink); }
.format h3 { font-size: 1.75rem; letter-spacing: -0.035em; }
.format__where { margin: 6px 0 24px; }
.format__price { font: 400 .8125rem/1 var(--f-mono); letter-spacing: .02em; color: var(--ink-soft); margin-bottom: 24px; }
.format__price span { font: 800 clamp(2rem, 9vw, 2.75rem)/1 var(--f-display); letter-spacing: -0.035em; color: var(--ink); margin-right: 6px; }
.format__price em { font-style: normal; white-space: nowrap; }
.format__soon { margin: 0; padding: 14px 16px; border: 1.5px dashed var(--rule); font-size: 1rem; line-height: 1.4; color: var(--ink-soft); text-align: center; }
.format ul { list-style: none; margin: 0 0 32px; padding: 0; font-size: 1rem; flex: 1; }
.format li { padding: 9px 0 9px 22px; border-top: 1px solid var(--rule); position: relative; }
.format li::before { content: ""; position: absolute; left: 2px; top: 1.05em; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--teal); }
.format li.label { color: var(--ink-soft); padding-top: 12px; }
.format .btn { align-self: stretch; }
@media (max-width: 960px) { .formats { grid-template-columns: minmax(0, 1fr); max-width: 520px; } }

/* ---------------------------------------------------------------- author */
.author { padding-block: var(--section); background: var(--paper-deep); }
.author__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: center; }
.author__photo { grid-column: 1 / span 4; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; filter: grayscale(1) contrast(1.05); mix-blend-mode: multiply; }
.author__text { grid-column: 1 / span 7; }
.author__photo + .author__text { grid-column: 6 / span 7; }
.author__facts { grid-column: 9 / span 4; list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.author__facts li { padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 1rem; line-height: 1.4; }
.author__facts .label { display: block; margin-bottom: 2px; }
.author__photo ~ .author__facts { display: none; }
.author__text h2 { margin: 12px 0 20px; }
.author__text p:not(.label) { max-width: 60ch; }
@media (max-width: 860px) {
  .author__photo, .author__text, .author__photo + .author__text, .author__facts { grid-column: 1 / -1; }
  .author__facts { margin-top: 32px; }
  .author__photo { max-width: 320px; margin-bottom: 32px; }
}

/* ---------------------------------------------------------------- email */
.email { padding-block: var(--section); background: var(--teal-deep); color: var(--paper); }
.email h2 { color: var(--paper); margin-bottom: 20px; }
.email p { color: color-mix(in srgb, var(--paper) 85%, var(--teal-deep)); max-width: 44ch; }
.email__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); align-items: end; }
.email__grid > div { grid-column: 1 / span 6; }
.email__form { grid-column: 8 / span 5; }
.email__form label { display: block; font: 400 .8125rem/1.4 var(--f-mono); letter-spacing: .02em; margin-bottom: 8px; color: var(--ochre-light); }
.email__row { display: flex; gap: 8px; }
.email__row input {
  flex: 1; min-width: 0; min-height: 52px; padding: 0 16px; font: 400 1.0625rem var(--f-body);
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--paper); border-radius: var(--radius);
}
.email__row input::placeholder { color: var(--ink-soft); }
.email__row input:focus-visible { outline-color: var(--ochre-light); }
.email__row input[aria-invalid="true"] { border-color: var(--alert); }
.email .btn--primary { border-color: var(--ochre-light); background: var(--ochre-light); }
.email .btn--primary:hover { background: var(--ochre); }
.email :focus-visible { outline-color: var(--ochre-light); }
.email__msg { min-height: 1.5em; margin: 10px 0 0; font-size: 1rem; }
.email__msg.is-error { color: var(--alert); }
.email__msg.is-ok { color: var(--ochre-light); }
@media (max-width: 860px) {
  .email__grid > div, .email__form { grid-column: 1 / -1; }
  .email__form { margin-top: 24px; }
}
@media (max-width: 420px) { .email__row { flex-direction: column; } }

/* ---------------------------------------------------------------- faq */
.faq { padding-block: var(--section); }
.faq__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.faq__grid h2 { grid-column: 1 / span 4; }
.faq__list { grid-column: 6 / span 7; border-top: 1.5px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  list-style: none; cursor: pointer; padding: 22px 44px 22px 0; position: relative;
  font: 700 1.25rem/1.3 var(--f-display); letter-spacing: -0.015em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 8px; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  background: linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat, linear-gradient(var(--ink), var(--ink)) center / 2px 100% no-repeat;
  transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
@media (hover: hover) { .faq summary:hover { color: var(--teal); } }
.faq details p { margin: -4px 0 24px; max-width: 60ch; color: var(--ink-soft); }
@media (max-width: 860px) {
  .faq__grid h2, .faq__list { grid-column: 1 / -1; }
  .faq__grid h2 { margin-bottom: 32px; }
}

/* ---------------------------------------------------------------- footer */
.footer { background: var(--ink); color: var(--paper); padding-block: 72px 40px; font-size: 1rem; }
.footer__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 40px; }
.footer__brand { grid-column: 1 / span 4; }
.footer__mark { width: 40px; height: 40px; margin-bottom: 18px; }
.footer__brand p { color: color-mix(in srgb, var(--paper) 80%, var(--ink)); max-width: 36ch; }
.footer__brand strong { color: var(--paper); font: 700 1.125rem var(--f-display); letter-spacing: -0.02em; }
.footer__by { font-style: italic; }
.footer__col { grid-column: span 3; display: flex; flex-direction: column; align-items: flex-start; }
.footer__col:first-of-type { grid-column: 5 / span 2; }
.footer__col:nth-of-type(2) { grid-column: span 3; }
.footer__col h2 { color: var(--ochre-light); margin-bottom: 10px; letter-spacing: .02em; font-weight: 400; }
.footer__col a { color: var(--paper); text-decoration: none; min-height: 44px; display: flex; align-items: center; }
.footer__soon { margin: 10px 0 0; font-size: .9375rem; color: color-mix(in srgb, var(--paper) 70%, var(--ink)); max-width: min(26ch, 100%); }
.footer__col a:hover { text-decoration: underline; }
.footer :focus-visible { outline-color: var(--ochre-light); }
.footer__legal { grid-column: 1 / -1; border-top: 1px solid color-mix(in srgb, var(--paper) 15%, transparent); padding-top: 24px; margin: 0; color: color-mix(in srgb, var(--paper) 62%, var(--ink)); }
@media (max-width: 1023px) {
  .footer__brand { grid-column: 1 / -1; }
  .footer__col, .footer__col:first-of-type, .footer__col:nth-of-type(2) { grid-column: span 4; }
}
@media (max-width: 640px) { .footer__col, .footer__col:first-of-type, .footer__col:nth-of-type(2) { grid-column: span 6; } }
@media (max-width: 480px) { .footer__col, .footer__col:first-of-type, .footer__col:nth-of-type(2) { grid-column: 1 / -1; } }

/* ---------------------------------------------------------------- glossary + term + 404 */
.page-head { padding-block: clamp(56px, 8vw, 112px) clamp(32px, 4vw, 56px); border-bottom: 1.5px solid var(--ink); }
.page-head h1 { font-size: clamp(2.75rem, 7vw, 5.5rem); margin: 12px 0 20px; }
.page-head p:not(.label) { max-width: 56ch; color: var(--ink-soft); }
.crumbs { font: 400 .8125rem/1.4 var(--f-mono); letter-spacing: .02em; color: var(--ink-soft); }
.crumbs a { color: var(--ink-soft); display: inline-block; padding: 13px 4px; margin: -13px -4px; }

.glossary-body { padding-bottom: var(--section); }
.az__inner { display: flex; flex-wrap: wrap; gap: 0 2px; padding-block: 8px; padding-left: calc(var(--side) - 14px); }
.az { position: sticky; top: var(--nav-h); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--rule); }
.az a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; font: 400 .9375rem var(--f-mono); color: var(--ink); text-decoration: none; border-radius: var(--radius); }
@media (hover: hover) { .az a:hover { background: var(--paper-deep); } }
.az a[aria-disabled="true"] { color: var(--rule); pointer-events: none; }
@media (max-width: 600px) { .az__inner { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; } }
.gfilter { display: block; width: 100%; max-width: 480px; min-height: 52px; padding: 0 16px; margin-top: 8px; font: 400 1.0625rem var(--f-body); color: var(--ink); background: var(--paper-light); border: 1.5px solid var(--ink); border-radius: var(--radius); }
.gfilter::placeholder { color: var(--ink-soft); }
.gletter { padding-top: 48px; }
.gletter h2 { font-size: 2.5rem; color: var(--teal); margin-bottom: 8px; }
.gterms { margin: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.gterm { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; padding: 8px 0 18px; border-bottom: 1px solid var(--rule); }
.gterm dt { grid-column: 1 / span 4; font: 700 1.125rem/1.35 var(--f-display); letter-spacing: -0.01em; }
.gterm dt a { color: var(--ink); text-decoration: none; display: block; padding-block: 10px; }
.gterm dt:not(:has(a)) { padding-top: 10px; }
.gterm dd { padding-top: 10px; }
.gterm dt a:hover { color: var(--teal); text-decoration: underline; }
.gterm dd { grid-column: 5 / span 8; margin: 0; font-size: 1.0625rem; max-width: 64ch; }
.gterm--see dd { color: var(--ink-soft); font-style: italic; }
.gempty { padding: 48px 0; color: var(--ink-soft); }
@media (max-width: 760px) {
  .gterms { display: block; }
  .gterm { display: block; }
  .gterm dd { margin-top: 6px; }
}

.term { padding-block: clamp(40px, 6vw, 80px) var(--section); }
.term__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }
.term__def { grid-column: 1 / span 7; font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.5; }
.term__aside { grid-column: 9 / span 4; padding: 32px; background: var(--paper-light); border: 1px solid var(--rule); align-self: start; }
.term__aside h2 { font-size: 1.35rem; margin-bottom: 12px; letter-spacing: -0.015em; }
.term__aside p { font-size: 1rem; }
.term__aside .btn { margin-top: 8px; width: 100%; }
.term__nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule); grid-column: 1 / span 7; font-size: 1rem; }
.term__nav a { display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 0; }
.term__nav a span { font: 400 .8125rem var(--f-mono); color: var(--ink-soft); }
.term__next { text-align: right; margin-left: auto; }
@media (max-width: 860px) {
  .term__def, .term__aside, .term__nav { grid-column: 1 / -1; }
  .term__aside { margin-top: 40px; }
}

.notfound { padding-block: var(--section); min-height: 60vh; }
.notfound h1 { font-size: clamp(2.75rem, 7vw, 5.5rem); margin: 12px 0 24px; }
.notfound p:not(.label) { max-width: 46ch; color: var(--ink-soft); }
.notfound .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal]:not(.is-in) { opacity: 1; transform: none; }
  .book { transform: rotateX(4deg) rotateY(-24deg); }
  .rings--hero { will-change: auto; }
}

/* the loop's lit end-state is the default; JS only dims it while scrubbing */
html:not(.js) .loop__svg { --spread: 0; --trace: 100; }
html:not(.js) .node circle { fill: var(--ochre-light); stroke: var(--ochre-light); }
html:not(.js) .node text { opacity: 1; }
html:not(.js) .gate__disc { fill: var(--ochre-light); stroke: var(--ochre-light); stroke-dasharray: none; }
html:not(.js) .gate__check { stroke-dashoffset: 0; }

/* inline cross-references (glossary): a comfortable tap target, a hint when locked */
.xref { display: inline-block; padding: 10px 2px; margin: -10px -2px; }
.xref[data-locked]::after { content: "\00a0🔒"; font-size: .7em; }

@media (max-width: 860px) {
  h1, h2, .letter__quote p { letter-spacing: -0.025em; word-spacing: .04em; }
}
.gletter { scroll-margin-top: calc(var(--nav-h) + 72px); }
