/* ============================================
   NAWAFID — نَوَافِذ Design System
   Arabic Course Platform
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ============================================
   1. CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  /* Colors */
  --primary: #0F172A;
  --primary-light: #1E293B;
  --primary-mid: #162438;
  
  /* Brand Colors from Logo */
  --brand-primary: #1D4ED8;
  --brand-secondary: #0F172A;
  --brand-accent: #F59E08;
  --brand-glow: rgba(29, 78, 216, 0.12);
  --brand-glow-strong: rgba(29, 78, 216, 0.2);
  
  /* Accents */
  --accent-gold: #F59E08;
  --accent-amber: #FBBF24;
  --accent-glow: rgba(245, 158, 8, 0.12);
  
  --success: #10B981;
  --danger: #EF4444;
  --info: #0EA5E9;
  --text-primary: #F5F5F5;
  --text-secondary: #B0B9C3;
  --text-muted: #7A8492;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-bg-hover: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-hover: rgba(29, 78, 216, 0.45);

  /* Typography */
  --font-arabic: 'Amiri', 'Noto Naskh Arabic', serif;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --shadow-gold: 0 4px 20px rgba(245, 158, 8, 0.15);

  /* Transitions - Optimized for performance */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 70px;
  --max-width: 1440px;
}

/* ============================================
   2. RESET & BASE
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* Arabic text utility */
.ar {
  font-family: var(--font-arabic);
  direction: rtl;
  line-height: 1.8;
}

.ar-lg {
  font-family: var(--font-arabic);
  direction: rtl;
  font-size: 2rem;
  line-height: 2;
}

/* ============================================
   3. BACKGROUNDS
   ============================================ */
.pattern-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image:
    repeating-linear-gradient(45deg, var(--brand-primary) 0, var(--brand-primary) 1px, transparent 0, transparent 50%),
    repeating-linear-gradient(-45deg, var(--brand-primary) 0, var(--brand-primary) 1px, transparent 0, transparent 50%);
  background-size: 60px 60px;
}

.gradient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.gradient-orb--gold {
  width: 500px; height: 500px;
  background: rgba(37, 99, 235, 0.08);
  top: -100px; right: -100px;
}
.gradient-orb--blue {
  width: 400px; height: 400px;
  background: rgba(52, 152, 219, 0.06);
  bottom: -50px; left: -100px;
}

