/* ============================================================
   ANIMATIONS.CSS — الفرسان الثلاثه
   Safe animation layer — NO layout changes, NO hidden content
   All opacity-0 states are set via JS (.anim-ready class)
   ============================================================ */

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

/* ----------------------------------------------------------
   SCROLL PROGRESS BAR
   ---------------------------------------------------------- */
#scroll-progress-bar {
  position: fixed;
  top: 0;
  right: 0;
  width: 0%;
  height: 3px;
  background: var(--secondary);
  z-index: 10001;
  pointer-events: none;
  transition: width 0.08s linear;
}

/* ----------------------------------------------------------
   NAVBAR SHRINK
   ---------------------------------------------------------- */
.site-header {
  transition: box-shadow 0.3s ease;
}
.site-header.scrolled .header-main {
  box-shadow: 0 4px 20px rgba(0,0,0,0.12) !important;
}

/* Nav hover underline - draw right → left */
.main-nav .nav-list a {
  position: relative;
}
.main-nav .nav-list a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 0%;
  height: 2px;
  background: var(--secondary);
  transition: width 0.3s ease;
}
.main-nav .nav-list a:hover::after {
  width: 100%;
}

/* CTA button shimmer */
@keyframes btn-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.btn-primary {
  background-image: linear-gradient(
    110deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%
  );
  background-size: 200% auto;
  animation: btn-shimmer 3s linear infinite;
}

/* ----------------------------------------------------------
   HERO BREATHING OVERLAY
   ---------------------------------------------------------- */
@keyframes hero-breathe {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 0.55; }
}
.hero::before,
.hero-section::before,
.page-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  animation: hero-breathe 6s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.hero > *:not(#hero-canvas):not(.hero-floating-badge),
.hero-section > *:not(#hero-canvas):not(.hero-floating-badge),
.page-hero > *:not(#hero-canvas):not(.hero-floating-badge) {
  position: relative;
  z-index: 2;
}
.hero-title { animation: fadeSlideUp 0.8s ease-out 0.15s both; }
.hero-subtitle { animation: fadeSlideUp 0.8s ease-out 0.3s both; }
.hero-brand-kicker { animation: fadeSlideUp 0.65s ease-out 0.05s both; }
.hero-brand-name .brand-word {
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  animation: brandNameRise 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.hero-brand-name .brand-word-primary { animation-delay: 0.14s; }
.hero-brand-name .brand-word-gold { animation-delay: 0.26s; }
.hero-brand-service { animation: fadeSlideUp 0.75s ease-out 0.36s both; }

@keyframes brandNameRise {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero-section h1,
.page-hero h1 { animation: fadeSlideUp 0.7s ease-out 0.1s both; }

.hero p,
.hero-section p,
.page-hero p  { animation: fadeSlideUp 0.7s ease-out 0.35s both; }

.hero .hero-buttons,
.hero-section .cta-buttons,
.hero-section .hero-cta,
.page-hero .cta-buttons { animation: scaleBounce 0.6s cubic-bezier(.34,1.56,.64,1) 0.55s both; }

.hero .hero-reviews,
.hero-section .trust-badges,
.hero-section .hero-badges,
.page-hero .hero-reviews { animation: fadeSlideLeft 0.6s ease-out 0.75s both; }

#hero-truck {
  position: absolute;
  bottom: 18px;
  left: 28px;
  width: 120px;
  opacity: 0;
  animation: truck-drive-in 1.2s ease-out 0.4s forwards;
  will-change: transform;
  z-index: 3;
  pointer-events: none;
}

/* ----------------------------------------------------------
   STATS — gold underline draw
   ---------------------------------------------------------- */
.stat-item .stat-underline {
  display: block;
  height: 3px;
  background: var(--secondary);
  width: 0;
  margin: 6px auto 0;
  border-radius: 2px;
  transition: width 0.6s ease 0.2s;
}
.stat-item.in-view .stat-underline {
  width: 60px;
}

/* ----------------------------------------------------------
   SERVICE CARDS — JS adds .anim-ready then .revealed
   ---------------------------------------------------------- */
.service-card.anim-ready {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.55s ease, transform 0.55s ease,
              box-shadow 0.3s ease, border-top-width 0.3s ease;
  will-change: transform, opacity;
}
.service-card.anim-ready.revealed {
  opacity: 1;
  transform: translateY(0);
}
/* stagger delays */
.service-card.anim-ready:nth-child(1) { transition-delay: 0s;    }
.service-card.anim-ready:nth-child(2) { transition-delay: 0.15s; }
.service-card.anim-ready:nth-child(3) { transition-delay: 0.3s;  }
.service-card.anim-ready:nth-child(4) { transition-delay: 0.45s; }
.service-card.anim-ready:nth-child(5) { transition-delay: 0.6s;  }
.service-card.anim-ready:nth-child(6) { transition-delay: 0.75s; }

/* Hover */
.service-card:hover {
  transform: translateY(-8px) !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.13) !important;
}
.service-card:hover .service-icon,
.service-card:hover .card-icon {
  transform: rotate(5deg) scale(1.1);
  transition: transform 0.3s ease;
}

/* ----------------------------------------------------------
   PROCESS STEPS — JS adds .anim-ready then .revealed
   ---------------------------------------------------------- */
.process-step.anim-ready,
.step-card.anim-ready {
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(.34,1.3,.64,1);
  will-change: transform;
}
.process-step.anim-ready.revealed,
.step-card.anim-ready.revealed {
  opacity: 1;
  transform: scale(1);
}
.process-step.anim-ready:nth-child(1), .step-card.anim-ready:nth-child(1) { transition-delay: 0s;   }
.process-step.anim-ready:nth-child(2), .step-card.anim-ready:nth-child(2) { transition-delay: 0.2s; }
.process-step.anim-ready:nth-child(3), .step-card.anim-ready:nth-child(3) { transition-delay: 0.4s; }
.process-step.anim-ready:nth-child(4), .step-card.anim-ready:nth-child(4) { transition-delay: 0.6s; }

/* Step circle pulse */
@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212,163,70,0.3); }
  50%       { box-shadow: 0 0 0 8px rgba(212,163,70,0); }
}
.step-number, .step-circle {
  animation: step-pulse 2s ease-in-out infinite;
}

