:root {
  color-scheme: dark;

  /* ========== Backgrounds ========== */
  --bg-primary: #0B0F14;
  --bg-secondary: #111827;
  --bg-tertiary: #1E293B;
  --bg-elevated: #1E293B;
  --bg-inverse: #FFFFFF;

  /* ========== Text ========== */
  --text-primary: #F0F0F0;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --text-disabled: #334155;
  --text-inverse: #0B0F14;

  /* ========== Accent (Orange) ========== */
  --accent-primary: #FC6E08;
  --accent-primary-rgb: 252, 110, 8;
  --accent-secondary: #FD8F3D;
  --accent-tertiary: #FEB075;

  /* ========== Brand Gradients ========== */
  --brand-gradient: linear-gradient(135deg, #FC6E08 0%, #FD8F3D 50%, #FEB075 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(252,110,8,0.16) 0%, rgba(253,143,61,0.06) 100%);
  --gradient-brand-text: linear-gradient(120deg, #FC6E08 0%, #FEB075 60%, #FD8F3D 100%);
  --gradient-radial-brand: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(252,110,8,0.14), transparent 70%);

  /* ========== Background System (Aurora Mesh + Circuit) ========== */
  --lc-bg-deep: #060A0F;
  --lc-mesh-1: rgba(252, 110, 8, 0.07);
  --lc-mesh-2: rgba(56, 189, 248, 0.05);
  --lc-mesh-3: rgba(167, 139, 250, 0.05);
  --lc-aurora-1: rgba(252, 110, 8, 0.10);
  --lc-aurora-2: rgba(56, 189, 248, 0.07);
  --lc-aurora-3: rgba(167, 139, 250, 0.06);
  --lc-node-color: rgba(252, 110, 8, 0.45);
  --lc-node-hub: rgba(252, 110, 8, 0.75);
  --lc-line-color: rgba(255, 255, 255, 0.045);
  --lc-line-active: rgba(252, 110, 8, 0.25);
  --lc-pulse-color: rgba(252, 110, 8, 0.85);
  --lc-spotlight: rgba(252, 110, 8, 0.07);
  --lc-grid-dot: rgba(255, 255, 255, 0.06);
  --lc-vignette: rgba(0, 0, 0, 0.35);
  --lc-ambient-tint: rgba(252, 110, 8, 0.0);

  /* ========== Section Accent Palette ========== */
  --accent-emerald: #22C55E;
  --accent-emerald-rgb: 34, 197, 94;
  --accent-sky: #38BDF8;
  --accent-sky-rgb: 56, 189, 248;
  --accent-violet: #A78BFA;
  --accent-violet-rgb: 167, 139, 250;
  --accent-rose: #FB7185;
  --accent-rose-rgb: 251, 113, 133;
  --accent-cyan: #2DD4BF;
  --accent-cyan-rgb: 45, 212, 191;

  /* ========== Glow Shadow ========== */
  --shadow-glow: 0 0 32px rgba(252, 110, 8, 0.18);
  --shadow-glow-strong: 0 0 48px rgba(252, 110, 8, 0.28);

  /* ========== Diff Syntax ========== */
  --diff-add-fg: #86EFAC;
  --diff-add-bg: rgba(34, 197, 94, 0.10);
  --diff-del-fg: #FCA5A5;
  --diff-del-bg: rgba(239, 68, 68, 0.10);

  /* ========== Semantic ========== */
  --color-success: #22C55E;
  --color-success-rgb: 34, 197, 94;
  --color-warning: #F59E0B;
  --color-warning-rgb: 245, 158, 11;
  --color-error: #EF4444;
  --color-error-rgb: 239, 68, 68;

  /* ========== Grays ========== */
  --gray-50: #F1F5F9;
  --gray-200: #475569;
  --gray-300: #64748B;
  --gray-400: #94A3B8;
  --gray-500: #CBD5E1;
  --gray-800: #1E293B;

  /* ========== Borders ========== */
  --border-color: #1E293B;
  --border-color-hover: #334155;
  --border-color-light: rgba(255, 255, 255, 0.06);

  /* ========== Surfaces ========== */
  --surface-card: #111827;
  --surface-raised: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-active: rgba(255, 255, 255, 0.09);

  /* ========== Glass ========== */
  --glass-bg: rgba(11, 15, 20, 0.85);
  --glass-bg-hover: rgba(11, 15, 20, 0.95);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);

  /* ========== Shadows ========== */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.65);
  --shadow-2xl: 0 32px 80px rgba(0, 0, 0, 0.75);

  /* ========== Typography ========== */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  --text-2xs: 0.65rem;
  --text-xs: 0.72rem;
  --text-sm: 0.82rem;
  --text-base: 1rem;
  --text-md: 1.15rem;
  --text-lg: 1.35rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.2rem;
  --text-3xl: 2.8rem;
  --text-4xl: 3.5rem;
  --text-5xl: 4.5rem;
  --text-6xl: 5.5rem;

  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
  --weight-black: 900;

  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --tracking-tight: -0.03em;
  --tracking-snug: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.02em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

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

  /* ========== Radii ========== */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* ========== Motion ========== */
  --duration-fast: 0.15s;
  --duration-base: 0.25s;
  --duration-slow: 0.4s;
  --duration-slower: 0.6s;
  --duration-reveal: 0.7s;

  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1);

  /* ========== Z-Index ========== */
  --z-base: 0;
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-toast: 400;

  /* ========== Layout ========== */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --max-width-wide: 1400px;
  --nav-height: 64px;
}

