/* Sanenza site, built on the Sanenza design system.
   Rules: one page background for every section, header and footer; no dividers between sections;
   no colour fades, no see-through layers, no shadows of any kind. Depth comes from solid surface steps and the leaf corner.
   Light is the default; dark follows the OS, and the header toggle overrides either way. */

:root {
  --surface: #EEF4F0;
  --surface-raised: #FFFFFF;
  --surface-sunken: #E0EAE4;
  --ink: #0F1F1A;
  --muted: #45574E;
  --brand: #0B7A5F;
  --brand-strong: #075E49;
  --brand-soft: #D2EADF;
  --on-brand: #FFFFFF;
  --accent: #A12F6B;
  --accent-soft: #F4DDE9;
  --responder: #1F5FA8;
  --responder-soft: #DCE8F7;
  --adverse: #B0460A;
  --adverse-soft: #F9E3D3;
  --cell: #7D9188;
  --field-border: #6A7F76;

  --font-display: "Spectral", "Iowan Old Style", Georgia, serif;
  --font-text: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --font-data: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px; --space-20: 80px;
  --radius-field: 4px;
  --leaf-sm: 8px; --leaf-md: 16px; --leaf-lg: 32px;
  --max: 1200px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #0B1512; --surface-raised: #14231E; --surface-sunken: #060D0B;
    --ink: #E6F0EB; --muted: #A3B8AF;
    --brand: #45C9A1; --brand-strong: #86E2C4; --brand-soft: #10392D; --on-brand: #03201A;
    --accent: #F293C3; --accent-soft: #3A1528;
    --responder: #8DB9F2; --responder-soft: #142B47; --adverse: #FFA06A; --adverse-soft: #43220E;
    --cell: #5E756B; --field-border: #71897F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: #0B1512; --surface-raised: #14231E; --surface-sunken: #060D0B;
  --ink: #E6F0EB; --muted: #A3B8AF;
  --brand: #45C9A1; --brand-strong: #86E2C4; --brand-soft: #10392D; --on-brand: #03201A;
  --accent: #F293C3; --accent-soft: #3A1528;
  --responder: #8DB9F2; --responder-soft: #142B47; --adverse: #FFA06A; --adverse-soft: #43220E;
  --cell: #5E756B; --field-border: #71897F;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface); color: var(--ink);
  font-family: var(--font-text); font-size: 17px; line-height: 27px;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--brand-strong); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--brand-strong); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: var(--space-4); top: var(--space-4); z-index: 100; background: var(--brand); color: var(--on-brand); padding: var(--space-2) var(--space-4); }
sup { font-size: 0.7em; line-height: 0; }
.sel { user-select: all; }

.wrap {
  width: 100%; max-width: calc(var(--max) + 48px); margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
@media (max-width: 640px) {
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}

/* Leaf corner: rounded top-right and bottom-left, square elsewhere */
.leaf-sm { border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); }
.leaf-md { border-radius: 0 var(--leaf-md) 0 var(--leaf-md); }
.leaf-lg { border-radius: 0 var(--leaf-lg) 0 var(--leaf-lg); }

/* Pentagon marker from the Cohort mark */
.pent { display: inline-block; width: 10px; height: 10px; flex: none; background: var(--accent); clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); }

