/* ============================================
   ANIMATIONS — Tu Espacio Online
   ============================================ */

/* --- Fade / Slide In (Intersection Observer triggers) --- */

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger-children .reveal:nth-child(1) { transition-delay: 0s; }
.stagger-children .reveal:nth-child(2) { transition-delay: 0.12s; }
.stagger-children .reveal:nth-child(3) { transition-delay: 0.24s; }
.stagger-children .reveal:nth-child(4) { transition-delay: 0.36s; }

/* --- Hero entrance (staggered) --- */

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

.hero-anim-1 {
  animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.hero-anim-2 {
  animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both;
}

.hero-anim-3 {
  animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both;
}

.hero-anim-4 {
  animation: heroFadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.85s both;
}

/* --- Floating / pulsing decorative --- */

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

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

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(74, 158, 232, 0.15); }
  50%      { box-shadow: 0 0 40px rgba(123, 79, 212, 0.3); }
}

/* --- Button shimmer --- */

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

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.btn-primary:hover::after {
  opacity: 1;
  animation: shimmer 1.2s ease-in-out infinite;
}

/* --- Typing cursor in hero mockup --- */

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

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #4A9EE8;
  margin-left: 2px;
  animation: blink 0.9s step-end infinite;
}

/* --- Gradient text animation (subtle hue shift) --- */

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

.gradient-text-animated {
  background-size: 200% 200%;
  animation: gradientShift 6s ease-in-out infinite;
}

/* --- Timeline dot pulse --- */

@keyframes dotPulse {
  0%   { box-shadow: 0 0 0 0 rgba(74, 158, 232, 0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(74, 158, 232, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 158, 232, 0); }
}

.timeline-dot.visible {
  animation: dotPulse 2s ease-out 0.5s;
}

/* --- Scale in (for pricing card) --- */

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

.scale-reveal {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.scale-reveal.visible {
  opacity: 1;
  transform: scale(1);
}

/* --- Navbar scroll transition --- */

.navbar {
  transition: background-color 0.35s ease,
              box-shadow 0.35s ease,
              backdrop-filter 0.35s ease;
}

/* --- Mobile menu --- */

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-menu.open {
  animation: slideDown 0.3s ease forwards;
}

/* --- Card hover lift --- */

.card-hover {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 60px rgba(74, 158, 232, 0.12),
              0 8px 24px rgba(123, 79, 212, 0.08);
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .scale-reveal { opacity: 1; transform: none; }
}
