/* ==========================================================================
   PORTAL WEB DE ENFERMERÍA - CUIDO TU SALUD (MARILUZ MERCADO TAPIA)
   ANIMATIONS.CSS - SISTEMA DE ANIMACIONES AVANZADAS, 3D TILT & MICRO-INTERACCIONES
   Estética Stitch: Salud, Confianza y Calidez Humana (Vanilla CSS3, 60 FPS)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BARRA SUPERIOR DE PROGRESO DE SCROLL
   -------------------------------------------------------------------------- */
#scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--secondary) 0%, #E29578 50%, var(--tertiary) 100%);
  z-index: 9999;
  pointer-events: none;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(212, 140, 112, 0.6);
}

/* --------------------------------------------------------------------------
   2. CANVAS DE PULSO CARDÍACO (ECG) EN EL HERO
   -------------------------------------------------------------------------- */
.hero-canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

#hero-pulse-canvas {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.65;
}

/* --------------------------------------------------------------------------
   3. BLOBS ORGÁNICOS FLOTANTES (DECORATIVOS EN FONDO)
   -------------------------------------------------------------------------- */
.floating-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  pointer-events: none;
  opacity: 0.45;
  z-index: 1;
  animation: floatOrganic 18s ease-in-out infinite alternate;
}

.blob-hero-1 {
  top: -80px;
  right: -60px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(212, 140, 112, 0.28) 0%, rgba(255, 219, 206, 0.05) 70%);
  animation-duration: 22s;
}

.blob-hero-2 {
  bottom: -60px;
  left: -80px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(142, 168, 157, 0.25) 0%, rgba(205, 233, 220, 0.04) 70%);
  animation-duration: 26s;
  animation-delay: -5s;
}

.blob-about {
  top: 15%;
  right: -5%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(212, 140, 112, 0.2) 0%, transparent 70%);
  animation-duration: 20s;
}

@keyframes floatOrganic {
  0% {
    transform: translate(0px, 0px) scale(1) rotate(0deg);
  }
  33% {
    transform: translate(25px, -35px) scale(1.08) rotate(6deg);
  }
  66% {
    transform: translate(-30px, 20px) scale(0.94) rotate(-6deg);
  }
  100% {
    transform: translate(20px, 40px) scale(1.04) rotate(4deg);
  }
}

/* --------------------------------------------------------------------------
   4. SISTEMA SCROLL REVEAL (INTERSECTION OBSERVER)
   -------------------------------------------------------------------------- */
.reveal-on-scroll {
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-up {
  transform: translateY(32px);
}

.reveal-left {
  transform: translateX(-36px);
}

.reveal-right {
  transform: translateX(36px);
}

.reveal-scale {
  transform: scale(0.92);
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Delays escalonados (Stagger) */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }

/* --------------------------------------------------------------------------
   5. EFECTO 3D TILT INTERACTIVO (TARJETAS VIVAS)
   -------------------------------------------------------------------------- */
.tilt-card {
  perspective: 1100px;
  transform-style: preserve-3d;
  transition: transform 0.2s ease-out, box-shadow 0.3s ease;
  will-change: transform;
}

.tilt-inner {
  transform: translateZ(24px);
  transition: transform 0.3s ease-out;
}

/* --------------------------------------------------------------------------
   6. MICRO-INTERACCIONES EN EL HERO
   -------------------------------------------------------------------------- */
/* Badge Habilitación con Pulso de Verificación */
.hero-badge-auth {
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 43, 72, 0.08);
  transition: var(--transition);
}

.hero-badge-auth::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 20%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 80%
  );
  transform: rotate(25deg);
  animation: badgeSheen 5s infinite ease-in-out;
  pointer-events: none;
}

@keyframes badgeSheen {
  0%, 80% {
    left: -60%;
  }
  100% {
    left: 140%;
  }
}

/* Punto de estado activo con latido cardíaco */
.status-dot {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  background-color: #2A9D8F;
  border-radius: 50%;
}

.status-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background-color: rgba(42, 157, 143, 0.4);
  animation: pulseHeartbeat 1.8s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes pulseHeartbeat {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.6);
    opacity: 0.2;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Resaltado del retrato en Hero */
