/* ══════════════════════════════════════════════════════════════════════════
   One Global Operations — design tokens (spec §8)

   Dark is the default (`:root` and [data-theme="dark"]); light is the "daylight tower"
   ([data-theme="light"]). The layout sets data-theme before first paint from
   localStorage('ogo-theme'); default dark regardless of OS preference.

   One red policy (spec decision 9): --critical IS --brand. Red appears only on the OGO mark,
   the active rail bar, primary CTA pills, the attention rule on critical rows, breached /
   critical badges (glyph + word) and alert rings — never on links, hover, selection, focus,
   chart series, region tints or the flow arc.
   ══════════════════════════════════════════════════════════════════════════ */

:root,
:root[data-theme="dark"] {
    color-scheme: dark;

    /* backgrounds and surfaces */
    --bg-0: #04060c;
    --bg-1: #0a0f1c;
    --bg-2: #111830;
    --surface: #0f1627;
    --surface-2: #161f35;
    --surface-3: #1e2944;
    --glass: rgba(12, 18, 34, .66);
    --glass-strong: rgba(12, 18, 34, .86);
    --glass-border: rgba(148, 163, 184, .16);
    --glass-blur: 14px;
    --glass-highlight: rgba(255, 255, 255, .06);
    --line: rgba(148, 163, 184, .14);
    --line-strong: rgba(148, 163, 184, .30);

    /* type */
    --text: #e8edf7;
    --text-2: #aab4c8;
    --text-3: #6f7a93;
    --text-inverse: #0b1020;

    /* brand */
    --brand: #ff3b4a;
    --brand-deep: #e60012;
    --brand-wash: rgba(255, 59, 74, .14);
    --on-brand: #ffffff;

    /* accent (links, hover, selection, focus) */
    --accent: #6ea8ff;
    --accent-wash: rgba(110, 168, 255, .14);
    --focus: #9cc4ff;

    /* status — badges and SLA bars only, always glyph + word */
    --good: #3ddc97;
    --warn: #f5c842;
    --serious: #ff8a4c;
    --critical: var(--brand);
    --hold: #a78bfa;
    --neutral: #8b95ab;

    /* products — arcs under a product filter, pipeline headers, rail icons, queue rule */
    --p-payments: #38bdf8;
    --p-loans: #c084fc;
    --p-trade: #2dd4bf;
    --p-guarantees: #e5b53a;

    /* regions — hex tints, region chips, labels — never status */
    --r-japan: #f0abfc;
    --r-amer: #93c5fd;
    --r-emea: #5eead4;
    --r-apac: #fdba74;

    /* globe */
    --flow: var(--accent);
    --flow-tip: #ffffff;
    --handover: #f5c842;
    --arc-handover: rgba(255, 255, 255, .85);
    --site-on: #e8edf7;
    --globe-sphere: #0b1226;
    --globe-emissive: #070c1a;
    --globe-atmo: #2f6fed;
    --hex-none: rgba(118, 136, 176, .22);
    --night: rgba(2, 5, 14, .55);
    --terminator: rgba(255, 214, 170, .35);
    --stage-backdrop: radial-gradient(1200px 800px at 40% 50%, #0c1430 0%, #04060c 70%);

    /* charts */
    --chart-1: #6ea8ff;
    --chart-2: #3ddc97;
    --chart-3: #e5b53a;
    --chart-4: #c084fc;
    --chart-5: #2dd4bf;
    --chart-6: #ff8a4c;

    /* elevation */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .28);
    --shadow-2: 0 12px 40px rgba(0, 0, 0, .5);
    --selection-glow: 0 0 0 1px var(--accent), 0 0 24px var(--accent-wash);

    /* type scale */
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
    --fs-11: .6875rem;
    --fs-12: .75rem;
    --fs-13: .8125rem;
    --fs-14: .875rem;
    --fs-16: 1rem;
    --fs-20: 1.25rem;
    --fs-28: 1.75rem;
    --fs-40: 2.5rem;
    --lh: 1.4;
    --track-label: .08em;

    /* shape and space */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 28px; --s8: 32px;
    --rail-w: 240px;
    --rail-w-collapsed: 56px;
    --topbar-h: 52px;
    --panel-w: 400px;
    --panel-w-world: 340px;
    --drawer-w: 560px;
    --row-h: 34px;
    --kpi-h: 64px;

    /* motion */
    --dur-fast: 120ms;
    --dur: 220ms;
    --dur-slow: 320ms;
    --ease: cubic-bezier(.2, .7, .2, 1);
    --dur-camera-region: 1000ms;
    --dur-camera-site: 800ms;
    --dur-camera-flow: 900ms;
    --dur-tween: 400ms;
    --dur-flip: 320ms;
    --dur-badge: 220ms;
    --dur-toast: 6000ms;
    --dur-shimmer: 1200ms;
}