/* ---------- Type ---------- */
.display-xl, .display, .h2, .brand span, .panel-title, .loop-item strong, .nav-menu a strong, .scen strong, .role strong { font-family: var(--font-display); }
.display-xl { font-weight: 600; font-size: clamp(40px, 6vw, 68px); line-height: 1.04; letter-spacing: -0.015em; text-wrap: balance; }
.display { font-weight: 600; font-size: clamp(30px, 3.6vw, 40px); line-height: 1.15; letter-spacing: -0.005em; text-wrap: balance; }
.h2 { font-weight: 500; font-size: 23px; line-height: 29px; text-wrap: balance; }
.lead { font-size: 20px; line-height: 31px; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }
.small { font-size: 15px; line-height: 23px; }
.label { font-family: var(--font-data); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.09em; text-transform: uppercase; }
.eyebrow { color: var(--muted); display: inline-flex; align-items: center; gap: var(--space-2); }
.mono { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.prose { display: grid; gap: var(--space-4); max-width: 68ch; color: var(--muted); font-size: 18px; line-height: 29px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: var(--surface); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--surface); }
.nav { display: flex; align-items: center; gap: var(--space-4); height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; }
.brand svg { width: 32px; height: 32px; color: var(--brand); }
.brand span { font-weight: 600; font-size: 26px; line-height: 1; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.nav > nav { margin-left: auto; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links > li { position: relative; }
.nav-link, .nav-menu-btn {
  font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none;
  background: var(--surface); border: 0; cursor: pointer; padding: var(--space-2) var(--space-3);
  display: inline-flex; align-items: center; gap: 6px; border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm);
}
.nav-link:hover, .nav-menu-btn:hover { background: var(--surface-sunken); color: var(--ink); }
.nav-link[aria-current="page"], .nav-menu-btn.is-active { background: var(--brand-soft); color: var(--brand-strong); }
.nav-menu-btn svg { width: 10px; height: 10px; flex: none; transition: transform 160ms ease-out; }
.nav-menu-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-menu {
  position: absolute; top: calc(100% + 10px); left: 0; width: 360px; background: var(--surface-raised);
  padding: var(--space-3); display: grid; gap: 2px; z-index: 70; border-radius: 0 var(--leaf-md) 0 var(--leaf-md);
}
.nav-menu[hidden] { display: none; }
.nav-menu a { display: grid; gap: 2px; padding: var(--space-3); color: var(--ink); text-decoration: none; border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); }
.nav-menu a:hover, .nav-menu a[aria-current="page"] { background: var(--brand-soft); }
.nav-menu a strong { font-weight: 600; font-size: 18px; }
.nav-menu a span { font-size: 14px; line-height: 20px; color: var(--muted); }
.theme-toggle, .nav-toggle {
  width: 44px; height: 44px; display: inline-grid; place-items: center; flex: none;
  background: var(--surface-raised); color: var(--ink); border: 0; cursor: pointer; border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm);
}
.theme-toggle svg, .nav-toggle svg { width: 20px; height: 20px; }
.theme-toggle .i-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; } :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; } }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.nav-toggle { display: none; }
.site-header .nav-cta-item, .site-header .nav-account-item { display: none; }
/* Account link: a quiet text link before the primary button, never a filled button. */
.nav-account {
  flex: none; font-size: 15px; font-weight: 600; line-height: 20px; color: var(--brand-strong); white-space: nowrap;
  padding: var(--space-2) var(--space-1); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.nav-account:hover { color: var(--ink); }
.nav-account[aria-current="page"] { color: var(--ink); text-decoration-thickness: 2px; }
.acct-short { display: none; }
.nav-link, .nav-menu-btn, .nav-cta { white-space: nowrap; }
/* Mid widths: the account link shortens to "Sign in"; the full label stays for screen readers. */
@media (max-width: 1360px) and (min-width: 1081px) {
  .nav-account .acct-full { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-account .acct-short { display: inline; }
}
@media (max-width: 1240px) and (min-width: 1081px) {
  .nav { gap: var(--space-3); }
  .nav-link, .nav-menu-btn { padding-inline: var(--space-2); }
}

@media (max-width: 1080px) {
  .nav { height: 64px; gap: var(--space-3); }
  .nav > nav { margin-left: 0; position: absolute; left: 0; right: 0; top: 64px; background: var(--surface); display: none; }
  .site-header.open .nav > nav { display: block; max-height: calc(100vh - 64px); overflow-y: auto; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 0; padding: var(--space-2) max(16px, env(safe-area-inset-right, 0px)) var(--space-8) max(16px, env(safe-area-inset-left, 0px)); }
  .nav-link, .nav-menu-btn { width: 100%; justify-content: space-between; padding: var(--space-4) var(--space-3); font-size: 18px; }
  .nav-menu { position: static; width: auto; padding: 0 0 var(--space-3); background: var(--surface); }
  .nav-menu a { padding: var(--space-3) var(--space-4); background: var(--surface-raised); }
  .site-header .nav-links .nav-account-item { display: block; }
  .site-header .nav > .nav-account { display: none; }
  .site-header .nav-links .nav-cta-item { display: block; padding-top: var(--space-4); }
  .site-header .nav-cta-item .btn { width: 100%; justify-content: center; }
  .theme-toggle { margin-left: auto; }
  .nav-toggle { display: inline-grid; }
}
@media (max-width: 480px) { .site-header .nav > .nav-cta { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 46px;
  padding: var(--space-3) var(--space-6); border: 0; cursor: pointer;
  font-family: var(--font-text); font-size: 15px; font-weight: 600; line-height: 20px;
  text-decoration: none; transition: background-color 180ms ease-out, color 180ms ease-out;
  border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm);
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); color: var(--on-brand); }
.btn-secondary { background: var(--brand-soft); color: var(--brand-strong); }
.btn-secondary:hover { background: var(--surface-sunken); color: var(--ink); }
.btn-ghost { background: var(--surface); color: var(--brand-strong); padding-left: var(--space-2); padding-right: var(--space-2); text-decoration: underline; }
.btn-ghost:hover { color: var(--ink); }
.btn-sm { min-height: 40px; padding: var(--space-2) var(--space-4); font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); align-items: center; }
.btn-row.center { justify-content: center; }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3);
  font-family: var(--font-data); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); background: var(--surface-sunken); color: var(--ink); white-space: nowrap;
}
.tag-brand { background: var(--brand-soft); color: var(--brand-strong); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-responder { background: var(--responder-soft); color: var(--responder); }
.tag-adverse { background: var(--adverse-soft); color: var(--adverse); }

/* ---------- Sections and grid ---------- */
section { padding-block: var(--space-20); }
main > section:first-child { padding-top: var(--space-16); }
@media (max-width: 640px) { section { padding-block: var(--space-16); } main > section:first-child { padding-top: var(--space-10); } }
.sec-head { display: grid; gap: var(--space-4); max-width: 760px; margin-bottom: var(--space-10); }
.grid { display: grid; gap: var(--space-5); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Hero: centred thesis on the axis, figure centred below ---------- */
.hero { display: grid; gap: var(--space-12); justify-items: center; }
.hero-copy { display: grid; gap: var(--space-5); justify-items: center; text-align: center; max-width: 880px; min-width: 0; }
.hero-copy .lead { margin-inline: auto; }
.hero-note { font-size: 14px; line-height: 20px; color: var(--muted); }
.hero-figure { width: 100%; max-width: 1080px; min-width: 0; }
.hero-figure > .panel { max-width: 720px; margin-inline: auto; }

/* ---------- Population figure ---------- */
.pop-fig { background: var(--surface-raised); padding: var(--space-6) var(--space-8); display: grid; gap: var(--space-6); }
.pop-head, .panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2) var(--space-4); }
.pop-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px) minmax(0, 1fr); gap: var(--space-8); align-items: center; }
.pop-grid { min-width: 0; }
.pop { width: 100%; height: auto; }
.pop .pt { transition: fill 200ms ease-out; }
.pop .pt.is-n { fill: var(--cell); }
.pop .pt.is-r { fill: var(--responder); }
.pop .pt.is-a { fill: var(--adverse); }
.pop .pt use:last-child { display: none; }
.pop .pt.is-a use:first-child { display: none; }
.pop .pt.is-a use:last-child { display: inline; }
.pop .pt.sub.is-n, .pop .pt.sub.is-r { fill: var(--accent); }
.pop-stats { display: grid; gap: var(--space-3); min-width: 0; }
.stat { background: var(--surface-sunken); padding: var(--space-4) var(--space-5); display: grid; gap: 2px; border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); }
.stat .label { color: var(--muted); }
.stat strong { font-family: var(--font-data); font-weight: 500; font-size: 28px; line-height: 34px; font-variant-numeric: tabular-nums; }
.pop-side { display: grid; gap: var(--space-5); min-width: 0; }
.pop-legend { display: grid; gap: var(--space-2); font-size: 15px; line-height: 22px; }
.pop-legend li { display: flex; align-items: center; gap: var(--space-3); }
.pop-legend i { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 0 4px 0 4px; }
.lg-r { background: var(--responder); } .lg-n { background: var(--cell); } .lg-sub { background: var(--accent); }
.lg-a { background: var(--adverse); clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); border-radius: 0 !important; }
@media (max-width: 960px) {
  .pop-body { grid-template-columns: minmax(0, 1fr); }
  .pop-grid { order: -1; max-width: 420px; width: 100%; margin-inline: auto; }
  .pop-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) { .pop-fig { padding: var(--space-5); } .pop-stats { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Panels ---------- */
.panel { background: var(--surface-raised); padding: var(--space-6) var(--space-8); display: grid; gap: var(--space-4); min-width: 0; }
.panel-title { font-weight: 600; font-size: 21px; line-height: 27px; }
.panel-foot { font-size: 14px; line-height: 20px; color: var(--muted); }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: 0; }
.panel dt, .panel dd { padding: var(--space-2) var(--space-3); font-size: 15px; line-height: 22px; }
.panel dt { color: var(--muted); }
.panel dd { font-family: var(--font-data); font-variant-numeric: tabular-nums; text-align: right; }
.panel dt:nth-of-type(odd), .panel dd:nth-of-type(odd) { background: var(--surface-sunken); }
.panel-action { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); justify-content: space-between; align-items: center; background: var(--brand-soft); padding: var(--space-3) var(--space-4); font-size: 15px; line-height: 22px; border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); }
@media (max-width: 640px) { .panel { padding: var(--space-5); } .panel dl { grid-template-columns: minmax(0, 1fr); } .panel dd { text-align: left; padding-top: 0; } .panel dt:nth-of-type(odd), .panel dd:nth-of-type(odd) { background: var(--surface-raised); } }