/* ============================================
   4. TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }

.text-gradient {
  background: linear-gradient(135deg, var(--brand-primary), #0E9FD9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-ar-title {
  font-family: var(--font-arabic);
  font-size: clamp(2.5rem, 6vw, 5rem);
  background: linear-gradient(135deg, var(--brand-primary), #0E9FD9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.6;
  direction: rtl;
}

/* ============================================
   5. LAYOUT
   ============================================ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-3xl) 0;
  position: relative;
  z-index: 1;
  scroll-margin-top: var(--header-height);
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ============================================
   6. NAVBAR
   ============================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding-left: max(var(--space-lg), calc((100vw - var(--max-width)) / 2 + var(--space-lg)));
  padding-right: max(var(--space-lg), calc((100vw - var(--max-width)) / 2 + var(--space-lg)));
  z-index: 1000;
  transition: background var(--transition-base), box-shadow var(--transition-base);
  /* Ensure header text remains legible over page content */
  background: rgba(10, 22, 40, 0.65);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.navbar.scrolled {
  background: rgba(10, 22, 40, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.navbar__logo {
  font-family: var(--font-arabic);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.navbar__logo-icon {
  width: 36px; height: 36px;
  background: var(--brand-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: white;
  font-weight: 800;
  font-family: var(--font-heading);
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  margin-left: auto;
}

.navbar__link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  position: relative;
}

.navbar__link:hover,
.navbar__link.active {
  color: var(--text-primary);
}

.navbar__link::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 2px;
  background: var(--brand-primary);
  transition: width var(--transition-base);
}

.navbar__link:hover::after { width: 100%; }

.navbar__cta {
  margin-left: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.navbar__cta .theme-toggle {
  margin-right: 0;
  margin-bottom: 0;
}

/* Mobile menu toggle */
.navbar__toggle {
  display: none;
  background: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  padding: var(--space-sm);
}

/* ============================================
   7. BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--brand-primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.2);
}

.btn--primary:hover {
  background: #1a3aad;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--glass-border);
  color: var(--text-secondary);
}

.btn--outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-glow);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn--ghost:hover {
  color: var(--brand-primary);
}

.btn--lg {
  padding: 1rem 2.25rem;
  font-size: 1rem;
}

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

/* ============================================
   8. CARDS (Glassmorphism)
   ============================================ */
.card {
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.card:hover {
  background: var(--glass-bg);
  border-color: var(--glass-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin-bottom: var(--space-md);
  background: var(--brand-glow);
}

.card__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.card__desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Unit Card --- */
.unit-card {
  background: transparent;
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.unit-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--brand-primary);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.unit-card:hover {
  background: var(--glass-bg);
  border-color: var(--brand-primary);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.15);
}

.unit-card:hover::before { opacity: 1; }

.unit-card__icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.unit-card__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-xs);
}

.unit-card__title-ar {
  font-family: var(--font-arabic);
  font-size: 1.3rem;
  direction: rtl;
  margin-bottom: var(--space-xs);
}

.unit-card__title-id {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.unit-card__progress {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.unit-card__progress-bar {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
  transition: width 0.8s ease;
}

.unit-card--locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.unit-card--locked:hover {
  transform: none;
  box-shadow: none;
}

/* ============================================
   9. HERO SECTION
   ============================================ */
.hero {
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding-top: calc(var(--header-height) + var(--space-xl));
  padding-bottom: var(--space-2xl);
  padding-left: max(var(--space-lg), calc((100vw - var(--max-width)) / 2 + var(--space-lg)));
  padding-right: max(var(--space-lg), calc((100vw - var(--max-width)) / 2 + var(--space-lg)));
  position: relative;
  z-index: 1;
  width: 100%;
  gap: var(--space-2xl);
}

.hero__content {
  flex: 1;
  max-width: 650px;
}

.hero__image {
  flex: 1;
  max-width: 600px;
  display: flex;
  justify-content: center;
  align-items: flex-end; /* Align to bottom */
  margin-bottom: 0; /* Normal position, fully raised */
  z-index: 2;
}

.hero__image img {
  width: 100%;
  max-width: 600px;
  height: 550px;
  object-fit: cover;
  object-position: top;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  /* Removed floating animation so she stays anchored to the bottom */
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

.hero__bismillah {
  font-family: var(--font-arabic);
  font-size: 1.1rem;
  color: var(--brand-primary);
  margin-bottom: var(--space-lg);
  direction: rtl;
}

.hero__title {
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 2;
}

.text-highlight {
  position: relative;
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
  font-weight: 800;
}

.text-highlight::after {
  display: none;
}

.floating-shape {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  opacity: 0.8;
  animation: float-random 10s ease-in-out infinite alternate;
}

.shape-1 { top: 25%; left: 2%; animation-delay: 0s; transform: rotate(15deg); }
.shape-2 { bottom: 20%; right: 45%; animation-delay: -2s; transform: rotate(-10deg); }
.shape-3 { top: 25%; right: 42%; animation-delay: -4s; }
.shape-4 { bottom: 15%; left: 15%; animation-delay: -6s; transform: rotate(45deg); }
.shape-5 { top: 40%; left: 35%; animation-delay: -8s; }

@keyframes float-random {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(20px, -20px) rotate(10deg); }
  100% { transform: translate(-10px, 15px) rotate(-5deg); }
}

.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  font-weight: 400;
  letter-spacing: -0.3px;
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2x2 grid by default */
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

@media (min-width: 768px) {
  .hero__stats {
    grid-template-columns: repeat(4, 1fr); /* 4x1 row on desktop */
  }
}

.hero__stat {
  text-align: left;
}

.hero__stat-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--brand-primary);
}

.hero__stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ============================================
   10. SECTION HEADERS
   ============================================ */
.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-header__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--brand-primary);
  margin-bottom: var(--space-sm);
}

.section-header__title {
  margin-bottom: var(--space-sm);
}

.section-header__desc {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  font-size: 0.95rem;
}

/* ============================================
   11. STATS BAR
   ============================================ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.stat-card {
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  transition: all var(--transition-base);
}

.stat-card:hover {
  border-color: var(--brand-primary);
  background: var(--brand-glow);
}

.stat-card__icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.stat-card__value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.stat-card__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ============================================
   12. TESTIMONIALS
   ============================================ */
.testimonial-card {
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
}

.testimonial-card:hover {
  background: var(--glass-bg);
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.15);
}

/* ============================================
   13. FOOTER
   ============================================ */
.footer {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--glass-border);
  position: relative;
  z-index: 1;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer__text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer__links {
  display: flex;
  gap: var(--space-lg);
}

