/* ============================================================
   ServeLynx Theme — animations.css
   Keyframes, AOS overrides, scroll effects, hover transitions
   ============================================================ */

/* ── Keyframe Definitions ── */

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

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

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

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

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

@keyframes float-slow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-20px) rotate(2deg); }
  66%       { transform: translateY(-10px) rotate(-2deg); }
}

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

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(41, 182, 246, 0.4);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(41, 182, 246, 0);
  }
}

@keyframes pulse-ring {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(41, 182, 246, 0.4); }
  70%  { transform: scale(1); box-shadow: 0 0 0 12px rgba(41, 182, 246, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(41, 182, 246, 0); }
}

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

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

@keyframes scroll-dot {
  0%        { transform: translateY(0); opacity: 1; }
  60%, 100% { transform: translateY(12px); opacity: 0; }
}

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

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

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(41, 182, 246, 0.2); }
  50%       { box-shadow: 0 0 40px rgba(41, 182, 246, 0.4), 0 0 80px rgba(41, 182, 246, 0.1); }
}

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

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


/* ── AOS (Animate On Scroll) Custom Overrides ── */

[data-aos] {
  pointer-events: none;
}

[data-aos].aos-animate {
  pointer-events: auto;
}

/* Tighten AOS easing */
[data-aos][data-aos][data-aos-easing="ease-out-quart"] {
  transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
}


/* ── Hero Gradient Animation ── */
.hero-bg {
  animation: gradient-shift 12s ease infinite;
  background-size: 200% 200%;
}


/* ── Floating Shapes (Hero decorative) ── */
.hero-shape {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

.hero-shape--circle-1 {
  width: 300px;
  height: 300px;
  border: 1px solid rgba(41, 182, 246, 0.1);
  top: 15%;
  right: 10%;
  animation: float-slow 8s ease-in-out infinite;
}

.hero-shape--circle-2 {
  width: 180px;
  height: 180px;
  border: 1px solid rgba(41, 182, 246, 0.08);
  top: 40%;
  right: 25%;
  animation: float-slow 11s ease-in-out infinite reverse;
}

.hero-shape--dot-grid {
  position: absolute;
  width: 200px;
  height: 200px;
  background-image: radial-gradient(circle, rgba(41,182,246,0.3) 1px, transparent 1px);
  background-size: 20px 20px;
  top: 20%;
  left: 5%;
  opacity: 0.4;
  animation: float-medium 7s ease-in-out infinite;
}


/* ── Typing Cursor Effect ── */
.typed-cursor {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  background: var(--electric);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}


/* ── Card hover glow ── */
.card,
.pricing-card,
.integration-badge {
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    border-color var(--transition-base);
}


/* ── Nav active link underline ── */
.nav-links a.active {
  position: relative;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--electric);
  border-radius: 1px;
}


/* ── Section divider glow ── */
.divider-glow {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-blue) 50%, transparent);
  margin: 0;
}


/* ── Shimmer loading skeleton ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--navy-800) 25%,
    var(--navy-700) 50%,
    var(--navy-800) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}


/* ── Scroll-triggered number counter ── */
.stat-number.counted {
  animation: counter-pop 0.4s ease;
}


/* ── App mockup floating animation ── */
.app-mockup {
  animation: float-medium 5s ease-in-out infinite;
}


/* ── Portal visual glow ── */
.portal-visual {
  animation: glow-pulse 4s ease-in-out infinite;
}


/* ── Feature module alternating entrance ── */
.feature-module:nth-child(even) .feature-module-layout {
  /* Even sections have reversed layout */
}


/* ── Success checkmark animation ── */
@keyframes check-pop {
  0%   { transform: scale(0) rotate(-45deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.form-success__icon {
  animation: check-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}


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

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

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


/* ── Stagger children animation ── */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.aos-animate > *:nth-child(1) { transition-delay: 0ms; }
.stagger-children.aos-animate > *:nth-child(2) { transition-delay: 80ms; }
.stagger-children.aos-animate > *:nth-child(3) { transition-delay: 160ms; }
.stagger-children.aos-animate > *:nth-child(4) { transition-delay: 240ms; }
.stagger-children.aos-animate > *:nth-child(5) { transition-delay: 320ms; }
.stagger-children.aos-animate > *:nth-child(6) { transition-delay: 400ms; }

.stagger-children.aos-animate > * {
  opacity: 1;
  transform: translateY(0);
}


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

  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
  }
}
