/* ═══════════════════════════════════════════════════
   NEXWAVE — MAIN STYLES
   Premium Dark Glassmorphism + Neon Accents
   ═══════════════════════════════════════════════════ */

/* SEO/A11y — content visible to crawlers & screen readers but not visually rendered */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:root {
  /* Base Dark Palette */
  --bg-deep: #06060e;
  --bg-dark: #0a0a18;
  --bg-surface: rgba(255, 255, 255, 0.03);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.07);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);

  /* Neon Accent — RGB channels for alpha compositing */
  --neon-primary: #e040fb;
  --neon-primary-rgb: 224, 64, 251;
  --neon-secondary: #7c4dff;
  --neon-secondary-rgb: 124, 77, 255;
  --neon-glow: rgba(var(--neon-primary-rgb), 0.4);
  --neon-glow-soft: rgba(var(--neon-primary-rgb), 0.15);
  --neon-gradient: linear-gradient(135deg, var(--neon-primary) 0%, var(--neon-secondary) 100%);

  /* Text — all three levels pass WCAG AA on --bg-deep (#06060e) */
  --text-primary: rgba(255, 255, 255, 0.95);   /* ~18:1 contrast */
  --text-secondary: rgba(255, 255, 255, 0.75); /* ~11:1 contrast */
  --text-muted: rgba(255, 255, 255, 0.7);      /* ~9.8:1 contrast (WCAG AAA) */

  /* Typography */
  --font-ar: 'Tajawal', sans-serif;

  /* Spacing */
  --section-padding: clamp(40px, 5vh, 64px);
  --container-width: 1200px;
  --container-padding: clamp(20px, 5vw, 40px);

  /* Glass */
  --glass-blur: 20px;
  --glass-blur-heavy: 40px;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Dynamic theme color (morphed by JS) */
  --theme-hue: 290;
  --theme-color: hsl(var(--theme-hue), 80%, 65%);
  --theme-glow: hsla(var(--theme-hue), 80%, 65%, 0.3);

  /* Design System Color Tokens (for teacher themes) */
  --token-magenta: #e040fb;
  --token-magenta-hue: 290;
  --token-cyan: #00bcd4;
  --token-cyan-hue: 187;
  --token-orange: #ff9800;
  --token-orange-hue: 36;
  --token-green: #4caf50;
  --token-green-hue: 122;
  --token-blue: #2196f3;
  --token-blue-hue: 207;
  --token-red: #ff5722;
  --token-red-hue: 14;
  --token-purple: #9c27b0;
  --token-purple-hue: 291;
  --token-teal: #009688;
  --token-teal-hue: 174;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: var(--font-ar);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  direction: rtl;
  /* Continuous gradient background — no background-attachment:fixed for mobile scroll perf */
  background: linear-gradient(
    180deg,
    var(--bg-deep) 0%,
    #0a0a1a 15%,
    #0d0818 30%,
    #0a0a1a 50%,
    #080614 70%,
    #0a0a1a 85%,
    var(--bg-deep) 100%
  );
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ═══════ FOCUS STYLES ═══════ */
:focus-visible {
  outline: 2px solid var(--neon-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Remove default outline — :focus-visible handles it accessibly */
:focus:not(:focus-visible) {
  outline: none;
}

/* ═══════ UTILITY ═══════ */
.section-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.section-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 100px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--neon-primary);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.3px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.section-title {
  font-family: var(--font-ar);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.section-desc {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.8;
  overflow-wrap: break-word;
}

/* ═══════ SKIP LINK ═══════ */
#main-content:focus {
  outline: none; /* Prevent giant focus ring around whole content area */
}

/* Visually hidden until focused — keyboard users jump past nav instantly */
.skip-link {
  position: fixed;
  top: -100%;
  right: 50%;
  transform: translateX(50%);
  z-index: 99999;
  padding: 10px 24px;
  background: var(--neon-primary);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 0 0 12px 12px;
  transition: top 0.2s var(--ease-out-quart);
  white-space: nowrap;
}

.skip-link:focus {
  top: 0;
  outline: 2px solid #000;
  outline-offset: -4px;
}

/* ═══════ NAVIGATION ═══════ */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 var(--container-padding);
  transition: all 0.5s var(--ease-out-expo);
}

/* Stay transparent on scroll — no glass bar, no border */
.nav-bar.scrolled {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}

.nav-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav-logo-img {
  height: 36px;
  width: auto;
  filter: drop-shadow(0 0 12px rgba(var(--neon-primary-rgb), 0.2));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Adapt: 44px min touch target height for nav links */
.nav-link {
  padding: 10px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.25s var(--ease-out-quart);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--neon-primary);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--neon-glow);
}

.nav-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 1001;
}

.nav-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s var(--ease-out-expo);
}

.nav-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.nav-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(6, 6, 14, 0.97);
  backdrop-filter: blur(var(--glass-blur-heavy));
  -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out-quart);
}

.mobile-menu.active {
  opacity: 1;
  pointer-events: all;
}

.mobile-menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Adapt: 44px min-height touch targets on mobile links */
.mobile-link {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 12px 40px;
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: 16px;
  transition: all 0.2s var(--ease-out-quart);
}

.mobile-link:hover,
.mobile-link:focus-visible {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.mobile-link:active {
  transform: scale(0.97);
  background: rgba(var(--neon-primary-rgb), 0.06);
}

/* ═══════ SCROLLBAR ═══════ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--neon-primary-rgb), 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--neon-primary-rgb), 0.5);
}

/* Polish: use transform for GPU-accelerated positioning (no top/left reflow) */
.cursor-glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--neon-primary-rgb), 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  top: -160px;
  left: -160px;
  will-change: transform;
  transition: opacity 0.5s var(--ease-out-expo);
  opacity: 0;
}

.cursor-glow.visible {
  opacity: 1;
}

@media (hover: none) {
  .cursor-glow { display: none; }
}

/* ═══════ SELECTION ═══════ */
::selection {
  background: rgba(var(--neon-primary-rgb), 0.3);
  color: var(--text-primary);
}

/* ═══════ FOOTER ═══════ */
.footer {
  padding: 40px var(--container-padding);
  border-top: 1px solid var(--border-glass);
}

.footer-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-logo {
  height: 28px;
  opacity: 0.4;
  filter: drop-shadow(0 0 8px rgba(var(--neon-primary-rgb), 0.15));
  transition: opacity 0.3s;
}

.footer-logo:hover {
  opacity: 0.7;
}

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

/* ═══════ PAGE LOADER ═══════ */
/* Loader styles moved to css/loader.css */

/* ═══════ ANIMATION FALLBACK ═══════ */
/* Ensure elements are visible if JS fails or for reduced-motion users */
@media (prefers-reduced-motion: reduce) {
  .stat-card,
  .feature-card,
  .teacher-grid-card,
  .contact-card {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* No-JS fallback */
.no-js .stat-card,
.no-js .feature-card,
.no-js .teacher-grid-card,
.no-js .contact-card {
  opacity: 1;
  transform: none;
}

/* ═══════ NOISE TEXTURE OVERLAY ═══════ */
/* Subtle grain — opacity very low, content-visibility:hidden keeps it off compositing tree */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}
