/* site.css — donttrade design system (v2). One file, no framework.
 *
 * Tokens follow DESIGN-TEARDOWN-PRO-TRADING-SITES §3. Every colour pair used for
 * text or UI is checked by checks/contrast.py (text ≥ 4.5:1, UI ≥ 3:1, both themes).
 * Rust has ONE meaning: links, focus and "the gap / flagged pattern". The light rust
 * #9A3B1C is never used on a dark surface (it measures 2.55:1 there).
 */

/* ------------------------------------------------------------------ fonts (self-hosted, OFL) */
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* ------------------------------------------------------------------ tokens: light */
:root {
  --bg: #FFFFFF;
  --surface: #F4F5F7;
  --text: #16181C;
  --muted: #5B606A;
  --rust: #9A3B1C;
  --rust-hover: #7C2F16;
  --on-rust: #FFFFFF;
  --border: #DADCE0;       /* decorative lines only */
  --field-border: #6B717B; /* form controls: a UI component, so ≥ 3:1 */
  --plan: #4A6A94;
  --gain: #1F7A52;
  --loss: #A3264F;
  --caution: #8C6A1E;

  --font-sans: "Plex Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --fs-0: 0.875rem;  /* 14 */
  --fs-1: 1rem;      /* 16 */
  --fs-2: 1.25rem;   /* 20 */
  --fs-3: 1.5625rem; /* 25 */
  --fs-4: 1.9375rem; /* 31 */
  --fs-5: 2.4375rem; /* 39 */
  --fs-6: 3.0625rem; /* 49 */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px;
  --gutter: 24px;
  --max: 1200px;
  --prose: 68ch;
  --radius: 4px;
  --target: 44px;
  color-scheme: light;
}

/* ------------------------------------------------------------------ tokens: dark (system preference) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181C;
    --surface: #1E2126;
    --text: #F2F1EE;
    --muted: #A7ABB3;
    --rust: #E07A52;
    --rust-hover: #EC9A78;
    --on-rust: #16181C;
    --border: #2A2D33;
    --field-border: #8A8F98;
    --plan: #6E8BB0;
    --gain: #3FB37F;
    --loss: #E86A8E;
    --caution: #D9A441;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ tokens: dark (toggle) */
:root[data-theme="dark"] {
  --bg: #16181C;
  --surface: #1E2126;
  --text: #F2F1EE;
  --muted: #A7ABB3;
  --rust: #E07A52;
  --rust-hover: #EC9A78;
  --on-rust: #16181C;
  --border: #2A2D33;
  --field-border: #8A8F98;
  --plan: #6E8BB0;
  --gain: #3FB37F;
  --loss: #E86A8E;
  --caution: #D9A441;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-1)/1.5 var(--font-sans);
  overflow-wrap: anywhere;
}
h1, h2, h3, h4 { line-height: 1.15; font-weight: 600; margin: var(--s4) 0 var(--s2); }
h1 { font-size: var(--fs-5); margin-top: var(--s3); }
h2 { font-size: var(--fs-4); }
h3 { font-size: var(--fs-3); }
h4 { font-size: var(--fs-2); }
@media (max-width: 600px) { h1 { font-size: var(--fs-4); } h2 { font-size: var(--fs-3); } h3 { font-size: var(--fs-2); } }
p, ul, ol, dl { margin: 0 0 var(--s2); }
p, li { max-width: var(--prose); }
small, .small { font-size: var(--fs-0); }
.display { font-size: var(--fs-6); line-height: 1.15; font-weight: 600; }
@media (max-width: 600px) { .display { font-size: var(--fs-5); } }
.muted { color: var(--muted); }
.num, code, kbd, samp { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
code { font-size: 0.95em; }
img, svg { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s4) 0; }

a { color: var(--rust); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--rust-hover); }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  a, .btn, button, input, select, textarea, summary { transition: color 150ms, background-color 150ms, border-color 150ms; }
}

.skip-link { position: absolute; left: var(--s2); top: -100px; background: var(--bg); color: var(--rust); padding: var(--s1) var(--s2); z-index: 10; }
.skip-link:focus { top: var(--s1); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ------------------------------------------------------------------ layout: 12-column grid */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
@media (max-width: 600px) { :root { --gutter: 16px; } }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.grid > * { grid-column: 1 / -1; min-width: 0; }
@media (min-width: 900px) {
  .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
  .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }
}
.section { padding: var(--s5) 0; }
.section + .section { border-top: 1px solid var(--border); }
.stack > * + * { margin-top: var(--s2); }

