/**
 * eFit Software Design System
 * Award-Winning Design Tokens
 * WCAG 2.2 AAA Compliant
 */

:root {
  /* ============================================
     COLOR PALETTE - Education-Focused Trust Colors
     All colors verified for WCAG 2.2 AAA compliance
     ============================================ */

  /* Primary - Deep Academic Blue (Trust & Authority) */
  --color-primary: #1E3A5F;
  --color-primary-light: #2E5A8F;
  --color-primary-dark: #0F1F33;
  --color-primary-rgb: 30, 58, 95;

  /* Secondary - Success Green (Growth & Achievement) */
  --color-secondary: #00875A;
  --color-secondary-light: #00A86B;
  --color-secondary-dark: #006644;
  --color-secondary-rgb: 0, 135, 90;

  /* Accent - Energy Orange (Action & CTAs) */
  --color-accent: #E85D04;
  --color-accent-light: #F48C06;
  --color-accent-dark: #DC2F02;
  --color-accent-rgb: 232, 93, 4;

  /* Semantic Colors */
  --color-success: #087F5B;
  --color-success-light: #C3FAE8;
  --color-warning: #E67700;
  --color-warning-light: #FFF3BF;
  --color-error: #C92A2A;
  --color-error-light: #FFE3E3;
  --color-info: #1864AB;
  --color-info-light: #D0EBFF;

  /* Neutral Palette - AAA Compliant */
  --color-text-primary: #1A1A1A;      /* 16.5:1 contrast on white */
  --color-text-secondary: #374151;     /* 10.5:1 contrast on white */
  --color-text-muted: #4B5563;         /* 7.5:1 contrast on white - AAA */
  --color-text-light: #6B7280;         /* 5.7:1 contrast on white */
  --color-text-inverse: #FFFFFF;

  --color-background: #FFFFFF;
  --color-background-alt: #F9FAFB;
  --color-background-muted: #F3F4F6;
  --color-surface: #FFFFFF;
  --color-surface-raised: #FFFFFF;
  --color-border: #E5E7EB;
  --color-border-strong: #D1D5DB;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  --gradient-hero: linear-gradient(135deg, #1E3A5F 0%, #2E5A8F 50%, #3B6B9E 100%);
  --gradient-accent: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
  --gradient-surface: linear-gradient(180deg, #FFFFFF 0%, #F9FAFB 100%);

  /* ============================================
     TYPOGRAPHY - Modern & Readable
     ============================================ */

  /* Font Families */
  --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-display: 'Plus Jakarta Sans', var(--font-family-primary);
  --font-family-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes - Major Third Scale (1.25) */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;      /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 1.875rem;    /* 30px */
  --font-size-4xl: 2.25rem;     /* 36px */
  --font-size-5xl: 3rem;        /* 48px */
  --font-size-6xl: 3.75rem;     /* 60px */
  --font-size-7xl: 4.5rem;      /* 72px */

  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;

  /* Letter Spacing */
  --letter-spacing-tighter: -0.05em;
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;
  --letter-spacing-wider: 0.05em;
  --letter-spacing-widest: 0.1em;

  /* ============================================
     SPACING - 8px Base Grid System
     ============================================ */

  --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 */

  /* ============================================
     ELEVATION - Shadow System
     ============================================ */

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

  /* Colored Shadows */
  --shadow-primary: 0 4px 14px 0 rgba(30, 58, 95, 0.25);
  --shadow-accent: 0 4px 14px 0 rgba(232, 93, 4, 0.25);

  /* ============================================
     BORDER RADIUS
     ============================================ */

  --radius-none: 0;
  --radius-sm: 0.25rem;    /* 4px */
  --radius-md: 0.375rem;   /* 6px */
  --radius-lg: 0.5rem;     /* 8px */
  --radius-xl: 0.75rem;    /* 12px */
  --radius-2xl: 1rem;      /* 16px */
  --radius-3xl: 1.5rem;    /* 24px */
  --radius-full: 9999px;

  /* ============================================
     TRANSITIONS & ANIMATIONS
     ============================================ */

  --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);

  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* ============================================
     FOCUS & ACCESSIBILITY
     ============================================ */

  --focus-ring-color: rgba(30, 58, 95, 0.5);
  --focus-ring-width: 3px;
  --focus-ring-offset: 2px;
  --focus-ring: 0 0 0 var(--focus-ring-width) var(--focus-ring-color);

  /* ============================================
     Z-INDEX SCALE
     ============================================ */

  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-fixed: 1200;
  --z-modal-backdrop: 1300;
  --z-modal: 1400;
  --z-popover: 1500;
  --z-tooltip: 1600;

  /* ============================================
     BREAKPOINTS (for reference in media queries)
     ============================================ */

  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;

  /* ============================================
     CONTAINER WIDTHS
     ============================================ */

  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1400px;
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #0F172A;
    --color-background-alt: #1E293B;
    --color-background-muted: #334155;
    --color-surface: #1E293B;
    --color-surface-raised: #334155;

    --color-text-primary: #F8FAFC;
    --color-text-secondary: #E2E8F0;
    --color-text-muted: #CBD5E1;
    --color-text-light: #94A3B8;

    --color-border: #334155;
    --color-border-strong: #475569;
  }
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   HIGH CONTRAST MODE SUPPORT
   ============================================ */

@media (forced-colors: active) {
  :root {
    --color-primary: CanvasText;
    --color-accent: LinkText;
    --focus-ring-color: Highlight;
  }
}

/* ============================================
   BASE RESET & GLOBAL STYLES
   ============================================ */

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ============================================
   FOCUS STYLES - WCAG 2.2 AAA
   ============================================ */

:focus {
  outline: none;
}

:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-primary);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-3) var(--space-6);
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ============================================
   TYPOGRAPHY UTILITIES
   ============================================ */

.text-display {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
}

.text-heading {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}

.text-body {
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
}

.text-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
}

/* ============================================
   BUTTON SYSTEM
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 48px;
}

.btn:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-primary);
  outline-offset: var(--focus-ring-offset);
}

/* Primary Button - Main CTA */
.btn-primary {
  background: var(--gradient-accent);
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-accent);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-primary);
}

.btn-secondary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-2px);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

/* Large Button */
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
  min-height: 56px;
  border-radius: var(--radius-xl);
}

/* Small Button */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  min-height: 40px;
}

/* ============================================
   CARD SYSTEM
   ============================================ */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-strong);
}

.card-elevated {
  box-shadow: var(--shadow-md);
  border: none;
}

.card-elevated:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

/* ============================================
   CONTAINER
   ============================================ */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 640px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

/* ============================================
   SECTION SPACING
   ============================================ */

.section {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

@media (min-width: 768px) {
  .section {
    padding-top: var(--space-24);
    padding-bottom: var(--space-24);
  }
}

/* ============================================
   BADGE SYSTEM
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.badge-primary {
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

.badge-accent {
  background: rgba(var(--color-accent-rgb), 0.1);
  color: var(--color-accent);
}

/* ============================================
   LINK STYLES
   ============================================ */

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

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

.link-subtle {
  text-decoration: none;
}

.link-subtle:hover {
  text-decoration: underline;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: var(--color-background);
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  min-height: 48px;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

.form-input::placeholder {
  color: var(--color-text-light);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mx-auto { margin-left: auto; margin-right: auto; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }

.relative { position: relative; }
.absolute { position: absolute; }

.w-full { width: 100%; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in {
  animation: fadeIn var(--transition-slow) var(--ease-out);
}

.animate-slide-up {
  animation: slideUp var(--transition-slow) var(--ease-out);
}
