/* ALS Research Watch — design tokens and components. System fonts only (no third-party requests). */
:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --text: #1c2526;
  --muted: #55625f;
  --border: #d8dedb;
  --primary: #1f4e5a;
  --primary-ink: #ffffff;
  --link: #1b5a7a;
  --focus: #c25e00;
  --warm: #f3e9dc;
  --peer: #1d6b4f;   --peer-bg: #e3f2ea;
  --pre: #8a4b00;    --pre-bg: #fbeedd;
  --trial: #2f4f9a;  --trial-bg: #e6ecfa;
  --guide: #5a3d8a;  --guide-bg: #efe8f8;
  --company: #8a2d3b; --company-bg: #f8e6e9;
  --warn: #8a4b00;   --warn-bg: #fff3df;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 2px 8px rgb(0 0 0 / 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --step--1: clamp(0.85rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.075rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.35vw, 1.375rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.7vw, 1.8rem);
  --step-3: clamp(1.9rem, 1.6rem + 1.4vw, 2.6rem);
  --space: 1rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121819; --surface: #1a2224; --surface-2: #202a2c; --text: #e6ecea; --muted: #a3b0ad;
    --border: #2f3b3d; --primary: #6fb3c2; --primary-ink: #0d1415; --link: #8cc8e0; --focus: #ffb366;
    --warm: #2a2620;
    --peer: #8fd6b5; --peer-bg: #16302a; --pre: #f2c08a; --pre-bg: #34261a; --trial: #a9bdf2; --trial-bg: #1d2640;
    --guide: #cbb5ee; --guide-bg: #2a2140; --company: #f0a9b4; --company-bg: #3a1d23; --warn: #f2c08a; --warn-bg: #34261a;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--step-0)/1.6 var(--font); }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font: 700 var(--step-3)/1.15 var(--serif); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); font-family: var(--serif); }
h3 { font-size: var(--step-1); }
p, ul, ol, dl { margin: 0 0 1em; }

.wrap { width: min(72rem, 100% - 2rem); margin-inline: auto; }
.narrow { width: min(46rem, 100% - 2rem); }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; background: var(--primary); color: var(--primary-ink); padding: 0.6rem 1rem; z-index: 10; border-radius: 0 0 6px 6px; }
.skip-link:focus { top: 0; }
main { display: block; padding-bottom: 3rem; }
main:focus { outline: none; }

.preview-bar { background: var(--warn-bg); color: var(--warn); text-align: center; padding: 0.5rem 1rem; font-weight: 600; }
.offline-banner { background: var(--warn-bg); color: var(--warn); text-align: center; padding: 0.5rem 1rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 0.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; min-height: 44px; }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; margin: 0; padding: 0; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 0.25rem; color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--link); text-decoration: underline; text-decoration-thickness: 2px; }

/* Profile */
.profile { background: var(--warm); border-bottom: 1px solid var(--border); }
.profile-inner { display: flex; gap: 1.25rem; align-items: center; padding-block: 1.25rem; }
.profile-photo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--surface); }
.profile-name { font-size: var(--step-1); font-family: var(--font); margin-bottom: 0.25rem; }
.profile-desc { margin-bottom: 0.5rem; max-width: 60ch; }
.social { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; padding: 0; margin: 0; }
.social a { display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 40em) { .profile-photo { width: 120px; height: 120px; } }

