/* Topline. Editorial / evidence direction.
   Tokens in OKLCH, 8-point spacing, fluid type via clamp(). */

:root {
  --bg:      oklch(0.965 0.012 80);   /* warm paper */
  --bg-2:    oklch(0.935 0.016 80);   /* deeper paper, section bands */
  --fg:      oklch(0.20 0.015 60);    /* ink */
  --muted:   oklch(0.46 0.015 60);
  --border:  oklch(0.84 0.014 75);
  --accent:  oklch(0.42 0.10 155);    /* deep ledger green */
  --accent-fg: oklch(0.985 0.01 80);
  --rule:    oklch(0.20 0.015 60);

  --display: "Old Standard TT", "Iowan Old Style", Georgia, serif;
  --body:    "Libre Franklin", "Helvetica Neue", Arial, sans-serif;

  --measure: 62ch;
  --shell: 1200px;
  --gutter: clamp(16px, 5vw, 64px);

  --s-1: 8px;  --s-2: 16px; --s-3: 24px; --s-4: 32px;
  --s-5: 48px; --s-6: 64px; --s-7: 96px; --s-8: 128px;

  --fs-body: clamp(1.0625rem, 0.98rem + 0.4vw, 1.1875rem);
  --fs-lede: clamp(1.1875rem, 1.05rem + 0.6vw, 1.4375rem);
  --fs-h3:   clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-h2:   clamp(1.875rem, 1.3rem + 2.4vw, 3.125rem);
  --fs-h1-def: clamp(1.5rem, 1.1rem + 1.8vw, 2.5rem);
  --fs-hero:  clamp(5.5rem, 2.25rem + 16.5vw, 14rem);
  --fs-big:   clamp(3.25rem, 2rem + 5vw, 5.5rem);
  --fs-eyebrow: 0.8125rem;

  --section: clamp(4rem, 3rem + 6vw, 9rem);
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; text-wrap: pretty; max-width: var(--measure); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.08; letter-spacing: -0.015em; margin: 0; text-wrap: balance; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
ul, ol { margin: 0; padding: 0; }

.container { max-width: var(--shell); margin-inline: auto; padding-inline: var(--gutter); }

.skip { position: absolute; left: var(--s-2); top: -100px; background: var(--fg); color: var(--bg); padding: var(--s-1) var(--s-2); z-index: 100; }
.skip:focus { top: var(--s-2); }

/* Focus ring, 3:1 minimum, 2px */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px;
  font: inherit; font-weight: 600; text-decoration: none;
  border: 1.5px solid var(--fg); border-radius: 999px; color: var(--fg); background: transparent;
  cursor: pointer; transition: background-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { min-height: 52px; padding: 14px 28px; font-size: 1.0625rem; }
.link-quiet { color: var(--muted); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.link-quiet:hover { color: var(--fg); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 68px; }
.wordmark { display: flex; flex-direction: column; text-decoration: none; line-height: 1; }
.wordmark-name { font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; }
.wordmark-desc { font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.site-header nav { display: none; gap: var(--s-4); }
.site-header nav a { text-decoration: none; font-weight: 500; color: var(--muted); padding: 10px 0; }
.site-header nav a:hover { color: var(--fg); }
@media (min-width: 900px) { .site-header nav { display: flex; } }
@media (max-width: 480px) { .header-inner .btn { padding-inline: 14px; font-size: .9375rem; } }

/* ---------- Eyebrow / heads ---------- */
.eyebrow { font-size: var(--fs-eyebrow); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: var(--s-2); }
.section-head { margin-bottom: var(--s-5); }
.section-head h2 { margin-bottom: var(--s-3); max-width: 22ch; }
.lede { font-size: var(--fs-lede); line-height: 1.45; color: var(--fg); }

/* ---------- Hero ---------- */
.hero { padding-block: var(--s-6) var(--section); border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; gap: var(--s-6); align-items: start; }
@media (min-width: 1000px) {
  .hero-grid { grid-template-columns: minmax(0, 6fr) minmax(320px, 5fr); gap: var(--s-7); }
}
.hero h1 { display: grid; gap: var(--s-2); }
.hero-number {
  font-size: var(--fs-hero); line-height: .98; font-weight: 400; letter-spacing: -0.05em;
  display: inline-block; margin-left: -0.04em;
}
.hero-number .x { font-style: italic; font-weight: 400; color: var(--accent); }
.hero-def { font-size: var(--fs-h1-def); font-weight: 500; line-height: 1.15; max-width: 26ch; }
.hero-meta { margin-top: var(--s-4); font-size: var(--fs-lede); color: var(--muted); max-width: 40ch; }
.hero-meta strong { color: var(--fg); }
.hero-sub { margin-top: var(--s-3); max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); margin-top: var(--s-5); }

/* ---------- Hero record (verification ledger) ---------- */
.record { border-top: 2px solid var(--rule); padding-top: var(--s-3); }
.record-title { font-size: var(--fs-eyebrow); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: var(--s-3); }
.record-list { margin: 0; display: grid; gap: 0; }
.record-list > div { display: grid; grid-template-columns: 1fr; gap: 6px; padding-block: 14px; border-bottom: 1px solid var(--border); }
.record-list > div:last-of-type { grid-template-columns: 1fr auto; align-items: baseline; gap: var(--s-2); }
.record-list dt { font-size: .8125rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.record-list dd { margin: 0; font-size: .9375rem; }
.record-list .zero { font-family: var(--display); font-size: 1.5rem; line-height: 1; }
.record-note { margin: var(--s-3) 0 0; font-size: .8125rem; color: var(--muted); }

/* ---------- Proof ---------- */
.proof { padding-block: var(--section); }
.stats { display: grid; gap: var(--s-4); margin: 0; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); gap: var(--s-5); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { border-top: 1px solid var(--rule); padding-top: var(--s-3); }
.stat dt { font-size: var(--fs-eyebrow); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; min-height: 2.6em; }
.stat dd { margin: var(--s-2) 0 var(--s-2); }
.big { font-family: var(--display); font-size: var(--fs-big); font-weight: 400; letter-spacing: -0.04em; line-height: .95; }
.big .plus { font-size: .5em; font-style: normal; font-weight: 400; color: var(--accent); vertical-align: .55em; margin-left: .04em; letter-spacing: 0; }
.big .of { font-size: .32em; font-style: italic; margin-inline: .18em; color: var(--muted); letter-spacing: 0; vertical-align: .25em; }
.stat p { color: var(--muted); font-size: 0.9375rem; margin: 0; }
.fine { margin-top: var(--s-6); padding: var(--s-3) var(--s-4); background: var(--bg-2); border-left: 2px solid var(--accent); max-width: 70ch; }
.fine p { margin: 0; font-size: .9375rem; color: var(--muted); }

/* ---------- Two-column sections ---------- */
.grid-2 { display: grid; gap: var(--s-5); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 5fr 7fr; gap: var(--s-7); align-items: start; } .grid-2 .section-head { position: sticky; top: 96px; margin-bottom: 0; } }

/* ---------- Fit ---------- */
.fit { padding-block: var(--section); background: var(--bg-2); border-block: 1px solid var(--border); }
.gate { display: grid; grid-template-columns: 3rem 1fr; gap: var(--s-2) var(--s-3); padding-block: var(--s-4); border-top: 1px solid var(--rule); }
.gate:first-child { border-top: 0; padding-top: 0; }
.gate-num { font-family: var(--display); font-size: 1.125rem; color: var(--accent); padding-top: .35em; }
.gate h3 { grid-column: 2; }
.gate-tag { display: block; font-family: var(--body); font-size: var(--fs-eyebrow); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-top: 6px; }
.gate p { grid-column: 2; margin: 0; }
.industries { border-top: 1px solid var(--rule); padding-top: var(--s-4); margin-top: var(--s-2); }
.industries h3 { font-family: var(--body); font-size: var(--fs-eyebrow); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-2); }
.industries ul { list-style: none; display: grid; gap: 6px 24px; }
@media (min-width: 640px) { .industries ul { grid-template-columns: 1fr 1fr; } }
.industries li { padding-left: 18px; position: relative; }
.industries li::before { content: ""; position: absolute; left: 0; top: .72em; width: 8px; height: 1.5px; background: var(--accent); }

/* ---------- Engine ---------- */
.engine { padding-block: var(--section); }
.parts { list-style: none; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.part { display: grid; grid-template-columns: 3.5rem 1fr; gap: var(--s-1) var(--s-3); padding-block: var(--s-4); border-bottom: 1px solid var(--border); }
.part-num { font-family: var(--display); font-size: 2rem; font-weight: 400; color: var(--accent); line-height: 1; }
.part h3 { grid-column: 2; }
.part p { grid-column: 2; margin: 0; color: var(--muted); }
@media (min-width: 900px) {
  .parts { grid-template-columns: repeat(5, 1fr); border-top: 0; align-items: start; }
  .part {
    display: flex; flex-direction: column; align-items: start;
    border-bottom: 0; border-top: 1px solid var(--rule);
    padding: var(--s-3) var(--s-3) 0 0; gap: 0;
  }
  .part-num { margin-bottom: var(--s-2); }
  .part h3 { margin-bottom: var(--s-1); min-height: 2.2em; }
}

/* ---------- Stories ---------- */
.stories { padding-block: var(--section); background: var(--fg); color: var(--bg); }
.stories .eyebrow { color: oklch(0.78 0.10 155); }
.stories .lede, .stories p { color: oklch(0.86 0.012 80); }
.stories h2, .stories h3 { color: var(--bg); }
.wells { display: grid; gap: var(--s-4); }
@media (min-width: 640px) { .wells { grid-template-columns: 1fr 1fr; } }
.well { border-top: 1px solid oklch(0.40 0.012 70); padding-top: var(--s-3); }
.well h3 { margin-bottom: var(--s-1); }
.well p { margin: 0; font-size: .9375rem; }

/* ---------- Terms ---------- */
.terms { padding-block: var(--section); }
.terms-grid { display: grid; gap: var(--s-4); }
@media (min-width: 720px) { .terms-grid { grid-template-columns: 1fr 1fr; gap: var(--s-5) var(--s-6); } }
.term { border-top: 1px solid var(--rule); padding-top: var(--s-3); }
.term h3 { margin-bottom: var(--s-1); }
.term p { margin: 0; color: var(--muted); }
.disclaimer { margin-top: var(--s-6); font-size: .875rem; color: var(--muted); max-width: 70ch; }

/* ---------- About ---------- */
.about { padding-block: var(--section); background: var(--bg-2); border-block: 1px solid var(--border); }
.about-body p { font-size: var(--fs-lede); line-height: 1.5; }

/* ---------- Form ---------- */
.preview { padding-block: var(--section); }
.form { display: grid; gap: var(--s-3); max-width: 520px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .9375rem; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input {
  font: inherit; font-size: 1.0625rem; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 6px; background: #fff; color: var(--fg);
  transition: border-color .15s var(--ease);
}
.field input:hover { border-color: var(--muted); }
.field input:focus { border-color: var(--fg); outline: none; box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 25%, transparent); }
.field input:user-invalid { border-color: oklch(0.55 0.18 25); }
.field input::placeholder { color: oklch(0.62 0.01 70); }
.hp { position: absolute; left: -10000px; }
.form-note { margin: 0; font-size: .875rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding-block: var(--s-5); }
.footer-inner { display: grid; gap: var(--s-3); }
@media (min-width: 720px) { .footer-inner { grid-template-columns: 1fr 1fr; align-items: end; } .footer-fine { text-align: right; justify-self: end; } }
.site-footer p { margin: 0; font-size: .875rem; color: var(--muted); }
.site-footer .wordmark-name { display: block; margin-bottom: var(--s-1); }

/* ---------- Motion: fast, purposeful, opt-out ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ---------- Figures ---------- */
.figures { display: grid; gap: var(--s-6); margin-top: var(--s-7); }
@media (min-width: 900px) { .figures { grid-template-columns: 1.4fr 1fr; } .fig-cases { grid-column: 1 / -1; } }
.fig { margin: 0; border-top: 1px solid var(--rule); padding-top: var(--s-3); }
.fig figcaption { display: grid; gap: 4px; margin-bottom: var(--s-3); }
.fig-title { font-family: var(--display); font-size: var(--fs-h3); line-height: 1.15; }
.fig-sub { font-size: .9375rem; color: var(--muted); max-width: 60ch; }
.chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-svg .tick { font-family: var(--body); font-size: 12px; fill: var(--muted); }
.chart-svg .label { font-family: var(--body); font-size: 13px; font-weight: 600; fill: var(--fg); }
.chart-svg .label.muted { fill: var(--muted); font-weight: 400; }
.chart-svg .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { fill: color-mix(in oklch, var(--accent) 12%, transparent); }
.chart-svg .dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.chart-svg .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart-svg .bar { fill: var(--accent); }
.tip { position: absolute; pointer-events: none; background: var(--fg); color: var(--bg); font-size: .8125rem; padding: 6px 10px; border-radius: 4px; white-space: nowrap; }
.tip span { color: oklch(0.80 0.012 80); margin-left: 6px; }
.fig-table { margin-top: var(--s-2); font-size: .875rem; color: var(--muted); }
.fig-table summary { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.fig-table table { border-collapse: collapse; margin-top: var(--s-2); }
.fig-table th, .fig-table td { text-align: left; padding: 4px 16px 4px 0; border-bottom: 1px solid var(--border); }
.cases { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.case { display: grid; gap: 2px; min-width: 150px; padding: var(--s-3); border-radius: 6px; font-size: .9375rem; color: var(--muted); }
.case b { font-family: var(--display); font-size: 1.25rem; font-weight: 400; color: var(--fg); }
.case.closed { background: color-mix(in oklch, var(--accent) 14%, transparent); border: 1.5px solid var(--accent); }
.case.open { border: 1.5px dashed var(--border); }

/* ---------- Hero entrance ---------- */
.hero-number { padding-top: .06em; }
@media (prefers-reduced-motion: no-preference) {
  .hero-number { animation: rise .9s cubic-bezier(.2,.7,.2,1) both; }
  .hero-number .x { display: inline-block; animation: rise .9s .25s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(.12em); } to { opacity: 1; transform: none; } }
}

.tile { display: flex; align-items: baseline; gap: var(--s-2); padding-top: var(--s-2); }
.tile .big { font-size: clamp(4rem, 3rem + 6vw, 7rem); }
.tile-unit { font-family: var(--display); font-size: var(--fs-h3); color: var(--muted); }

.also { margin-top: var(--s-3); font-size: .9375rem; color: var(--muted); }

/* ---------- Plates (public-domain engravings) ---------- */
.plate { margin: var(--s-5) 0 0; max-width: 360px; }
.plate img { width: 100%; height: auto; display: block; mix-blend-mode: multiply; opacity: .92; }
.plate figcaption { margin-top: var(--s-2); font-size: .75rem; letter-spacing: .02em; color: var(--muted); }
@media (max-width: 899px) { .plate { max-width: 260px; margin-top: var(--s-4); } }

/* ---- Dot grid background (Paper shader, static — paints once, no animation) ---- */
.dot-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .07;
}
.dot-bg canvas { display: block; width: 100%; height: 100%; }
/* Content sits on the paper ground; sections that need to hide the dots opt in. */
body { background: var(--bg); }
