/* ===========================
   Quick Math Facts Design System
   Modern, clean educational tool design
   =========================== */

:root {
  /* Color Palette - Educational and professional */
  --surface-0: #0A0E15;
  --surface-1: #111826;
  --surface-2: #1A2332;
  --surface-3: #243447;
  --surface-4: #2E4057;

  /* Primary colors - Trust and focus */
  --primary-50: #EBF2FF;
  --primary-100: #D6E4FF;
  --primary-200: #ADCAFF;
  --primary-300: #84AFFF;
  --primary-400: #5B95FF;
  --primary-500: #3B7BFF;
  --primary-600: #2962E6;
  --primary-700: #1A4AB3;
  --primary-800: #0F3380;
  --primary-900: #071D4D;

  /* Success - For answers and completion */
  --success-50: #ECFDF5;
  --success-100: #D1FAE5;
  --success-500: #10B981;
  --success-600: #059669;
  --success-700: #047857;
  --success-800: #065F46;

  /* Warning - For clear/reset actions */
  --warning-50: #FFF7ED;
  --warning-100: #FFEDD5;
  --warning-500: #F59E0B;
  --warning-600: #D97706;
  --warning-700: #B45309;

  /* Error states */
  --error-50: #FEF2F2;
  --error-100: #FEE2E2;
  --error-500: #EF4444;
  --error-600: #DC2626;
  --error-800: #991B1B;

  /* Neutral grays */
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Semantic colors */
  --bg-page: #F9FAFB;
  --bg-card: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-muted: var(--gray-50);
  --bg-hover: var(--primary-50);

  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-muted: #6B7280;
  --text-inverse: #FFFFFF;

  --border-light: #E5E7EB;
  --border-medium: #D1D5DB;
  --border-dark: #9CA3AF;
  --border-focus: var(--primary-500);

  /* Typography Scale - Fluid and responsive */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;

  --text-xs: clamp(0.75rem, 0.7rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.825rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.15rem + 0.4vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.35rem + 0.6vw, 1.875rem);
  --text-3xl: clamp(1.875rem, 1.65rem + 0.9vw, 2.25rem);
  --text-4xl: clamp(2.25rem, 1.95rem + 1.2vw, 3rem);

  --line-tight: 1.25;
  --line-snug: 1.375;
  --line-normal: 1.5;
  --line-relaxed: 1.625;
  --line-loose: 1.75;

  --tracking-tight: -0.015em;
  --tracking-normal: 0;
  --tracking-wide: 0.015em;

  /* Spacing Scale */
  --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;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Z-index layers */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1400px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================
   Base Reset & Typography
   =========================== */

*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-normal);
  color: var(--text-primary);
  background: var(--bg-page);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--line-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
  line-height: var(--line-relaxed);
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-700);
}

a:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

ul, ol {
  list-style-position: inside;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: var(--space-1) var(--space-2);
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

/* ===========================
   Form Elements
   =========================== */

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button, select {
  cursor: pointer;
}

button:disabled, select:disabled, input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 123, 255, 0.1);
}

input[type="checkbox"], input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  accent-color: var(--primary-600);
}

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ===========================
   Responsive Breakpoints
   =========================== */

/* Mobile-first approach */
/* Base styles are for mobile (< 640px) */

@media (min-width: 640px) {
  /* sm: tablets */
}

@media (min-width: 768px) {
  /* md: small laptops */
}

@media (min-width: 1024px) {
  /* lg: desktops */
}

@media (min-width: 1280px) {
  /* xl: large screens */
}
