/* ========================================
   Measslainte - Unified Design System
   WonderMod Customization Layer
   ======================================== */

/* Import WonderMod core variables first */
@import url('/css/core/theme-vars.css');

/* ========================================
   Design System Variables
   ======================================== */
:root {
  /* Warm, Trustworthy Color Palette */
  --primary: #2d3748;
  --primary-light: #4a5568;
  --secondary: #5a67d8;
  --accent: #667eea;
  --accent-warm: #9f7aea;
  --accent-tertiary: #ed8936;

  /* Earth tones for warmth */
  --earth-brown: #744210;
  --earth-tan: #d69e2e;
  --earth-cream: #fefcbf;
  --earth-sage: #c8d7b2;

  /* Semantic Colors */
  --success: #48bb78;
  --warning: #ecc94b;
  --danger: #f56565;
  --info: #4299e1;

  /* Neutrals */
  --bg-primary: #ffffff;
  --bg-secondary: #f7fafc;
  --bg-tertiary: #edf2f7;
  --bg-dark: #1a202c;

  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-light: #a0aec0;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #9f7aea 100%);
  --gradient-warm: linear-gradient(135deg, #ed8936 0%, #ecc94b 100%);
  --gradient-cool: linear-gradient(135deg, #4299e1 0%, #667eea 100%);
  --gradient-dark: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);

  /* Spacing Scale (8pt system) */
  --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;

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

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

  /* Transitions */
  --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);
}

/* ========================================
   Accessibility Features (WCAG 2.2 AAA)
   ======================================== */

/* Skip Links */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* Focus States */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Screen Reader Only */
.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;
}

/* Reduced Motion */
@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;
  }
}

/* ========================================
   Enhanced Typography
   ======================================== */

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--primary);
  margin-bottom: var(--space-4);
}

h1 { font-size: 2.5rem; font-weight: 800; }
h2 { font-size: 2rem; font-weight: 700; }
h3 { font-size: 1.5rem; font-weight: 700; }
h4 { font-size: 1.25rem; font-weight: 600; }
h5 { font-size: 1.125rem; font-weight: 600; }
h6 { font-size: 1rem; font-weight: 600; }

/* Reading Container */
.reading-container {
  max-width: 70ch;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-warm);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* ========================================
   Component Styles
   ======================================== */

/* Cards */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--bg-tertiary);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

/* Notice Boxes */
.notice {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  margin: var(--space-6) 0;
}

.notice.info { background: #ebf8ff; border-color: #4299e1; }
.notice.warning { background: #fffaf0; border-color: #ed8936; }
.notice.danger { background: #fff5f5; border-color: #f56565; }
.notice.success { background: #f0fff4; border-color: #48bb78; }

/* Path Cards (Start Here) */
.path-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.path-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.path-card:hover {
  box-shadow: var(--shadow-lg);
  border-left-width: 6px;
  transform: translateY(-2px);
}

.path-card:hover::before {
  transform: scaleX(1);
}

.path-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
  margin-right: 0.75rem;
}

/* Reading Level Badges */
.reading-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: var(--space-2);
  box-shadow: var(--shadow-xs);
}

.reading-badge.overview {
  background: linear-gradient(135deg, #c6f6d5, #9ae6b4);
  color: #22543d;
}

.reading-badge.intermediate {
  background: linear-gradient(135deg, #bee3f8, #90cdf4);
  color: #2c5282;
}

.reading-badge.technical {
  background: linear-gradient(135deg, #fed7d7, #feb2b2);
  color: #742a2a;
}

/* Topic Grid */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  margin: var(--space-8) 0;
}

.topic-item {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-base);
}

.topic-item:hover {
  background: var(--bg-primary);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.topic-grid-mini {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.topic-grid-mini .topic-item {
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.topic-grid-mini .topic-item:hover {
  background: white;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* Hero Section */
.hero {
  background: var(--gradient-primary);
  color: white;
  padding: var(--space-16) var(--space-6);
  border-radius: var(--radius-2xl);
  margin-bottom: var(--space-12);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

/* CTA Section */
.cta {
  background: var(--bg-secondary);
  border-radius: var(--radius-2xl);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  margin: var(--space-12) 0;
}

/* Enhanced Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-6) 0;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  overflow: hidden;
}

thead {
  background: var(--gradient-cool);
  color: white;
}

th, td {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  border-bottom: 1px solid var(--bg-tertiary);
}

tbody tr:hover {
  background: var(--bg-secondary);
}

/* Evidence Tables */
.evidence-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--space-6) 0;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.evidence-table thead {
  background: var(--primary);
  color: white;
}

.evidence-table th {
  background: transparent;
  color: white;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.evidence-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
}

.evidence-table tbody tr:last-child {
  border-bottom: none;
}

.evidence-table tbody tr:hover {
  background: #f7fafc;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  :root {
    --space-16: var(--space-12);
    --space-12: var(--space-8);
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }

  .topic-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: var(--space-12) var(--space-4);
  }

  .cta {
    padding: var(--space-8) var(--space-4);
  }

  .topic-grid-mini {
    grid-template-columns: 1fr;
  }

  .path-card {
    padding: 1.5rem;
  }

  .path-card h3 {
    font-size: 1.25rem;
  }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .hero,
  .cta,
  .skip-link,
  .path-card h3 span {
    display: none;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
    word-break: break-all;
  }
}
