/* ============================================
   PREMIUM SCROLL & MICRO-INTERACTIONS
   Hafiza Binte Waheed — Quran Academy
   ============================================ */

/* ---- Split text base ---- */
[data-split] .char,
[data-split] .word {
  display: inline-block;
}

/* ---- Reveal helpers ---- */
[data-reveal="fade"] { will-change: transform, opacity; }

/* ---- Course card glow (mouse tracking) ---- */
.course-card::after,
.resource-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  background: radial-gradient(
    500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(237, 162, 162, 0.12),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.course-card:hover::after,
.resource-card:hover::after,
.course-card.is-active::after { opacity: 1; }

/* ---- Quiz ripple ---- */
.quiz-option { position: relative; overflow: hidden; }

.quiz-option .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: rippleEffect 0.6s linear;
  background: rgba(168, 23, 74, 0.15);
  pointer-events: none;
}

@keyframes rippleEffect {
  to { transform: scale(4); opacity: 0; }
}

/* ---- Testimonial track ---- */
.testimonials-track { will-change: transform; }

/* ---- Marquee ---- */
.marquee-inner { will-change: transform; }

/* ---- Navbar entrance ---- */
@keyframes navDropIn {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.navbar { transition: transform 0.5s cubic-bezier(0.22,1,0.36,1), opacity 0.5s ease, background 0.5s ease, padding 0.5s ease; }

/* ---- Menu overlay ---- */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(6px);
}

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

/* ---- Mobile nav slide ---- */
.nav-links.open a {
  animation: navLinkIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.nav-links.open a:nth-child(1) { animation-delay: 0.05s; }
.nav-links.open a:nth-child(2) { animation-delay: 0.1s; }
.nav-links.open a:nth-child(3) { animation-delay: 0.15s; }
.nav-links.open a:nth-child(4) { animation-delay: 0.2s; }
.nav-links.open a:nth-child(5) { animation-delay: 0.25s; }
.nav-links.open a:nth-child(6) { animation-delay: 0.3s; }
.nav-links.open a:nth-child(7) { animation-delay: 0.35s; }

@keyframes navLinkIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- Lazy images ---- */
img[loading="lazy"] { opacity: 0; transition: opacity 0.6s ease; }
img[loading="lazy"].loaded { opacity: 1; }

/* ---- Scroll progress glow pulse ---- */
#scroll-progress-bar {
  transition: width 0.1s linear;
}

/* ---- Section depth on scroll ---- */
.about-section,
.quiz-section,
.testimonials-section,
.glimpse-section,
.resources-section,
.newsletter-section {
  position: relative;
  isolation: isolate;
}

/* ---- Glimpse curtain ---- */
.glimpse-curtain {
  position: absolute;
  inset: 0;
  background: var(--pink-primary);
  z-index: 2;
  transform: scaleX(1);
  transform-origin: left;
}

.glimpse-curtain.revealed {
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 1.1s cubic-bezier(0.77, 0, 0.175, 1);
  transition-delay: var(--cd, 0s);
}

/* ---- Active nav link ---- */
.nav-links a.active-nav {
  color: var(--pink-light) !important;
}

.navbar.scrolled .nav-links a.active-nav {
  color: var(--pink-primary) !important;
}

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

  .marquee-inner { animation: none !important; }
  #cursor-dot, #cursor-ring, .cursor-text-el { display: none !important; }
  body, button, a { cursor: auto !important; }
  [data-split] .char,
  [data-split] .word {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---- Focus & selection ---- */
::selection {
  background: rgba(168, 23, 74, 0.2);
  color: var(--pink-deep);
}

:focus-visible {
  outline: 2px solid var(--pink-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

[id] { scroll-margin-top: 85px; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--beige-bg); }
::-webkit-scrollbar-thumb { background: var(--pink-light); border-radius: 8px; border: 2px solid var(--beige-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--pink-primary); }