/* ----------------------------------------------------------
   SECTION TITLE — underline draw after reveal
   ---------------------------------------------------------- */
.section-title h2,
.section-title h3 {
  position: relative;
  display: inline-block;
}
.section-title h2::after,
.section-title h3::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 0;
  height: 3px;
  width: 0;
  background: var(--secondary);
  border-radius: 2px;
  transition: width 0.7s ease 0.3s;
}
.section-title.revealed h2::after,
.section-title.revealed h3::after {
  width: 60px;
}

/* ----------------------------------------------------------
   NEIGHBORHOOD TAGS — JS adds .anim-ready then .revealed
   ---------------------------------------------------------- */
.area-tag.anim-ready,
.neighborhood-tag.anim-ready,
.coverage-tag.anim-ready {
  opacity: 0;
  transform: scale(0);
  display: inline-block;
  transition: background 0.3s, color 0.3s, transform 0.3s;
}
@keyframes tag-pop {
  0%   { opacity: 0; transform: scale(0); }
  70%  { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
.area-tag.anim-ready.revealed,
.neighborhood-tag.anim-ready.revealed,
.coverage-tag.anim-ready.revealed {
  animation: tag-pop 0.35s cubic-bezier(.34,1.56,.64,1) forwards;
}
.area-tag:hover,
.neighborhood-tag:hover,
.coverage-tag:hover {
  background: var(--secondary) !important;
  color: #fff !important;
  transform: translateY(-3px) !important;
}

/* Animated dot pattern behind tags */
.coverage-section,
.neighborhoods-section {
  position: relative;
  overflow: hidden;
}
.coverage-section::before,
.neighborhoods-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(212,163,70,0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  animation: bg-drift 20s linear infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes bg-drift {
  from { background-position: 0 0;     }
  to   { background-position: 0 -200px; }
}
.coverage-section > *, .neighborhoods-section > * { position: relative; z-index: 1; }

/* ----------------------------------------------------------
   REVIEW CARDS — JS-driven stagger via animationDelay
   ---------------------------------------------------------- */
@keyframes card-fan-in {
  from { opacity: 0; transform: rotate(3deg) scale(0.95) translateY(20px); }
  to   { opacity: 1; transform: rotate(0deg) scale(1)    translateY(0); }
}
.review-card.anim-ready,
.testimonial-card.anim-ready {
  opacity: 0;
  will-change: transform, opacity;
}
.review-card.anim-ready.revealed,
.testimonial-card.anim-ready.revealed {
  animation: card-fan-in 0.5s ease forwards;
}

/* ----------------------------------------------------------
   FINAL CTA SECTION
   ---------------------------------------------------------- */
@keyframes gradient-shift {
  0%   { background-position: 0% 50%;   }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%;   }
}
.cta-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  background-size: 300% 300%;
  animation: gradient-shift 8s ease infinite;
}

/* CTA button pulses */
@keyframes wa-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(255,255,255,0.35); }
  70%  { box-shadow: 0 0 0 12px rgba(255,255,255,0);   }
  100% { box-shadow: 0 0 0 0   rgba(255,255,255,0);    }
}
@keyframes gold-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(212,163,70,0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(212,163,70,0);  }
  100% { box-shadow: 0 0 0 0   rgba(212,163,70,0);   }
}
.cta-banner a[href*="wa.me"]  { animation: wa-pulse   2s infinite; }
.cta-banner a[href*="tel"]    { animation: gold-pulse 2s infinite 1s; }

