/* Theme tokens (Phase A). Light is the bare :root default; dark is
 * applied either by system preference (prefers-color-scheme, guarded so
 * an explicit light choice can still win) or by an explicit
 * data-theme="dark" attribute on <html> set by assets/js/theme.js and
 * persisted in localStorage. Every other stylesheet in this app should
 * reference these variables, never a literal color. */

:root {
    --color-bg: #f4f5f7;
    --color-surface: #ffffff;
    --color-surface-raised: #ffffff;
    --color-text: #1a1d23;
    --color-text-muted: #5b6270;
    --color-border: #dde1e7;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-text: #ffffff;
    /* Text-on-bg pairs below are picked for >=4.5:1 contrast (WCAG AA,
     * normal text) at badge size (~12px) — the original success/danger
     * values measured 3.0:1/3.95:1 against their -bg pair (computed via
     * the WCAG relative-luminance formula), both real AA failures despite
     * looking like reasonable colors; warning passed at only 4.51:1, too
     * thin a margin to be confident of across renderers. Dark-mode
     * equivalents already passed comfortably (8.2:1/5.9:1) and are
     * unchanged. */
    --color-success: #166534;
    --color-success-bg: #dcfce7;
    --color-warning: #92400e;
    --color-warning-bg: #fef3c7;
    --color-danger: #b91c1c;
    --color-danger-bg: #fee2e2;
    --color-info: #0e7490;
    --color-info-bg: #cffafe;
    --color-muted-bg: #eceef1;
    --shadow-elevated: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #14161a;
        --color-surface: #1c1f26;
        --color-surface-raised: #232730;
        --color-text: #e6e8ec;
        --color-text-muted: #9aa1ad;
        --color-border: #2d323c;
        --color-primary: #3b82f6;
        --color-primary-hover: #60a5fa;
        --color-primary-text: #0b0d10;
        --color-success: #4ade80;
        --color-success-bg: #14301f;
        --color-warning: #fbbf24;
        --color-warning-bg: #3a2a0c;
        --color-danger: #f87171;
        --color-danger-bg: #3a1414;
        --color-info: #22d3ee;
        --color-info-bg: #0d3138;
        --color-muted-bg: #262b34;
        --shadow-elevated: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    }
}

:root[data-theme="dark"] {
    --color-bg: #14161a;
    --color-surface: #1c1f26;
    --color-surface-raised: #232730;
    --color-text: #e6e8ec;
    --color-text-muted: #9aa1ad;
    --color-border: #2d323c;
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-primary-text: #0b0d10;
    --color-success: #4ade80;
    --color-success-bg: #14301f;
    --color-warning: #fbbf24;
    --color-warning-bg: #3a2a0c;
    --color-danger: #f87171;
    --color-danger-bg: #3a1414;
    --color-info: #22d3ee;
    --color-info-bg: #0d3138;
    --color-muted-bg: #262b34;
    --shadow-elevated: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
}
