/* Design tokens — plan section 19.4, revised for the web UI port (P0, 2026-11-05).
 *
 * The brand block is copied from the company site's :root so the web app reads as the same
 * product family; the app-only additions are separated below it.
 *
 * Drift guard: `scripts/audit_a11y.py` (run by scripts/build.ps1) computes the contrast of every
 * text token against every background token and fails the build below AA. It replaces the
 * `scripts/audit_brand_tokens.py` this file used to promise but never had.
 *
 * Rules that this file encodes:
 *   - Cinzel is display only (headings, the wordmark). Never table cells, never prices.
 *   - Gold is brand and interaction. It is NEVER a data colour: PnL is green/red only.
 *   - --text-muted is AA for body copy (>= 4.5:1 on the darkest card). --text-faint is decoration
 *     only (calendar axis labels, disabled hints) and is exempt from the audit at 3:1.
 *   - Two densities: comfortable for reading, compact for tables. `data-density` on <html>.
 */

@font-face {
    font-family: 'Cinzel';
    /* Served by this app, not by the company site: the old `/assets/Cinzel.ttf` was a 404 in the web
       tier, so the wordmark silently fell back to Georgia. 125 KB, cached, and it is the one font the
       brand needs. */
    src: url('/app/static/vendor/Cinzel.ttf') format('truetype');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: dark;

    /* brand — company site */
    --bg-primary: #050505;
    --bg-secondary: #0c0c0e;
    --bg-card: #101014;
    --bg-card-hover: #16161b;
    --gold: #c9a227;
    --gold-light: #e4c46a;
    --gold-dark: #8f7419;
    --text-primary: #f2f2f2;
    --text-secondary: #a3a3a3;
    /* Audit: 5.57:1 on --bg-card, 5.98:1 on --bg-primary. */
    --text-muted: #8b8b8b;
    /* Decoration only — axis labels, inert hints. Never body copy. */
    --text-faint: #6b6b6b;
    --border: rgba(201, 162, 39, 0.15);
    --border-strong: rgba(201, 162, 39, 0.3);
    --radius: 14px;
    --radius-sm: 8px;
    --max-width: 1200px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);

    /* app-only */
    /* --loss is a text colour: 5.24:1 on --bg-card. --loss-strong is for dots and fills, where
       contrast is not a legibility requirement. */
    --profit: #27ae60;
    --loss: #e05c4a;
    --loss-strong: #c0392b;
    --warn: #f39c12;
    --info: #2d9cdb;
    --font-display: 'Cinzel', Georgia, serif;
    --font-body: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, 'Cascadia Mono', 'Roboto Mono', monospace;

    /* Type scale. Screens use these, not raw rem values. */
    --text-xs: 0.75rem;
    --text-sm: 0.82rem;
    --text-base: 0.95rem;
    --text-lg: 1.15rem;
    --text-xl: 1.45rem;
    --text-2xl: 1.75rem;

    /* Categorical series palette for breakdowns.
       Gold is deliberately absent (it is brand and interaction, never data) and so are green and
       red, which already mean profit and loss on these screens - a green series would read as a
       winning strategy regardless of what it plots. Colours are distinguishable at a glance and
       never the only channel: every series carries a text label in the legend. */
    --series-1: #4c8dff;
    --series-2: #a98bde;
    --series-3: #2fa3a3;
    --series-4: #d95f8a;
    --series-5: #67c9e8;
    --series-6: #d97f4a;
    --series-7: #9aa1ab;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* Density. --row-h is what tables and list rows read. */
    --row-h-compact: 36px;
    --row-h-comfortable: 48px;
    --row-h: var(--row-h-comfortable);

    /* Motion. Short, and zero when the user asks for less (see shell.css). */
    --dur-fast: 120ms;
    --dur-base: 200ms;
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

    --focus-ring: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--gold);
    --touch-target: 24px;
    --rail-w: 212px;
    --rail-w-collapsed: 68px;
    --z-header: 10;
    --z-rail: 20;
    --z-dialog: 40;
    --z-toast: 50;
}

:root[data-density="compact"] {
    --row-h: var(--row-h-compact);
}

/* Honour the user's motion preference at the token level: nothing that consumes a duration can
   animate. shell.css carries the media query that also disables transitions declared elsewhere. */
@media (prefers-reduced-motion: reduce) {
    :root {
        --dur-fast: 0ms;
        --dur-base: 0ms;
    }
}