/* Headline clip reveal */
@keyframes clip-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0%   0 0); }
}
.cta-banner h2 { animation: clip-reveal 0.9s ease-out 0.2s both; }

/* ----------------------------------------------------------
   WHATSAPP FLOATING BUTTON
   ---------------------------------------------------------- */
@keyframes wa-entrance {
  from { opacity: 0; transform: translateY(60px) scale(0.5); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
@keyframes wa-float {
  0%, 100% { transform: translateY(0);  }
  50%       { transform: translateY(-6px); }
}
@keyframes wa-ripple {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0;   }
}

.whatsapp-float {
  opacity: 0;
  position: relative;
  animation:
    wa-entrance 0.6s cubic-bezier(.34,1.56,.64,1) 2s  forwards,
    wa-float    3s ease-in-out                    2.7s infinite;
  will-change: transform;
}
.whatsapp-float::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.35);
  animation: wa-ripple 3s ease-out 2.7s infinite;
  pointer-events: none;
}
.whatsapp-float:hover {
  transform: rotate(10deg) scale(1.1) !important;
  animation-play-state: paused !important;
}

/* ----------------------------------------------------------
   GLOBAL SECTION REVEAL — only when JS adds .anim-ready
   (this way sections are NEVER invisible without JS help)
   ---------------------------------------------------------- */
section.anim-ready {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  will-change: transform, opacity;
}
section.anim-ready.section-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Antigravity Premium Animations Layer
   ========================================================================== */

/* 1. Staggered Word Reveal */
.reveal-word {
  display: inline-flex;
  overflow: hidden;
  vertical-align: bottom;
  margin-left: 0.08em;
  margin-right: 0.08em;
}

.reveal-word-inner {
  display: inline-block;
  transform: translateY(105%);
  opacity: 0;
  animation: revealWordUp 0.85s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes revealWordUp {
  0% {
    transform: translateY(105%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 2. Interactive Steps Progress Connector */
.step-progress-line {
  position: absolute;
  top: 40px;
  left: 12%;
  right: 12%;
  height: 4px;
  background: rgba(10, 92, 54, 0.1);
  z-index: 1;
  border-radius: 2px;
  overflow: hidden;
  pointer-events: none;
}

.step-progress-line-fill {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  transition: width 0.4s ease-out;
}

/* RTL / LTR Directions for Progress Line Fill */
html[dir="rtl"] .step-progress-line-fill,
[dir="rtl"] .step-progress-line-fill {
  right: 0;
  left: auto;
  background: linear-gradient(-90deg, var(--primary) 0%, var(--secondary) 100%);
}

html[dir="ltr"] .step-progress-line-fill,
[dir="ltr"] .step-progress-line-fill {
  left: 0;
  right: auto;
}

/* Hide original background indicator bar if our script runs */
.how-grid.progress-active::before {
  display: none !important;
}

@media (max-width: 768px) {
  .step-progress-line {
    display: none !important;
  }
}

/* Define missing keyframes */
@keyframes fadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleBounce {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  70% {
    transform: scale(1.02);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeSlideLeft {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes truck-drive-in {
  0% {
    opacity: 0;
    transform: translateX(100px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}