/* ------------------------------------------------------------------ header / footer */
/* Header (Manager V3): one 64 px line at every width. ≥ 900 px: brand · nav row · theme toggle.
   < 900 px: brand · Menu (a <details>, works without JS) · theme toggle as an icon button; the
   open menu is a list laid over the page under the header, so the page does not move. */
.site-header { border-bottom: 1px solid var(--border); position: relative; z-index: 20; background: var(--bg); }
.site-header .wrap { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s1) var(--s3); min-height: 64px; }
.brand { font-weight: 600; color: var(--text); text-decoration: none; font-size: var(--fs-2); margin-right: auto; display: inline-flex; align-items: center; min-height: var(--target); white-space: nowrap; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav .nav-row { display: flex; flex-wrap: wrap; gap: 0 var(--s2); }
.site-nav a { display: inline-flex; align-items: center; min-height: var(--target); color: var(--text); text-decoration: none; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"], .site-nav a[aria-current="true"] { color: var(--rust); text-decoration: underline; }
.nav-menu { display: none; }
.nav-menu > summary {
  list-style: none; display: inline-flex; align-items: center; gap: var(--s1);
  min-height: var(--target); min-width: var(--target); padding: 0 12px; margin: 0;
  border: 1px solid var(--field-border); border-radius: var(--radius); color: var(--text); font-weight: 600;
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary:hover { background: var(--surface); }
.nav-menu .i-close, .nav-menu[open] .i-menu { display: none; }
.nav-menu[open] .i-close { display: block; }
details.nav-menu { border-bottom: 0; }
details.nav-menu[open] > summary { color: var(--text); background: var(--surface); }
.site-nav .nav-panel {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--bg); border-bottom: 1px solid var(--field-border);
  padding: var(--s1) var(--gutter) var(--s2); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}
.site-nav .nav-panel a { display: flex; min-height: 48px; border-bottom: 1px solid var(--border); font-size: var(--fs-1); }
.site-nav .nav-panel li:last-child a { border-bottom: 0; }
.theme-toggle svg { display: block; flex: none; }
.theme-toggle { display: inline-flex; align-items: center; gap: var(--s1); white-space: nowrap; }
.theme-toggle[hidden] { display: none; }
@media (max-width: 899.98px) {
  .site-header .wrap { gap: var(--s1); }
  .site-nav .nav-row { display: none; }
  .nav-menu { display: block; }
  .site-header .theme-toggle { justify-content: center; padding: 0; width: var(--target); }
  .site-header .theme-toggle .tt-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
}
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: var(--s5) 0 var(--s4); margin-top: var(--s6); font-size: var(--fs-0); }
.site-footer .cols { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.site-footer h2 { font-size: var(--fs-1); margin: 0 0 var(--s1); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li a { display: inline-flex; align-items: center; min-height: var(--target); }
.site-footer .legal { margin-top: var(--s3); color: var(--muted); max-width: var(--prose); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-height: var(--target); min-width: var(--target); padding: 10px 20px;
  border: 2px solid var(--rust); border-radius: var(--radius);
  background: var(--rust); color: var(--on-rust);
  font: 600 var(--fs-1)/1.2 var(--font-sans); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--rust-hover); border-color: var(--rust-hover); color: var(--on-rust); }
.btn-secondary { background: transparent; color: var(--rust); }
.btn-secondary:hover { background: var(--surface); color: var(--rust-hover); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.theme-toggle {
  min-height: var(--target); min-width: var(--target); padding: 0 12px;
  background: transparent; color: var(--text); border: 1px solid var(--field-border); border-radius: var(--radius);
  font: inherit; cursor: pointer;
}

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-0); }
caption { text-align: left; font-weight: 600; padding-bottom: var(--s1); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { border-bottom: 2px solid var(--field-border); }
td.num, th.num { text-align: right; white-space: nowrap; }

/* ------------------------------------------------------------------ details / FAQ */
details { border-bottom: 1px solid var(--border); }
summary { cursor: pointer; min-height: var(--target); display: flex; align-items: center; font-weight: 600; padding: var(--s1) 0; }
details > :not(summary) { margin-left: 0; }
details[open] > summary { color: var(--rust); }

/* ------------------------------------------------------------------ forms */
.field { margin-bottom: var(--s3); max-width: 32rem; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { display: block; color: var(--muted); font-size: var(--fs-0); margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="number"], input[type="url"], input[type="file"], select, textarea {
  width: 100%; min-height: var(--target); padding: 10px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--field-border); border-radius: var(--radius);
  font: inherit;
}
textarea { min-height: 6rem; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border: 2px solid var(--loss); }
.error { color: var(--loss); font-weight: 600; font-size: var(--fs-0); margin-top: 4px; }
.error::before { content: "✕ "; }
.check { display: flex; gap: var(--s1); align-items: flex-start; min-height: var(--target); }
.check input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--rust); flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s3); }

