/* ============================================================
   CV GROUP — animations.css
   Animaciones, transiciones y efectos de scroll
   ============================================================ */

/* ─── FADE-IN BASE (aplicado via JS con IntersectionObserver) ─── */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Delays escalonados para grillas */
.fade-up:nth-child(1) { transition-delay: 0ms; }
.fade-up:nth-child(2) { transition-delay: 60ms; }
.fade-up:nth-child(3) { transition-delay: 120ms; }
.fade-up:nth-child(4) { transition-delay: 180ms; }
.fade-up:nth-child(5) { transition-delay: 240ms; }
.fade-up:nth-child(6) { transition-delay: 300ms; }

/* ─── HERO — pulso suave en el eyebrow badge ─── */
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(151, 196, 89, 0); }
  50%       { box-shadow: 0 0 0 6px rgba(151, 196, 89, 0.12); }
}

.hero-eyebrow {
  animation: badge-pulse 3s ease-in-out infinite;
}

/* ─── BOTÓN FLOTANTE WHATSAPP — rebote de entrada ─── */
@keyframes wa-bounce-in {
  0%   { opacity: 0; transform: scale(0.5) translateY(20px); }
  70%  { transform: scale(1.1) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

#whatsapp-float.show {
  animation: wa-bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Pulso continuo sobre el botón flotante */
@keyframes wa-ring {
  0%   { box-shadow: 0 4px 16px rgba(37,211,102,0.4), 0 0 0 0 rgba(37,211,102,0.4); }
  70%  { box-shadow: 0 4px 16px rgba(37,211,102,0.4), 0 0 0 12px rgba(37,211,102,0); }
  100% { box-shadow: 0 4px 16px rgba(37,211,102,0.4), 0 0 0 0 rgba(37,211,102,0); }
}

#whatsapp-float {
  animation: wa-ring 2.5s ease-in-out 4s infinite;
}

/* ─── NAVBAR — transición de sombra al hacer scroll ─── */
.navbar {
  transition: box-shadow 0.3s ease;
}

/* ─── TARJETAS — hover lift con sombra ─── */
.service-card,
.about-card,
.project-card {
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.service-card:hover,
.about-card:hover,
.project-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

/* ─── STATS — contador ya definido en main.js, esto agrega el underline animado ─── */
.stat-num::after {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: rgba(151, 196, 89, 0.4);
  margin: 8px auto 0;
  border-radius: 1px;
}

/* ─── FORM INPUTS — focus ring animado ─── */
.form-group input,
.form-group select,
.form-group textarea {
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

/* ─── TRUST BAR items — aparecen con fade al cargar ─── */
@keyframes trust-slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.trust-item:nth-child(1) { animation: trust-slide-in 0.4s ease 0.1s both; }
.trust-item:nth-child(2) { animation: trust-slide-in 0.4s ease 0.2s both; }
.trust-item:nth-child(3) { animation: trust-slide-in 0.4s ease 0.3s both; }
.trust-item:nth-child(4) { animation: trust-slide-in 0.4s ease 0.4s both; }
.trust-item:nth-child(5) { animation: trust-slide-in 0.4s ease 0.5s both; }

/* ─── SCROLL SUAVE en secciones — marca visual activa en nav ─── */
.nav-links a.active {
  color: var(--white);
  position: relative;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--green-400);
  border-radius: 1px;
  animation: trust-slide-in 0.2s ease both;
}

/* ─── SKELETON LOADER (para cuando agregues imágenes dinámicas) ─── */
@keyframes skeleton-shine {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-100) 25%,
    var(--gray-50) 50%,
    var(--gray-100) 75%
  );
  background-size: 200% auto;
  animation: skeleton-shine 1.5s linear infinite;
  border-radius: var(--radius-sm);
}

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