/* ==========================================================================
   AutoGenius Speed Layer & ETSv2 Field Report — Design Tokens
   Editorial Telemetry Aesthetic: Stripe Press × The Pudding × Web.dev Almanac
   ========================================================================== */

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

  /* Canvas & Surfaces */
  --bg-canvas: #0B0E14;
  --bg-surface: #111622;
  --bg-surface-2: #161C2B;
  --bg-surface-3: #1D2538;
  --bg-header: rgba(11, 14, 20, 0.86);
  --bg-code: #0D121C;

  /* Hairlines & Borders */
  --border-subtle: #1E2738;
  --border-strong: #2E3B54;
  --border-focus: #3B82F6;

  /* Typography Ink */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #8494AB;
  --text-inverse: #0B0E14;

  /* Semantic Telemetry Palette (inherited automatically by SVG/Canvas charts) */
  --accent-emerald: #10B981;
  --accent-emerald-ink: #34D399;
  --accent-emerald-soft: rgba(16, 185, 129, 0.14);
  --accent-emerald-border: rgba(16, 185, 129, 0.34);

  --accent-coral: #F43F5E;
  --accent-coral-ink: #FB7185;
  --accent-coral-soft: rgba(244, 63, 94, 0.14);
  --accent-coral-border: rgba(244, 63, 94, 0.34);

  --accent-amber: #F59E0B;
  --accent-amber-ink: #FBBF24;
  --accent-amber-soft: rgba(245, 158, 11, 0.14);
  --accent-amber-border: rgba(245, 158, 11, 0.34);

  --accent-cobalt: #3B82F6;
  --accent-cobalt-ink: #60A5FA;
  --accent-cobalt-soft: rgba(59, 130, 246, 0.14);
  --accent-cobalt-border: rgba(59, 130, 246, 0.34);

  --accent-violet: #8B5CF6;
  --accent-violet-ink: #A78BFA;
  --accent-violet-soft: rgba(139, 92, 246, 0.14);
  --accent-violet-border: rgba(139, 92, 246, 0.34);

  --accent-cyan: #06B6D4;
  --accent-cyan-ink: #22D3EE;
  --accent-cyan-soft: rgba(6, 182, 212, 0.14);
  --accent-cyan-border: rgba(6, 182, 212, 0.34);

  /* Chart & Telemetry Visualization Tokens */
  --chart-grid: rgba(148, 163, 184, 0.14);
  --chart-grid-strong: rgba(148, 163, 184, 0.28);
  --chart-axis: #475569;
  --chart-label: #94A3B8;
  --chart-label-strong: #E2E8F0;
  --chart-bar-track: rgba(148, 163, 184, 0.12);
  --chart-pass-zone: rgba(16, 185, 129, 0.09);
  --chart-warn-zone: rgba(245, 158, 11, 0.08);
  --chart-fail-zone: rgba(244, 63, 94, 0.08);
  --chart-tooltip-bg: rgba(11, 14, 20, 0.96);
  --chart-tooltip-border: #334155;
  --chart-tooltip-text: #F8FAFC;
  --chart-tooltip-muted: #94A3B8;

  /* Elevation & Subtle Editorial Textures */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 10px 26px -6px rgba(0, 0, 0, 0.48);
  --shadow-lg: 0 22px 48px -10px rgba(0, 0, 0, 0.65);
  --hero-grid-dot: rgba(148, 163, 184, 0.11);
  --scroll-shadow-edge: rgba(11, 14, 20, 0.85);
}

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

  /* Canvas & Surfaces */
  --bg-canvas: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F1F5F9;
  --bg-surface-3: #E2E8F0;
  --bg-header: rgba(248, 250, 252, 0.88);
  --bg-code: #F1F5F9;

  /* Hairlines & Borders */
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus: #2563EB;

  /* Typography Ink */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #526075;
  --text-inverse: #FFFFFF;

  /* Semantic Telemetry Palette — Light Mode */
  --accent-emerald: #059669;
  --accent-emerald-ink: #047857;
  --accent-emerald-soft: rgba(5, 150, 105, 0.10);
  --accent-emerald-border: rgba(5, 150, 105, 0.28);

  --accent-coral: #E11D48;
  --accent-coral-ink: #BE123C;
  --accent-coral-soft: rgba(225, 29, 72, 0.09);
  --accent-coral-border: rgba(225, 29, 72, 0.28);

  --accent-amber: #D97706;
  --accent-amber-ink: #B45309;
  --accent-amber-soft: rgba(217, 119, 6, 0.10);
  --accent-amber-border: rgba(217, 119, 6, 0.28);

  --accent-cobalt: #2563EB;
  --accent-cobalt-ink: #1D4ED8;
  --accent-cobalt-soft: rgba(37, 99, 235, 0.10);
  --accent-cobalt-border: rgba(37, 99, 235, 0.28);

  --accent-violet: #7C3AED;
  --accent-violet-ink: #6D28D9;
  --accent-violet-soft: rgba(124, 58, 237, 0.10);
  --accent-violet-border: rgba(124, 58, 237, 0.28);

  --accent-cyan: #0891B2;
  --accent-cyan-ink: #0E7490;
  --accent-cyan-soft: rgba(8, 145, 178, 0.10);
  --accent-cyan-border: rgba(8, 145, 178, 0.28);

  /* Chart & Telemetry Visualization Tokens — Light Mode */
  --chart-grid: rgba(15, 23, 42, 0.09);
  --chart-grid-strong: rgba(15, 23, 42, 0.18);
  --chart-axis: #94A3B8;
  --chart-label: #475569;
  --chart-label-strong: #0F172A;
  --chart-bar-track: rgba(15, 23, 42, 0.07);
  --chart-pass-zone: rgba(5, 150, 105, 0.08);
  --chart-warn-zone: rgba(217, 119, 6, 0.07);
  --chart-fail-zone: rgba(225, 29, 72, 0.06);
  --chart-tooltip-bg: rgba(15, 23, 42, 0.96);
  --chart-tooltip-border: #334155;
  --chart-tooltip-text: #F8FAFC;
  --chart-tooltip-muted: #CBD5E1;

  /* Elevation & Subtle Editorial Textures */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 24px -6px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 22px 44px -12px rgba(15, 23, 42, 0.15);
  --hero-grid-dot: rgba(15, 23, 42, 0.08);
  --scroll-shadow-edge: rgba(248, 250, 252, 0.92);
}

/* Shared Geometry, Typography & Motion Scale */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.84375rem;   /* 13.5px */
  --text-base: 0.9375rem;  /* 15px */
  --text-md: 1.03125rem;   /* 16.5px */
  --text-lg: 1.1875rem;    /* 19px */
  --text-xl: 1.4375rem;    /* 23px */
  --text-2xl: 1.875rem;    /* 30px */
  --text-3xl: 2.375rem;    /* 38px */

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --header-height: 60px;
  --toc-width: 248px;
  --reading-max: 1140px;
  --shell-max: 1440px;

  --z-base: 1;
  --z-sticky: 30;
  --z-header: 40;
  --z-backdrop: 55;
  --z-drawer: 60;
  --z-tooltip: 80;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-med: 240ms var(--ease-out);
}