/* ------------------------------------------------------------------ tabs (ARIA tablist) */
[role="tablist"] { display: flex; flex-wrap: wrap; gap: var(--s1); border-bottom: 1px solid var(--field-border); margin-bottom: var(--s3); }
[role="tab"] {
  min-height: var(--target); padding: 0 var(--s3); background: transparent; color: var(--text);
  border: 0; border-bottom: 3px solid transparent; font: 600 var(--fs-1) var(--font-sans); cursor: pointer;
}
[role="tab"][aria-selected="true"] { border-bottom-color: var(--rust); color: var(--rust); }
[role="tabpanel"][hidden] { display: none; }

/* ------------------------------------------------------------------ notices and badges */
.notice { border-left: 4px solid var(--plan); background: var(--surface); padding: var(--s2) var(--s3); margin: 0 0 var(--s3); max-width: var(--prose); }
.notice > :last-child { margin-bottom: 0; }
.notice-caution { border-left-color: var(--caution); }
.notice-error { border-left-color: var(--loss); }
.notice-gap { border-left-color: var(--rust); }
.notice strong:first-child { display: block; }

/* A verdict is never colour alone: icon + text, always. */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; min-height: 28px;
  border: 1px solid currentColor; border-radius: 999px; font-size: var(--fs-0); font-weight: 600; white-space: nowrap;
}
.badge::before { font-family: var(--font-mono); }
.badge-real { color: var(--rust); }
.badge-real::before { content: "●"; }
.badge-noise { color: var(--muted); }
.badge-noise::before { content: "○"; }
.badge-few { color: var(--caution); }
.badge-few::before { content: "–"; }

.gain { color: var(--gain); }
.loss { color: var(--loss); }

