/* Insights — own stylesheet; the catalog style.css is never loaded here.
   Light theme on purpose (insights_build_plan.md § 6.1): chart PNGs land in
   light publications, and a light page without covers reads as analytics. */

:root {
    --bg: #fbfaf7;
    --surface: #ffffff;
    --text: #1d1f23;
    --muted: #5f6570;
    --rule: #e3e1dc;
    --accent: #1f5fbf;
    --notice: #fff4d6;
    --notice-rule: #e8cf8a;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --measure: 700px;
    --figure: 960px;
    --sidebar: 240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 18px/1.6 var(--font);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
.muted { color: var(--muted); }

/* --- chrome ---------------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--surface); }
.header-inner, .footer-inner {
    max-width: calc(var(--sidebar) + var(--figure) + 64px);
    margin: 0 auto;
    padding: 12px 16px;
    display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
}
.wordmark { color: var(--text); text-decoration: none; font-weight: 700; font-size: 19px; }
.wm-section { color: var(--accent); }
.header-nav a { color: var(--muted); font-size: 15px; }

.site-footer { border-top: 1px solid var(--rule); margin-top: 64px; font-size: 15px; color: var(--muted); }
.site-footer .footer-inner { display: block; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 8px 0; }
.footer-links a { color: var(--muted); }

.notice { padding: 12px 16px; border: 1px solid var(--notice-rule); background: var(--notice); font-size: 16px; }
.notice-preview { text-align: center; border-width: 0 0 1px; }
.notice-withdrawn { margin-bottom: 24px; }

/* --- grid ------------------------------------------------------------------ */
.layout {
    max-width: calc(var(--sidebar) + var(--figure) + 64px);
    margin: 0 auto;
    padding: 0 16px;
}
.main { min-width: 0; }

@media (min-width: 1024px) {
    .layout {
        display: grid;
        grid-template-columns: var(--sidebar) minmax(0, 1fr);
        gap: 48px;
    }
    .sidebar {
        position: sticky; top: 0; align-self: start;
        max-height: 100vh; overflow-y: auto;
        padding: 32px 0;
    }
}

/* --- sidebar --------------------------------------------------------------- */
.side-block { margin: 0 0 28px; font-size: 15px; line-height: 1.4; }
.side-label {
    margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted);
}
.side-block ol, .side-block ul { list-style: none; margin: 0; padding: 0; }
.side-block li { margin: 0; }
.side-block a {
    display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--rule);
    color: var(--text); text-decoration: none;
}
.side-block a:hover, .side-block a[aria-current], .toc a.is-current {
    border-left-color: var(--accent); color: var(--accent);
}
.toc summary { cursor: pointer; list-style: none; }
.toc summary::-webkit-details-marker { display: none; }

/* Below desktop the sidebar is a "Contents" disclosure under the header,
   collapsed by default (JS closes it; without JS it simply stays open). */
@media (max-width: 1023.98px) {
    .sidebar { order: 0; padding-top: 16px; }
    .toc { border: 1px solid var(--rule); background: var(--surface); padding: 10px 14px; }
    .toc summary::after { content: " ▾"; }
    .toc[open] summary::after { content: " ▴"; }
    .side-nav { border: 1px solid var(--rule); background: var(--surface); padding: 10px 14px; }
    .side-nav > summary::after { content: " ▾"; }
    .side-nav[open] > summary::after { content: " ▴"; }
}
@media (min-width: 1024px) {
    /* On desktop the browse tree is always open; its summary is just a label. */
    .side-nav > summary { pointer-events: none; }
}
.side-nav > summary { cursor: pointer; list-style: none; }
.side-nav > summary::-webkit-details-marker { display: none; }
.nav-group {
    margin: 16px 0 6px; font-size: 13px; font-weight: 700; color: var(--text);
}
.nav-year > summary {
    cursor: pointer; padding: 4px 0 4px 12px; border-left: 2px solid var(--rule);
    color: var(--muted); font-variant-numeric: tabular-nums;
}
.nav-year > ul a { padding-left: 24px; }

/* --- article --------------------------------------------------------------- */
.hub-head, .cards { max-width: var(--measure); }
/* The article itself is figure-wide; its text children keep the reading measure. */
.article { max-width: var(--figure); }
.article > :not(.prose), .prose > :not(.figure) { max-width: var(--measure); }
.article-head { padding-top: 32px; }
.kicker {
    margin: 0 0 8px; font-size: 14px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--accent);
}
h1 { font-size: clamp(30px, 5vw, 42px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -.01em; }
.dek { font-size: 20px; line-height: 1.45; color: var(--muted); margin: 0 0 12px; }
.dateline { font-size: 15px; color: var(--muted); margin: 0; }

.key-numbers {
    list-style: none; padding: 0; margin: 28px 0;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px;
}
.key-numbers li {
    background: var(--surface); border-top: 3px solid var(--accent);
    padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.kn-value { font-size: 32px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kn-label { font-size: 15px; line-height: 1.35; color: var(--muted); }

.prose h2 { font-size: 26px; line-height: 1.25; margin: 48px 0 12px; }
.prose h3 { font-size: 20px; line-height: 1.3; margin: 32px 0 8px; }
.prose h2, .prose h3, .figure { scroll-margin-top: 16px; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose table {
    border-collapse: collapse; width: 100%; margin: 0 0 24px; font-size: 16px;
    font-variant-numeric: tabular-nums;
}
.prose th, .prose td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 700; }
/* Figures live in charts; prose tables are mostly words — left-aligned. */
.prose img { max-width: 100%; height: auto; }

/* --- figure ---------------------------------------------------------------- */
.figure { margin: 32px 0; padding: 20px; background: var(--surface); border: 1px solid var(--rule); }
@media (min-width: 1024px) {
    /* Figures may break out of the text measure, up to the figure width. */
    .figure { width: min(var(--figure), 100%); }
}
.fig-title { font-size: 19px; font-weight: 700; line-height: 1.3; }
.fig-sub { font-size: 15px; color: var(--muted); margin-top: 2px; }
.fig-chart { margin: 16px 0 8px; }
.fig-chart svg { display: block; width: 100%; height: auto; }
.chart-narrow { display: none !important; }
@media (max-width: 599.98px) {
    .figure { padding: 14px 12px; margin-left: -4px; margin-right: -4px; }
    .chart-wide { display: none !important; }
    .chart-narrow { display: block !important; }
}
.fig-source { font-size: 13px; color: var(--muted); }
.fig-source a { color: var(--muted); }

/* --- closing boxes ----------------------------------------------------------- */
.method-box, .errata, .related {
    margin: 40px 0 0; padding: 18px 20px; background: var(--surface);
    border: 1px solid var(--rule); font-size: 16px;
}
.box-title { font-size: 15px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 10px; color: var(--muted); }
.method-box p, .method-box ul { margin: 0 0 10px; }
.errata ul, .related ul { margin: 0; padding-left: 20px; }

/* --- hub ------------------------------------------------------------------- */
.hub-head { padding-top: 32px; }
.cards { list-style: none; padding: 0; margin: 8px 0 0; }
.card { padding: 24px 0; border-top: 1px solid var(--rule); }
.card h2 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; }
.card h2 a { color: var(--text); text-decoration: none; }
.card h2 a:hover { color: var(--accent); }
.card .dek { font-size: 17px; }