/* ---------- Cards, steps, metrics ---------- */
.card { background: var(--surface-raised); padding: var(--space-6); display: grid; gap: var(--space-3); align-content: start; color: var(--ink); min-width: 0; }
.card p { color: var(--muted); font-size: 16px; line-height: 25px; }
.card-link { text-decoration: none; transition: background-color 180ms ease-out; }
.card-link:hover { background: var(--brand-soft); color: var(--ink); }
.card-link .more { color: var(--brand-strong); font-weight: 600; font-size: 15px; text-decoration: underline; text-underline-offset: 4px; }
.ticks { display: grid; gap: var(--space-2); }
.ticks li { display: grid; grid-template-columns: 14px 1fr; gap: var(--space-3); align-items: baseline; }
.ticks li::before { content: ""; width: 10px; height: 10px; background: var(--brand); clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); transform: translateY(1px); }
.step { background: var(--surface-raised); padding: var(--space-6); display: grid; gap: var(--space-3); align-content: start; min-width: 0; }
.step-n { font-family: var(--font-display); font-weight: 600; font-size: 44px; line-height: 44px; color: var(--brand); }
.step p { color: var(--muted); font-size: 16px; line-height: 25px; }
.step .label { color: var(--accent); }
.metric { background: var(--surface-raised); padding: var(--space-5) var(--space-6); display: grid; gap: var(--space-1); align-content: start; min-width: 0; }
.metric .label { color: var(--muted); }
.metric-value { font-family: var(--font-data); font-weight: 500; font-size: 30px; line-height: 36px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.metric-value small { font-size: 15px; color: var(--muted); margin-left: var(--space-1); }
.metric p { font-size: 14px; line-height: 20px; color: var(--muted); }

/* ---------- Split: copy left, panel right by default ---------- */
.split { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-10) var(--space-10); align-items: center; }
.split > .split-copy-wrap { grid-column: 1 / span 5; min-width: 0; }
.split > .split-panel { grid-column: 6 / span 7; min-width: 0; }
.split.flip > .split-copy-wrap { grid-column: 8 / span 5; grid-row: 1; }
.split.flip > .split-panel { grid-column: 1 / span 7; grid-row: 1; }
.split-copy { display: grid; gap: var(--space-4); min-width: 0; }
@media (max-width: 960px) { .split > .split-copy-wrap, .split > .split-panel, .split.flip > .split-copy-wrap, .split.flip > .split-panel { grid-column: 1 / -1; grid-row: auto; } }

