/* static/css/tokens.css
   Design tokens: every colour, font, radius and size the UI uses.
   Components read these; they never hard-code values (spec 2026-10-01, 6.2).
   Themes are chosen by attributes on <html>, set by display-boot.js:
     data-theme="dark|light"  data-contrast="standard|high"
     data-text-size="sm|md|lg|xl"  data-motion="full|reduce"
   Every text/background pair is tested for WCAG contrast in
   tests/test_theme_tokens.py. */

:root, :root[data-theme="dark"] {
    --surface-base: #0B0E12;
    --surface: #12171D;
    --surface-raised: #171D25;
    --surface-sunken: #0F1318;
    --line: #1F2630;
    --line-strong: #2C3541;
    --text: #E8ECF1;
    --text-muted: #8D97A6;
    --on-accent: #07120D;
    --accent: #3FB68B;
    --accent-strong: #52C99D;
    --status-ok: #3FB68B;
    --status-bad: #F2725C;
    --status-warn: #E3B341;
    --focus-ring: #58A6FF;

    --tint-accent-weak: rgba(63, 182, 139, 0.08);
    --tint-accent-mid: rgba(63, 182, 139, 0.16);
    --tint-accent-strong: rgba(63, 182, 139, 0.32);
    --tint-ok-weak: rgba(63, 182, 139, 0.08);
    --tint-ok-mid: rgba(63, 182, 139, 0.16);
    --tint-ok-strong: rgba(63, 182, 139, 0.32);
    --tint-bad-weak: rgba(242, 114, 92, 0.08);
    --tint-bad-mid: rgba(242, 114, 92, 0.16);
    --tint-bad-strong: rgba(242, 114, 92, 0.32);
    --tint-warn-weak: rgba(227, 179, 65, 0.08);
    --tint-warn-mid: rgba(227, 179, 65, 0.16);
    --tint-warn-strong: rgba(227, 179, 65, 0.32);
    --tint-host-weak: rgba(179, 146, 240, 0.08);
    --tint-host-mid: rgba(179, 146, 240, 0.16);
    --tint-host-strong: rgba(179, 146, 240, 0.32);
    --tint-neutral-weak: rgba(232, 236, 241, 0.04);
    --tint-neutral-mid: rgba(232, 236, 241, 0.08);
    --tint-neutral-strong: rgba(232, 236, 241, 0.14);

    --map-router: #58A6FF;
    --map-switch: #3FB68B;
    --map-host: #B392F0;
    --map-unknown: #8D97A6;
    --map-device-fill: #171D25;
    --map-link-ok: #3FB68B;
    --map-link-inferred: #E3B341;
    --map-link-unverified: #7D8898;
    --map-link-bad: #F2725C;
    --map-link-console: #4DA3FF;
    --map-badge-bg: #0F1318;
    --map-port: #8CC4FF;
    --map-ip: #7EE2B8;
    --map-label: #C9D1DC;

    --shadow-card: 0 10px 24px rgba(0, 0, 0, 0.45);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55);
    --scrim: rgba(0, 0, 0, 0.55);

    color-scheme: dark;
}

:root[data-theme="light"] {
    --surface-base: #F3F5F8;
    --surface: #FFFFFF;
    --surface-raised: #FFFFFF;
    --surface-sunken: #EEF2F7;
    --line: #E1E6ED;
    --line-strong: #C9D1DC;
    --text: #16202E;
    --text-muted: #56626F;
    --on-accent: #FFFFFF;
    --accent: #1B7350;
    --accent-strong: #155C40;
    --status-ok: #1B7350;
    --status-bad: #B42318;
    --status-warn: #8A5A00;
    --focus-ring: #1D5FA8;

    --tint-accent-weak: rgba(27, 115, 80, 0.08);
    --tint-accent-mid: rgba(27, 115, 80, 0.14);
    --tint-accent-strong: rgba(27, 115, 80, 0.28);
    --tint-ok-weak: rgba(27, 115, 80, 0.08);
    --tint-ok-mid: rgba(27, 115, 80, 0.14);
    --tint-ok-strong: rgba(27, 115, 80, 0.28);
    --tint-bad-weak: rgba(180, 35, 24, 0.07);
    --tint-bad-mid: rgba(180, 35, 24, 0.13);
    --tint-bad-strong: rgba(180, 35, 24, 0.26);
    --tint-warn-weak: rgba(138, 90, 0, 0.08);
    --tint-warn-mid: rgba(138, 90, 0, 0.14);
    --tint-warn-strong: rgba(138, 90, 0, 0.28);
    --tint-host-weak: rgba(110, 69, 201, 0.07);
    --tint-host-mid: rgba(110, 69, 201, 0.13);
    --tint-host-strong: rgba(110, 69, 201, 0.26);
    --tint-neutral-weak: rgba(22, 32, 46, 0.04);
    --tint-neutral-mid: rgba(22, 32, 46, 0.07);
    --tint-neutral-strong: rgba(22, 32, 46, 0.12);

    --map-router: #1D5FA8;
    --map-switch: #1B7350;
    --map-host: #6E45C9;
    --map-unknown: #56626F;
    --map-device-fill: #FFFFFF;
    --map-link-ok: #1B7350;
    --map-link-inferred: #8A5A00;
    --map-link-unverified: #5F6A7A;
    --map-link-bad: #B42318;
    --map-link-console: #1565C0;
    --map-badge-bg: #FFFFFF;
    --map-port: #1D5FA8;
    --map-ip: #1B7350;
    --map-label: #16202E;

    --shadow-card: 0 8px 20px rgba(19, 41, 75, 0.10);
    --shadow-pop: 0 12px 28px rgba(19, 41, 75, 0.16);
    --scrim: rgba(19, 41, 75, 0.35);

    color-scheme: light;
}