/* ------------------------------------------------------------------ stat rows */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s2); margin: 0 0 var(--s3); }
.stat { border-top: 2px solid var(--border); padding-top: var(--s1); }
.stat dt { color: var(--muted); font-size: var(--fs-0); }
.stat dd { margin: 0; font-family: var(--font-mono); font-size: var(--fs-3); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ charts (inline SVG + table fallback) */
.chart { margin: 0 0 var(--s3); }
.chart svg { display: block; width: 100%; height: auto; }
.chart-bars svg { max-width: 420px; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 12px var(--font-mono); }
.chart .line-actual { stroke: var(--text); stroke-width: 2; fill: none; }
.chart .line-plan { stroke: var(--plan); stroke-width: 2; stroke-dasharray: 6 4; fill: none; }
.chart .area-dd { fill: var(--loss); opacity: 0.25; }
.chart .bar-gain { fill: var(--gain); }
.chart .bar-loss { fill: var(--loss); }
.chart .bar-plain { fill: var(--plan); }
.chart .bar-flag { fill: var(--rust); }  /* rust = the flagged pattern */
.chart .bar-label { fill: var(--text); font: 13px var(--font-sans); }
.chart .annot { fill: var(--rust); font: 600 12px var(--font-sans); }
.chart figcaption { font-size: var(--fs-0); color: var(--muted); margin-top: var(--s1); }
.chart details summary { font-weight: 400; font-size: var(--fs-0); color: var(--rust); }

/* ------------------------------------------------------------------ drop zone */
.dropzone {
  border: 2px dashed var(--field-border); border-radius: var(--radius); padding: var(--s4) var(--s3);
  background: var(--surface); text-align: left;
}
.dropzone.is-over { border-color: var(--rust); }

/* ------------------------------------------------------------------ before-you-pay */
.byp { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 6px var(--s2); margin: 0 0 var(--s2); }
.byp dt { font-weight: 600; }
.byp dd { margin: 0; }
@media (max-width: 600px) { .byp { grid-template-columns: 1fr; } .byp dd { margin-bottom: var(--s1); } }

/* ------------------------------------------------------------------ print */
@media print {
  .site-header, .site-footer, .no-print, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
  .section { padding: 12px 0; }
}

/* ------------------------------------------------------------------ pages and tools (steps 10–17) */
.lede { font-size: var(--fs-2); line-height: 1.45; max-width: var(--prose); }
@media (max-width: 600px) { .lede { font-size: var(--fs-1); } }
.crumb { margin: var(--s3) 0 0; }
.crumb + h1 { margin-top: var(--s1); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; }
.tool { margin: var(--s4) 0; }
.tool-out { margin-top: var(--s4); }
.tool-out > h2 { margin-top: 0; }
.tool-out h3 { margin-top: var(--s5); }
.tool-out .soon-list { margin-top: var(--s4); }   /* C1: the neutral lines where the badges were */
.teaser { margin-top: var(--s4); }
.disclaimer { font-size: var(--fs-0); color: var(--muted); max-width: var(--prose); border-top: 1px solid var(--border); padding-top: var(--s1); }
/* Numbers read best close to their labels: results tables and the equity chart are
   capped instead of stretching across 1200 px (SVG text also scales with the width). */
.tool-out .table-wrap, .tool-out .chart { max-width: 820px; }
.tool-out .chart svg { max-width: 760px; }
/* Table words wrap at spaces, never mid-word (body uses overflow-wrap: anywhere for long URLs). */
.table-wrap th, .table-wrap td { overflow-wrap: normal; } /* inside a scroll container, so a wide table scrolls */
.tool-out tbody th[scope="row"] { min-width: 9rem; }
@media (max-width: 600px) { .tool-out td.num { white-space: normal; } .stat dd { font-size: var(--fs-2); } }
.nowrap { white-space: nowrap; }
/* The file picker is the native input (keyboard and screen readers handle it for free);
   only its button is styled. */
.file-pick { max-width: 32rem; margin: 0 0 var(--s2); }
.file-pick label { display: block; font-weight: 600; margin-bottom: 4px; }
.file-pick input[type="file"] { background: var(--bg); padding: 6px; }
input[type="file"]::file-selector-button {
  min-height: 36px; margin-right: var(--s2); padding: 6px 16px; border: 2px solid var(--rust); border-radius: var(--radius);
  background: var(--rust); color: var(--on-rust); font: 600 var(--fs-1)/1.2 var(--font-sans); cursor: pointer;
}
input[type="file"]:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0 var(--gutter); max-width: 60rem; }
.field-grid[hidden] { display: none; }
.field-grid .field { max-width: none; }
fieldset legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.formula { font-family: var(--font-mono); font-size: var(--fs-0); background: var(--surface); border-left: 4px solid var(--plan); padding: var(--s2); overflow-x: auto; max-width: 820px; white-space: pre-wrap; }
.tool-list th[scope="row"] { min-width: 12rem; font-size: var(--fs-1); }
.tool-list td a { display: inline-flex; align-items: center; min-height: var(--target); }
/* A visually-hidden (absolute) child must not escape the scroll container and widen the page. */
.table-wrap { position: relative; }
@media (max-width: 600px) {
  .tool-list th:last-child, .tool-list td:last-child { display: none; } /* the tool name is already the link */
  .tool-list th[scope="row"] { min-width: 7rem; }
}

/* ------------------------------------------------------------------ home (step 13) */
.hero { padding: var(--s5) 0 var(--s4); }
.hero h1 { margin-top: 0; }
.hero .grid { align-items: start; }
.hero-shot { margin: 0; }
.hero-shot img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.hero-shot figcaption { font-size: var(--fs-0); color: var(--muted); margin-top: var(--s1); }
@media (min-width: 900px) { .hero-shot { margin-top: var(--s2); } }
.trader-line { border-left: 4px solid var(--rust); padding: var(--s1) 0 var(--s1) var(--s2); margin-top: var(--s4); }
.trader-line p:last-child { margin-bottom: 0; }
.evidence { list-style: none; margin: 0; padding: var(--s2) 0; display: flex; flex-wrap: wrap; gap: 0 var(--s4);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.evidence li { display: flex; align-items: center; min-height: var(--target); }
.finding .display { margin: 0; color: var(--rust); }
.finding-text { font-size: var(--fs-3); line-height: 1.3; font-weight: 600; max-width: 30ch; }
@media (max-width: 600px) { .finding-text { font-size: var(--fs-2); } }
.steps { padding-left: 1.5rem; }
.steps li { margin-bottom: var(--s2); }
.split { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin: 0; }
.split dt { font-weight: 600; font-size: var(--fs-2); margin-bottom: var(--s1); }
.split dd { margin: 0; max-width: var(--prose); }
.closing h3 { margin-top: var(--s2); }
.finding .display { font-variant-numeric: tabular-nums; font-size: 4rem; line-height: 1; }
@media (max-width: 600px) { .finding .display { font-size: var(--fs-6); } }
@media (min-width: 900px) { .finding-note { padding-top: var(--s4); } }

/* ------------------------------------------------------------------ audience pages and forms (steps 14-16) */
.pipeline { list-style: none; margin: var(--s2) 0; padding: 0; counter-reset: none; border-left: 2px solid var(--rust); }
.pipeline li { padding: var(--s1) 0 var(--s1) var(--s2); }
.pipeline li strong { display: block; }
.request-form { max-width: 34rem; }
.req, .opt { font-weight: 400; color: var(--muted); font-size: var(--fs-0); }
.mailto-line { margin-top: var(--s2); }
.price-table td:nth-child(2) { min-width: 16rem; }
.price-table td:nth-child(3), .price-table td:nth-child(4) { min-width: 8rem; }
pre { font-family: var(--font-mono); font-size: var(--fs-0); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s2); overflow-x: auto; max-width: 100%; }
.jump { padding-left: 1.25rem; }
.jump li a { display: inline-flex; align-items: center; min-height: var(--target); }
.prose { max-width: 46rem; }
.prose .byp { margin-bottom: var(--s3); }