/* ========== Light Theme Override ========== */
.light {
  color-scheme: light;

  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-tertiary: #F1F5F9;
  --bg-elevated: #FFFFFF;
  --bg-inverse: #0B0F14;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --text-disabled: #CBD5E1;
  --text-inverse: #FFFFFF;

  --accent-primary: #FC6E08;
  --accent-primary-rgb: 252, 110, 8;
  --accent-secondary: #E05D00;
  --accent-tertiary: #FEB075;

  /* Brand gradients carry over (defined on :root) */
  --gradient-radial-brand: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(252,110,8,0.08), transparent 70%);
  --shadow-glow: 0 0 32px rgba(252, 110, 8, 0.12);
  --shadow-glow-strong: 0 0 48px rgba(252, 110, 8, 0.20);

  /* Background System (light overrides) */
  --lc-bg-deep: #EEF2F7;
  --lc-mesh-1: rgba(252, 110, 8, 0.05);
  --lc-mesh-2: rgba(56, 189, 248, 0.04);
  --lc-mesh-3: rgba(167, 139, 250, 0.04);
  --lc-aurora-1: rgba(252, 110, 8, 0.06);
  --lc-aurora-2: rgba(56, 189, 248, 0.05);
  --lc-aurora-3: rgba(167, 139, 250, 0.04);
  --lc-node-color: rgba(224, 93, 0, 0.3);
  --lc-node-hub: rgba(224, 93, 0, 0.5);
  --lc-line-color: rgba(0, 0, 0, 0.035);
  --lc-line-active: rgba(252, 110, 8, 0.18);
  --lc-pulse-color: rgba(224, 93, 0, 0.6);
  --lc-spotlight: rgba(252, 110, 8, 0.04);
  --lc-grid-dot: rgba(0, 0, 0, 0.045);
  --lc-vignette: rgba(100, 80, 50, 0.08);
  --lc-ambient-tint: rgba(252, 110, 8, 0.0);

  /* Diff syntax (darker for light backgrounds) */
  --diff-add-fg: #15803D;
  --diff-add-bg: rgba(34, 197, 94, 0.12);
  --diff-del-fg: #B91C1C;
  --diff-del-bg: rgba(239, 68, 68, 0.10);

  --gray-50: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-800: #1E293B;

  --border-color: #E2E8F0;
  --border-color-hover: #CBD5E1;
  --border-color-light: rgba(0, 0, 0, 0.05);

  --surface-card: #FFFFFF;
  --surface-raised: rgba(0, 0, 0, 0.02);
  --surface-hover: rgba(0, 0, 0, 0.04);
  --surface-active: rgba(0, 0, 0, 0.06);

  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-bg-hover: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-border-hover: rgba(0, 0, 0, 0.12);
  --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);
  --shadow-2xl: 0 32px 80px rgba(0, 0, 0, 0.15);
}

/* ========== Theme Transition ========== */
html.theme-ready body,
html.theme-ready header,
html.theme-ready nav,
html.theme-ready main,
html.theme-ready section,
html.theme-ready article,
html.theme-ready aside,
html.theme-ready footer,
html.theme-ready .card,
html.theme-ready .nav,
html.theme-ready .btn,
html.theme-ready input,
html.theme-ready textarea,
html.theme-ready select,
html.theme-ready .theme-toggle,
html.theme-ready .back-to-top,
html.theme-ready .cp-overlay,
html.theme-ready .cp-panel,
html.theme-ready .cookie-banner,
html.theme-ready .mega-card,
html.theme-ready .ability-card,
html.theme-ready .stat-card,
html.theme-ready .pricing-card,
html.theme-ready .blog-card,
html.theme-ready .capability-card {
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

/* ========== Theme Toggle Button ========== */
.theme-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
  margin-left: var(--space-2);
}

.theme-toggle:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-secondary);
}

.theme-toggle:active {
  transform: translateY(1px);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
  position: absolute;
  transform-origin: center;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* Dark (default): moon visible, sun hidden */
.theme-toggle__sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.72);
}

.theme-toggle__moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Light: sun visible, moon hidden */
.light .theme-toggle__sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.light .theme-toggle__moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.72);
}

/* ========== Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {
  html.theme-ready body,
  html.theme-ready header,
  html.theme-ready nav,
  html.theme-ready main,
  html.theme-ready section,
  html.theme-ready article,
  html.theme-ready aside,
  html.theme-ready footer,
  html.theme-ready .card,
  html.theme-ready .nav,
  html.theme-ready .btn,
  html.theme-ready input,
  html.theme-ready textarea,
  html.theme-ready select,
  html.theme-ready .theme-toggle,
  .theme-toggle__icon {
    transition: none;
  }
}
