/* ==========================================================================
   PLUS CHRONOMETER — DESIGN TOKENS & CYBER-INDUSTRIAL DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Color System — Dark Cyber-Industrial Base (Default, Harmonized with #3b5998 hue 221°) */
  --bg-primary: #090d16;
  --bg-surface: #0f1728;
  --bg-surface-elevated: #152038;
  --bg-card: rgba(18, 28, 49, 0.75);
  --bg-card-hover: rgba(26, 40, 70, 0.88);
  --bg-glass: rgba(14, 21, 38, 0.75);

  /* Primary Brand & Industrial ERP Colors (#3b5998 palette) */
  --color-brand-blue: #3b5998;
  --color-brand-blue-hover: #4a69ad;
  --color-brand-blue-light: #5d7fc7;
  --color-brand-blue-dark: #2a4170;
  --color-brand-blue-surface: rgba(59, 89, 152, 0.14);
  --color-brand-blue-glow: rgba(59, 89, 152, 0.45);
  
  /* Harmonious High-Tech Laser Cyan (Soft, Eye-Friendly Glacier Blue) */
  --color-laser-cyan: #38bdf8;
  --color-laser-cyan-dim: rgba(56, 189, 248, 0.14);
  --color-laser-cyan-glow: rgba(56, 189, 248, 0.35);
  
  /* Status & Telemetry Indicators (Accessible & Eye-Friendly) */
  --color-status-active: #10b981;
  --color-status-active-glow: rgba(16, 185, 129, 0.35);
  --color-status-warning: #f59e0b;
  --color-status-warning-glow: rgba(245, 158, 11, 0.35);
  --color-status-danger: #ef4444;
  --color-status-danger-glow: rgba(239, 68, 68, 0.35);
  --color-status-idle: #64748b;
  
  /* Text & Typography Hierarchy */
  --text-white: #ffffff;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;
  --text-cyan: #38bdf8;

  /* Borders & Grid Overlays */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-cyan: rgba(56, 189, 248, 0.28);
  --border-brand: rgba(59, 89, 152, 0.35);
  --border-active: rgba(16, 185, 129, 0.4);
  --grid-line: rgba(59, 89, 152, 0.06);
  --grid-line-bright: rgba(56, 189, 248, 0.12);

  /* Typography Scales */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Elevation, Shadows & Neon Radiance */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.8);
  --shadow-glow-cyan: 0 0 25px rgba(56, 189, 248, 0.35);
  --shadow-glow-blue: 0 0 30px rgba(59, 89, 152, 0.45);
  --shadow-glow-emerald: 0 0 25px rgba(16, 185, 129, 0.35);

  /* Glassmorphism & Backdrop */
  --glass-blur: blur(10px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --glass-border-cyan: 1px solid rgba(56, 189, 248, 0.28);

  /* Spacing & Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Motion & Transitions */
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   LIGHT THEME DESIGN SYSTEM (SURGICAL HIGH-TECH WHITE & #3b5998 BLUE)
   ========================================================================== */
[data-theme="light"] {
  /* Pristine Ergonomic Engineering Base */
  --bg-primary: #f5f7fb;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #e9eef6;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-glass: rgba(255, 255, 255, 0.88);

  /* Primary Brand & Industrial ERP Colors */
  --color-brand-blue: #3b5998;
  --color-brand-blue-hover: #4a69ad;
  --color-brand-blue-light: #5d7fc7;
  --color-brand-blue-dark: #2a4170;
  --color-brand-blue-surface: rgba(59, 89, 152, 0.08);
  --color-brand-blue-glow: rgba(59, 89, 152, 0.25);
  --color-laser-cyan: #0284c7;
  --color-laser-cyan-dim: rgba(2, 132, 199, 0.08);
  --color-laser-cyan-glow: rgba(2, 132, 199, 0.22);

  /* Status Indicators */
  --color-status-active: #059669;
  --color-status-active-glow: rgba(5, 150, 105, 0.2);
  --color-status-warning: #d97706;
  --color-status-warning-glow: rgba(217, 119, 6, 0.2);
  --color-status-danger: #dc2626;
  --color-status-danger-glow: rgba(220, 38, 38, 0.2);
  --color-status-idle: #64748b;

  /* High-Contrast Crisp Typography */
  --text-white: #0f172a;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --text-cyan: #0284c7;

  /* Crisp Borders & Light Grid */
  --border-subtle: rgba(15, 23, 42, 0.12);
  --border-cyan: rgba(59, 89, 152, 0.25);
  --border-brand: rgba(59, 89, 152, 0.3);
  --border-active: rgba(5, 150, 105, 0.4);
  --grid-line: rgba(59, 89, 152, 0.04);
  --grid-line-bright: rgba(59, 89, 152, 0.08);

  /* Clean Shadows for Layered Architecture */
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.1);
  --shadow-glow-cyan: 0 6px 25px rgba(2, 132, 199, 0.15);
  --shadow-glow-blue: 0 6px 25px rgba(59, 89, 152, 0.18);
  --shadow-glow-emerald: 0 6px 25px rgba(5, 150, 105, 0.15);

  --glass-border: 1px solid rgba(15, 23, 42, 0.08);
  --glass-border-cyan: 1px solid rgba(59, 89, 152, 0.22);
}

/* Base resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: clip;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ==========================================================================
   GENERALIZED INDUSTRIAL TYPOGRAPHY SYSTEM (SPACE GROTESK & JETBRAINS MONO)
   ========================================================================== */

/* Headings — Space Grotesk with subtle modern tracking */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-white);
  line-height: 1.2;
}

/* Navigation Links — Geometric & Crisp Space Grotesk */
.nav-link,
.nav-menu a {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Interactive Action Buttons & Tabs — Space Grotesk */
.btn,
.filter-tab,
.twin-control-btn,
.modal-content button[type="submit"] {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Large Numbers & Telemetry Counters — Space Grotesk */
.hero-stat-num,
.nesting-yield-val,
.gauge-value,
.stat-counter-num,
.roi-payback-val {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* High-Tech Industrial Micro-Typography — JetBrains Mono */
.hero-badge-live,
.top-hud-bar,
.hud-btn,
.section-tag,
.status-pill,
.hud-tag,
.brand-subtitle,
.gauge-header,
.gauge-unit,
.scroll-explore-indicator,
.inspector-item-label,
.inspector-item-val,
.mqtt-log-line {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

/* Background Grid */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* Ambient Radial Glows */
body::after {
  content: "";
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 600px;
  background: radial-gradient(circle, rgba(59, 89, 152, 0.25) 0%, rgba(56, 189, 248, 0.08) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] body::after {
  background: radial-gradient(circle, rgba(59, 89, 152, 0.08) 0%, rgba(2, 132, 199, 0.03) 40%, transparent 70%);
}

/* Selection */
::selection {
  background-color: var(--color-laser-cyan);
  color: #ffffff;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg-primary);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-laser-cyan);
}
