/* =====================================================================
   RUIDO Events — capa de movimiento
   Se carga DESPUÉS de styles.css y no cambia estructura ni colores:
   solo añade animaciones. Para desactivarla entera, quita de index.html
   las líneas marcadas con «ANIMACIONES».

   La clase .js-anim la pone un script del <head> solo si el visitante
   no ha pedido «reducir movimiento». Sin esa clase, nada de esto actúa.
   ===================================================================== */

:root {
  --anim-ease: cubic-bezier(.16, .8, .2, 1);
}

/* ---------- 1. Intro: el logo entra, suena y vuela a la cabecera ---------- */
.intro {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: #000; cursor: pointer;
}
.intro__logo {
  position: relative;
  width: min(70vw, 520px); aspect-ratio: 735 / 215;
  will-change: transform;
}
.intro__logo img { width: 100%; height: 100%; display: block; }
/* Ondas: salen del isotipo (los anillos del logo), en el azul de la marca */
.intro__onda {
  position: absolute; left: 15.4%; top: 49.8%;
  width: 24%; aspect-ratio: 1; margin: -12% 0 0 -12%;
  border: 1.5px solid var(--brand); border-radius: 50%;
  opacity: 0; pointer-events: none;
}
/* Mientras dura la intro se esconde el logo de la cabecera (llega volando) */
.intro-activa .brand img { opacity: 0; }
/* Protección: si la intro está pendiente, tapa la página; si el JS fallara, se destapa sola */
.intro-pendiente body::before {
  content: ""; position: fixed; inset: 0; z-index: 999; background: #000;
  animation: introDestapar .4s 4s forwards;
}
@keyframes introDestapar { to { opacity: 0; visibility: hidden; } }

/* ---------- 2. Hero: entrada escalonada + vídeo con zoom lento ---------- */
.js-anim .hero-video { animation: heroZoom 16s var(--anim-ease) both; will-change: scale, translate; }
@keyframes heroZoom { from { scale: 1.14; } to { scale: 1; } }

.js-anim .site-header { transition: background-color .3s var(--ease), border-color .3s var(--ease), backdrop-filter .3s, translate .8s var(--anim-ease), opacity .8s; }
.js-anim:not(.hero-lista) .site-header:not(.menu-open) .main-nav,
.js-anim:not(.hero-lista) .menu-toggle { opacity: 0; translate: 0 -12px; }
.js-anim .main-nav, .js-anim .menu-toggle { transition: opacity .7s var(--anim-ease) .5s, translate .7s var(--anim-ease) .5s; }

.js-anim .hero-content > .eyebrow,
.js-anim .hero-sub,
.js-anim .hero-actions > *,
.js-anim .hero-tagline {
  transition: opacity .9s var(--anim-ease), translate .9s var(--anim-ease);
}
.js-anim:not(.hero-lista) .hero-content > .eyebrow,
.js-anim:not(.hero-lista) .hero-sub,
.js-anim:not(.hero-lista) .hero-actions > *,
.js-anim:not(.hero-lista) .hero-tagline { opacity: 0; translate: 0 22px; }
.js-anim .hero-sub { transition-delay: .55s; }
.js-anim .hero-actions > :nth-child(1) { transition-delay: .7s; }
.js-anim .hero-actions > :nth-child(2) { transition-delay: .82s; }
.js-anim .hero-tagline { transition-delay: 1.1s; }

/* El lema del pie del hero «respira» abriendo el espaciado */
.js-anim.hero-lista .hero-tagline { animation: lemaAbrir 2.4s var(--anim-ease) 1.1s both; }
@keyframes lemaAbrir { from { letter-spacing: .05em; } to { letter-spacing: .3em; } }

/* ---------- 3. Titulares: las palabras suben una a una ---------- */
.pal { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .14em; margin-bottom: -.14em; }
.pal > span { display: inline-block; transition: translate 1s var(--anim-ease); transition-delay: calc(var(--i, 0) * 70ms + var(--retraso, 0ms)); }
.js-anim:not(.hero-lista) .hero-title .pal > span,
.js-anim .section-head.reveal:not(.is-visible) .pal > span,
.js-anim .section-head.anim-cab:not(.is-visible) .pal > span { translate: 0 110%; }
.js-anim .hero-title { --retraso: 120ms; }

/* Las cabeceras de sección ya no entran en bloque: entra cada pieza */
.js-anim .section-head.reveal { opacity: 1; transform: none; }
.js-anim .section-head .eyebrow,
.js-anim .section-head .section-sub { transition: opacity .8s var(--anim-ease), translate .8s var(--anim-ease); }
.js-anim .section-head .section-sub { transition-delay: .35s; }
.js-anim .section-head.reveal:not(.is-visible) .eyebrow,
.js-anim .section-head.reveal:not(.is-visible) .section-sub,
.js-anim .section-head.anim-cab:not(.is-visible) .eyebrow,
.js-anim .section-head.anim-cab:not(.is-visible) .section-sub { opacity: 0; translate: 0 16px; }

