/* ============================================
   tokens.css — Design tokens (Paper Firehose UI)
   ============================================

   The values of the design system "Paper Firehose UI" (tokens.json),
   written as CSS custom properties ("CSS variables").

   How CSS variables work:
   - `--name: value;` DEFINES a variable on an element. Defined on :root
     (the <html> element), every element on the page inherits it.
   - `var(--name)` USES it. app.css never writes a colour or a size
     directly — it always says var(--ink), var(--space-4), ... so a value
     changes in ONE place, here.

   Light and dark: the light values are the default. When the phone or
   computer is set to dark mode, the browser matches the
   `prefers-color-scheme: dark` media query below and the colour
   variables are redefined. Spacing, radii and fonts are the same in
   both themes, so only the colours appear twice.

   Keep this file in sync with the design system: change a value there
   first, then copy it here.
*/

:root {
    /* Tell the browser that the page supports both schemes: native
       controls (scrollbars, date pickers, the checkbox tick) then follow
       the theme too. */
    color-scheme: light dark;

    /* ---------- Colours (light theme) ---------- */
    --paper: #fbfaf7;           /* page background */
    --paper-raised: #ffffff;    /* inputs, secondary buttons, notices */
    --paper-sunken: #f2f0ea;    /* inline code, hover fill */
    --rule: #e4e1d9;            /* hairlines between list items */
    --control-border: #8c887f;  /* edges of inputs and buttons (3:1) */
    --ink: #1b1a17;             /* text; fill of the primary button */
    --ink-muted: #5e5b54;       /* help text, metadata */
    --on-ink: var(--paper);     /* text on an ink fill */
    --accent: #c23a1e;          /* the "red pencil": brand mark, high scores */
    --focus: var(--accent);     /* keyboard focus ring */
    --danger: #a3231b;          /* destructive actions, errors */
    --success: #2f6b3a;         /* status dot of a finished run */
    --warning: #8a5a00;         /* status dot of a running run */

    /* ---------- Spacing: a 4px scale ---------- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;   /* phone page gutter */
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;

    /* ---------- Corner radii ---------- */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-pill: 999px;

    /* ---------- Sizes ---------- */
    --size-tap: 44px;        /* minimum height of anything tappable */
    --size-appbar: 56px;     /* height of the top bar */
    --size-content: 680px;   /* maximum width of the page column */

    /* ---------- Fonts: only fonts already on the device ----------
       No font files are downloaded (the CSP allows only our own origin,
       and system fonts appear instantly). Each list is tried left to
       right: San Francisco on Apple devices, Segoe UI on Windows,
       Roboto on Android via system-ui. */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- Colours (dark theme) ----------
   Only the colours change. --on-ink and --focus need no new line: they
   point at --paper and --accent, which are redefined here. */
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #151412;
        --paper-raised: #1e1d1a;
        --paper-sunken: #282622;
        --rule: #33312c;
        --control-border: #78746b;
        --ink: #edebe5;
        --ink-muted: #a29f96;
        --accent: #f0714f;
        --danger: #ff8a80;
        --success: #7cc48a;
        --warning: #e0b04a;
    }
}
