/* pages.css — the ONE stylesheet for the document pages: about, changelog,
   privacy, the generated methodology, and the Worker-rendered leaderboard and
   statistics. The app shell (style.css) has its own, viewport-proportional
   system; these are documents, so they sit on an ordinary rem scale and only
   share the shell's PALETTE. Keep the two token lists in step by eye: the
   canvas, ink, surface, hairline, panel and accent values here are the ones
   style.css declares.

   Served as a fixed-name static asset. sw.js lists it in PRECACHE_URLS so an
   installed client refreshes it on every deploy instead of holding a runtime
   copy for the life of the install. */

:root {
    color-scheme: dark light;
    --canvas: #211f1c;
    --ink: #ece8e0;
    --ink-muted: rgba(236, 232, 224, 0.58);
    --surface: rgba(255, 255, 255, 0.07);
    --surface-hi: rgba(255, 255, 255, 0.13);
    --hairline: rgba(255, 255, 255, 0.12);
    --panel: #2b2a27;
    --accent: #c9563f;
    --accent-hi: #e0725b;
}

@media (prefers-color-scheme: light) {
    :root {
        --canvas: #fff;
        --ink: #1f1d1a;
        --ink-muted: rgba(31, 29, 26, 0.58);
        --surface: rgba(0, 0, 0, 0.05);
        --surface-hi: rgba(0, 0, 0, 0.10);
        --hairline: rgba(0, 0, 0, 0.12);
        --panel: #f6f4f0;
        --accent: #b8452f;
        --accent-hi: #9a3823;
    }
}

html {
    background: var(--canvas);
}

body {
    margin: 0 auto;
    padding: 3rem 1.25rem 4rem;
    max-width: 760px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--canvas);
    -webkit-text-size-adjust: 100%;
}

/* --- Headings ------------------------------------------------------------
   The title is large and left-set, with no rule under it: the page's margin
   and weight do the work. Sections start with a hairline ABOVE the heading,
   which separates blocks of prose without colouring the heading itself; the
   accent is kept for links. */
h1 {
    margin: 0 0 1.25rem;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--ink);
}

h2 {
    margin: 2.6rem 0 0.75rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--hairline);
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink);
}

h3 {
    margin: 1.8rem 0 0.5rem;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--ink);
}

/* A secondary note inside a heading (the leaderboard's activity window). */
h1 .hnote {
    font-size: 0.55em;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--ink-muted);
    white-space: nowrap;
}

/* The line under a title: what the page is, in the muted ink. */
p.sub {
    margin: -0.75rem 0 1.5rem;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

/* --- Prose --------------------------------------------------------------- */
p {
    margin: 0 0 1rem;
}

ul, ol {
    margin: 0.5rem 0 1.25rem;
    padding-left: 1.4rem;
}

li {
    margin-bottom: 0.5rem;
}

li::marker {
    color: var(--ink-muted);
}

strong {
    font-weight: 600;
    color: var(--ink);
}

em {
    font-style: italic;
}

a {
    color: var(--accent);
    text-decoration: none;
    text-underline-offset: 0.15em;
}

a:hover,
a:focus-visible {
    color: var(--accent-hi);
    text-decoration: underline;
}

code {
    padding: 0.1em 0.4em;
    border-radius: 4px;
    background: var(--surface);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}

/* Display formulas and diagrams carry meaningful alignment, so they scroll
   sideways rather than wrap. */
pre {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    background: var(--surface);
    overflow-x: auto;
    font-size: 0.85em;
    line-height: 1.5;
}

pre code {
    padding: 0;
    background: none;
    font-size: inherit;
}

blockquote {
    margin: 1rem 0;
    padding-left: 1rem;
    border-left: 2px solid var(--hairline);
    color: var(--ink-muted);
}

hr {
    border: none;
    border-top: 1px solid var(--hairline);
    margin: 2.5rem 0;
}

/* --- Tables ---------------------------------------------------------------
   Rules between rows only, never a full grid; the header is a small tracked
   label in the muted ink, the same idiom as the app's category labels. */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    font-size: 0.95em;
}

th, td {
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid var(--hairline);
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

tbody tr:nth-child(even) {
    background: var(--surface);
}

/* --- Panels and the footer ------------------------------------------------ */
.toc {
    margin: 2rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    background: var(--panel);
}

.footer,
footer {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--hairline);
    font-size: 0.88rem;
    color: var(--ink-muted);
}

.footer {
    text-align: center;
}

footer p {
    margin: 0.35rem 0;
}

footer a {
    color: inherit;
}

.empty {
    padding: 2rem 0;
    text-align: center;
    color: var(--ink-muted);
}

/* Native form controls take the system Field pair rather than inherit: the
   open list is painted by the OS, which leaves it light in dark mode, so an
   inherited light-on-dark text would render white on white. */
select {
    font: inherit;
    font-size: 0.85rem;
    padding: 0.3rem 1.6rem 0.3rem 0.6rem;
    color: FieldText;
    background: Field;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 480px) {
    body {
        padding: 2rem 1rem 3rem;
    }
    h1 {
        font-size: 1.6rem;
    }
}