:root[data-theme="dark"][data-contrast="high"] {
    --surface-base: #05070A;
    --surface: #0B0E12;
    --surface-raised: #10151B;
    --surface-sunken: #05070A;
    --line: #6B7686;
    --line-strong: #9AA5B4;
    --text: #F5F7FA;
    --text-muted: #C9D1DC;
    --on-accent: #03120C;
    --accent: #5FE0B0;
    --accent-strong: #7FEAC2;
    --status-ok: #5FE0B0;
    --status-bad: #FF9B8A;
    --status-warn: #FFD166;
    --focus-ring: #FFD166;
    --map-router: #8CC4FF;
    --map-switch: #5FE0B0;
    --map-host: #D2BBFF;
    --map-link-ok: #5FE0B0;
    --map-link-inferred: #FFD166;
    --map-link-bad: #FF9B8A;
    --map-link-console: #8CC4FF;
    --map-label: #F5F7FA;
    --map-unknown: #C9D1DC;
    --map-port: #B8DAFF;
    --map-ip: #A6F0D2;
    --map-link-unverified: #C9D1DC;
}

:root[data-theme="light"][data-contrast="high"] {
    --surface-base: #FFFFFF;
    --surface: #FFFFFF;
    --surface-raised: #F6F8FA;
    --line: #6B7686;
    --line-strong: #2E3846;
    --text: #0B0F14;
    --text-muted: #2E3846;
    --accent: #0B5036;
    --accent-strong: #0A4430;
    --status-ok: #0B5036;
    --status-bad: #8F1A10;
    --status-warn: #5C3B00;
    --focus-ring: #0B4A8C;
    --map-router: #0B4A8C;
    --map-switch: #0E5A3C;
    --map-host: #4B2A9E;
    --map-link-ok: #0E5A3C;
    --map-link-inferred: #5C3B00;
    --map-link-bad: #8F1A10;
    --map-link-console: #0B4A8C;
    --map-label: #0B0F14;
    --map-unknown: #2E3846;
    --map-port: #0B4A8C;
    --map-ip: #0E5A3C;
    --map-link-unverified: #3E4856;
}

:root {
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --sidebar-width: 440px;
    --rail-width: 5.75rem;
    --context-height: 3rem;

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;

    /* Legacy names used by legacy.css. Each points at a semantic token so the
       old rules follow the theme; they disappear as screens are rewritten. */
    --bg-base: var(--surface-base);
    --bg-surface: var(--surface);
    --bg-surface-hover: var(--surface-raised);
    --bg-surface-subtle: var(--surface-sunken);
    --border-color: var(--line);
    --border-highlight: var(--line-strong);
    --text-primary: var(--text);
    --text-secondary: var(--text-muted);
    --accent-blue: var(--accent);
    --accent-blue-hover: var(--accent-strong);
    --accent-blue-glow: var(--tint-accent-mid);
    --accent-green: var(--status-ok);
    --accent-green-glow: var(--tint-ok-mid);
    --accent-amber: var(--status-warn);
    --accent-amber-glow: var(--tint-warn-mid);
    --accent-red: var(--status-bad);
    --accent-red-glow: var(--tint-bad-mid);
    --accent-purple: var(--map-host);
}

:root[data-text-size="sm"] { font-size: 87.5%; }
:root[data-text-size="md"] { font-size: 100%; }
:root[data-text-size="lg"] { font-size: 112.5%; }
:root[data-text-size="xl"] { font-size: 125%; }

:root[data-motion="reduce"] *,
:root[data-motion="reduce"] *::before,
:root[data-motion="reduce"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}