/* ---------- Loop ---------- */
.loop { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.loop > li { min-width: 0; display: grid; }
.loop-item { background: var(--surface-raised); padding: var(--space-5) var(--space-6); display: grid; grid-template-columns: auto 1fr; gap: var(--space-1) var(--space-4); align-content: start; text-decoration: none; color: var(--ink); min-width: 0; transition: background-color 180ms ease-out; }
.loop-item:hover { background: var(--brand-soft); color: var(--ink); }
.loop-n { grid-row: span 3; font-size: 15px; color: var(--brand-strong); padding-top: 2px; }
.loop-item .label { color: var(--accent); }
.loop-item strong { font-size: 22px; line-height: 28px; font-weight: 600; }
.loop-item p { font-size: 15px; line-height: 23px; color: var(--muted); }
.loop-item.is-active { background: var(--brand); color: var(--on-brand); }
.loop-item.is-active .label, .loop-item.is-active p, .loop-item.is-active .loop-n { color: var(--on-brand); }
.loop-return { margin-top: var(--space-3); background: var(--surface-sunken); padding: var(--space-4) var(--space-6); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: baseline; color: var(--muted); }
.loop-return .label { color: var(--brand-strong); }
@media (max-width: 960px) { .loop { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .loop { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Stack chips, roles, plans ---------- */
.stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.stack-item { background: var(--surface-raised); padding: var(--space-4) var(--space-5); display: grid; gap: 2px; min-width: 0; }
.stack-item strong { font-size: 16px; font-weight: 600; }
.stack-item span { font-size: 14px; line-height: 20px; color: var(--muted); }
.roles { display: grid; gap: var(--space-2); }
.role { background: var(--surface-raised); padding: var(--space-4) var(--space-5); display: grid; grid-template-columns: 200px 1fr auto; gap: var(--space-2) var(--space-5); align-items: baseline; }
.role strong { font-size: 19px; font-weight: 600; }
@media (max-width: 760px) { .role { grid-template-columns: minmax(0, 1fr); } }
.plan { background: var(--surface-raised); padding: var(--space-8) var(--space-6); display: grid; gap: var(--space-4); align-content: start; min-width: 0; }
.plan p { color: var(--muted); font-size: 16px; line-height: 25px; }
.plan .btn { justify-self: start; }
.plan-main { background: var(--brand-soft); }
.plan-main .btn-secondary { background: var(--surface-raised); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 15px; line-height: 22px; }
caption { text-align: left; color: var(--muted); padding-bottom: var(--space-3); caption-side: bottom; padding-top: var(--space-3); }
th, td { text-align: left; padding: var(--space-3) var(--space-4); vertical-align: top; }
thead th { font-family: var(--font-data); font-size: 12px; line-height: 16px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--surface); }
tbody tr:nth-child(odd) { background: var(--surface-raised); }
tbody tr:nth-child(even) { background: var(--surface-sunken); }
tbody th { font-weight: 600; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: var(--space-2); max-width: 880px; }
.faq details { background: var(--surface-raised); border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); }
.faq summary { cursor: pointer; padding: var(--space-4) var(--space-5); font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: var(--space-4); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-data); color: var(--brand-strong); flex: none; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 var(--space-5) var(--space-5); color: var(--muted); max-width: 70ch; }

/* ---------- CTA band: centred, like the hero ---------- */
.cta { background: var(--brand); color: var(--on-brand); padding: var(--space-16) var(--space-10); display: grid; gap: var(--space-5); justify-items: center; text-align: center; }
.cta > svg { width: 44px; height: 44px; color: var(--on-brand); }
.cta p { max-width: 58ch; }
.cta .btn-primary { background: var(--on-brand); color: var(--brand); }
.cta .btn-primary:hover { background: var(--surface); color: var(--ink); }
.cta .btn-ghost { background: var(--brand); color: var(--on-brand); }
.cta :focus-visible { outline-color: var(--on-brand); }
@media (max-width: 640px) { .cta { padding: var(--space-12) var(--space-5); } }

/* ---------- Code ---------- */
.code { background: var(--surface-sunken); min-width: 0; overflow: hidden; }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) var(--space-4) var(--space-3) var(--space-6); background: var(--surface-raised); }
.code-bar .label { color: var(--muted); }
.copy-btn { font-family: var(--font-text); font-size: 14px; font-weight: 600; background: var(--brand-soft); color: var(--brand-strong); border: 0; padding: var(--space-2) var(--space-3); cursor: pointer; min-height: 36px; border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); }
.copy-btn:hover { background: var(--surface-sunken); color: var(--ink); }
.code pre { margin: 0; padding: var(--space-5) var(--space-6); overflow-x: auto; font-family: var(--font-data); font-size: 14px; line-height: 22px; color: var(--ink); }
.code .k { color: var(--brand-strong); } .code .s { color: var(--accent); } .code .c { color: var(--muted); }

