/* Grino #27 — full research page. Light + dark via prefers-color-scheme, print-friendly. */
:root {
  --bg: #fbfbf8;
  --surface: #ffffff;
  --text: #1b1f1d;
  --muted: #56615b;
  --rule: #dce2de;
  --accent: #253b33;
  --accent-ink: #253b33;
  --accent-soft: #e7efeb;
  --link: #2c5a4a;
  --warn-bg: #fff6e5;
  --warn-rule: #d9a441;
  --bad: #a3392a;
  --code-bg: #f1f3f1;
  --tag-data: #2c5a4a;
  --tag-model: #7a4f9c;
  --tag-assump: #9a6a12;
  --tag-nv: #a3392a;
  --font-head: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513;
    --surface: #171c19;
    --text: #e3e8e5;
    --muted: #9eaaa3;
    --rule: #2c3531;
    --accent: #253b33;
    --accent-ink: #9fcab8;
    --accent-soft: #1d2a24;
    --link: #9fcab8;
    --warn-bg: #2a2416;
    --warn-rule: #b98a2e;
    --bad: #e08a78;
    --code-bg: #1d2320;
    --tag-data: #9fcab8;
    --tag-model: #c7a6e6;
    --tag-assump: #e2bb6a;
    --tag-nv: #e08a78;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513;
  --surface: #171c19;
  --text: #e3e8e5;
  --muted: #9eaaa3;
  --rule: #2c3531;
  --accent: #253b33;
  --accent-ink: #9fcab8;
  --accent-soft: #1d2a24;
  --link: #9fcab8;
  --warn-bg: #2a2416;
  --warn-rule: #b98a2e;
  --bad: #e08a78;
  --code-bg: #1d2320;
  --tag-data: #9fcab8;
  --tag-model: #c7a6e6;
  --tag-assump: #e2bb6a;
  --tag-nv: #e08a78;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; color: var(--text); }
h2 { font-size: 1.55rem; margin: 3.2rem 0 0.8rem; padding-top: 0.6rem; border-top: 2px solid var(--accent); }
h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
h4 { font-size: 1rem; margin: 1.4rem 0 0.4rem; }
h2 .num, h3 .num { color: var(--accent-ink); margin-right: 0.35em; }
.anchor { margin-left: 0.4em; font-size: 0.8em; text-decoration: none; color: var(--muted); opacity: 0; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
p, li { max-width: 72ch; }
ul, ol { padding-left: 1.3em; }
li { margin: 0.25em 0; }
small, .small { font-size: 0.875rem; }
code, .mono { font-family: var(--font-mono); font-size: 0.86em; background: var(--code-bg); padding: 0.05em 0.3em; border-radius: 3px; overflow-wrap: anywhere; }
pre { font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.45; background: var(--code-bg); padding: 0.9rem 1rem; border-radius: 6px; overflow-x: auto; max-width: 100%; }
pre code { background: none; padding: 0; font-size: inherit; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

/* layout */
.page {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
  gap: 3rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}
.toc {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 1.6rem 0 2rem;
  font-family: var(--font-head);
  font-size: 0.86rem;
  line-height: 1.35;
}
.toc .toc-title { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.72rem; color: var(--muted); margin: 0 0 0.6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; max-width: none; }
.toc a { display: block; padding: 0.28rem 0.6rem; border-left: 2px solid var(--rule); color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); border-left-color: var(--muted); }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent-ink); font-weight: 600; }
.toc ol ol a { padding-left: 1.4rem; font-size: 0.8rem; }
.toc-mobile { display: none; }
main { min-width: 0; padding-top: 1.6rem; }

/* header */
.kicker { font-family: var(--font-head); font-size: 0.82rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-ink); font-weight: 600; margin: 0 0 0.6rem; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.45rem); margin: 0 0 0.9rem; letter-spacing: -0.01em; max-width: 30ch; }
.lede { font-size: 1.16rem; color: var(--text); max-width: 64ch; }
.meta { font-family: var(--font-head); font-size: 0.82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 1rem 0 0; }

/* boxes */
.box { border: 1px solid var(--rule); border-left: 4px solid var(--accent-ink); background: var(--surface); padding: 0.9rem 1.1rem; border-radius: 6px; margin: 1.3rem 0; max-width: 72ch; }
.box > :first-child { margin-top: 0; }
.box > :last-child { margin-bottom: 0; }
.box h4 { margin-top: 0; font-size: 0.95rem; }
.box.warn { background: var(--warn-bg); border-left-color: var(--warn-rule); }
.box.key { background: var(--accent-soft); }

