/* ==========================================================================
   Flyingkiwi content pages.
   Long-form reading, the blog index, the technical area, the report, the FAQ,
   privacy and the 404 page. Every token comes from base.css; this file only
   adds content-page layout and components. No background gradients, no italics,
   one accent colour, closed spacing scale. Mobile first.
   ========================================================================== */

:root {
  --reading-measure: 700px; /* long-form column, kept under 72 characters */
  --rail-width: 220px;      /* sticky table of contents on the report */
}

/* --------------------------------------------------------------------------
   1. Page shell
   -------------------------------------------------------------------------- */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 120px var(--s-32) var(--s-96);
}

/* --------------------------------------------------------------------------
   2. Editorial primitives: kicker, hero, lede, meta, tagline
   -------------------------------------------------------------------------- */

.eyebrow {
  color: var(--brand);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.hero { padding-bottom: var(--s-48); }

.hero .eyebrow { margin-bottom: var(--s-16); }

.hero .lede { margin-top: var(--s-24); }

.hero .hero-meta { margin-top: var(--s-32); }

.hero .language-jump { margin-top: var(--s-16); }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-12);
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.hero-meta a { color: var(--muted); }

.hero-meta a:hover { color: var(--ink); }

.lede {
  max-width: 60ch;
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: 1.6;
}

/* Display heading: the one approved text gradient, from base.css values. */
.hero h1,
.article-header h1 {
  max-width: 22ch;
  margin-top: var(--s-16);
  font-size: var(--display);
  line-height: 1.02;
  letter-spacing: -0.035em;
  background: linear-gradient(90deg, #fff, #9b9b9b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1,
  .article-header h1 { color: var(--ink); }
}

/* Word-reveal tagline. base.css owns the .w spans and their states. */
.tagline-section {
  margin: 0 0 var(--s-80);
  padding: var(--s-64) 0;
  border-block: 1px solid var(--line);
}

.tagline-section .tagline {
  max-width: 24ch;
  font-size: clamp(var(--text-4xl), 5.2vw, var(--text-6xl));
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-8) var(--s-24);
  margin-bottom: var(--s-8);
}

.section-head h2 {
  font-size: var(--text-3xl);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.section-head a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.section-head a:hover { color: var(--brand); }

.section-note {
  max-width: 70ch;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   3. Article list: asymmetric grid, featured post left, three rows right
   -------------------------------------------------------------------------- */

/* Kept for any preserved markup; the blog index uses .article-grid. */
.article-list {
  display: grid;
  gap: var(--s-16);
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-grid {
  display: grid;
  gap: var(--s-16);
}

.article-item {
  min-width: 0;
  margin: 0;
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-16);
  height: 100%;
  min-height: 44px;
  padding: var(--s-24);
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: background var(--dur-2) var(--ease), transform var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}

.article-card:visited { color: var(--ink); }

.article-card:hover,
.article-card:focus-visible {
  background: var(--surface-raised);
  color: var(--ink);
  transform: translateY(calc(var(--s-2) * -1));
}

.article-card:active { transform: translateY(0) scale(0.985); }

.article-card__index {
  color: var(--faint);
  font-family: var(--mono);
  font-size: var(--text-xl);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color var(--dur-2) var(--ease);
}

.article-card:hover .article-card__index { color: var(--brand); }

.article-card__text {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
}

.article-card__title {
  font-size: var(--text-2xl);
  line-height: 1.18;
  letter-spacing: -0.028em;
  transition: transform var(--dur-2) var(--ease);
}

.article-card:hover .article-card__title { transform: translateX(var(--s-2)); }

.article-card__dek {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.article-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-8);
  color: var(--muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.article-card__meta .article-card__arrow--meta {
  margin-left: auto;
  color: var(--muted);
}

.article-card:hover .article-card__arrow--meta { color: var(--brand); }

.article-card__more {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  margin-top: auto;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

.article-card__arrow {
  display: inline-block;
  transition: transform var(--dur-2) var(--ease);
}

.article-card:hover .article-card__more { color: var(--ink); }

.article-card:hover .article-card__arrow { transform: translateX(var(--s-4)); }

/* Featured card: more air, the numeral becomes the graphic element. Words sit at
   the top, the release facts and the call to action close the card. */
.article-card--featured {
  justify-content: space-between;
  gap: var(--s-24);
  padding: var(--s-32);
}

.article-card--featured .article-card__index {
  font-size: var(--text-5xl);
  letter-spacing: -0.04em;
}

.article-card--featured .article-card__title {
  max-width: 18ch;
  font-size: var(--text-4xl);
  line-height: 1.06;
}

.article-card--featured .article-card__dek {
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: var(--text-base);
}

/* Release facts: three short measured values inside the featured card. */
.article-card__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-16) var(--s-24);
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-card__fact {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin: 0;
}

.article-card__fact-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.article-card__fact-label {
  color: var(--muted);
  font-size: var(--text-xs);
}

@media (min-width: 900px) {
  .article-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }

  .article-grid > .article-item--featured {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .article-grid > .article-item:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .article-grid > .article-item:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }

  .article-grid > .article-item:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
  }

  .article-grid .research-note {
    grid-column: 1;
    grid-row: 3;
    margin: 0;
  }

  .article-grid .research-note .link-card { height: 100%; }
}

/* --------------------------------------------------------------------------
   4. Link cards (related reading, reports, resources, 404 destinations)
   -------------------------------------------------------------------------- */

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--s-12);
}