/* Hero */
.hero { padding-block: 2.5rem 1.5rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--step--1); font-weight: 600; color: var(--muted); margin-bottom: 0.5rem; }
.lede { font-size: var(--step-1); max-width: 62ch; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.last-check { font-size: var(--step--1); color: var(--muted); margin-top: 1rem; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.55rem 1.1rem; border-radius: 8px; border: 2px solid var(--primary); background: var(--primary); color: var(--primary-ink); font: 600 1rem var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--primary); }
.filters { display: grid; gap: 0.75rem; grid-template-columns: 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
@media (min-width: 48em) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; } }
.field label { display: block; font-weight: 600; font-size: var(--step--1); margin-bottom: 0.25rem; }
.field input, .field select { width: 100%; min-height: 44px; padding: 0.5rem 0.65rem; border: 1px solid #8a9895; border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
.field-actions { display: flex; gap: 0.5rem; }

/* Feed */
.feed-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 1rem; margin-top: 1rem; }
.result-count { min-height: 1.5em; color: var(--muted); }
.post-list { display: grid; gap: 1rem; }
.post-card { background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--primary); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.post-card.has-notice { border-left-color: var(--warn); }
.post-card h3 { margin: 0.4rem 0 0.25rem; font-size: var(--step-1); }
.post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h3 a:hover { color: var(--link); text-decoration: underline; }
.cite { font-size: var(--step--1); }
.card-actions { margin: 0; font-weight: 600; }
.card-actions a { display: inline-block; padding-block: 0.4rem; }
.labels { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.label { display: inline-block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.label-peer_reviewed { background: var(--peer-bg); color: var(--peer); border-color: transparent; }
.label-preprint { background: var(--pre-bg); color: var(--pre); border-color: transparent; }
.label-trial_registration { background: var(--trial-bg); color: var(--trial); border-color: transparent; }
.label-guideline, .label-official_update { background: var(--guide-bg); color: var(--guide); border-color: transparent; }
.label-company_claim, .label-secondary_report { background: var(--company-bg); color: var(--company); border-color: transparent; }
.label-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.dates { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: var(--step--1); color: var(--muted); margin: 0 0 0.6rem; }
.dates div { display: flex; gap: 0.35rem; }
.dates dt { font-weight: 600; }
.dates dt::after { content: ":"; }
.dates dd { margin: 0; }
.pagination { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: center; margin-top: 1.5rem; }
.pagination a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 0.75rem; font-weight: 600; }
.empty, .state { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 1.5rem; }
.state { margin-top: 2rem; }
.legend { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.legend dl { display: grid; gap: 0.6rem; }
.legend dl div { display: grid; grid-template-columns: 10rem 1fr; gap: 0.75rem; align-items: start; }
.legend dd { margin: 0; color: var(--muted); }
@media (max-width: 30em) { .legend dl div { grid-template-columns: 1fr; gap: 0.2rem; } }

/* Post detail and prose pages */
.post-detail, .prose { padding-top: 1.5rem; }
.crumbs { margin-bottom: 1rem; }
.crumbs a { display: inline-flex; min-height: 44px; align-items: center; }
.prose p, .prose li { max-width: 68ch; }
.prose h2 { margin-top: 2rem; }
.notice { background: var(--warn-bg); color: var(--text); border-left: 4px solid var(--warn); padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.notice p:last-child { margin-bottom: 0; }
.limits { background: var(--surface-2); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.5rem 0; }
.limits h2 { font-size: var(--step-1); font-family: var(--font); margin-top: 0; }
.limits p:last-child { margin: 0; }
.sources h2, .history h2 { margin-top: 2rem; }
.source { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.source-title { font-weight: 700; }
.meta { display: grid; gap: 0.3rem; font-size: var(--step--1); }
.meta div { display: grid; grid-template-columns: 11rem 1fr; gap: 0.75rem; }
.meta dt { color: var(--muted); font-weight: 600; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 30em) { .meta div { grid-template-columns: 1fr; gap: 0; } }
.history ul, .related { padding-left: 1.2rem; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1.25rem; margin-bottom: 1.5rem; }
.toc ul { margin: 0; padding-left: 1.1rem; columns: 2 14rem; }
.toc a { display: inline-block; padding-block: 0.2rem; }
.refs li { margin-bottom: 0.4rem; overflow-wrap: anywhere; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-block: 1.5rem; font-size: var(--step--1); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; padding: 0; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
.disclaimer { max-width: 75ch; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media print {
  .site-header nav, .filters, .pagination, .skip-link, .offline-banner { display: none; }
  body { background: #fff; color: #000; }
  .post-card, .source { box-shadow: none; break-inside: avoid; }
}

/* Keep the four menu items on one line on phones. */
@media (max-width: 30em) {
  .nav { gap: 0.25rem 0.6rem; }
  .nav a { padding-inline: 0.15rem; font-size: 0.95rem; }
}

/* Owner profile on the contact page */
.owner { background: var(--warm); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.75rem; }
.owner-head { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; }
.owner-photo { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); flex: none; }
@media (min-width: 40em) { .owner-photo { width: 140px; height: 140px; } }
.owner-name { font-family: var(--font); font-size: var(--step-2); margin: 0 0 0.35rem; }
.owner-facts { display: grid; gap: 0.15rem; margin: 0; font-size: var(--step--1); }
.owner-facts div { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.owner-facts dt { font-weight: 600; color: var(--muted); }
.owner-facts dt::after { content: ":"; }
.owner-facts dd { margin: 0; }
.owner-desc { margin: 1rem 0 0.5rem; }
.owner-social { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; padding: 0; margin: 0.5rem 0 0; }
.owner-social a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.owner-bank { background: var(--surface); border-radius: 8px; padding: 0.9rem 1.1rem; margin-top: 1rem; }
.owner-bank h3 { margin: 0 0 0.4rem; font-size: var(--step-1); }
.owner-bank-details { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.95rem; overflow-wrap: anywhere; margin-bottom: 0.5rem; }

/* Homepage hero: text + C9orf72 animation (transparent canvas, theme colours) */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: center; }
@media (min-width: 56em) { .hero-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 2.5rem; } }
.dna-figure {
  --dna-strand-a: #2b6fcc; --dna-strand-b: #2aa0b0;
  margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; background: transparent;
}
@media (prefers-color-scheme: dark) { .dna-figure { --dna-strand-a: #5b9bf0; --dna-strand-b: #4fc3d1; } }
.dna-figure canvas { display: block; width: auto; height: 440px; aspect-ratio: 240 / 520; background: transparent; }
@media (max-width: 55.99em) { .dna-figure canvas { height: 320px; } }
.dna-labels { position: relative; width: 100%; max-width: 320px; height: 3.4rem; text-align: center; }
.dna-label { position: absolute; inset: 0; opacity: 0; display: flex; flex-direction: column; align-items: center; }
.dna-main { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.dna-sub { font-size: 0.875rem; color: var(--muted); margin-top: 0.2rem; }