/* ---------- Filter chips and catalogue ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.chip { font-family: var(--font-text); font-size: 15px; font-weight: 600; padding: var(--space-2) var(--space-4); min-height: 40px; border: 0; background: var(--surface-raised); color: var(--ink); cursor: pointer; border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); }
.chip:hover { background: var(--brand-soft); }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
.filter-count { margin-bottom: var(--space-4); }
.scen { background: var(--surface-raised); padding: var(--space-5) var(--space-6); display: grid; gap: var(--space-3); align-content: start; min-width: 0; }
.scen[hidden] { display: none; }
.scen-head { display: flex; justify-content: space-between; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; }
.scen strong { font-size: 20px; line-height: 26px; font-weight: 600; }
.scen dl { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-3); font-size: 14px; line-height: 20px; }
.scen dt { color: var(--muted); } .scen dd { font-family: var(--font-data); text-align: right; }

/* ---------- Estimator ---------- */
.est { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-5); }
.est-inputs { grid-column: 1 / span 7; background: var(--surface-raised); padding: var(--space-6) var(--space-8); display: grid; gap: var(--space-5); min-width: 0; }
.est-out { grid-column: 8 / span 5; display: grid; gap: var(--space-3); align-content: start; min-width: 0; }
.range { display: grid; gap: var(--space-2); }
.range-top { display: flex; justify-content: space-between; gap: var(--space-3); font-weight: 600; }
.range output { font-family: var(--font-data); font-weight: 500; color: var(--brand-strong); }
input[type=range] { width: 100%; accent-color: var(--brand); min-height: 32px; }
.est-assume { font-size: 14px; line-height: 20px; color: var(--muted); }
@media (max-width: 960px) { .est-inputs, .est-out { grid-column: 1 / -1; } .est-inputs { padding: var(--space-5); } }

