/* =======================================================
   ADVAYA — Animations CSS
   ======================================================= */

/* ---- Keyframe Definitions ---- */

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-16px); }
}

@keyframes float-rotate {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-12px) rotate(3deg); }
  66%       { transform: translateY(-6px) rotate(-2deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.05); opacity: 0.85; }
}

@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes draw-line {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes counter-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

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

@keyframes morph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50%       { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}

/* ---- Hero Entrance Animations ---- */

.hero__left {
  animation: slide-right 0.9s var(--ease-smooth) 0.2s both;
}

.hero__right {
  animation: slide-left 0.9s var(--ease-smooth) 0.4s both;
}

.hero__badge {
  animation: slide-down 0.6s var(--ease-smooth) 0.1s both;
}

.hero__title {
  animation: slide-up 0.8s var(--ease-smooth) 0.25s both;
}

.hero__subtitle {
  animation: slide-up 0.8s var(--ease-smooth) 0.4s both;
}

.hero__actions {
  animation: slide-up 0.8s var(--ease-smooth) 0.55s both;
}

.hero__trust-row {
  animation: slide-up 0.6s var(--ease-smooth) 0.7s both;
}

.hero__stats {
  animation: slide-up 0.7s var(--ease-smooth) 0.65s both;
}

.hero__image-frame {
  animation: scale-in 1s var(--ease-smooth) 0.3s both;
}

.hero__image-badge--tl {
  animation: slide-right 0.7s var(--ease-spring) 0.8s both;
}

.hero__image-badge--br {
  animation: slide-left 0.7s var(--ease-spring) 0.9s both;
}

.hero__scroll {
  animation: fade-in 1s var(--ease-smooth) 1.2s both;
}

/* ---- Hero V2 Entrance Animations ---- */

.hv2__badge {
  animation: slide-down 0.65s var(--ease-smooth) 0.1s both;
}

.hv2__title {
  animation: slide-up 0.85s var(--ease-smooth) 0.25s both;
}

.hv2__subtitle {
  animation: slide-up 0.8s var(--ease-smooth) 0.42s both;
}

.hv2__actions {
  animation: slide-up 0.8s var(--ease-smooth) 0.56s both;
}

.hv2__trust-row {
  animation: slide-up 0.7s var(--ease-smooth) 0.7s both;
}

.hv2__left {
  animation: slide-right 0.9s var(--ease-smooth) 0.15s both;
}

.hv2__right {
  animation: slide-left 0.95s var(--ease-smooth) 0.3s both;
}

.hv2__float-card--tl {
  animation: slide-right 0.75s var(--ease-spring) 0.85s both;
}

.hv2__float-card--br {
  animation: slide-left 0.75s var(--ease-spring) 1s both;
}

.hv2__stats {
  animation: slide-up 0.7s var(--ease-smooth) 0.75s both;
}

.hv2__scroll {
  animation: fade-in 1s var(--ease-smooth) 1.3s both;
}

/* ---- Floating Elements ---- */
.hero__image-frame {
  /* subtle float after initial animation settles */
}

.float-element {
  animation: float 6s ease-in-out infinite;
}

.float-element--slow {
  animation-duration: 9s;
}

.float-element--offset {
  animation-delay: -3s;
}

.float-rotate-element {
  animation: float-rotate 8s ease-in-out infinite;
}

/* ---- Decorative particles in hero ---- */
.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  animation: float 8s ease-in-out infinite;
}

.particle:nth-child(1) { width: 8px; height: 8px; top: 20%; left: 15%; animation-delay: 0s; }
.particle:nth-child(2) { width: 5px; height: 5px; top: 60%; left: 8%; animation-delay: -2s; animation-duration: 6s; }
.particle:nth-child(3) { width: 10px; height: 10px; top: 40%; right: 12%; animation-delay: -4s; animation-duration: 10s; }
.particle:nth-child(4) { width: 6px; height: 6px; top: 75%; right: 20%; animation-delay: -1s; animation-duration: 7s; }
.particle:nth-child(5) { width: 4px; height: 4px; top: 15%; right: 35%; animation-delay: -3s; animation-duration: 9s; }
.particle:nth-child(6) { width: 7px; height: 7px; top: 85%; left: 40%; animation-delay: -5s; animation-duration: 11s; }

/* ---- Blob animations ---- */
.hero-blob-1 {
  width: 600px;
  height: 600px;
  top: -200px;
  right: -200px;
  background: rgba(9, 130, 80, 0.15);
  animation: float-blob-1 15s ease-in-out infinite;
}

.hero-blob-2 {
  width: 400px;
  height: 400px;
  bottom: -100px;
  left: -100px;
  background: rgba(0, 158, 239, 0.12);
  animation: float-blob-2 18s ease-in-out infinite;
}