:root[data-theme="light"] {
    color-scheme: light;

    --bg-0: #eef2f8;
    --bg-1: #f6f8fc;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f4fa;
    --surface-3: #e6ebf4;
    --glass: rgba(255, 255, 255, .72);
    --glass-strong: rgba(255, 255, 255, .9);
    --glass-border: rgba(15, 23, 42, .10);
    --glass-highlight: rgba(255, 255, 255, .5);
    --line: rgba(15, 23, 42, .10);
    --line-strong: rgba(15, 23, 42, .22);

    --text: #0f172a;
    --text-2: #475569;
    --text-3: #7c8799;
    --text-inverse: #ffffff;

    --brand: #e60012;
    --brand-deep: #b8000e;
    --brand-wash: rgba(230, 0, 18, .10);
    --on-brand: #ffffff;

    --accent: #1d5fd6;
    --accent-wash: rgba(29, 95, 214, .10);
    --focus: #1d5fd6;

    --good: #15803d;
    --warn: #b45309;
    --serious: #c2410c;
    --critical: var(--brand);
    --hold: #4f46e5;
    --neutral: #64748b;

    --p-payments: #0369a1;
    --p-loans: #7c3aed;
    --p-trade: #0f766e;
    --p-guarantees: #9a6b00;

    --r-japan: #a21caf;
    --r-amer: #1d4ed8;
    --r-emea: #0f766e;
    --r-apac: #c2410c;

    --flow: var(--accent);
    --flow-tip: #0f172a;
    --handover: #b45309;
    --arc-handover: rgba(15, 23, 42, .7);
    --site-on: #0f172a;
    --globe-sphere: #c9d6ea;
    --globe-emissive: #b7c6dd;
    --globe-atmo: #9db7e6;
    --hex-none: rgba(51, 65, 85, .18);
    --night: rgba(15, 23, 42, .22);
    --terminator: rgba(180, 83, 9, .35);
    --stage-backdrop: radial-gradient(1200px 800px at 40% 50%, #ffffff 0%, #dfe7f3 70%);

    --chart-1: #1d5fd6;
    --chart-2: #15803d;
    --chart-3: #9a6b00;
    --chart-4: #7c3aed;
    --chart-5: #0f766e;
    --chart-6: #c2410c;

    --shadow-1: 0 1px 2px rgba(15, 23, 42, .08), 0 4px 16px rgba(15, 23, 42, .08);
    --shadow-2: 0 12px 32px rgba(15, 23, 42, .14);
}

/* Reduced motion collapses every duration to 0 except the 120 ms opacity fades (spec §4.4). */
@media (prefers-reduced-motion: reduce) {
    :root, :root[data-theme="dark"], :root[data-theme="light"] {
        --dur: 0ms; --dur-slow: 0ms;
        --dur-camera-region: 0ms; --dur-camera-site: 0ms; --dur-camera-flow: 0ms;
        --dur-tween: 0ms; --dur-flip: 0ms; --dur-badge: 0ms; --dur-shimmer: 0ms;
    }
}

/* prefers-contrast: more thickens outlines (spec §14). */
@media (prefers-contrast: more) {
    :root, :root[data-theme="dark"], :root[data-theme="light"] {
        --line: var(--line-strong);
        --glass-border: var(--line-strong);
    }
}
