/* Layout concept: a field guide. Narrow reading column, a specimen-style "evidence" label on every claim,
   and a particle-size ruler as the site's signature element. Cool sea-glass paper, deep-water ink, cobalt accent. */
:root {
  --paper: #f1f5f4;
  --surface: #ffffff;
  --ink: #0f2a2b;
  --muted: #4c6564;
  --line: #d2dddb;
  --accent: #1f4fd1;
  --accent-ink: #ffffff;
  --tint: #e2e9fb;
  --good: #1d7a4d;
  --good-bg: #e1f2e9;
  --warn: #9a5c00;
  --warn-bg: #fbefd9;
  --bad: #b3261e;
  --bad-bg: #fbe4e2;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.1rem;
  --step-4: clamp(2.2rem, 5vw, 3.4rem);
  --radius: 10px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1617; --surface: #112123; --ink: #e2edeb; --muted: #94aba9; --line: #233a3b;
    --accent: #86a3ff; --accent-ink: #0b1617; --tint: #17244a;
    --good: #63c793; --good-bg: #13301f; --warn: #e5a94f; --warn-bg: #352610; --bad: #f2857b; --bad-bg: #3b1714;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b1617; --surface: #112123; --ink: #e2edeb; --muted: #94aba9; --line: #233a3b;
  --accent: #86a3ff; --accent-ink: #0b1617; --tint: #17244a;
  --good: #63c793; --good-bg: #13301f; --warn: #e5a94f; --warn-bg: #352610; --bad: #f2857b; --bad-bg: #3b1714;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: var(--step-0); line-height: 1.65;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: var(--step-4); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--step-2); font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: var(--step-1); font-weight: 650; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 16px; }

/* Header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; margin-right: auto; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: var(--step--1); font-weight: 600; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-toggle summary { list-style: none; cursor: pointer; font-weight: 700; font-size: var(--step--1); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
  .nav-toggle summary::-webkit-details-marker { display: none; }
  .nav-toggle[open] + .nav, .nav { display: none; }
  .nav-toggle[open] ~ .nav { display: flex; flex-direction: column; width: 100%; gap: 2px; padding-bottom: 8px; }
  .nav-toggle[open] ~ .nav a { padding: 8px 0; font-size: var(--step-0); }
}

/* Breadcrumbs + page hero */
.crumbs { font-size: var(--step--1); color: var(--muted); padding-top: 22px; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--muted); }
.page-hero { padding-block: 18px 28px; display: grid; gap: 14px; max-width: 780px; }
.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 600; }
.dek { font-size: var(--step-1); color: var(--muted); margin: 0; line-height: 1.5; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }

/* Article layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 48px; align-items: start; padding-bottom: 64px; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); gap: 24px; } .toc { order: -1; } }
.prose { max-width: 70ch; min-width: 0; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { margin-top: 2.2em; padding-top: 0.2em; scroll-margin-top: 90px; }
.prose h3 { margin-top: 1.6em; scroll-margin-top: 90px; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose li + li { margin-top: 0.35em; }
.prose strong { font-weight: 700; }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }

.toc { position: sticky; top: 84px; font-size: var(--step--1); border-left: 2px solid var(--line); padding-left: 16px; }
@media (max-width: 960px) { .toc { position: static; border-left: 0; padding-left: 0; } .toc details { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--surface); } }
.toc-title { font-family: var(--font-mono); text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; cursor: pointer; }
.toc ol { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* Key takeaways (answer-first block) */
.takeaways { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.takeaways h2 { font-size: var(--step-0); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin: 0 0 8px; padding: 0; }
.takeaways ul { margin: 0; padding-left: 1.2em; }

/* Evidence labels: the subject's own vocabulary for how sure we are */
.ev { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; vertical-align: 2px; white-space: nowrap; }
.ev::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ev.strong { color: var(--good); background: var(--good-bg); }
.ev.emerging { color: var(--warn); background: var(--warn-bg); }
.ev.contested { color: var(--bad); background: var(--bad-bg); }

.callout { border-left: 3px solid var(--accent); background: var(--tint); padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0; }
.callout p { margin: 0; }
.stat { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Lists of swaps / checklist */
.swaps { list-style: none; padding: 0; display: grid; gap: 10px; }
.swaps li { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 !important; }
.swaps .from { color: var(--muted); }
.swaps .arrow { color: var(--accent); font-family: var(--font-mono); }
@media (max-width: 520px) { .swaps li { grid-template-columns: minmax(0,1fr); gap: 2px; } .swaps .arrow { display: none; } .swaps .from::after { content: " →"; color: var(--accent); } }

/* Product type cards */
.ptype { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 8px; }
.ptype h3 { margin: 0 !important; }
.ptype dl { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 4px 14px; margin: 0; font-size: var(--step--1); }
.ptype dt { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding-top: 3px; }
.ptype dd { margin: 0; }
@media (max-width: 520px) { .ptype dl { grid-template-columns: minmax(0,1fr); } .ptype dd { margin-bottom: 6px; } }

/* FAQ */
.faq { display: grid; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: 700; font-family: var(--font-display); font-size: 1.05rem; }
.faq details[open] summary { margin-bottom: 8px; }
.faq details p { margin: 0; }

/* Sources */
.sources { border-top: 1px solid var(--line); margin-top: 3em; padding-top: 1.2em; font-size: var(--step--1); color: var(--muted); }
.sources h2 { font-size: var(--step-0); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 8px !important; }
.sources ol { padding-left: 1.3em; margin: 0; display: grid; gap: 4px; }

/* Related links */
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.related a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); font-weight: 650; }
.related a span { display: block; color: var(--muted); font-weight: 400; font-size: var(--step--1); margin-top: 2px; }
.related a:hover { border-color: var(--accent); }

