/* ============================================================
   TASBEEH LANDING — ANIMATIONS
   Philosophy: Motion should feel intentional and organic.
   Every animation serves a purpose — guide attention,
   provide feedback, or communicate depth.
   ============================================================ */

/* ============================================================
   1. KEYFRAME DEFINITIONS
   ============================================================ */

/* --- Loader --- */
@keyframes loaderSpin {
  to { transform: rotate(360deg); }
}

@keyframes loaderPulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(0.92); opacity: 0.8; }
}

/* --- Hero --- */

/* Subtle continuous zoom on hero background */
@keyframes heroZoom {
  from { transform: scale(1.05); }
  to   { transform: scale(1.12); }
}

/* Hero icon floats in a gentle organic loop */
@keyframes heroFloat {
  0%   { transform: translateY(0px) rotate(0deg); }
  25%  { transform: translateY(-10px) rotate(0.5deg); }
  50%  { transform: translateY(-16px) rotate(0deg); }
  75%  { transform: translateY(-8px) rotate(-0.5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

/* Gold glow ring pulsates around the icon */
@keyframes glowPulse {
  0%, 100% { transform: scale(1);    opacity: 0.6; }
  50%       { transform: scale(1.15); opacity: 1; }
}

/* Scroll indicator bounces softly */
@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
  50%       { transform: translateX(-50%) translateY(8px); opacity: 0.6; }
}

/* Ambient gold particles drift upward and fade */
@keyframes particleFloat {
  0%   { transform: translateY(0)     translateX(0)    scale(1);    opacity: 0; }
  10%  { opacity: 0.8; }
  50%  { transform: translateY(-60px) translateX(12px) scale(1.2);  opacity: 0.6; }
  90%  { opacity: 0.2; }
  100% { transform: translateY(-120px) translateX(-8px) scale(0.8); opacity: 0; }
}

/* --- Reveal Animations (triggered by IntersectionObserver) --- */

/* Fade up — the core reveal */
@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(32px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in — no movement */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Scale in — for icons, badges, stats */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide in from left (RTL: from right visually) */
@keyframes revealLeft {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from right */
@keyframes revealRight {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Card reveal — slight lift from below */
@keyframes revealCard {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Counter Number Roll --- */
@keyframes counterRoll {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

/* --- Modal / Lightbox --- */

/* Bottom sheet slides up */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* FAQ answer expands */
@keyframes faqExpand {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Toast notification */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(0.92);
  }
}

/* Phone dot pulse */
@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.3); }
}

/* Nav link underline draw */
@keyframes underlineDraw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Shimmer on skeleton loaders */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

/* Gold shimmer sweep on special elements */
@keyframes goldSweep {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

/* Ripple burst on button click */
@keyframes rippleBurst {
  from {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.4;
  }
  to {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
  }
}

/* ============================================================
   2. REVEAL CLASSES — Initial States
   Elements start invisible and are animated by JS
   when they enter the viewport via IntersectionObserver.
   ============================================================ */

.reveal-up,
.reveal-fade,
.reveal-scale,
.reveal-left,
.reveal-right,
.reveal-card {
  opacity: 0;
  will-change: transform, opacity;
}

/* Staggered delay helpers */
.reveal-delay-1 { transition-delay: 100ms !important; animation-delay: 100ms !important; }
.reveal-delay-2 { transition-delay: 200ms !important; animation-delay: 200ms !important; }
.reveal-delay-3 { transition-delay: 300ms !important; animation-delay: 300ms !important; }
.reveal-delay-4 { transition-delay: 400ms !important; animation-delay: 400ms !important; }
.reveal-delay-5 { transition-delay: 500ms !important; animation-delay: 500ms !important; }

/* ============================================================
   3. REVEAL CLASSES — Animated States
   Applied by IntersectionObserver when element enters viewport.
   ============================================================ */

.reveal-up.animated {
  animation: revealUp 0.7s var(--ease-out) both;
}

.reveal-fade.animated {
  animation: fadeIn 0.7s var(--ease-out) both;
}

.reveal-scale.animated {
  animation: scaleIn 0.6s var(--ease-spring) both;
}

.reveal-left.animated {
  animation: revealLeft 0.7s var(--ease-out) both;
}

.reveal-right.animated {
  animation: revealRight 0.7s var(--ease-out) both;
}

.reveal-card.animated {
  animation: revealCard 0.65s var(--ease-out) both;
}

/* ============================================================
   4. STAGGERED GRID CHILDREN
   When a parent with .stagger-children becomes visible,
   each child gets an incremental delay.
   ============================================================ */

.stagger-children > *:nth-child(1)  { animation-delay: 0ms; }
.stagger-children > *:nth-child(2)  { animation-delay: 60ms; }
.stagger-children > *:nth-child(3)  { animation-delay: 120ms; }
.stagger-children > *:nth-child(4)  { animation-delay: 180ms; }
.stagger-children > *:nth-child(5)  { animation-delay: 240ms; }
.stagger-children > *:nth-child(6)  { animation-delay: 300ms; }
.stagger-children > *:nth-child(7)  { animation-delay: 360ms; }
.stagger-children > *:nth-child(8)  { animation-delay: 420ms; }
.stagger-children > *:nth-child(9)  { animation-delay: 480ms; }
.stagger-children > *:nth-child(10) { animation-delay: 540ms; }

/* ============================================================
   5. PARALLAX LAYER SYSTEM
   Used by JS to translate layers at different speeds.
   ============================================================ */

[data-parallax] {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* ============================================================
   6. BUTTON RIPPLE EFFECT
   JS injects a .ripple span inside each .btn on click.
   ============================================================ */

.btn {
  /* Already has position: relative; overflow: hidden */
}

.btn .ripple-effect {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  animation: rippleBurst 0.6s var(--ease-out) forwards;
}

/* ============================================================
   7. NAV LINK HOVER UNDERLINE
   ============================================================ */

.nav__link {
  position: relative;
}

.nav.scrolled .nav__link::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--clr-primary);
  border-radius: var(--r-full);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--dur-base) var(--ease-spring);
}

.nav.scrolled .nav__link:hover::after {
  transform: scaleX(1);
}

/* ============================================================
   8. FEATURE CARD — Icon Micro-interaction
   ============================================================ */

.feature-card__icon svg {
  transition: transform var(--dur-base) var(--ease-spring),
              color var(--dur-base);
}

.feature-card:hover .feature-card__icon svg {
  transform: scale(1.12) rotate(-4deg);
  color: var(--clr-primary-dark);
}

.feature-card--gold:hover .feature-card__icon svg {
  color: var(--clr-gold-dark);
}

/* ============================================================
   9. GALLERY ITEM — Image Zoom
   ============================================================ */

.gallery__item {
  /* overflow: hidden already set */
}

.gallery__item img {
  transition: transform 0.5s var(--ease-out);
}

.gallery__item:focus-visible {
  outline: 3px solid var(--clr-primary);
  outline-offset: 4px;
}

/* ============================================================
   10. STAT NUMBER COUNTER ANIMATION
   Numbers animate when .animated class is applied by JS.
   ============================================================ */

.stat__number {
  display: inline-block;
  transition: transform var(--dur-base) var(--ease-spring);
}

.stat.counting .stat__number {
  animation: counterRoll 0.3s var(--ease-out);
}

/* ============================================================
   11. FAQ ACCORDION — Height Transition
   We use JS to set explicit max-height for smooth animation.
   ============================================================ */

.faq__answer-inner {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s var(--ease-out);
}

.faq__item.open .faq__answer-inner {
  /* max-height set by JS based on scrollHeight */
}

/* ============================================================
   12. PHONE SLIDE TRANSITIONS
   ============================================================ */

.phone__slides {
  /* transition already defined in style.css */
}

/* Active slide gets a subtle scale-up */
.phone__slide.active img {
  transform: scale(1.01);
  transition: transform 0.5s var(--ease-out);
}

/* ============================================================
   13. HERO CONTENT STAGGER
   Each hero child reveals in sequence on page load.
   ============================================================ */

.hero__icon-wrap.animated  { animation-duration: 0.8s; animation-delay: 0.1s; }
.hero__bismillah.animated  { animation-duration: 0.7s; animation-delay: 0.25s; }
.hero__title.animated      { animation-duration: 0.8s; animation-delay: 0.4s; }
.hero__description.animated{ animation-duration: 0.7s; animation-delay: 0.55s; }
.hero__cta.animated        { animation-duration: 0.7s; animation-delay: 0.7s; }
.hero__badges.animated     { animation-duration: 0.6s; animation-delay: 0.85s; }

/* ============================================================
   14. SCROLL PROGRESS BAR
   A thin colored line at the top of the page
   showing reading progress.
   ============================================================ */

#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--clr-primary) 0%,
    var(--clr-gold) 50%,
    var(--clr-primary) 100%
  );
  z-index: 9998;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(212,175,55,0.4);
}

