/**
 * Design System - Theme Variables
 * Modern, minimal, technically sophisticated design
 * Supports dark mode (default) and light mode
 */

/* ============================================
   ROOT - Default Dark Mode
   ============================================ */
:root, [data-theme="dark"] {
  /* Background Hierarchy */
  --bg-primary: #0a0e14;      /* Main background - deep charcoal */
  --bg-secondary: #131821;    /* Cards, elevated surfaces */
  --bg-tertiary: #1c222d;     /* Hover states, navbar */
  --bg-accent: #222936;       /* Inputs, code blocks */

  /* Text Hierarchy */
  --text-primary: #e6e8eb;    /* Main text - high contrast */
  --text-secondary: #9ca3af;  /* Secondary text, labels */
  --text-tertiary: #6b7280;   /* Muted text, metadata */

  /* Interactive Colors */
  --accent-primary: #3b82f6;  /* Links, primary actions - tech blue */
  --accent-hover: #60a5fa;    /* Hover state */
  --accent-subtle: #1e3a8a;   /* Subtle accents, badges */

  /* Borders and Dividers */
  --border-primary: #2d3748;
  --border-secondary: #1f2937;
  --border-accent: #3b82f6;

  /* Semantic Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Shadows - More pronounced for dark mode */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.7);
}

/* ============================================
   LIGHT MODE
   ============================================ */
[data-theme="light"] {
  /* Background Hierarchy */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --bg-accent: #f9fafb;

  /* Text Hierarchy */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;

  /* Interactive Colors */
  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: #dbeafe;

  /* Borders and Dividers */
  --border-primary: #e5e7eb;
  --border-secondary: #f3f4f6;
  --border-accent: #2563eb;

  /* Semantic Colors */
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --info: #2563eb;

  /* Shadows - Subtle for light mode */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
:root {
  /* Font Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code',
               Consolas, Monaco, 'Courier New', monospace;

  /* Fluid Type Scale - Responsive sizing using clamp() */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);    /* 12-14px */
  --text-sm: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);        /* 14-16px */
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);    /* 16-18px */
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);       /* 18-20px */
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);      /* 20-24px */
  --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);           /* 24-32px */
  --text-3xl: clamp(1.875rem, 1.5rem + 1.5vw, 2.5rem);     /* 30-40px */
  --text-4xl: clamp(2.25rem, 1.8rem + 2vw, 3rem);          /* 36-48px */

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 1.75;

  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
}

/* ============================================
   SPACING SCALE
   ============================================ */
:root {
  --space-0: 0;
  --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 */
  --space-32: 8rem;       /* 128px */
}

/* ============================================
   BORDER RADIUS
   ============================================ */
:root {
  --radius-none: 0;
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;  /* Pill shape */
}

/* ============================================
   TRANSITIONS
   ============================================ */
:root {
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Z-INDEX SCALE
   ============================================ */
:root {
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ============================================
   LAYOUT
   ============================================ */
:root {
  --navbar-height: 3.5rem;    /* 56px */
  --container-max: 1200px;
  --content-max: 800px;
}

/* ============================================
   THEME TRANSITION
   Smooth transition when switching themes
   ============================================ */
html {
  transition: background-color var(--transition-base);
  background-color: var(--bg-primary);
}

/* Tell browsers about color scheme for proper rendering */
html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

body,
.card,
.btn,
.form-control,
.navbar,
.footer {
  transition:
    background-color var(--transition-base),
    color var(--transition-base),
    border-color var(--transition-base);
}