.link-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  min-height: 44px;
  padding: var(--s-24);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: background var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}

.link-card:visited { color: var(--ink); }

.link-card:hover,
.link-card:focus-visible {
  background: var(--surface-raised);
  color: var(--ink);
  transform: translateY(calc(var(--s-2) * -1));
}

.link-card:active { transform: translateY(0) scale(0.985); }

.link-card__kicker {
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.link-card__title {
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.link-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
  margin-top: auto;
  padding-top: var(--s-8);
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.link-card__arrow {
  display: inline-block;
  color: var(--faint);
  transition: transform var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

.link-card:hover .link-card__arrow {
  color: var(--brand);
  transform: translateX(var(--s-4));
}

/* One wide link card: the blog's pointer to the technical area. */
.research-note { margin-top: var(--s-32); }

.research-note .link-card { padding: var(--s-32); }

.research-note .link-card__title { font-size: var(--text-2xl); }

/* --------------------------------------------------------------------------
   5. Measured stats
   -------------------------------------------------------------------------- */

.stats-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--s-12);
  margin-top: var(--s-24);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  padding: var(--s-24);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.stat__value {
  color: var(--ink);
  font-size: var(--text-3xl);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.stat__label {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5;
}

.stat__note {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.stats-note {
  max-width: 70ch;
  margin-top: var(--s-16);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   6. Pipeline figure: request, worker, engine, tokens
   -------------------------------------------------------------------------- */

.pipeline-figure { margin: var(--s-64) 0 0; }

.pipeline {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-24);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  padding: var(--s-24);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.pipeline-index {
  color: var(--brand);
  font-family: var(--mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.pipeline-step h3 {
  font-size: var(--text-lg);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.pipeline-step p {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.pipeline-wire { display: none; }

@keyframes pipeline-pulse {
  0% { opacity: 0; transform: translateX(0); }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(calc(var(--s-16) - 4px)); }
}

@media (min-width: 900px) {
  .pipeline { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .pipeline-wire {
    position: absolute;
    top: var(--s-40);
    left: calc(100% + var(--s-4));
    display: block;
    width: var(--s-16);
    height: 1px;
    background: var(--line-strong);
  }

  .pipeline-wire::after {
    content: "";
    position: absolute;
    top: -2px;
    left: 0;
    width: 4px;
    height: 4px;
    border-radius: var(--r-full);
    background: var(--brand);
    animation: pipeline-pulse 2.4s var(--ease-in-out) infinite;
  }

  .pipeline-step:nth-child(2) .pipeline-wire::after { animation-delay: 0.4s; }
  .pipeline-step:nth-child(3) .pipeline-wire::after { animation-delay: 0.8s; }
}

.no-break { white-space: nowrap; }

.pipeline-caption {
  max-width: 75ch;
  margin-top: var(--s-16);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.section-reports { margin-top: var(--s-64); }

.section-sources {
  margin-top: var(--s-64);
  padding-top: var(--s-32);
  border-top: 1px solid var(--line);
}

.section-sources h2 {
  margin: 0 0 var(--s-16);
  font-size: var(--text-2xl);
  letter-spacing: -0.03em;
}

.section-sources p {
  max-width: 65ch;
  color: var(--ink-soft);
  font-size: var(--text-base);
  line-height: 1.7;
}

.section-sources p + p { margin-top: var(--s-16); }

/* --------------------------------------------------------------------------
   7. Q&A list: two columns, no accordion
   -------------------------------------------------------------------------- */

.qa { margin: var(--s-16) 0 0; }

.qa-item {
  display: grid;
  gap: var(--s-8);
  padding: var(--s-24) 0;
  border-top: 1px solid var(--line);
}

.qa-item:last-child { border-bottom: 1px solid var(--line); }

.qa dt {
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.4;
}

.qa dd {
  max-width: 60ch;
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--text-base);
  line-height: 1.7;
}

.qa dd p + p { margin-top: var(--s-8); }

@media (min-width: 900px) {
  .qa-item {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--s-32);
  }

  .qa dt {
    position: sticky;
    top: 104px;
    align-self: start;
  }
}

/* --------------------------------------------------------------------------
   8. Callout
   -------------------------------------------------------------------------- */

.callout {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  margin: var(--s-32) 0;
  padding: var(--s-24);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.callout__label {
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 600;
}

.callout p {
  max-width: 65ch;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   9. Reading: long-form typography
   -------------------------------------------------------------------------- */

.article-layout {
  width: 100%;
  max-width: var(--reading-measure);
  min-width: 0;
  margin: 0 auto;
}

.reading {
  color: var(--ink-soft);
  outline: none;
}

.reading h1 { margin-top: var(--s-16); }

.reading h2 {
  margin: var(--s-48) 0 var(--s-16);
  color: var(--ink);
  font-size: var(--text-2xl);
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.reading h3 {
  margin: var(--s-32) 0 var(--s-8);
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.35;
}

.reading h2 + h3 { margin-top: var(--s-16); }

.reading p,
.reading li {
  font-size: var(--text-base);
  line-height: 1.75;
}

.reading p { margin: 0; }

/* Long unbreakable strings (URLs, hashes) must not widen the page at 320px. */
.reading p,
.reading li,
.reading dd,
.reading dt,
.reading caption,
.reading figcaption,
.qa dt,
.qa dd,
.stat__note,
.pipeline-step p,
.pipeline-caption,
.link-card__title,
.article-card__title { overflow-wrap: anywhere; }

.reading th,
.reading td { overflow-wrap: break-word; }

/* Keep model names and other short identifiers on one line. */
.nowrap { white-space: nowrap; }

.reading p + p { margin-top: var(--s-16); }

.reading h2 + p,
.reading h3 + p { margin-top: 0; }

.reading ul,
.reading ol {
  margin: var(--s-16) 0 0;
  padding-left: var(--s-24);
}

.reading li { margin: var(--s-8) 0; }

.reading li:first-child { margin-top: 0; }

.reading li:last-child { margin-bottom: 0; }

.reading li::marker { color: var(--faint); }

.reading strong {
  color: var(--ink);
  font-weight: 600;
}

.reading em {
  font-style: normal;
  font-weight: 600;
}

.reading a {
  color: var(--brand);
  text-decoration: none;
}

.reading a:hover {
  color: #b4e18a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reading a:visited { color: #b4e18a; }

.reading hr {
  margin: var(--s-48) 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.reading blockquote {
  margin: var(--s-24) 0;
  padding: var(--s-8) 0 var(--s-8) var(--s-24);
  border-left: 2px solid var(--brand);
}

.reading blockquote p {
  color: var(--ink);
  font-size: var(--text-base);
}

.reading img { border-radius: var(--r-lg); }

.reading > img { margin: var(--s-32) auto; }

.reading figure { margin: var(--s-32) 0; }

/* Diagrams drawn as inline SVG (Blazing Kiwi articles and paper). Styled by class: the CSP allows no inline styles. */
.dia-svg { display: block; width: 100%; max-width: 520px; height: auto; margin: 0 auto; overflow: visible; }
.dia figcaption { max-width: 520px; margin-inline: auto; }
.dia-step { fill: var(--faint); font: 600 11px var(--font); letter-spacing: 0.02em; }
.dia-box { fill: var(--surface-raised); stroke: var(--line-strong); }
.dia-box-lit { fill: rgba(155, 206, 107, 0.1); stroke: var(--brand-line); }
.dia-panel { fill: var(--surface); stroke: var(--line); }
.dia-layers rect { fill: var(--surface-high); }
.dia-layer-lit, .dia-bit-on, .dia-card-lit { fill: var(--brand); }
.dia-bit-off, .dia-card { fill: var(--surface-high); }
.dia-label { fill: var(--ink); font: 700 13px var(--font); }
.dia-sub { fill: var(--muted); font: 500 11px var(--font); }
.dia-text { fill: var(--ink-soft); font: 500 12.5px var(--font); }
.dia-mono { fill: var(--ink); font: 500 13px var(--mono); }
.dia-note { fill: var(--faint); font: 500 10.5px var(--font); }
.dia-wire { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.dia-wire-lit { stroke: var(--brand-line); }
.dia-arrowhead { fill: var(--muted); }
.dia-cite { fill: var(--brand); font-weight: 700; }
.dia-lock { fill: none; stroke: var(--brand); stroke-width: 1.5; stroke-linejoin: round; }
.dia-bar { fill: var(--surface-high); }
.dia-bar-lit { fill: var(--brand); }
.dia-bar-warn { fill: var(--warn); }

/* MathML in the technical paper. */
.reading math { font-size: 1.05em; }
.math-block { margin: var(--s-24) 0; padding: var(--s-12) var(--s-16); overflow-x: auto; border-radius: var(--r-md);
  background: var(--bg-deep); }
.math-block math { display: block; font-size: 1.1em; }

.reading figcaption {
  margin-top: var(--s-8);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.reading code {
  padding: 2px var(--s-4);
  border-radius: var(--r-xs);
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.reading pre {
  margin: var(--s-24) 0;
  padding: var(--s-24);
  border-radius: var(--r-md);
  background: var(--bg-deep);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: var(--text-sm);
  line-height: 1.5;
  overflow-x: auto;
}

.reading pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: var(--text-sm);
  overflow-wrap: normal;
}

.formula {
  margin: var(--s-24) 0;
  padding: var(--s-12) var(--s-24);
  border-left: 2px solid var(--brand);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  overflow-x: auto;
}

/* Tables: full width, row hairlines only, mono numerals. */
.table-scroll {
  max-width: 100%;
  margin: var(--s-24) 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.table-scroll:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: var(--s-4);
  border-radius: var(--r-sm);
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
  text-align: left;
}

.table-scroll caption {
  padding: 0 0 var(--s-8);
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.5;
  text-align: left;
}

.table-scroll th,
.table-scroll td {
  padding: var(--s-12) var(--s-16) var(--s-12) 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table-scroll thead th {
  padding-top: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.table-scroll tbody th {
  color: var(--ink-soft);
  font-weight: 600;
}

.table-scroll td { color: var(--ink-soft); }
.table-scroll .num { text-align: right; }
.table-scroll .mid { text-align: center; }

.table-scroll tbody tr:last-child th,
.table-scroll tbody tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------------------
   10. Article header, translation, related, protocol correction
   -------------------------------------------------------------------------- */

.article-header { margin-bottom: var(--s-40); }

.article-header .eyebrow { margin: var(--s-8) 0 var(--s-8); }

.article-header .lede { margin-top: var(--s-24); }

.article-header .article-meta { margin-top: var(--s-24); }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-12);
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  min-height: 44px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover { color: var(--ink); }

.back-link--chevron::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: var(--s-2);
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--dur-2) var(--ease);
}

.back-link--chevron:hover::before { transform: translateX(calc(var(--s-2) * -1)) rotate(45deg); }

.language-jump {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  min-height: 44px;
  color: var(--brand);
  font-size: var(--text-sm);
  text-decoration: none;
}

.language-jump:hover {
  color: #b4e18a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.translation {
  margin-top: var(--s-64);
  padding-top: var(--s-32);
  border-top: 1px solid var(--line);
}

.translation > h2:first-child { margin-top: 0; }

.translation p { color: var(--muted); }

.related {
  margin-top: var(--s-64);
  padding-top: var(--s-32);
  border-top: 1px solid var(--line);
}

.related h2 {
  margin: 0 0 var(--s-16);
  font-size: var(--text-xl);
  letter-spacing: -0.025em;
}

.related .link-grid { margin-top: var(--s-16); }

.reading .back-link { color: var(--muted); }

.reading .back-link:hover { color: var(--ink); }

.back-link--chevron::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: var(--s-2);
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--dur-2) var(--ease);
}

.back-link--chevron:hover::before { transform: translateX(calc(var(--s-2) * -1)) rotate(45deg); }

.reading .language-jump { color: var(--brand); }

.reading .language-jump:hover { color: #b4e18a; }

.reading .link-card,
.reading .link-card:visited { color: var(--ink); }

.reading .link-card__kicker { color: var(--brand); }

.reading .link-card__meta { color: var(--muted); }

.reading .link-card:hover { color: var(--ink); }

.protocol-correction {
  margin: 0 0 var(--s-32);
  padding: var(--s-24);
  border: 1px solid var(--brand-line);
  border-radius: var(--r-lg);
  background: var(--brand-soft);
}

.protocol-correction:first-child { margin-top: 0; }

.protocol-correction h2 {
  margin: 0 0 var(--s-8);
  color: var(--brand);
  font-size: var(--text-lg);
}

.protocol-correction p {
  margin: var(--s-8) 0 0;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.65;
}

.release-list {
  display: grid;
  margin: var(--s-32) 0 0;
  padding: 0;
  list-style: none;
}

.release-list li {
  margin: 0;
  padding: var(--s-24) 0;
  border-top: 1px solid var(--line);
}

.release-list h2 {
  margin: 0 0 var(--s-8);
  font-size: var(--text-xl);
}

.release-list p {
  color: var(--muted);
  font-size: var(--text-sm);
}

/* --------------------------------------------------------------------------
   11. Contents: wrapping row on mobile, sticky rail on the report
   -------------------------------------------------------------------------- */

.toc {
  margin: var(--s-32) 0;
  padding: var(--s-16) 0;
  border-block: 1px solid var(--line);
}

.toc ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s-24);
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li { margin: 0; }

.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--dur-2) var(--ease);
}

.toc a:hover { color: var(--ink); }

.toc a.is-active,
.toc a[aria-current="true"] { color: var(--brand); }

.report-layout > .article-layout {
  width: 100%;
  max-width: var(--reading-measure);
  margin: 0 auto;
}

/* The rail only exists on wide screens; below that the report's own .toc row
   (kept in place after the header) does the same job. */
.report-rail { display: none; }

@media (min-width: 1080px) {
  .report-layout {
    display: grid;
    grid-template-columns: var(--rail-width) minmax(0, var(--reading-measure));
    align-items: start;
    justify-content: center;
    gap: var(--s-32);
  }

  .report-layout > .article-layout {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .report-rail {
    display: block;
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 104px;
  }

  .report-rail .toc {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .report-rail .toc ol {
    flex-direction: column;
    gap: 0;
  }

  .report-rail .toc a {
    width: 100%;
    font-size: var(--text-sm);
  }

  .report-layout .reading .toc { display: none; }
}

/* --------------------------------------------------------------------------
   12. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s-48) var(--s-32) max(var(--s-64), env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-8) var(--s-32);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--s-16);
  margin-left: auto;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: var(--text-sm);
  text-decoration: none;
}

.footer-links a:hover { color: var(--ink); }

.footer-credit {
  width: 100%;
  margin-top: var(--s-16);
  color: var(--faint);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.footer-credit a { color: var(--muted); }

.footer-credit a:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   13. Reading progress bar (driven by ui.js, hidden while width is 0)
   -------------------------------------------------------------------------- */

[data-progress] {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 130;
  width: 0;
  height: 2px;
  background: var(--brand);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   14. 404
   -------------------------------------------------------------------------- */

.page-404 .mark-404 {
  width: 40px;
  height: 40px;
  margin-bottom: var(--s-24);
}

.page-404 .code-404 {
  color: var(--surface-high);
  font-family: var(--mono);
  font-size: clamp(6rem, 24vw, 13rem);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.85;
  -webkit-text-stroke: 2px var(--brand-line);
  user-select: none;
}

@supports not (-webkit-text-stroke: 1px black) {
  .page-404 .code-404 { -webkit-text-stroke: 0; }
}

.page-404 h1 {
  max-width: 18ch;
  margin-top: var(--s-16);
  font-size: var(--text-4xl);
  letter-spacing: -0.03em;
}

.page-404 .lede { margin-top: var(--s-16); }

.page-404 .link-grid {
  max-width: 900px;
  margin-top: var(--s-48);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

/* --------------------------------------------------------------------------
   15. Document helper (privacy, plain legal pages)
   -------------------------------------------------------------------------- */

.document {
  max-width: var(--reading-measure);
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   15a. Book: the author's ebook as a CSS 3D object. Seven faces in one
   preserve-3d body; ui.js writes --ry, --rx, --open and --sheen. Without
   JavaScript the book rests in the same pose and opens its cover on hover.
   -------------------------------------------------------------------------- */

.book {
  --bw: 176px;                          /* cover width; the cover is 9:16 */
  --bh: calc(var(--bw) * 1.7778);
  --bt: calc(var(--bw) * 0.075);        /* thickness of the page block */
  --ry: -24deg;
  --rx: 6deg;
  --open: 0deg;
  --sheen: 50%;
  position: relative;
  display: grid;
  place-items: center;
  width: calc(var(--bw) * 1.5);
  height: calc(var(--bh) * 1.14);
  perspective: calc(var(--bw) * 6);
  perspective-origin: 50% 35%;
}

.book--sm { --bw: 92px; }

.book--lg { --bw: 228px; }

.book__body {
  position: relative;
  width: var(--bw);
  height: var(--bh);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
}

.book__face {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.book__cover {
  width: var(--bw);
  height: var(--bh);
  overflow: hidden;
  border-radius: 2px var(--r-xs) var(--r-xs) 2px;
  background: #0d1b2c;
  transform-origin: left center;
  transform: translateZ(calc(var(--bt) / 2)) rotateY(var(--open));
}

.book__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The hinge crease along the spine, then a moving highlight driven by --sheen. */
.book__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.12) 2.5%,
    rgba(0, 0, 0, 0.14) 5%, transparent 9%);
}

.book__sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, transparent 40%, rgba(255, 255, 255, 0.13) 50%, transparent 60%);
  background-position: var(--sheen) 0;
  background-size: 300% 100%;
}

/* First page, seen when the cover opens. */
.book__page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9em;
  top: 2px;
  width: calc(var(--bw) - 3px);
  height: calc(var(--bh) - 4px);
  padding: 0 9% 0 34%;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.2), transparent 9%), #e9e6df;
  color: #26251f;
  font-size: calc(var(--bw) * 0.056);
  line-height: 1.35;
  transform: translateZ(calc(var(--bt) / 2 - 1px));
}

.book__page-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.book__page-text { font-weight: 500; }

.book__page-text::after {
  content: "";
  display: block;
  height: 4.2em;
  margin-top: 0.9em;
  background: repeating-linear-gradient(180deg, rgba(38, 37, 31, 0.18) 0 1px, transparent 1px 0.7em);
}

.book__back {
  width: var(--bw);
  height: var(--bh);
  border-radius: var(--r-xs) 2px 2px var(--r-xs);
  background: #0b1725;
  transform: translateZ(calc(var(--bt) / -2)) rotateY(180deg);
}

.book__spine {
  width: var(--bt);
  height: var(--bh);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), transparent 45%, rgba(0, 0, 0, 0.35)), #0e2135;
  transform-origin: left center;
  transform: translateZ(calc(var(--bt) / -2)) rotateY(-90deg);
}

/* Page block: right edge, top and bottom, stacked sheets in hairlines. */
.book__edge {
  top: 2px;
  left: calc(var(--bw) - var(--bt) - 2px);
  width: var(--bt);
  height: calc(var(--bh) - 4px);
  background: repeating-linear-gradient(90deg, #dcd8d0 0 1px, #b9b4aa 1px 2px);
  transform-origin: right center;
  transform: translateZ(calc(var(--bt) / -2)) rotateY(90deg);
}

.book__top,
.book__bottom {
  left: 0;
  width: calc(var(--bw) - 2px);
  height: var(--bt);
  background: repeating-linear-gradient(0deg, #d3cfc6 0 1px, #aba69c 1px 2px);
}

.book__top {
  transform-origin: center top;
  transform: translateZ(calc(var(--bt) / -2)) rotateX(90deg);
}

.book__bottom {
  top: calc(var(--bh) - var(--bt));
  transform-origin: center bottom;
  transform: translateZ(calc(var(--bt) / -2)) rotateX(-90deg);
}

.book__shadow {
  position: absolute;
  left: 50%;
  bottom: 1%;
  width: calc(var(--bw) * 1.15);
  height: calc(var(--bw) * 0.2);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
  transform: translateX(-44%);
  pointer-events: none;
}

html:not(.js) .book__cover { transition: transform var(--dur-4) var(--ease); }

html:not(.js) [data-book-host]:hover .book { --open: -52deg; }

/* --------------------------------------------------------------------------
   15b. Ebook promotion: the feature band (blog), the book hero (its own page)
   and the compact note at the end of an article. Buttons inside .reading keep
   their own colours.
   -------------------------------------------------------------------------- */

.book-feature {
  display: grid;
  gap: var(--s-24);
  align-items: center;
  margin: var(--s-80) 0 0;
  padding: var(--s-32) var(--s-24);
  border-radius: var(--r-xl);
  background: var(--surface);
}

.book-feature__figure {
  display: grid;
  place-items: center;
}

.book-feature h2 {
  margin-top: var(--s-12);
  font-size: var(--text-4xl);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.book-sub {
  margin-top: var(--s-8);
  color: var(--ink-soft);
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.book-dek {
  max-width: 54ch;
  margin-top: var(--s-16);
  color: var(--muted);
  line-height: 1.65;
}

.book-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-16) var(--s-32);
  margin: var(--s-24) 0 0;
  padding: 0;
  list-style: none;
}

.book-facts li {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin: 0;
}

.book-facts__value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.book-facts__label {
  color: var(--muted);
  font-size: var(--text-xs);
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-12);
  margin-top: var(--s-32);
}

.book-fineprint {
  margin-top: var(--s-12);
  color: var(--faint);
  font-size: var(--text-xs);
  line-height: 1.55;
}

.book-hero {
  display: grid;
  gap: var(--s-40);
  align-items: center;
}

.book-hero .book-sub { font-size: var(--text-2xl); }

.book-hero__figure {
  display: grid;
  place-items: center;
}

.reading a.btn { text-decoration: none; }

.reading a.btn-primary,
.reading a.btn-primary:visited,
.reading a.btn-primary:hover { color: var(--brand-ink); }

.reading a.btn:not(.btn-primary),
.reading a.btn:not(.btn-primary):visited,
.reading a.btn:not(.btn-primary):hover { color: var(--ink); }

.book-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-16) var(--s-24);
  align-items: center;
  margin-top: var(--s-64);
  padding: var(--s-16) var(--s-24) var(--s-16) var(--s-8);
  border-radius: var(--r-xl);
  background: var(--surface);
}

.reading .book-note h2 {
  margin: var(--s-4) 0 0;
  font-size: var(--text-2xl);
  line-height: 1.15;
}

.reading .book-note p {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.reading .book-note .book-note__lead {
  margin-top: var(--s-8);
  color: var(--ink-soft);
}

.book-note .book-actions { margin-top: var(--s-16); }

/* Inline mention inside an article's prose. */
.reading .book-mention {
  margin: var(--s-32) 0;
  padding: var(--s-16) var(--s-24);
  border-left: 2px solid var(--brand);
}

@media (min-width: 900px) {
  .book-feature {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--s-48);
    padding: var(--s-48) var(--s-64) var(--s-48) var(--s-32);
  }

  .book-hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}

@media (max-width: 560px) {
  .book-note {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--s-16);
  }

  .book-note .book { --bw: 80px; margin: 0 auto 0 calc(var(--bw) * -0.15); }

  .book-feature h2 { font-size: var(--text-3xl); }
}

/* --------------------------------------------------------------------------
   15c. Blog index: lead row, topic sections, end cards
   -------------------------------------------------------------------------- */

.blog-lead {
  display: grid;
  gap: var(--s-16);
}

.blog-lead__side {
  display: grid;
  gap: var(--s-16);
}

.blog-lead__side .link-card { justify-content: space-between; }

.blog-lead__side .link-card__title { font-size: var(--text-xl); }

.topic-section { margin-top: var(--s-80); }

.topic-section .section-note { margin-bottom: var(--s-24); }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--s-16);
}

.blog-end {
  margin-top: var(--s-80);
}

@media (min-width: 900px) {
  .blog-lead { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }

  .blog-lead__side { grid-template-rows: 1fr 1fr; }

  .blog-lead__side .link-card { padding: var(--s-32); }
}

/* --------------------------------------------------------------------------
   15d. Glossary: the Q&A layout, with a visible target state
   -------------------------------------------------------------------------- */

.glossary-group { margin-top: var(--s-64); }

.glossary-group:first-of-type { margin-top: var(--s-32); }

.glossary-group > h2 {
  font-size: var(--text-3xl);
  letter-spacing: -0.03em;
}

.qa-item { scroll-margin-top: 104px; }

.qa-item:target dt { color: var(--brand); }

.qa dd .term-more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   15e. Footer book line
   -------------------------------------------------------------------------- */

.footer-book { width: 100%; }

.footer-book a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-12);
  min-height: 44px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.45;
  text-decoration: none;
}