.footer__link {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer__link:hover {
  color: var(--brand-primary);
}

/* ============================================
   13. FORM ELEMENTS
   ============================================ */
.form-group {
  margin-bottom: var(--space-lg);
}

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

.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: transparent;
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--brand-primary);
  background: var(--brand-glow);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08);
}

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

/* ============================================
   14. PROGRESS BAR
   ============================================ */
.progress {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

.progress--success .progress__bar {
  background: linear-gradient(90deg, var(--success), #27ae60);
}

/* ============================================
   15. BADGE
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge--gold {
  background: var(--brand-glow);
  color: var(--brand-primary);
  border: 1px solid rgba(29, 78, 216, 0.2);
}

.badge--success {
  background: rgba(46,204,113,0.1);
  color: var(--success);
  border: 1px solid rgba(46,204,113,0.2);
}

.badge--locked {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
}

/* ============================================
   16. ANIMATIONS (Optimized for performance)
   ============================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 8, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(245, 158, 8, 0); }
}

.animate-fade-up {
  animation: fadeInUp 0.5s ease both;
}

.animate-fade-in {
  animation: fadeIn 0.4s ease both;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }

/* Scroll reveal — simple always-visible with animation */
.reveal {
  opacity: 1;
  transform: none;
}

/* JS-enhanced: when JS marks as will-animate, start hidden */
.reveal.will-animate {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.reveal.will-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   17. RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }

  .navbar__links {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0; right: 0;
    background: rgba(10,22,40,0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: var(--space-xl);
    gap: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
  }

  .navbar__links.open { display: flex; }
  .navbar__toggle { display: block; margin-left: auto; }
  .navbar__cta { 
    margin-left: 0;
    margin-top: var(--space-md);
    width: 100%;
    flex-direction: row;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--glass-border);
  }

  .navbar__cta .btn { 
    flex: 1;
    text-align: center;
  }
  
  .navbar__cta .theme-toggle { 
    width: 56px;
    margin-right: 0;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .stats-bar { grid-template-columns: repeat(2, 1fr); }

  .hero {
    padding-top: calc(var(--header-height) + var(--space-xl));
    min-height: auto;
    padding-bottom: var(--space-2xl);
  }

  .hero__stats { gap: var(--space-lg); }

  .footer__inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  .stats-bar { grid-template-columns: 1fr; }
  .hero__actions { flex-direction: column; }
}

/* ============================================
   18. SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--primary);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-mid);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   19. UTILITIES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.mt-1 { margin-top: var(--space-md); }
.mt-2 { margin-top: var(--space-xl); }
.mb-1 { margin-bottom: var(--space-md); }
.mb-2 { margin-bottom: var(--space-xl); }

.brand-logo { max-height: 40px; width: auto; object-fit: contain; }

/* ============================================
   20. THEME TOGGLE (Modern Switch)
   ============================================ */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 56px;
  height: 32px;
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 3px;
  cursor: pointer;
  transition: all var(--transition-base);
  margin-right: var(--space-md);
}

.theme-toggle:hover {
  border-color: var(--brand-primary);
  background: var(--glass-bg-hover);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.theme-toggle::before {
  content: '🌙';
  font-size: 0.9rem;
  position: absolute;
  left: 6px;
  opacity: 1;
  transition: opacity var(--transition-base);
}

.theme-toggle::after {
  content: '☀️';
  font-size: 0.9rem;
  position: absolute;
  right: 6px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.theme-toggle__slider {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 26px;
  height: 26px;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
  transition: left var(--transition-base) cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding-top: calc(var(--header-height) + var(--space-xl));
  }
  
  .hero__content {
    max-width: 100%;
  }

  .hero__image {
    max-width: 100%;
    margin-top: var(--space-xl);
  }

  .hero__actions,
  .hero__stats {
    justify-content: center;
  }
  
  .hero__stat {
    text-align: center;
  }
}

/* Light mode toggle state */
html.light-mode .theme-toggle {
  background: rgba(245, 158, 8, 0.15);
  border-color: rgba(245, 158, 8, 0.3);
}

html.light-mode .theme-toggle:hover {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 8, 0.25);
  box-shadow: 0 0 0 3px rgba(245, 158, 8, 0.1);
}

html.light-mode .theme-toggle::before {
  opacity: 0;
}

html.light-mode .theme-toggle::after {
  opacity: 1;
}

html.light-mode .theme-toggle__slider {
  left: calc(100% - 29px);
  background: var(--accent-gold);
  box-shadow: 0 2px 4px rgba(245, 158, 8, 0.3);
}
