/* ==========================================================================
   BIOGRAN DESIGN SYSTEM TOKENS
   Theme Architecture: Dual Light & Dark OKLCH-based semantic variables
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ROOT DEFAULTS & LIGHT THEME
   -------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
  /* Color Strategy: Precision Cyan Accent + Slate Neutral Ramp */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-active: #075985;
  --primary-subtle: rgba(2, 132, 197, 0.08);
  --primary-border: rgba(2, 132, 197, 0.25);
  --primary-glow: rgba(2, 132, 197, 0.15);

  /* Surface Ramps (Light) */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;
  --bg-subtle: #f8fafc;

  /* Border Ramps (Light) */
  --border-subtle: #f1f5f9;
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-interactive: #94a3b8;

  /* Typography Colors (Light - Strict WCAG Contrast) */
  --text-primary: #0f172a;      /* Contrast ratio > 12:1 against bg-main */
  --text-secondary: #334155;    /* Contrast ratio > 7:1 */
  --text-muted: #475569;        /* Contrast ratio >= 4.5:1 */
  --text-disabled: #94a3b8;
  --text-inverse: #ffffff;

  /* Status Signals */
  --success: #10b981;
  --success-subtle: rgba(16, 185, 129, 0.10);
  --success-text: #047857;

  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.10);
  --warning-text: #b45309;

  --error: #ef4444;
  --error-subtle: rgba(239, 68, 68, 0.10);
  --error-text: #b91c1c;

  --info: #3b82f6;
  --info-subtle: rgba(59, 130, 246, 0.10);
  --info-text: #1d4ed8;

  /* Chart Palette */
  --chart-1: #0284c7;
  --chart-2: #10b981;
  --chart-3: #f59e0b;
  --chart-4: #8b5cf6;
  --chart-5: #ec4899;
  --chart-grid: #e2e8f0;

  /* Elevation & Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-overlay: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  /* Scrollbar */
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: #f1f5f9;
}

/* --------------------------------------------------------------------------
   2. DARK THEME OVERRIDES
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  /* Color Strategy: Precision Cyan Accent + Graphite Dark Ramp */
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-active: #0284c7;
  --primary-subtle: rgba(56, 189, 248, 0.12);
  --primary-border: rgba(56, 189, 248, 0.30);
  --primary-glow: rgba(56, 189, 248, 0.20);

  /* Surface Ramps (Dark - No Pure Black) */
  --bg-main: #0b0f17;
  --bg-surface: #111827;
  --bg-elevated: #1f2937;
  --bg-hover: #1f2937;
  --bg-active: #374151;
  --bg-subtle: #161e2e;

  /* Border Ramps (Dark) */
  --border-subtle: #161f2c;
  --border-default: #1f2937;
  --border-strong: #374151;
  --border-interactive: #4b5563;

  /* Typography Colors (Dark) */
  --text-primary: #f9fafb;
  --text-secondary: #e5e7eb;
  --text-muted: #9ca3af;
  --text-disabled: #4b5563;
  --text-inverse: #0f172a;

  /* Status Signals (Dark Adjusted) */
  --success: #34d399;
  --success-subtle: rgba(52, 211, 153, 0.12);
  --success-text: #6ee7b7;

  --warning: #fbbf24;
  --warning-subtle: rgba(251, 191, 36, 0.12);
  --warning-text: #fde68a;

  --error: #f87171;
  --error-subtle: rgba(248, 113, 113, 0.12);
  --error-text: #fca5a5;

  --info: #60a5fa;
  --info-subtle: rgba(96, 165, 250, 0.12);
  --info-text: #93c5fd;

  /* Chart Palette (Dark Adjusted) */
  --chart-1: #38bdf8;
  --chart-2: #34d399;
  --chart-3: #fbbf24;
  --chart-4: #a78bfa;
  --chart-5: #f472b6;
  --chart-grid: #1f2937;

  /* Elevation & Shadows (Dark - Subtle Glows) */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  --shadow-overlay: 0 20px 25px -5px rgba(0, 0, 0, 0.6), inset 0 1px 0 0 rgba(255, 255, 255, 0.08);

  /* Scrollbar */
  --scrollbar-thumb: #374151;
  --scrollbar-track: #111827;
}

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY, SPACING & RADIUS GLOBALS
   -------------------------------------------------------------------------- */
:root {
  /* Typography Families */
  --font-sans: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Geist Mono", SFMono-Regular, Consolas, monospace;

  /* Scale */
  --text-nano: 0.625rem;  /* 10px */
  --text-micro: 0.6875rem; /* 11px */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 2rem;      /* 32px */
  --text-display: clamp(1.75rem, 3.5vw, 2.5rem);

  /* Weights */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Spacing Scale */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */

  /* Radius Scale */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Motion & Transitions */
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 250ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-normal: 0ms;
    --transition-slow: 0ms;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
