/* ─── BroadClaw Design Tokens — single source of truth ───
 * Imported by layout.html (every page) and login.html (standalone).
 * Do not redeclare these tokens elsewhere. Add a new token here, use it everywhere.
 */

:root {
  /* Surfaces — 4-tier depth */
  --bg-canvas: #0a0e14;
  --bg-default: #12171e;
  --bg-subtle: #1a2030;
  --bg-inset: #070a0f;
  --bg-overlay: #1e2536;

  /* Borders */
  --border-default: #2a3346;
  --border-muted: #1e2738;
  --border-emphasis: #3d4f6a;

  /* Foreground */
  --fg-default: #e8edf5;
  --fg-muted: #8994a8;
  --fg-subtle: #5e6b80;
  --fg-on-accent: #ffffff;

  /* Accents */
  --accent-blue: #5ba0f5;
  --accent-green: #40c463;
  --accent-red: #f5534b;
  --accent-yellow: #e0a528;
  --accent-purple: #b68eff;
  --accent-orange: #f09050;
  --accent-cyan: #4ecdc4;
  --accent-pink: #f472b6;

  /* Accent backgrounds (10% tint) */
  --accent-blue-bg: rgba(91, 160, 245, .10);
  --accent-green-bg: rgba(64, 196, 99, .10);
  --accent-red-bg: rgba(245, 83, 75, .10);
  --accent-yellow-bg: rgba(224, 165, 40, .10);
  --accent-purple-bg: rgba(182, 142, 255, .10);
  --accent-orange-bg: rgba(240, 144, 80, .10);
  --accent-cyan-bg: rgba(78, 205, 196, .10);
  --accent-pink-bg: rgba(244, 114, 182, .10);

  /* Brand gradient (sidebar logo, login mark) */
  --gradient-brand: linear-gradient(135deg, #2a5a8f, #4e2d7e);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Type scale (desktop, dense operator UI) */
  --text-2xs: 10px;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 28px;

  /* Spacing scale (4px grid) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 40px;
  --space-3xl: 64px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .5);

  /* Typography */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Layout */
  --sidebar-width: 196px;
  --sidebar-collapsed-width: 56px;

  /* Motion */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

/* ─── Light theme override ─── */
html[data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #f5f7fb;
  --bg-default: #ffffff;
  --bg-subtle: #eef3fb;
  --bg-inset: #e8eef6;
  --bg-overlay: #dde7f4;
  --border-default: #c8d4e6;
  --border-muted: #dde4ef;
  --border-emphasis: #99afd0;
  --fg-default: #152338;
  --fg-muted: #4a607d;
  --fg-subtle: #5d7393; /* darkened from #6c819e to clear 4.5:1 on --bg-canvas */
  --accent-blue-bg: rgba(26, 115, 232, .10);
  --accent-green-bg: rgba(18, 134, 84, .10);
  --accent-red-bg: rgba(211, 47, 47, .10);
  --accent-yellow-bg: rgba(237, 157, 0, .10);
  --accent-purple-bg: rgba(124, 77, 255, .10);
  --accent-cyan-bg: rgba(0, 131, 143, .10);
  --shadow-sm: 0 2px 8px rgba(41, 72, 124, .06);
  --shadow-md: 0 4px 16px rgba(41, 72, 124, .10);
  --shadow-lg: 0 12px 36px rgba(41, 72, 124, .14);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at top right, rgba(91, 160, 245, .14), transparent 28%),
    radial-gradient(circle at top left, rgba(182, 142, 255, .12), transparent 22%),
    var(--bg-canvas);
}

/* ─── Reduced motion (accessibility) ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
