/* Design System - Extreme Quality UX */

/* Color System */
:root {
  /* Light Mode Colors */
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #60a5fa;
  --color-secondary: #10b981;
  --color-accent: #f59e0b;
  --color-error: #ef4444;
  --color-warning: #f59e0b;
  --color-success: #10b981;
  --color-info: #3b82f6;
  
  /* Neutral Scale */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  --color-gray-950: #030712;
  
  /* Semantic Colors */
  --bg-primary: #fff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border-color: #e5e7eb;
  --border-color-dark: #d1d5db;
  
  /* Code Theme */
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --code-keyword: #7dd3fc;
  --code-string: #86efac;
  --code-comment: #94a3b8;
  --code-function: #c084fc;
  --code-number: #fbbf24;
  --code-operator: #f472b6;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Focus States */
  --focus-ring: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--color-primary);
  --focus-ring-error: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--color-error);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border-color: #334155;
  --border-color-dark: #475569;
  --code-bg: #0f172a;
  --code-text: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* Spacing System (8px Grid) */
/* stylelint-disable no-duplicate-selectors -- Organized by theme/media query */
: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 */
}
/* stylelint-enable */

/* Typography System */
/* stylelint-disable no-duplicate-selectors -- Organized by theme/media query */
:root {
  --font-sans: -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", consolas, monaco, "Courier New", monospace;
  
  /* Fluid Typography */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.35rem + 0.75vw, 1.875rem);
  --text-3xl: clamp(1.875rem, 1.65rem + 1.125vw, 2.25rem);
  --text-4xl: clamp(2.25rem, 1.95rem + 1.5vw, 3rem);
  --text-5xl: clamp(3rem, 2.5rem + 2.5vw, 3.75rem);
  
  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;
}
/* stylelint-enable */

/* Animation System */
/* stylelint-disable no-duplicate-selectors -- Organized by theme/media query */
:root {
  --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-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --duration-75: 75ms;
  --duration-100: 100ms;
  --duration-150: 150ms;
  --duration-200: 200ms;
  --duration-300: 300ms;
  --duration-500: 500ms;
  --duration-700: 700ms;
  --duration-1000: 1000ms;
}
/* stylelint-enable */

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Z-Index Scale */
/* stylelint-disable no-duplicate-selectors -- Organized by theme/media query */
:root {
  --z-0: 0;
  --z-10: 10;
  --z-20: 20;
  --z-30: 30;
  --z-40: 40;
  --z-50: 50;
  --z-modal: 100;
  --z-popover: 200;
  --z-tooltip: 300;
  --z-notification: 400;
  --z-max: 9999;
}
/* stylelint-enable */

/* Utility Classes */

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;

  /* stylelint-disable-next-line property-no-deprecated -- clip required for older browsers */
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus Visible */
.focus-visible:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Skip Links */
.skip-links {
  position: absolute;
  top: -40px;
  left: 0;
  z-index: var(--z-max);
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  padding: var(--space-2) var(--space-4);
  background-color: var(--bg-primary);
  color: var(--color-primary);
  text-decoration: none;
  border-radius: 0 0 0.5rem;
  transform: translateY(-100%);
  transition: transform var(--duration-200) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Loading States */
@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.skeleton {
  animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  background-color: var(--color-gray-200);
  border-radius: 0.25rem;
}

[data-theme="dark"] .skeleton {
  background-color: var(--color-gray-700);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
  border-radius: 0.25rem;
}

.skeleton-title {
  height: 2em;
  width: 60%;
  margin-bottom: var(--space-4);
}

.skeleton-button {
  height: 2.5rem;
  width: 6rem;
  border-radius: 0.375rem;
}

/* Smooth Scrolling */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Print Styles */
@media print {
  :root {
    --bg-primary: white;
    --text-primary: black;
    --border-color: #ccc;
  }
  
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  h1, h2, h3, h4, h5, h6 {
    break-after: avoid;
  }
  
  pre, blockquote {
    break-inside: avoid;
  }
}

/* Course Recommendation Styles */
.course-recommendation-section {
  margin-top: 3rem;
  padding: 2rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.course-recommendation-section h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.course-recommendations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.course-card {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  transition: transform 0.2s, box-shadow 0.2s;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.course-card h4 {
  color: var(--color-primary);
  margin-bottom: 0.75rem;
  font-size: 1.2rem;
}

.course-card p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.course-card ul {
  margin: 0 0 1rem 1.5rem;
  color: var(--text-secondary);
}

.course-card li {
  margin-bottom: 0.5rem;
}

.course-link {
  display: inline-block;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 2px solid var(--color-primary);
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.course-link:hover {
  background-color: var(--color-primary);
  color: white;
}

.learning-paths {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.learning-paths h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.learning-paths ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.learning-paths li {
  background: var(--bg-primary);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.learning-paths a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.learning-paths a:hover {
  text-decoration: underline;
}

/* Dark mode support */
[data-theme="dark"] .course-recommendation-section {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

[data-theme="dark"] .course-card {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}

[data-theme="dark"] .course-card:hover {
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.5);
}

[data-theme="dark"] .learning-paths li {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}