.footer-book img {
  flex: none;
  width: 24px;
  height: 43px;
  border-radius: 2px;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.9);
  transform: perspective(200px) rotateY(-16deg);
  transition: transform var(--dur-3) var(--ease);
}

.footer-book strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.footer-book a:hover { color: var(--ink); }

.footer-book a:hover img { transform: perspective(200px) rotateY(-30deg) translateY(-2px); }

/* --------------------------------------------------------------------------
   16. Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 899px) {
  .page { padding: 96px var(--s-24) var(--s-64); }

  .hero { padding-bottom: var(--s-32); }

  .hero h1,
  .article-header h1 { max-width: 26ch; }

  .tagline-section {
    margin: 0 0 var(--s-64);
    padding: var(--s-48) 0;
  }

  .article-card--featured { padding: var(--s-24); }

  .article-card--featured .article-card__title { font-size: var(--text-3xl); }

  .article-card--featured .article-card__index { font-size: var(--text-4xl); }

  .related,
  .translation { margin-top: var(--s-48); }

  .site-footer { padding: var(--s-40) var(--s-24) var(--s-64); }

  .footer-links { margin-left: 0; }

  .report-rail { display: none; }
}

@media (max-width: 640px) {
  .page { padding: 96px var(--s-16) var(--s-48); }

  .section-head h2 { font-size: var(--text-2xl); }

  .article-list { gap: var(--s-12); }

  .article-card,
  .link-card,
  .stat,
  .callout,
  .pipeline-step { padding: var(--s-16); }

  .pipeline-step { padding: var(--s-24) var(--s-16); }

  .table-scroll table { min-width: 520px; }

  .table-scroll th,
  .table-scroll td { padding-right: var(--s-12); }

  .site-footer { padding: var(--s-32) var(--s-16) var(--s-48); }

  .footer-links { gap: 0 var(--s-8); }

  .page-404 h1 { font-size: var(--text-3xl); }
}

/* --------------------------------------------------------------------------
   17. Reduced motion: the connector pulse rests at full opacity
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .pipeline-wire::after {
    animation: none;
    opacity: 1;
  }
}

/* --------------------------------------------------------------------------
   18. Print: the preserved report bodies must stay printable
   -------------------------------------------------------------------------- */

