/* === VARIABLES.CSS === */
/* Design tokens — single source of truth for the entire design system */

:root {
  /* ─── Typography ─── */
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --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: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */

  /* ─── Spacing ─── */
  --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 */
  --space-16: 4rem;        /* 64px */
  --space-20: 5rem;        /* 80px */
  --space-24: 6rem;        /* 96px */

  /* ─── Border Radius ─── */
  --radius-sm: 0.375rem;   /* 6px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 0.75rem;    /* 12px */
  --radius-xl: 1rem;       /* 16px */
  --radius-2xl: 1.5rem;    /* 24px */
  --radius-full: 9999px;

  /* ─── Container ─── */
  --container-max: 1200px;
  --container-narrow: 800px;
  --container-padding: var(--space-6);

  /* ─── Transitions ─── */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-theme: 200ms ease;

  /* ─── Z-Index Scale ─── */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-cookie-banner: 500;
  --z-toast: 600;

  /* ─── Silo Accents ─── */
  --accent-solar: #F59E0B;
  --accent-solar-light: #FDE68A;
  --accent-solar-gradient: linear-gradient(135deg, #F59E0B, #D97706);

  --accent-3dprint: #8B5CF6;
  --accent-3dprint-light: #C4B5FD;
  --accent-3dprint-gradient: linear-gradient(135deg, #8B5CF6, #7C3AED);

  /* ─── Semantic Colors ─── */
  --color-success: #10B981;
  --color-success-bg: #D1FAE5;
  --color-warning: #F59E0B;
  --color-warning-bg: #FEF3C7;
  --color-danger: #EF4444;
  --color-danger-bg: #FEE2E2;
  --color-info: #3B82F6;
  --color-info-bg: #DBEAFE;
}

/* ─── LIGHT THEME (default) ─── */
:root,
[data-theme="light"] {
  --bg-primary: #FAFBFC;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-input: #F3F4F6;
  --bg-hover: #F9FAFB;
  --bg-code: #F1F5F9;

  --text-primary: #1A1D2E;
  --text-secondary: #5A6178;
  --text-tertiary: #9BA1B7;
  --text-inverse: #FFFFFF;

  --border-primary: #E5E7EB;
  --border-secondary: #D1D5DB;
  --border-focus: #3B82F6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  --header-bg: rgba(255, 255, 255, 0.85);
  --header-border: rgba(0, 0, 0, 0.06);

  color-scheme: light;
}

/* ─── DARK THEME ─── */
[data-theme="dark"] {
  --bg-primary: #0F1117;
  --bg-secondary: #1A1D2E;
  --bg-card: #222640;
  --bg-input: #2D3348;
  --bg-hover: #2D3348;
  --bg-code: #1E2235;

  --text-primary: #E8EAF0;
  --text-secondary: #9BA1B7;
  --text-tertiary: #6B7194;
  --text-inverse: #0F1117;

  --border-primary: #2D3348;
  --border-secondary: #3D4460;
  --border-focus: #60A5FA;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.35), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);

  --header-bg: rgba(15, 17, 23, 0.85);
  --header-border: rgba(255, 255, 255, 0.06);

  --accent-solar: #FBBF24;
  --accent-solar-light: #FDE68A;
  --accent-3dprint: #A78BFA;
  --accent-3dprint-light: #DDD6FE;

  --color-success: #34D399;
  --color-success-bg: #064E3B;
  --color-warning: #FBBF24;
  --color-warning-bg: #78350F;
  --color-danger: #F87171;
  --color-danger-bg: #7F1D1D;
  --color-info: #60A5FA;
  --color-info-bg: #1E3A5F;

  color-scheme: dark;
}

/* ─── System preference detection (before JS loads) ─── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0F1117;
    --bg-secondary: #1A1D2E;
    --bg-card: #222640;
    --bg-input: #2D3348;
    --bg-hover: #2D3348;
    --bg-code: #1E2235;

    --text-primary: #E8EAF0;
    --text-secondary: #9BA1B7;
    --text-tertiary: #6B7194;
    --text-inverse: #0F1117;

    --border-primary: #2D3348;
    --border-secondary: #3D4460;
    --border-focus: #60A5FA;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.35), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);

    --header-bg: rgba(15, 17, 23, 0.85);
    --header-border: rgba(255, 255, 255, 0.06);

    --accent-solar: #FBBF24;
    --accent-solar-light: #FDE68A;
    --accent-3dprint: #A78BFA;
    --accent-3dprint-light: #DDD6FE;

    --color-success: #34D399;
    --color-success-bg: #064E3B;
    --color-warning: #FBBF24;
    --color-warning-bg: #78350F;
    --color-danger: #F87171;
    --color-danger-bg: #7F1D1D;
    --color-info: #60A5FA;
    --color-info-bg: #1E3A5F;

    color-scheme: dark;
  }
}