/* Reading a trade file (read-file.js): an indeterminate bar and the seconds elapsed. */
.progress-line { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.progress-line[hidden] { display: none; }
.progress-line progress { width: min(240px, 60%); height: 8px; accent-color: var(--plan); }

/* ------------------------------------------------------------------ lifted pages (steps 28–29) */
/* The 20 pages lifted word for word from the pre-v2 site (research, about, corrections, code,
   glossary, the two old calculators, …) keep their own class names inside <main class="lifted">.
   These rules give that vocabulary the v2 look: Plex Sans, cool neutrals, rust only for links,
   focus and "the gap". The old token names that the bodies still use (inline SVG fills, a few
   rules below) are aliases of v2 tokens, so both themes and the contrast check carry over. */
.lifted {
  --measure: 68ch;
  --text-2: var(--muted);
  --text-muted: var(--muted);
  --border-ui: var(--field-border);
  --border-hairline: var(--border);
  --grid: var(--border);
  --accent: var(--rust);
  --on-accent: var(--on-rust);
  --link: var(--rust);
  --font-ui: var(--font-sans);
  --font-body: var(--font-sans);
  --chart-1: var(--plan);      /* this study's figure */
  --chart-2: var(--caution);   /* published estimates it is compared with */
  --chart-6: var(--muted);     /* the comparison bar */
  padding-bottom: var(--s5);
}
.lifted .page-head { padding: var(--s5) var(--gutter) var(--s1); }
.lifted .lifted-pre .notice { margin: var(--s2) 0 0; }
.lifted .lifted-pre + .page-head { padding-top: var(--s1); }   /* the crumb sits right above the H1, as on the new tools */
.lifted .col { max-width: calc(var(--measure) + 8ch); }
.lifted h1 { font-size: var(--fs-5); margin: 0 0 var(--s2); max-width: 24ch; }
.lifted h1.long { max-width: 30ch; font-size: var(--fs-4); }
@media (max-width: 600px) { .lifted h1, .lifted h1.long { font-size: var(--fs-4); } }
.lifted h2 { margin: var(--s5) 0 var(--s2); padding-top: var(--s3); border-top: 1px solid var(--border); max-width: 34ch; }
.lifted h3 { margin: var(--s4) 0 var(--s1); max-width: 44ch; }
.lifted p, .lifted ul, .lifted ol, .lifted blockquote, .lifted dl { max-width: var(--measure); }
.lifted ul, .lifted ol { padding-left: 1.35em; }
.lifted li { margin-bottom: 6px; }
.lifted blockquote { border-left: 3px solid var(--border); margin: 0 0 var(--s2); padding-left: var(--s2); color: var(--muted); }
.lifted code { background: var(--surface); padding: 1px 5px; border-radius: 3px; }
.lifted pre code { background: none; padding: 0; }
.lifted pre { max-width: min(90ch, 100%); }
.lifted .cite pre { white-space: pre-wrap; }
.lifted .lede { color: var(--text); max-width: 46ch; margin-bottom: var(--s3); }
.lifted .lead { margin: 0 0 var(--s1); }
.lifted .kicker, .lifted .meta, .lifted .prov, .lifted .fine, .lifted .funding, .lifted .study-firms,
.lifted .router, .lifted .hint, .lifted .scroll-hint, .lifted figcaption, .lifted .src, .lifted .when, .lifted .copy-msg {
  font-size: var(--fs-0); color: var(--muted);
}
.lifted .kicker { margin: 0 0 var(--s1); }
.lifted .meta { margin: 0 0 var(--s3); max-width: none; }
.lifted .prov { margin: var(--s1) 0 0; }
.lifted .fine { margin: var(--s1) 0 0; }
.lifted .funding { margin: 0 0 var(--s2); }
.lifted .study-firms { margin: var(--s2) 0 0; }
.lifted .meta a, .lifted .prov a, .lifted .fine a, .lifted .router a { color: var(--muted); }
.lifted .meta a:hover, .lifted .prov a:hover, .lifted .fine a:hover { color: var(--rust); }
.lifted .vh, .lifted .skip { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.lifted dfn { font-style: normal; font-weight: 600; }

/* notices: the v2 .notice, by meaning (plan = information, rust = the finding's standing or a correction) */
.lifted .standing, .lifted .banner, .lifted .update, .lifted .box, .lifted .correction, .lifted .toc {
  background: var(--surface); border-left: 4px solid var(--plan); padding: var(--s2) var(--s3);
  margin: 0 0 var(--s3); max-width: var(--measure);
}
.lifted .standing, .lifted .banner { border-left-color: var(--rust); }
.lifted .correction { border-left-color: var(--rust); border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lifted .box { border-left-color: var(--field-border); }
.lifted .toc { border-left-color: var(--border); }
.lifted .standing > :last-child, .lifted .banner > :last-child, .lifted .update > :last-child,
.lifted .box > :last-child, .lifted .correction > :last-child, .lifted .toc > :last-child { margin-bottom: 0; }
.lifted .box h3 { margin-top: 0; }
.lifted .toc ol { margin: var(--s1) 0 0; }
.lifted .toc li { margin: 0 0 4px; }
.lifted .correction p { margin: 0 0 var(--s1); }
.lifted .correction .corr-h { font-size: var(--fs-2); font-weight: 600; }
.lifted .correction .corr-old { color: var(--muted); border-left: 3px solid var(--field-border); padding-left: 12px; }
.lifted .corr-tag { display: inline-block; font-size: var(--fs-0); font-weight: 600; color: var(--rust);
  border: 1px solid var(--rust); border-radius: var(--radius); padding: 0 6px; margin-right: 6px; }
.lifted .correction .corr-links a, .lifted .fig-open a, .lifted .study-firms a, .lifted .links a, .lifted .hero-links a {
  display: inline-flex; align-items: center; min-height: var(--target); }

/* research index: the featured finding and the study rows */
.lifted .panel { border-top: 2px solid var(--rust); padding: var(--s3) 0 0; margin: 0 0 var(--s4); }
.lifted .hero-num { font-size: 4rem; line-height: 1; font-weight: 600; color: var(--rust); font-variant-numeric: tabular-nums; margin: 0 0 var(--s1); }
.lifted .hero-num .unit { font-size: 0.55em; }
@media (max-width: 600px) { .lifted .hero-num { font-size: var(--fs-6); } }
.lifted .finding { font-size: var(--fs-3); line-height: 1.25; font-weight: 600; margin: 0 0 var(--s1); max-width: 32ch; }
.lifted .also { padding-top: var(--s4); }
.lifted .also .item { border-top: 1px solid var(--border); padding-top: var(--s3); max-width: 46rem; }
.lifted .links { display: flex; flex-wrap: wrap; gap: 0 var(--s3); margin: 4px 0 0; max-width: none; }
.lifted .study-list { list-style: none; padding: 0; margin: 0; max-width: 55rem; }
.lifted .study-list li { border-top: 1px solid var(--border); padding: var(--s3) 0; margin: 0; }
.lifted .study-list li:last-child { border-bottom: 1px solid var(--border); }
.lifted .study-list .t { font-size: var(--fs-2); font-weight: 600; line-height: 1.3; margin: 0 0 var(--s1); max-width: none; }
.lifted .study-list .t a { color: var(--text); text-decoration-color: var(--border); }
.lifted .study-list .t a:hover { color: var(--rust); text-decoration-color: currentColor; }
.lifted .study-list .d { margin: 0 0 var(--s1); }
.lifted .tag { display: inline-block; font-size: var(--fs-0); color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 6px; margin: 0 6px 0 0; vertical-align: middle; }
.lifted .receipts { display: flex; flex-wrap: wrap; gap: 0 var(--s2); list-style: none; padding: 0; margin: 0 0 var(--s3); max-width: none; font-size: var(--fs-0); }
.lifted .receipts li { margin: 0; }
.lifted .track { list-style: none; padding: 0; }
.lifted .track li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); margin: 0; }
.lifted .track .when { font-variant-numeric: tabular-nums; padding-top: 2px; }
@media (max-width: 480px) { .lifted .track li { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* figures: inline SVG charts take the v2 type; the old data colours map onto the v2 data palette */
.lifted figure { margin: var(--s4) 0; max-width: min(92ch, 100%); }
.lifted figure svg, .lifted .panel svg { width: 100%; height: auto; display: block; }
.lifted svg text { font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.lifted svg.chart-m { display: none; }
@media (max-width: 820px) { .lifted svg.chart-d { display: none; } .lifted svg.chart-m { display: block; max-width: 440px; } }
.lifted .chart-title { font-weight: 600; margin: 0 0 6px; max-width: none; }
.lifted figcaption { margin-top: var(--s1); max-width: var(--measure); }
.lifted .fig-open { margin: var(--s1) 0 0; max-width: none; font-size: var(--fs-0); }

/* tables: the v2 table, scrolling inside its box on phones */
.lifted .table-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 var(--s2); position: relative; }
.lifted .table-scroll th, .lifted .table-scroll td { overflow-wrap: normal; }
.lifted .scroll-hint { display: none; margin: 0 0 6px; max-width: none; }
.lifted .versions td, .lifted .versions th { font-size: var(--fs-0); }
.lifted table { font-variant-numeric: tabular-nums; }
@media (max-width: 820px) {
  .lifted .scroll-hint { display: block; }
  .lifted .scroll-hint.fits { display: none; }
  .lifted .table-scroll.sticky1 tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--bg);
    min-width: 8.5rem; box-shadow: inset -1px 0 var(--border); }
  .lifted td code { overflow-wrap: anywhere; word-break: break-all; }
}

/* definition lists, steps, code excerpts */
.lifted .gloss dt { font-weight: 600; font-size: var(--fs-2); margin-top: var(--s3); }
.lifted .gloss dd { margin: 6px 0 0; }
.lifted .memo dl { display: grid; grid-template-columns: minmax(150px, max-content) minmax(0, 1fr); gap: 12px var(--s3); max-width: 54rem; }
.lifted .memo dt { font-weight: 600; }
.lifted .memo dd { margin: 0; }
.lifted dl.skeleton { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s1) 20px; max-width: 45rem; }
.lifted dl.skeleton dt { font-weight: 600; }
.lifted dl.skeleton dd { margin: 0; }
@media (max-width: 560px) {
  .lifted .memo dl, .lifted dl.skeleton { grid-template-columns: minmax(0, 1fr); }
  .lifted .memo dd, .lifted dl.skeleton dd { margin-bottom: 12px; }
}
.lifted .risk { list-style: none; padding: 0; }
.lifted .risk li { padding: 10px 0 10px var(--s2); border-left: 2px solid var(--border); margin: 0 0 6px; }
.lifted .rules li { margin-bottom: var(--s1); }
.lifted .code-shot { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s2);
  font-family: var(--font-mono); font-size: var(--fs-0); line-height: 1.6; overflow-x: auto; max-width: min(90ch, 100%);
  margin: 0 0 var(--s2); white-space: pre; }