@keyframes float-blob-1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  33%  { transform: translate(-30px, 20px) rotate(5deg) scale(1.05); }
  66%  { transform: translate(20px, -30px) rotate(-3deg) scale(0.97); }
}

@keyframes float-blob-2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  33%  { transform: translate(25px, -15px) rotate(-4deg) scale(1.03); }
  66%  { transform: translate(-15px, 25px) rotate(3deg) scale(0.98); }
}

/* ---- Gradient Text Animation ---- */
.gradient-text-anim {
  background: linear-gradient(90deg, #5ddba9, #009EEF, #5ddba9);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* ---- Section reveal delays ---- */
.reveal-delay-1 { transition-delay: 0.1s !important; }
.reveal-delay-2 { transition-delay: 0.2s !important; }
.reveal-delay-3 { transition-delay: 0.3s !important; }
.reveal-delay-4 { transition-delay: 0.4s !important; }
.reveal-delay-5 { transition-delay: 0.5s !important; }

/* ---- Card hover tilt (CSS 3D) ---- */
.tilt-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
}

/* ---- Icon pulse ring ---- */
.pulse-ring {
  position: relative;
  display: inline-flex;
}

.pulse-ring::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  animation: pulse-ring 2s ease-out infinite;
}

/* ---- Shimmer loading effect (for images) ---- */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--soft-grey) 25%,
    rgba(255,255,255,0.8) 50%,
    var(--soft-grey) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ---- Button ripple ---- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

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

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

/* ---- Navigation link underline animation ---- */
.nav-link-anim {
  position: relative;
}

.nav-link-anim::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-light);
  border-radius: 2px;
  transition: width 0.3s var(--ease-smooth);
}

.nav-link-anim:hover::after { width: 100%; }

/* ---- Progress bar animation ---- */
.progress-bar {
  height: 4px;
  background: var(--soft-grey);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar__fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: 2px;
  width: 0;
  transition: width 1.5s var(--ease-smooth);
}

/* ---- Counter digit animation ---- */
.counter-number {
  display: inline-block;
  transition: transform 0.3s var(--ease-spring);
}

.counter-number.pop {
  animation: counter-pop 0.4s var(--ease-spring);
}

/* ---- Morphing shape ---- */
.morph-shape {
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  animation: morph 8s ease-in-out infinite;
}

/* ---- Twinkle stars ---- */
.star {
  position: absolute;
  background: var(--white);
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}

/* ---- Wave animation for dividers ---- */
@keyframes wave-move {
  0%   { d: path("M0,40 C180,0 360,80 540,40 C720,0 900,80 1080,40 L1080,80 L0,80 Z"); }
  50%  { d: path("M0,40 C180,80 360,0 540,40 C720,80 900,0 1080,40 L1080,80 L0,80 Z"); }
  100% { d: path("M0,40 C180,0 360,80 540,40 C720,0 900,80 1080,40 L1080,80 L0,80 Z"); }
}

/* ---- Navbar scroll transform ---- */
@keyframes navbar-slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.navbar {
  animation: navbar-slide-down 0.5s var(--ease-smooth);
}

/* ---- Loading spinner ---- */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(9,130,80,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---- Stagger reveal for lists ---- */
.stagger-list > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-smooth), transform 0.5s var(--ease-smooth);
}

.stagger-list.revealed > *:nth-child(1) { opacity: 1; transform: none; transition-delay: 0.0s; }
.stagger-list.revealed > *:nth-child(2) { opacity: 1; transform: none; transition-delay: 0.1s; }
.stagger-list.revealed > *:nth-child(3) { opacity: 1; transform: none; transition-delay: 0.2s; }
.stagger-list.revealed > *:nth-child(4) { opacity: 1; transform: none; transition-delay: 0.3s; }
.stagger-list.revealed > *:nth-child(5) { opacity: 1; transform: none; transition-delay: 0.4s; }
.stagger-list.revealed > *:nth-child(6) { opacity: 1; transform: none; transition-delay: 0.5s; }
.stagger-list.revealed > *:nth-child(7) { opacity: 1; transform: none; transition-delay: 0.6s; }
.stagger-list.revealed > *:nth-child(8) { opacity: 1; transform: none; transition-delay: 0.7s; }

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

  .hero__left,
  .hero__right,
  .hero__badge,
  .hero__title,
  .hero__subtitle,
  .hero__actions,
  .hero__trust-row,
  .hero__stats,
  .hero__image-frame,
  .hero__image-badge--tl,
  .hero__image-badge--br,
  .hero__scroll,
  .hv2__left,
  .hv2__right,
  .hv2__badge,
  .hv2__title,
  .hv2__subtitle,
  .hv2__actions,
  .hv2__trust-row,
  .hv2__stats,
  .hv2__float-card--tl,
  .hv2__float-card--br,
  .hv2__scroll {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