/* ---------- 4. Tarjetas de eventos: se descubren de abajo arriba ---------- */
.js-anim .event-card.reveal {
  opacity: 1; background: transparent;
  transform: translateY(40px);
  transition: transform 1.1s var(--anim-ease), background-color .3s 1s;
}
.js-anim .event-card.reveal.is-visible { transform: none; background: #1a1a1d; }
/* El recorte va en la foto (no en la tarjeta) para no interferir con la detección de scroll */
.js-anim .event-card picture { transition: clip-path 1.1s var(--anim-ease); clip-path: inset(0 0 0 0); }
.js-anim .event-card.reveal:not(.is-visible) picture { clip-path: inset(100% 0 0 0); }
.js-anim .event-card:nth-child(2) picture { transition-delay: .09s; }
.js-anim .event-card:nth-child(3) picture { transition-delay: .18s; }
.js-anim .event-card:nth-child(4) picture { transition-delay: .27s; }
.js-anim .event-card.reveal:not(.is-visible) img { transform: scale(1.25); }
.js-anim .event-card img { transition: transform 1.6s var(--anim-ease); }
.js-anim .event-card .event-body { transition: opacity .8s var(--anim-ease) .5s, translate .8s var(--anim-ease) .5s; }
.js-anim .event-card.reveal:not(.is-visible) .event-body { opacity: 0; translate: 0 14px; }
.js-anim .event-card.reveal:not(.is-visible)::after { opacity: 0; }
.js-anim .event-card::after { transition: opacity .8s .3s; }
/* Inclinación 3D suave al mover el ratón (solo con ratón) */
@media (hover: hover) and (pointer: fine) {
  .js-anim .event-card.reveal.anim-lista {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform .35s ease-out;
  }
  .js-anim .event-card.anim-lista::before {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(158, 213, 245, .28), transparent 70%);
    opacity: 0; transition: opacity .4s;
  }
  .js-anim .event-card.anim-lista:hover::before { opacity: 1; }
}

/* ---------- 5. Tarjetas de servicio, opiniones y formulario ---------- */
/* Luz azul que sigue al cursor */
@media (hover: hover) and (pointer: fine) {
  .js-anim .service-card:hover,
  .js-anim .review-card:hover,
  .js-anim .aside-card:hover {
    background-image: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), rgba(158, 213, 245, .13), transparent 70%);
  }
}
/* El icono «suena» al aparecer la tarjeta */
.js-anim .service-card.reveal .service-icon { transition: scale .8s var(--anim-ease) .25s, rotate .8s var(--anim-ease) .25s; }
.js-anim .service-card.reveal:not(.is-visible) .service-icon { scale: .4; rotate: -20deg; }
.js-anim .service-card.reveal.is-visible .service-icon { animation: iconoOnda 1.4s ease-out .5s 1; }
@keyframes iconoOnda {
  0% { box-shadow: 0 0 0 0 rgba(158, 213, 245, .55); }
  100% { box-shadow: 0 0 0 22px rgba(158, 213, 245, 0); }
}
/* Estrellas: saltan una a una */
.js-anim .stars .estrella { display: inline-block; transition: scale .5s cubic-bezier(.3, 1.8, .5, 1), opacity .3s; transition-delay: calc(var(--i) * 90ms + .35s); }
.js-anim .review-card.reveal:not(.is-visible) .estrella { scale: 0; opacity: 0; }

/* ---------- 6. Botón principal: destello al pasar ---------- */
.js-anim .btn-primary { position: relative; overflow: hidden; }
.js-anim .btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .65), transparent);
  transform: skewX(-18deg); pointer-events: none;
}
.js-anim .btn-primary:hover::after { animation: destello .8s var(--anim-ease); }
@keyframes destello { to { left: 120%; } }
/* El CTA del hero late una vez cuando termina la entrada */
.js-anim.hero-lista .hero-actions .btn-primary { animation: latido 1.6s ease-out 2s 1; }
@keyframes latido {
  0% { box-shadow: 0 0 0 0 rgba(158, 213, 245, .6); }
  100% { box-shadow: 0 0 0 26px rgba(158, 213, 245, 0); }
}

/* ---------- 7. Detalles: barra de progreso, logo, WhatsApp ---------- */
.progreso-scroll {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 101;
  background: var(--brand); transform-origin: left; transform: scaleX(var(--p, 0));
  pointer-events: none;
}
/* Logo de la cabecera: una onda al pasar el ratón, sin tocar el logo */
.js-anim .brand { position: relative; display: inline-block; }
.js-anim .brand::after {
  content: ""; position: absolute; left: 15.4%; top: 50%; width: 24%; aspect-ratio: 1;
  translate: -50% -50%; border: 1.5px solid var(--brand); border-radius: 50%;
  opacity: 0; pointer-events: none;
}
.js-anim .brand:hover::after { animation: ondaLogo .9s ease-out; }
@keyframes ondaLogo { from { opacity: .9; scale: .6; } to { opacity: 0; scale: 2.6; } }

.js-anim .wa-float { transition: transform .2s, box-shadow .2s, opacity .6s 1.6s, translate .6s var(--anim-ease) 1.6s; }
.js-anim:not(.hero-lista) .wa-float { opacity: 0; translate: 0 20px; }

/* Bandas de llamada a la acción: entran con un punto de escala */
.js-anim .cta-band.reveal, .js-anim .services-cta.reveal { transform: translateY(24px) scale(.97); transition: opacity .9s var(--anim-ease), transform .9s var(--anim-ease); }
.js-anim .cta-band.reveal.is-visible, .js-anim .services-cta.reveal.is-visible { transform: none; }

/* Carrusel: las fotos se enderezan al entrar */
.js-anim .gallery .gallery-list li { transition: scale .5s var(--anim-ease); }
@media (hover: hover) { .js-anim .gallery-list li:hover { scale: 1.035; } }

/* Con «reducir movimiento» esta capa no actúa (no existe .js-anim), pero por si acaso: */
@media (prefers-reduced-motion: reduce) {
  .intro, .progreso-scroll { display: none !important; }
}