/* ============================================================
   15. GOLD SHIMMER — Premium Accent
   Used on the gold badge and featured card.
   ============================================================ */

.shimmer-gold {
  background: linear-gradient(
    105deg,
    var(--clr-gold-dark) 0%,
    var(--clr-gold) 30%,
    var(--clr-gold-light) 50%,
    var(--clr-gold) 70%,
    var(--clr-gold-dark) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: goldSweep 3s linear infinite;
}

/* ============================================================
   16. LOADING SKELETON
   For images before they load.
   ============================================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--clr-border-light) 25%,
    var(--clr-surface) 50%,
    var(--clr-border-light) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

/* ============================================================
   17. HOVER LIFT UTILITY
   ============================================================ */

.hover-lift {
  transition: transform var(--dur-base) var(--ease-spring),
              box-shadow var(--dur-base) var(--ease-out);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* ============================================================
   18. ENTRANCE ANIMATION — Page Ready State
   Body gets .page-ready after loader hides.
   ============================================================ */

body:not(.page-ready) .hero__content {
  /* Prevent flash before loader hides */
  visibility: hidden;
}

body.page-ready .hero__content {
  visibility: visible;
}

/* ============================================================
   19. CURSOR DOT (Desktop only)
   A custom cursor dot that follows the mouse.
   ============================================================ */

#cursorDot {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--clr-primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9997;
  transform: translate(-50%, -50%);
  transition: transform 0.08s linear,
              width 0.2s var(--ease-spring),
              height 0.2s var(--ease-spring),
              opacity 0.2s;
  mix-blend-mode: multiply;
  opacity: 0;
}

#cursorDot.visible { opacity: 1; }

#cursorDot.expanded {
  width: 32px;
  height: 32px;
  background: rgba(20,108,67,0.15);
  mix-blend-mode: normal;
}

/* ============================================================
   20. REDUCED MOTION — Accessibility First
   Respects user's OS-level "Reduce Motion" preference.
   All animations are safely disabled while keeping
   opacity transitions for UX clarity.
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

  /* Disable all animations */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* But keep opacity for reveal — without it elements stay hidden */
  .reveal-up,
  .reveal-fade,
  .reveal-scale,
  .reveal-left,
  .reveal-right,
  .reveal-card {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Hero background — no zoom */
  .hero__bg-image { animation: none; transform: scale(1); }

  /* No floating */
  .hero__icon-wrap,
  .cta__icon img { animation: none; }

  /* No particles */
  .particle { display: none; }

  /* No scroll bounce */
  .hero__scroll { animation: none; }

  /* No pulsing glow */
  .hero__icon-glow,
  .loader__icon img { animation: none; }

  /* No shimmer */
  .shimmer-gold { animation: none; -webkit-text-fill-color: var(--clr-gold); }

  /* Ripples don't fire */
  .btn .ripple-effect { display: none !important; }

  /* Scroll progress bar — instant */
  #scrollProgress { transition: none; }

  /* Gold sweep — static */
  @keyframes goldSweep { to { background-position: 0 center; } }
}
