/* ==========================================================================
   research-reading.css — the RESEARCH PALETTE for a published study's reading
   body (partials/_research_reading.html).
   ==========================================================================
   The founder's call: the full page and the landing drawer should feel like the
   Articles section EXCEPT the reading surface keeps the research paper's own
   look — a cream sheet, green accents, Georgia serif. So the paper is rendered
   inside a `.research-paper` container that carries this palette, and it sits as
   a self-contained "document" card inside whatever chrome the host supplies
   (the dark public shell on /research/<slug>, the dark garden drawer on the
   landing). Every selector is scoped under `.research-paper` so none of it can
   leak into the surrounding dark chrome.

   These rules are lifted from research_report.html's <style> block (the reading
   subset — no author toolbar / composer / print-only rules) and scoped. Keep in
   sync with that block if the paper's look changes there.
   ========================================================================== */

.research-paper {
    /* Palette — the research tokens, held on the container so they inherit into
       inline `var(--faint)` etc. without leaking to the page :root. */
    --ink: #1a1a17;
    --muted: #5f5b52;
    --faint: #8a8577;
    --rule: #d8d2c4;
    --accent: #1f6f4a;
    --paper: #fbfaf6;
    --panel: #f3f1ea;
    --ql-sans: 'Calibri', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --ql-display: 'DM Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;

    background: var(--paper);
    color: var(--ink);
    /* QuanterLab typography (founder, 2026-07-24) — DM Sans display + the
       platform's Calibri/Segoe body; the borrowed serif is gone. */
    font-family: var(--ql-sans);
    font-size: 15.5px;
    line-height: 1.62;
    letter-spacing: -0.005em;
    border: 1px solid var(--rule);
    border-radius: 12px;
    padding: 44px 52px 52px;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.14);
    overflow-wrap: break-word;
    /* Neutralise the host's 80% density zoom halo — the paper owns its type. */
    max-width: 860px;
    margin: 0 auto;
}

/* Headings + prose ------------------------------------------------------- */
.research-paper h1 {
    font-family: var(--ql-display);
    font-size: 29px; line-height: 1.18; margin: 0 0 6px; font-weight: 700;
    letter-spacing: -0.015em; text-wrap: balance; color: var(--ink);
}
.research-paper h2 {
    font-family: var(--ql-display);
    font-size: 18.5px; margin: 34px 0 10px; padding-bottom: 5px;
    border-bottom: 1px solid var(--rule); font-weight: 700; color: var(--ink);
}
.research-paper h3 {
    font-family: var(--ql-display);
    font-size: 15px; margin: 20px 0 6px; font-weight: 700; color: var(--muted);
}
.research-paper p { margin: 0 0 12px; }
.research-paper a { color: var(--accent); }
.research-paper em { font-style: italic; }
.research-paper sub { font-size: 0.75em; }

.research-paper .eyebrow {
    font-family: ui-sans-serif, system-ui, sans-serif; text-transform: uppercase;
    letter-spacing: 0.16em; font-size: 11px; color: var(--accent); font-weight: 700;
    margin-bottom: 10px;
}
.research-paper .byline { font-size: 13.5px; color: var(--muted); margin: 8px 0 2px; }
.research-paper .author-byline { font-size: 14px; color: var(--ink); margin: 2px 0 0; font-style: italic; }
.research-paper .author-note {
    background: #faf7ef; border: 1px solid var(--rule); border-left: 3px solid #c9a962;
    padding: 14px 18px; margin: 14px 0 4px; font-size: 15px;
}
.research-paper .author-note .an-lbl {
    font-family: ui-sans-serif, system-ui, sans-serif; text-transform: uppercase;
    letter-spacing: 0.14em; font-size: 10.5px; color: #b3711a; font-weight: 700; margin-bottom: 6px;
}
.research-paper .author-note p:last-child { margin-bottom: 0; }

.research-paper .meta-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px 26px; font-size: 13.5px;
    color: var(--muted); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
    padding: 12px 0; margin: 16px 0 26px;
}
.research-paper .meta-grid b { color: var(--ink); font-weight: 600; }

.research-paper .abstract {
    background: var(--panel); border-left: 3px solid var(--accent); padding: 16px 20px;
    margin: 0 0 8px; font-size: 15px;
}
.research-paper .abstract .lbl {
    font-family: ui-sans-serif, system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.14em;
    font-size: 10.5px; color: var(--accent); font-weight: 700; margin-bottom: 6px;
}

