/* Base + shared components for the zrch.com v2 world. Sections use these classes; no raw colours. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--ink-3) var(--stock); }
body {
  margin: 0; background: var(--vacuum); color: var(--text);
  font-family: var(--font); font-size: var(--body); line-height: 1.65;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-color: var(--track); text-decoration-thickness: 1px; text-underline-offset: 0.3em; }
a:hover { text-decoration-color: var(--ice); }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--ice); color: var(--vacuum); }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 4px; }
:root { accent-color: var(--track); }

.skip { position: absolute; left: var(--s-4); top: -100px; z-index: 100; background: var(--ice); color: var(--vacuum); padding: var(--s-3) var(--s-4); font-weight: 600; }
.skip:focus { top: var(--s-4); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Layout ---------------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.chapter { position: relative; padding-block: var(--section-y); border-top: 1px solid var(--hairline); scroll-margin-top: 5rem; }

/* Chapter header: heading left, optional lead right. No kickers, no numbers. */
.chapter-head { display: grid; gap: var(--s-6); margin-bottom: clamp(3.5rem, 2rem + 5vw, 7rem); }
@media (min-width: 64rem) { .chapter-head { grid-template-columns: 5fr 6fr; align-items: end; gap: var(--s-8); } }

/* ---- Paper chapters --------------------------------------------------------------
   Every chapter between the dark hero and the dark footer sits on pale turquoise stock with ink.
   The shared classes read --text / --text-2 / --hairline / --panel, so they follow. */
.theme-paper {
  --text: var(--ink); --text-2: var(--ink-2); --text-3: var(--ink-3);
  --hairline: rgb(0 51 51 / 0.2); --panel: rgb(0 51 51 / 0.035); --panel-strong: rgb(0 51 51 / 0.07);
  background: var(--stock); color: var(--text); color-scheme: light;
}
.theme-paper ::selection { background: var(--vacuum); color: var(--stock); }
.theme-paper :focus-visible { outline-color: var(--detector); }
.theme-paper a { text-decoration-color: var(--detector); }
.theme-paper .plate { background: var(--vacuum); color: var(--white); }
.theme-paper .plate:hover { background: var(--detector); }
.theme-paper .link-arrow { border-bottom-color: var(--vacuum); }
.theme-paper .label { color: var(--ink-3); }
.theme-paper.chapter { border-top: 0; padding-block: clamp(6.5rem, 3rem + 10vw, 13rem); }
.theme-paper.chapter + .theme-paper.chapter { border-top: 1px solid var(--hairline); }
.theme-paper .prose, .theme-paper .lead { color: var(--ink-2); }

/* Chapter marker: a leader line from the page edge ending in a hollow anchor at the heading,
   the hero's leader grammar carried down the page. It is drawn, not a text label (no kicker). */
.marked { position: relative; }
.marked::before {
  content: ""; position: absolute; top: 0.56em; right: calc(100% + 0.45em); width: 100vw; height: 1px;
  background: linear-gradient(to left, var(--text) 0, var(--text) 3.5rem, transparent 3.5rem);
  opacity: 0.3;
}
.marked::after {
  content: ""; position: absolute; top: calc(0.56em - 4px); right: calc(100% + 0.45em - 4px); width: 9px; height: 9px;
  border: 1px solid var(--text); border-radius: 50%; background: var(--stock);
}
.theme-dark .marked::after, .marked--dark::after { background: var(--vacuum); }
@media (max-width: 47.99rem) {
  .marked::before { right: calc(100% + min(0.45em, 0.625rem)); }
  .marked::after { right: calc(100% + min(0.45em, 0.625rem) - 4px); }
  .marked::before { background: linear-gradient(to left, var(--text) 0, var(--text) 1rem, transparent 1rem); }
}

/* Readout label on paper and dark: small tracked caps for facts, countries, e-mails (pinned to rows). */
.readout-label { font-size: var(--label); font-weight: 500; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-3, var(--text-2)); }

/* Pull quote: verbatim fragment of the copy set at display size. */
.pull { font-size: clamp(1.875rem, 1.1rem + 2.4vw, 3.25rem); font-weight: 500; line-height: 1.05; letter-spacing: -0.03em; text-wrap: balance; }
.pull::before { content: "\201C"; margin-left: -0.42em; }
.pull::after { content: "\201D"; }

/* ---- Type ------------------------------------------------------------------------ */
.display { font-size: var(--display); font-weight: 600; line-height: 1.06; letter-spacing: var(--track-tight); text-wrap: balance; }
.h2 { font-size: var(--h2); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
.h3 { font-size: var(--h3); font-weight: 600; line-height: 1.15; letter-spacing: -0.015em; }
.lead { font-size: var(--lead); line-height: 1.6; color: var(--text-2); max-width: 38ch; }
.prose { color: var(--text); max-width: 64ch; }
.prose > * + * { margin-top: 1em; }
.nowrap { white-space: nowrap; }

/* Readout label: small, tracked, uppercase Barlow 500. Pinned to figures and table rows,
   never as an eyebrow above a heading. */
.label { font-size: var(--label); font-weight: 500; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-2); }

/* ---- Actions --------------------------------------------------------------------- */
/* Plate: the primary action. Turquoise plate, ink text (3.95:1; AA for large text, the label is 19px bold). */
.plate {
  display: inline-flex; align-items: center; justify-content: space-between; gap: var(--s-6);
  max-width: 100%; min-height: 3.5rem; padding: 0 var(--s-5); background: var(--track); color: var(--ink);
  font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.005em; text-decoration: none;
  transition: background-color 160ms var(--ease-out);
}
.plate:hover { background: var(--ice); }
.plate svg, .link-arrow svg { width: 1.5rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.5; flex: none; transition: transform 200ms var(--ease-out); }
.plate:hover svg, .link-arrow:hover svg { transform: translateX(4px); }

.link-arrow { display: inline-flex; align-items: center; gap: var(--s-3); font-weight: 600; color: var(--text); text-decoration: none; padding-block: var(--s-2); border-bottom: 1px solid var(--track); }
.link-arrow:hover { border-color: var(--ice); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