@media print {
  :root { --bg: #fff; --ink: #111; --ink-soft: #222; --muted: #333; color-scheme: light; }

  html,
  body { background: #fff; color: #111; }

  body::after,
  .site-nav,
  .site-footer,
  .menu,
  .skip,
  .back-link,
  .language-jump,
  .toc,
  .report-rail,
  .related,
  .footer-credit,
  .book,
  .book-note,
  .book-feature,
  .footer-book { display: none; }

  .page {
    max-width: none;
    padding: 0;
  }

  .article-layout,
  .reading { max-width: none; }

  .hero h1,
  .article-header h1 {
    max-width: none;
    background: none;
    color: #111;
    -webkit-text-fill-color: #111;
    font-size: 28pt;
    line-height: 1.15;
  }

  .reading h2 {
    break-after: avoid;
    color: #111;
    font-size: 17pt;
    margin-top: 18pt;
  }

  .reading h3 {
    break-after: avoid;
    color: #111;
    font-size: 12pt;
  }

  .reading p,
  .reading li,
  .reading .lede,
  .reading .article-meta,
  .reading blockquote p,
  .translation p,
  .qa dd,
  .qa dt,
  .table-scroll td,
  .table-scroll th,
  .table-scroll caption {
    color: #222;
    font-size: 10.5pt;
    line-height: 1.6;
  }

  .reading a,
  .hero-meta a { color: #222; text-decoration: underline; }

  .reading code,
  .reading pre,
  .formula {
    background: transparent;
    border: 1px solid #ccc;
    color: #111;
  }

  .reading blockquote,
  .formula { border-left: 2px solid #222; }

  .protocol-correction,
  .callout,
  .stat,
  .link-card,
  .article-card {
    background: transparent;
    border: 1px solid #ccc;
  }

  .protocol-correction h2 { color: #111; }

  .math-block {
    overflow: visible;
    padding: 0;
    background: transparent;
    color: #111;
  }

  .reading math { color: #111; }

  .reading pre {
    overflow: visible;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .reading pre code { border: 0; }

  .table-scroll { overflow: visible; }

  .table-scroll table {
    min-width: 0;
    width: 100%;
    font-size: 9pt;
  }

  .table-scroll th,
  .table-scroll td {
    padding: 7px;
    border-color: #ccc;
  }

  .table-scroll tr { break-inside: avoid; }

  @page { size: A4; margin: 18mm; }
}