/* Headline stat blocks --------------------------------------------------- */
.research-paper .headline { display: flex; gap: 22px; flex-wrap: wrap; margin: 14px 0 6px; }
.research-paper .stat {
    border: 1px solid var(--rule); border-radius: 8px; padding: 12px 18px; min-width: 150px; background: #fff;
}
.research-paper .stat .k {
    font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10.5px; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--faint);
}
.research-paper .stat .v { font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 2px; }
.research-paper .stat .s { font-size: 12px; color: var(--muted); }
.research-paper .good { color: #2e7d32; }
.research-paper .warn { color: #b3711a; }
.research-paper .bad  { color: #b23b3b; }

/* Figures + tables ------------------------------------------------------- */
.research-paper figure { margin: 16px 0 6px; }
.research-paper .fig-svg { display: block; background: #fff; border: 1px solid var(--rule); border-radius: 6px; max-width: 100%; }
.research-paper figcaption { font-size: 12.5px; color: var(--muted); margin-top: 7px; }
.research-paper figcaption b { color: var(--ink); }

.research-paper .table-scroll, .research-paper .tbl-wrap { overflow-x: auto; }
.research-paper table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0 6px; }
.research-paper caption { caption-side: top; text-align: left; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.research-paper caption b { color: var(--ink); }
.research-paper th, .research-paper td {
    text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--rule); vertical-align: top;
}
.research-paper th {
    font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10.5px; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--faint); font-weight: 700;
}
.research-paper td.num, .research-paper th.num { text-align: right; font-variant-numeric: tabular-nums; }
.research-paper .claim { font-style: italic; color: var(--muted); }

/* References + colophon -------------------------------------------------- */
.research-paper .refs { font-size: 13px; color: var(--muted); padding-left: 22px; }
.research-paper .refs li { margin-bottom: 7px; }
/* Two-tier references: QuanterLab's architectural list + the author's own. */
.research-paper .refs-lbl {
    font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10.5px;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
    font-weight: 700; margin: 12px 0 4px;
}
.research-paper .refs-user { font-size: 12px; color: var(--faint); padding-left: 22px; margin: 0 0 8px; }
.research-paper .refs-user li { margin-bottom: 5px; }
.research-paper .refs-qmark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--faint);
    color: var(--faint); font-size: 9px; font-weight: 700; margin-left: 6px; cursor: help;
    font-family: ui-sans-serif, system-ui, sans-serif; vertical-align: middle;
}
.research-paper ol, .research-paper ul { margin: 0 0 12px; padding-left: 22px; }
.research-paper .foot {
    margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 11.5px;
    color: var(--faint); font-family: ui-sans-serif, system-ui, sans-serif;
}
.research-paper .draft-badge {
    display: inline-block; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 10.5px;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #b3711a;
    border: 1px solid #e0c48a; background: #fbf3df; border-radius: 4px; padding: 2px 8px;
    margin-left: 8px; vertical-align: middle;
}

/* Mathematics appendix (KaTeX) ------------------------------------------ */
.research-paper .math-doc { margin: 0 0 22px; }
.research-paper .math-doc h3 { margin-bottom: 2px; }
.research-paper .math-tagline { font-size: 13px; color: var(--muted); font-style: italic; margin: 0 0 8px; }
.research-paper .math-sec-h {
    font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--faint); font-weight: 700; margin: 10px 0 3px;
}
.research-paper .ql-katex { margin: 8px 0 4px; overflow-x: auto; }
.research-paper .ql-katex > code { font-size: 12px; color: var(--muted); }
.research-paper .math-caption { font-size: 12px; color: var(--faint); margin: 0 0 6px; }
.research-paper .math-parity { font-size: 12px; color: var(--muted); border-left: 2px solid var(--rule); padding-left: 10px; margin-top: 8px; }

/* Narrow screens --------------------------------------------------------- */
@media (max-width: 640px) {
    .research-paper { padding: 26px 22px 32px; font-size: 15px; }
    .research-paper h1 { font-size: 25px; }
    .research-paper .meta-grid { grid-template-columns: 1fr; }
    .research-paper .headline { gap: 12px; }
    .research-paper .stat { min-width: 0; flex: 1 1 140px; }
}