/* Home */
.home-hero { padding-block: 44px 28px; display: grid; gap: 18px; }
.home-hero h1 { font-size: clamp(2.4rem, 6.4vw, 4.4rem); max-width: 16ch; }
.home-hero .dek { max-width: 60ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-block; padding: 10px 18px; border-radius: 999px; font-weight: 700; text-decoration: none; border: 1px solid var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { color: var(--accent); background: transparent; }

/* Particle size ruler (signature element) */
.ruler-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px 20px 14px; }
.ruler { position: relative; min-width: 640px; height: 150px; font-size: 0.74rem; font-family: var(--font-mono); }
.ruler .band { position: absolute; top: 62px; height: 22px; border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.ruler .band.micro { left: 0; width: 74%; background: var(--tint); color: var(--accent); }
.ruler .band.nano { left: 74%; width: 26%; background: var(--warn-bg); color: var(--warn); }
.ruler .axis { position: absolute; top: 90px; left: 0; right: 0; height: 1px; background: var(--muted); }
.ruler .tick { position: absolute; top: 86px; width: 1px; height: 9px; background: var(--muted); }
.ruler .tick span { position: absolute; top: 12px; left: 0; transform: translateX(-50%); color: var(--muted); white-space: nowrap; }
.ruler .tick.first span { transform: none; }
.ruler .ref { position: absolute; top: 0; transform: translateX(-50%); text-align: center; color: var(--ink); white-space: nowrap; }
.ruler .ref::after { content: ""; display: block; width: 1px; height: 16px; margin: 3px auto 0; background: var(--line); }
.ruler .ref.lo { top: 26px; }
.ruler .nsf { position: absolute; top: 122px; height: 8px; background: var(--good); border-radius: 2px; }
.ruler .nsf-label { position: absolute; top: 134px; color: var(--good); transform: translateX(-50%); white-space: nowrap; }
.ruler-caption { font-size: var(--step--1); color: var(--muted); margin: 10px 0 0; }

.section { padding-block: 36px; }
.section-head { display: grid; gap: 6px; margin-bottom: 18px; max-width: 70ch; }
.section-head p { margin: 0; color: var(--muted); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { display: grid; gap: 6px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--accent); }
.card h3 { font-size: 1.12rem; }
.card p { margin: 0; color: var(--muted); font-size: var(--step--1); }
.card .k { font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; }

.ledger { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.ledger-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: baseline; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row p { margin: 0; }
@media (max-width: 560px) { .ledger-row { grid-template-columns: minmax(0,1fr); gap: 4px; } }

.article-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.article-list li { border-bottom: 1px solid var(--line); padding: 16px 0; display: grid; gap: 4px; }
.article-list a { font-family: var(--font-display); font-weight: 650; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.article-list a:hover { color: var(--accent); }
.article-list p { margin: 0; color: var(--muted); font-size: var(--step--1); }
.article-list time { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); font-size: var(--step--1); color: var(--muted); }
.site-footer .wrap { padding-block: 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.site-footer h2 { font-size: 0.78rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink); margin-bottom: 8px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.site-footer a { color: var(--muted); }
.site-footer p { margin: 0 0 8px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
html { scroll-behavior: smooth; }

/* Article images */
.hero-img { margin: 8px 0 0; display: grid; gap: 6px; }
.hero-img img, .figure img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.hero-img img { aspect-ratio: auto; max-height: 520px; object-fit: cover; }
.figure { margin: 1.6em 0 0; display: grid; gap: 6px; }
.hero-img figcaption, .figure figcaption { font-size: var(--step--1); color: var(--muted); }
.hero-img figcaption a, .figure figcaption a { color: var(--muted); }

/* Language switcher */
.lang-switch { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px !important; color: var(--ink) !important; }
.lang-switch:hover { border-color: var(--accent); box-shadow: none !important; }
html[lang="zh-Hant"] body { font-family: "Noto Sans TC", var(--font-body); line-height: 1.8; }
html[lang="zh-Hant"] h1, html[lang="zh-Hant"] h2, html[lang="zh-Hant"] h3 { font-family: "Noto Sans TC", var(--font-display); letter-spacing: 0; }

/* Home hero animation */
.home-hero { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: center; gap: 48px; padding-block: 36px 28px; }
.hero-copy { display: grid; gap: 18px; min-width: 0; }
.hero-copy h1 { font-size: clamp(2.2rem, 4.2vw, 3.5rem); max-width: 14ch; }
.hero-stage { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; display: grid; min-width: 0; }
.hero-canvas-wrap { position: relative; height: clamp(460px, 62vh, 620px); background: radial-gradient(120% 90% at 50% 100%, var(--tint), transparent 70%); }
.hero-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
.hero-readout { display: grid; gap: 4px; padding: 16px 24px 20px; border-top: 1px solid var(--line); min-height: 128px; align-content: start; }
.hero-num { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1.05; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hero-label { font-size: var(--step-0); line-height: 1.45; }
.hero-src { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
@media (max-width: 900px) { .home-hero { grid-template-columns: minmax(0, 1fr); gap: 28px; } .hero-canvas-wrap { height: 340px; } }
