/* Long-form pages: About, Methodology, Research, Privacy.
   A reading column plus a sticky side rail (contents, key facts), split by a
   hairline drawn in the gutter like the homepage column rules.

   Type: like the rest of the site, these pages are all serif, in two sizes
   only. --doc-text is every piece of reading text (paragraphs, list
   entries, table cells); --doc-small is secondary text (sources, notes, the
   rail). Change the two values here to resize all four pages at once. */

:root {
    --doc-text: 1.0625rem;
    --doc-small: 0.9375rem;
    --doc-leading: 1.65;
}

.doc-hero { padding: 1.75rem 0 1.25rem; text-align: center; }
.doc-hero .kicker { display: block; margin-bottom: 0.5rem; }
.doc-hero h1 {
    font-family: var(--font-serif);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.2;
    text-wrap: balance;
}
.doc-hero .dek {
    font-family: var(--font-serif);
    font-size: var(--doc-text);
    line-height: 1.55;
    color: var(--text-muted);
    max-width: 58ch;
    margin: 0.5rem auto 0;
    text-wrap: balance;
}

.doc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
    grid-template-areas: "body rail";
    column-gap: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-family: var(--font-serif);
}
.doc-body { grid-area: body; min-width: 0; }

/* ---------- Rail ---------- */
.doc-rail { grid-area: rail; position: relative; min-width: 0; }
.doc-rail::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -2rem;
    border-left: 1px solid var(--rule);
}
/* The top padding drops "On this page" onto the same baseline as the first
   section heading beside it */
.doc-rail-inner { position: sticky; top: 1.25rem; padding-top: 0.4rem; }
.rail-block + .rail-block { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.rail-h { font-size: var(--doc-small); font-weight: 700; line-height: 1.3; color: var(--text); margin-bottom: 0.5rem; }

.toc { list-style: none; }
.toc a {
    display: block;
    padding: 0.25rem 0;
    font-size: var(--doc-small);
    line-height: 1.4;
    color: var(--text-muted);
    transition: color 0.15s ease;
}
.toc a:hover { color: var(--accent); }

.facts { display: grid; row-gap: 0.7rem; }
.facts dt { font-size: var(--doc-small); color: var(--text-faint); line-height: 1.4; }
.facts dd { font-size: var(--doc-small); line-height: 1.45; }

/* ---------- Reading column ---------- */
.doc-section {
    padding: 1.4rem 0 1.5rem;
    border-top: 1px solid var(--rule);
    scroll-margin-top: 1rem;
}
.doc-section:first-child { border-top: none; padding-top: 0; }
.doc-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}
.doc-section h3 {
    font-size: var(--doc-text);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}
.doc-section p,
.def-list dt, .def-list dd,
.rating-table td,
.stat-text {
    font-size: var(--doc-text);
    line-height: var(--doc-leading);
}
.doc-section p + p,
.doc-section p + .def-list,
.doc-section p + .steps,
.doc-section p + .rating-table,
.doc-section p + .grid-2,
.doc-section .def-list + p,
.doc-section .steps + p,
.doc-section .rating-table + p,
.doc-section .grid-2 + p { margin-top: 0.9rem; }
.doc-section .note { font-size: var(--doc-small); color: var(--text-muted); }
.doc-body a:not(.btn):not(.card-link) {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.doc-body a:not(.btn):hover { color: var(--accent-strong); }

.doc-body code { font-size: 0.9em; }

.signature { margin-top: 1rem; font-style: italic; color: var(--text-muted); }

/* Definition rows: a short label on the left, the explanation on the right,
   hairlines between */
.def-list { border-top: 1px solid var(--rule); }
.def-list > div {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr);
    column-gap: 1.5rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--rule);
}
.def-list dt { font-weight: 700; }
.doc-body .def-list dt a { text-decoration: none; }
.doc-body .def-list dt a:hover { text-decoration: underline; }

/* Numbered steps: only for real sequences */
.steps { list-style: none; counter-reset: step; border-top: 1px solid var(--rule); }
.steps > li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--rule);
}
.steps > li::before {
    content: counter(step);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--accent);
}
.steps p + p { margin-top: 0.5rem; }

/* A list that ends its section drops its last hairline: the next section's
   top rule already draws that line */
.def-list:last-child > div:last-child,
.steps:last-child > li:last-child { border-bottom: none; padding-bottom: 0; }

/* Two approaches side by side (reuses .grid-2.ruled from base.css) */
.doc-section .grid-2 { row-gap: 1.25rem; }

/* Rating scale */
.rating-table { width: 100%; border-collapse: collapse; }
.rating-table th {
    text-align: left;
    font-size: var(--doc-small);
    font-weight: 700;
    color: var(--text-faint);
    padding: 0 0 0.5rem;
    border-bottom: 1px solid var(--rule-strong);
}
.rating-table td { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.rating-table td:first-child { width: 8.5rem; padding-right: 1rem; }
.rating-table td:nth-child(2) { padding-right: 1rem; }
.rating-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rating-table .bias-tag { font-size: var(--doc-small); }

/* By the numbers (reuses .grid-3.ruled from base.css). Each stat spans three
   shared rows (number, text, source), so the sources line up across columns
   however long each text runs. */
.stats { margin-top: 1rem; row-gap: 0; }
.stats > div { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; }
.stat-num { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--accent); }
.stat-text { margin-top: 0.4rem; }
.doc-section .stat-source { font-size: var(--doc-small); line-height: 1.45; color: var(--text-faint); margin-top: 0.6rem; }

/* References */
.refs { list-style: none; }
.refs li {
    font-size: var(--doc-small);
    line-height: 1.55;
    color: var(--text-muted);
    padding-left: 1.5rem;
    text-indent: -1.5rem;
    overflow-wrap: anywhere;
}
.refs li + li { margin-top: 0.6rem; }

.doc-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.1rem; }
.not-found { padding: 4rem 0 3rem; }
.not-found .dek { font-family: var(--font-serif); }
.not-found .doc-actions { justify-content: center; margin-top: 1.5rem; }

/* ---------- Responsive ---------- */
/* One column: the contents list becomes a compact wrapped line above the
   article, and any facts move below it, so the reading starts on screen one */
@media (max-width: 900px) {
    .doc-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "toc" "body" "facts"; }
    .doc-rail, .doc-rail-inner { display: contents; }
    .doc-rail::before { display: none; }
    .doc-rail-inner > .rail-block:first-child {
        grid-area: toc;
        padding-bottom: 1rem;
        margin-bottom: 1.4rem;
        border-bottom: 1px solid var(--rule);
    }
    .doc-rail-inner > .rail-block + .rail-block {
        grid-area: facts;
        margin-top: 0;
        padding-top: 1.25rem;
        border-top: 1px solid var(--rule);
    }
    .toc { display: flex; flex-wrap: wrap; column-gap: 1.1rem; }
    .toc a { padding: 0.2rem 0; }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; }
}

@media (max-width: 560px) {
    .doc-hero h1 { font-size: 1.55rem; }
    .facts { grid-template-columns: minmax(0, 1fr); }
    .def-list > div { grid-template-columns: minmax(0, 1fr); row-gap: 0.25rem; }
    .rating-table td:first-child { width: 6.5rem; }
    .stat-num { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) {
    .toc a { transition: none; }
}