.lifted .client-out { font-size: var(--fs-0); }
.lifted details { max-width: var(--measure); }
.lifted details p { margin: 4px 0 10px; }

/* the free email form and the "what next" block */
.lifted .subscribe { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: var(--s3) 0; margin: var(--s4) 0; max-width: var(--measure); }
.lifted .subscribe p.lead { font-weight: 600; margin: 0 0 12px; }
.lifted .subscribe form, .lifted .next-block form { display: flex; flex-wrap: wrap; gap: var(--s1); }
.lifted .subscribe input[type="email"], .lifted .next-block input[type="email"] { flex: 1 1 220px; width: auto; min-width: 0; }
.lifted .next-block { border-top: 1px solid var(--border); margin-top: var(--s5); padding-top: var(--s1); max-width: var(--measure); }
.lifted .next-block ol { list-style: none; padding: 0; }
.lifted .next-block li { padding: var(--s1) 0; border-bottom: 1px solid var(--border); margin: 0; }
.lifted .next-block li > a { display: inline-flex; align-items: center; min-height: var(--target); }
.lifted .subscribe button, .lifted .next-block button, .lifted .btn-2 {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--target); padding: 10px 20px;
  border: 2px solid var(--rust); border-radius: var(--radius); background: var(--rust); color: var(--on-rust);
  font: 600 var(--fs-1)/1.2 var(--font-sans); cursor: pointer; text-decoration: none; }