/* status tags */
.tag { display: inline-block; font-family: var(--font-head); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.05em 0.45em; border-radius: 3px; border: 1px solid currentColor; vertical-align: 0.12em; white-space: nowrap; }
.tag.data { color: var(--tag-data); }
.tag.model { color: var(--tag-model); }
.tag.assump { color: var(--tag-assump); }
.tag.nv { color: var(--tag-nv); }
.tag.src { color: var(--muted); }

/* citations */
a.cite { font-family: var(--font-head); font-size: 0.78em; text-decoration: none; white-space: nowrap; vertical-align: 0.08em; }
a.cite:hover { text-decoration: underline; }

/* tables */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-family: var(--font-head); font-size: 0.84rem; line-height: 1.4; font-variant-numeric: tabular-nums; }
caption { caption-side: top; text-align: left; padding: 0.7rem 0.8rem 0.4rem; font-weight: 600; font-size: 0.86rem; color: var(--text); }
th, td { padding: 0.45rem 0.7rem; text-align: left; vertical-align: top; border-top: 1px solid var(--rule); }
thead th { background: var(--accent-soft); color: var(--text); font-weight: 650; border-top: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
tr.best td { background: var(--accent-soft); font-weight: 600; }
tfoot td { font-size: 0.78rem; color: var(--muted); }
.table-note { font-family: var(--font-head); font-size: 0.78rem; color: var(--muted); padding: 0.5rem 0.8rem 0.7rem; border-top: 1px solid var(--rule); }

/* figures */
figure { margin: 1.5rem 0 1.8rem; }
figure .img { background: #ffffff; border: 1px solid var(--rule); border-radius: 6px; padding: 0.5rem; }
figure img { display: block; width: 100%; height: auto; }
figure.narrow { max-width: 40rem; }
figcaption { font-family: var(--font-head); font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; max-width: 80ch; line-height: 1.45; }
figcaption b { color: var(--text); }

/* key numbers grid */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.8rem; margin: 1.2rem 0 1.6rem; }
.kpi { border: 1px solid var(--rule); border-radius: 6px; padding: 0.8rem 0.9rem; background: var(--surface); font-family: var(--font-head); }
.kpi .v { font-size: 1.45rem; font-weight: 700; color: var(--accent-ink); line-height: 1.15; }
.kpi .l { font-size: 0.8rem; color: var(--text); margin-top: 0.3rem; line-height: 1.35; }
.kpi .s { font-size: 0.72rem; color: var(--muted); margin-top: 0.35rem; }

/* references */
ol.refs { padding-left: 2.3em; font-size: 0.92rem; }
ol.refs li { margin: 0.5em 0; max-width: 90ch; overflow-wrap: anywhere; }
ol.refs li:target { background: var(--accent-soft); outline: 4px solid var(--accent-soft); }
.files { font-size: 0.85rem; }

.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; }
.foot { margin-top: 4rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--font-head); font-size: 0.8rem; color: var(--muted); }

/* responsive */
@media (max-width: 960px) {
  .page { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px 3rem; }
  .toc { display: none; }
  .toc-mobile { display: block; margin: 1.2rem 0 0.4rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); font-family: var(--font-head); font-size: 0.9rem; }
  .toc-mobile summary { cursor: pointer; padding: 0.7rem 0.9rem; font-weight: 600; }
  .toc-mobile ol { list-style: none; margin: 0; padding: 0 0.9rem 0.8rem; }
  .toc-mobile li { margin: 0.15rem 0; }
  .toc-mobile ol ol { padding: 0 0 0 1rem; }
  .toc-mobile a { text-decoration: none; }
  body { font-size: 1rem; }
  h2 { font-size: 1.3rem; }
}

/* print */
@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #444; --rule: #bbb; --accent-soft: #eef2f0; --accent-ink: #253b33; --link: #000; }
  body { font-size: 10.5pt; background: #fff; }
  .page { display: block; max-width: none; padding: 0; }
  .toc, .toc-mobile, .anchor { display: none !important; }
  h2 { break-after: avoid; page-break-after: avoid; }
  h3, h4 { break-after: avoid; }
  figure, .table-wrap, .box, .kpi, pre { break-inside: avoid; page-break-inside: avoid; }
  .table-wrap { overflow: visible; }
  a { color: #000; text-decoration: none; }
  ol.refs a[href^="http"]::after { content: " <" attr(href) ">"; font-size: 0.85em; }
}