.hero-card {
  position: relative;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 42px -8px rgba(15, 43, 72, 0.16);
}

.hero-photo-wrapper {
  overflow: hidden;
  position: relative;
}

.hero-photo-wrapper img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-card:hover .hero-photo-wrapper img {
  transform: scale(1.04);
}

/* Indicador de scroll flotante en Hero */
.hero-scroll-indicator {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  z-index: 3;
  opacity: 0.85;
  transition: opacity 0.3s ease;
  cursor: pointer;
  text-decoration: none;
}

.hero-scroll-indicator:hover {
  opacity: 1;
  color: var(--primary);
}

.hero-scroll-indicator svg {
  animation: scrollBounce 2s infinite ease-in-out;
}

@keyframes scrollBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(7px);
  }
  60% {
    transform: translateY(4px);
  }
}

/* --------------------------------------------------------------------------
   7. CINTA DE CIFRAS (STATS STRIP) DINÁMICA
   -------------------------------------------------------------------------- */
.stat-item {
  position: relative;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
}

.stat-item:hover {
  transform: translateY(-5px);
  background-color: #FFFFFF;
  border-color: rgba(15, 43, 72, 0.16);
  box-shadow: 0 12px 28px -4px rgba(15, 43, 72, 0.1), 0 4px 10px -2px rgba(15, 43, 72, 0.04);
}

.stat-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: transform 0.3s ease, color 0.3s ease;
}