.lifted .subscribe button:hover, .lifted .next-block button:hover { background: var(--rust-hover); border-color: var(--rust-hover); }
.lifted .btn-2 { background: transparent; color: var(--rust); }
.lifted .btn-2:hover { background: var(--surface); color: var(--rust-hover); }
.lifted .btn-row { margin: 0 0 var(--s2); }
.lifted .cta-block { margin: var(--s2) 0 var(--s1); }
.lifted .addr { font-family: var(--font-mono); font-size: max(0.875em, 14px); overflow-wrap: anywhere; }
.lifted .copy { display: block; margin: 6px 0 0; min-height: var(--target); padding: 0 12px; border: 1px solid var(--field-border);
  border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; font-size: var(--fs-0); cursor: pointer; }
.lifted .copy[hidden] { display: none; }

/* the two old calculators (their page-level <style> rules, in v2 tokens) */
.lifted .calc { max-width: var(--measure); margin: 0 0 var(--s3); }
.lifted .calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; margin: 0 0 var(--s2); }
.lifted .calc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lifted .calc-field label { font-weight: 600; }
.lifted .calc-field .hint { margin: 0; }
.lifted .calc-field input { width: 100%; min-width: 0; }
.lifted .calc-field input[aria-invalid="true"] { border: 2px solid var(--loss); }
.lifted .calc-msg { border-left: 4px solid var(--loss); background: var(--surface); padding: 10px 12px; margin: 0 0 var(--s2); }
.lifted .calc-msg:empty { display: none; }
.lifted .calc-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin: 0 0 var(--s2); max-width: none; }
.lifted .calc-out div { border-top: 2px solid var(--border); padding-top: var(--s1); min-width: 0; }
.lifted .calc-out dt { color: var(--muted); font-size: var(--fs-0); margin: 0 0 4px; overflow-wrap: anywhere; }
.lifted .calc-out dd { font-family: var(--font-mono); font-size: var(--fs-2); color: var(--text); margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.lifted .calc-out dd.na { font-family: var(--font-sans); font-size: var(--fs-1); color: var(--muted); }
.lifted .calc-reading { font-size: var(--fs-2); margin: 0 0 var(--s2); max-width: var(--measure); }
.lifted .calc-notes { margin: 0 0 var(--s2); padding-left: 1.2em; max-width: var(--measure); }

/* small links get 44 px targets on touch screens, as on the old pages */
@media (pointer: coarse), (max-width: 1000px) {
  .lifted p a:not(.btn):not(.btn-2), .lifted td a, .lifted dd a, .lifted figcaption a, .lifted li > a { padding-block: 12px; }
  .lifted li > a:only-child { display: inline-block; vertical-align: top; padding-block: 10px; min-height: var(--target); }
  .lifted h2 > a { display: inline-flex; align-items: center; min-height: var(--target); }
}

/* the old inline style attributes (blocked by the CSP), as classes: lift_pages.py STYLE_CLASS */
.lifted .ls-measure { max-width: var(--measure) !important; }
.lifted .ls-mtn6 { margin-top: -6px !important; margin-bottom: 1em !important; }
.lifted .ls-minw720 { min-width: 720px !important; }
.lifted .ls-mtn8 { margin-top: -8px !important; }
.lifted .ls-mb10-ui { margin: 0 0 10px !important; }
.lifted .ls-note { font-size: var(--fs-0) !important; color: var(--muted) !important; }
.lifted .ls-panel { max-width: 640px !important; margin: 0 0 28px !important; }
.lifted .ls-mb14 { margin: 0 0 14px !important; }
.lifted .ls-prov-note { margin-top: 12px !important; font-size: var(--fs-0) !important; color: var(--muted) !important; }
.lifted .ls-mt12 { margin: 12px 0 0 !important; }
.lifted .ls-also-top { padding-top: 0 !important; margin: 0 0 28px !important; }
.lifted .ls-text2 { color: var(--muted) !important; }
.lifted .ls-mb8 { margin: 0 0 8px !important; }
.lifted .ls-mb6 { margin: 0 0 6px !important; }
.lifted .ls-m0 { margin: 0 !important; }
.lifted .ls-boxhead { margin: 0 0 8px !important; padding: 0 !important; border: 0 !important; font-size: var(--fs-2) !important; }
.lifted .ls-mt24 { margin-top: 24px !important; }
