/* ═══════════════════════════════════════════════════════════
   ANIMATIONS CSS — Smile & Teeth Care
   Premium GSAP + CSS Keyframe Animations
═══════════════════════════════════════════════════════════ */

/* ─── Global Transition Layers ───────────────────────────── */
[data-aos] {
  will-change: transform, opacity;
}

/* ─── Hero Title Word Reveal ─────────────────────────────── */
.hero-title .word {
  display: inline-block;
  overflow: hidden;
}

.hero-title .char {
  display: inline-block;
  animation: charReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes charReveal {
  from {
    opacity: 0;
    transform: translateY(40px) rotate(5deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

/* ─── Shimmer Effect ─────────────────────────────────────── */
.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.4) 50%,
    rgba(255,255,255,0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

/* ─── Pulse Glow ─────────────────────────────────────────── */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(30, 136, 229, 0.4);
  }
  50% {
    box-shadow: 0 0 0 16px rgba(30, 136, 229, 0);
  }
}

.pulse-glow {
  animation: pulseGlow 2.5s ease-in-out infinite;
}

/* ─── Float Up ───────────────────────────────────────────── */
@keyframes floatUp {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

.float-up {
  animation: floatUp 5s ease-in-out infinite;
}

/* ─── Spin Slow ──────────────────────────────────────────── */
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── Ripple Effect ──────────────────────────────────────── */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleEffect 0.6s linear;
  pointer-events: none;
}

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

/* ─── Gradient Shift ─────────────────────────────────────── */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-animate {
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

/* ─── Number Count Up (visual-only, JS does actual counting) */
.counter {
  font-variant-numeric: tabular-nums;
}

/* ─── Page Load Body Fade ────────────────────────────────── */
.page-ready {
  animation: pageFadeIn 0.5s ease forwards;
}

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

/* ─── Card Entrance ──────────────────────────────────────── */
.card-enter {
  animation: cardEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: scale(0.90) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ─── Slide In Left/Right ────────────────────────────────── */
@keyframes slideInLeft {
  from { transform: translateX(-40px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

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

@keyframes slideInUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ─── Dot Blink (Loading) ────────────────────────────────── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── Three.js Loading Animation ────────────────────────── */
.three-loading-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  border: 3px solid rgba(30,136,229,0.20);
  border-top-color: var(--primary, #1E88E5);
  border-radius: 50%;
  animation: spinRing 1s linear infinite;
}

@keyframes spinRing {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ─── Stagger Children ───────────────────────────────────── */
.stagger-children > * {
  animation: slideInUp 0.5s ease both;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.40s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }

/* ─── Service Tab Transition ─────────────────────────────── */
.service-card {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.service-card.hiding {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.service-card.showing {
  animation: cardEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ─── Hotspot Pulse ──────────────────────────────────────── */
@keyframes hotspotAppear {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─── WhatsApp Button Bounce ─────────────────────────────── */
@keyframes waBounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  60% { transform: translateY(-4px); }
}

.whatsapp-float {
  animation: waBounce 3s ease-in-out 3s 2;
}

/* ─── Timeline Pulse ─────────────────────────────────────── */
.timeline-dot::after {
  content: '';
  position: absolute;
  top: -4px; left: -4px;
  right: -4px; bottom: -4px;
  border-radius: 50%;
  border: 2px solid rgba(30,136,229,0.30);
  animation: timelinePulse 2s ease-in-out infinite;
}

@keyframes timelinePulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 0; }
}

/* ─── Stat Number Roll ───────────────────────────────────── */
@keyframes numberRoll {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.stat-number.animating {
  animation: numberRoll 0.3s ease forwards;
}

/* ─── Gallery Item Reveal ────────────────────────────────── */
.gallery-item {
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

.gallery-item.filter-hide {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}

.gallery-item.filter-show {
  opacity: 1;
  transform: scale(1);
}

/* ─── Preloader Progress ─────────────────────────────────── */
@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* ─── Navbar Scroll Transition ───────────────────────────── */
.navbar-wrapper {
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease,
    padding 0.3s ease;
}

/* ─── Button Press Effect ────────────────────────────────── */
.btn:active {
  transform: scale(0.97) translateY(1px) !important;
}

/* ─── Focus Ring Animation ───────────────────────────────── */
:focus-visible {
  animation: focusRingAppear 0.2s ease forwards;
}

@keyframes focusRingAppear {
  from { outline-offset: 0; }
  to   { outline-offset: 3px; }
}

/* ─── Skeleton Loading ───────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--accent) 25%,
    #dde3e7 50%,
    var(--accent) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: 8px;
}

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

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

  .hero-bg-orb,
  .hero-floating-el,
  .hero-float-card,
  .scroll-indicator,
  .whatsapp-float,
  .timeline-dot::after {
    animation: none !important;
  }
}