/* ---------- Forms ---------- */
.form { background: var(--surface-raised); padding: var(--space-8); display: grid; gap: var(--space-5); min-width: 0; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
@media (max-width: 640px) { .form { padding: var(--space-5); } .form-row { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: var(--space-2); min-width: 0; }
.field label { font-weight: 600; font-size: 15px; line-height: 20px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: var(--space-2) var(--space-3); font: inherit; font-size: 16px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--field-border); border-radius: var(--radius-field);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--brand-strong); outline-offset: 1px; }
.hint { font-size: 14px; line-height: 20px; color: var(--muted); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border: 2px solid var(--adverse); }
.field.invalid .hint, .check.invalid .hint { color: var(--adverse); }
.check { display: grid; grid-template-columns: 24px 1fr; gap: var(--space-2) var(--space-3); align-items: start; font-size: 15px; line-height: 22px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); }
.check .hint { grid-column: 2; }
.form-status { padding: var(--space-4) var(--space-5); background: var(--responder-soft); color: var(--ink); font-size: 15px; line-height: 22px; border-radius: 0 var(--leaf-sm) 0 var(--leaf-sm); }
.form-status.err { background: var(--adverse-soft); }
.form-status[hidden] { display: none; }

/* ---------- Investigator sign-in: centred, on the same axis as the hero ---------- */
.signin { max-width: 560px; margin-inline: auto; display: grid; gap: var(--space-8); }
.signin-copy { display: grid; gap: var(--space-4); justify-items: center; text-align: center; }
.emails { display: grid; gap: var(--space-2); }
.email-row { background: var(--surface-raised); padding: var(--space-4) var(--space-5); display: grid; gap: 2px; }
.email-row .mono { font-size: 17px; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); padding-block: var(--space-16) var(--space-10); }
.foot { display: grid; grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); gap: var(--space-8); }
.foot-brand { display: grid; gap: var(--space-4); align-content: start; max-width: 340px; }
.foot-brand p { font-size: 15px; line-height: 23px; color: var(--muted); }
.foot h2 { font-family: var(--font-data); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-3); }
.foot ul { display: grid; gap: var(--space-2); }
.foot ul a { color: var(--ink); text-decoration: none; font-size: 15px; }
.foot ul a:hover { color: var(--brand-strong); text-decoration: underline; }
.foot-base { margin-top: var(--space-12); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); font-size: 14px; color: var(--muted); }
@media (max-width: 960px) { .foot { grid-template-columns: repeat(2, minmax(0, 1fr)); } .foot-brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .foot { grid-template-columns: minmax(0, 1fr); } }

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