.stat-item:hover .stat-value {
  transform: scale(1.06);
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   8. SOBRE MÍ - MARCO FOTOGRÁFICO Y BARRAS DE APTITUD
   -------------------------------------------------------------------------- */
.about-image-wrapper {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 38px -6px rgba(15, 43, 72, 0.12);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-image-wrapper:hover {
  transform: translateY(-6px);
}

.about-photo {
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-image-wrapper:hover .about-photo {
  transform: scale(1.035);
}

/* Barras de Compromiso Asistencial */
.clinical-meter-group {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.clinical-meter-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.clinical-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

.clinical-meter-track {
  width: 100%;
  height: 7px;
  background-color: rgba(15, 43, 72, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.clinical-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--secondary) 0%, #E29578 50%, var(--tertiary) 100%);
  transition: width 1.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   9. MISIÓN Y VISIÓN - TARJETAS DUALES 3D
   -------------------------------------------------------------------------- */
.mv-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

.mv-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--secondary);
  transition: width 0.3s ease;
}

.mv-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 16px 36px -6px rgba(15, 43, 72, 0.12);
  border-color: rgba(212, 140, 112, 0.35);
}

.mv-card:hover::before {
  width: 7px;
}

.mv-card:hover .mv-icon-box {
  transform: scale(1.1) rotate(5deg);
  background-color: var(--secondary);
  color: #FFFFFF;
}

.mv-icon-box {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease, color 0.3s ease;
}

/* --------------------------------------------------------------------------
   10. TARJETAS DE SERVICIOS CLÍNICOS
   -------------------------------------------------------------------------- */
.service-card {
  position: relative;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
  will-change: transform;
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 40px -8px rgba(15, 43, 72, 0.12), 0 4px 12px rgba(15, 43, 72, 0.04);
  border-color: rgba(212, 140, 112, 0.4);
}

.service-card .service-icon-box,
.service-card .service-icon {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.3s ease;
}

.service-card:hover .service-icon-box,
.service-card:hover .service-icon {
  transform: scale(1.12);
}

/* Botón Consultar Servicio */
.service-btn-consultar {
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.service-btn-consultar:hover {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   11. GALERÍA CLÍNICA CON ZOOM Y OVERLAY
   -------------------------------------------------------------------------- */
.gallery-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.gallery-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 18px 36px -6px rgba(15, 43, 72, 0.14);
}

.gallery-image-wrapper {
  overflow: hidden;
  position: relative;
}

.gallery-img {
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  display: block;
}

.gallery-card:hover .gallery-img {
  transform: scale(1.08);
}

.gallery-card-info {
  transition: background-color 0.3s ease;
}

.gallery-card:hover .gallery-card-info {
  background-color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   12. TESTIMONIOS - ESTRELLAS ANIMADAS Y TARJETAS
   -------------------------------------------------------------------------- */
.testimonio-card,
.testimonial-card {
  position: relative;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.3s ease;
}

.testimonio-card:hover,
.testimonial-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px -6px rgba(15, 43, 72, 0.1);
  border-color: rgba(212, 140, 112, 0.35);
}

.testimonio-estrellas-animadas svg,
.testimonial-stars svg {
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.testimonio-card:hover .testimonio-estrellas-animadas svg,
.testimonial-card:hover .testimonial-stars svg {
  animation: starPop 0.5s ease forwards;
}

@keyframes starPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   13. ZONAS DE COBERTURA - ONDAS DE RADAR
   -------------------------------------------------------------------------- */
.zona-item {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.zona-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px -4px rgba(15, 43, 72, 0.08);
}

.coverage-phone-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.3s ease;
}

.coverage-phone-btn::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 9999px;
  border: 2px solid rgba(212, 140, 112, 0.5);
  animation: pulseRingBtn 2.2s infinite cubic-bezier(0.2, 0.8, 0.4, 1);
  pointer-events: none;
}

@keyframes pulseRingBtn {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   14. BLOG - TARJETAS Y FLECHA DE LECTURA
   -------------------------------------------------------------------------- */
.blog-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

.blog-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 18px 36px -6px rgba(15, 43, 72, 0.12);
}

.blog-card-img-wrap {
  overflow: hidden;
}

.blog-card-img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-card:hover .blog-card-img {
  transform: scale(1.06);
}

.blog-read-link svg,
.blog-read-more svg {
  transition: transform 0.25s ease;
}

.blog-card:hover .blog-read-link svg,
.blog-card:hover .blog-read-more svg {
  transform: translateX(5px);
}

/* --------------------------------------------------------------------------
   15. FAQ - INDICADOR GIRATORIO Y EXPANSIÓN
   -------------------------------------------------------------------------- */
.faq-item {
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease;
}

.faq-item:hover {
  border-color: rgba(212, 140, 112, 0.35);
  box-shadow: 0 6px 20px -2px rgba(15, 43, 72, 0.05);
}

.faq-icon-rotator {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.faq-item.active .faq-icon-rotator {
  transform: rotate(45deg);
  color: var(--secondary);
}

/* --------------------------------------------------------------------------
   16. WHATSAPP FLOTANTE - DOBLE ANILLO DE PULSO VITAL
   -------------------------------------------------------------------------- */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 990;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.whatsapp-float:hover {
  transform: scale(1.08);
}

.whatsapp-btn-pulse {
  position: relative;
}

.whatsapp-btn-pulse::before,
.whatsapp-btn-pulse::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background-color: rgba(37, 211, 102, 0.35);
  pointer-events: none;
  z-index: -1;
  animation: waPulseRing 2.6s infinite cubic-bezier(0.2, 0.8, 0.4, 1);
}

.whatsapp-btn-pulse::after {
  animation-delay: 1.3s;
}

@keyframes waPulseRing {
  0% {
    transform: scale(0.9);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.75);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   17. EFECTO ONDA RIPPLE EN BOTONES
   -------------------------------------------------------------------------- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

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

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

/* --------------------------------------------------------------------------
   18. PREFERENCIAS DE ACCESIBILIDAD (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;
    scroll-behavior: auto !important;
  }

  .floating-blob,
  #hero-pulse-canvas,
  .hero-canvas-container {
    display: none !important;
  }

  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --------------------------------------------------------------------------
   19. OPTIMIZACIÓN RESPONSIVE MOBILE-FIRST (CERO SCROLL HORIZONTAL)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .floating-blob {
    max-width: 240px;
    max-height: 240px;
    filter: blur(35px);
    opacity: 0.3;
  }

  .blob-hero-1 {
    top: -40px;
    right: -40px;
  }

  .blob-hero-2 {
    bottom: -40px;
    left: -40px;
  }

  .hero-scroll-indicator {
    display: none;
  }

  .reveal-left,
  .reveal-right {
    transform: translateY(22px);
  }

  .stat-item {
    padding: 0.9rem 0.5rem;
  }

  .tilt-card {
    transform: none !important;
  }
}
