/* ==========================================================================
   Visia · 06 motion
   Un único momento orquestado: el titular se enciende como una pantalla de
   puntos y el resto del hero sube en cascada.
   Lo demás solo se mueve si el usuario hace algo o si informa (progreso
   de los pasos, cabecera).

   - El estado por defecto es SIEMPRE el final. Las animaciones solo
     preparan el estado inicial bajo html.motion-ok (boot.js).
   - Sin JS o con prefers-reduced-motion todo se ve terminado.
   - Solo se animan transform y opacity.
   ========================================================================== */
@layer motion {

  /* --- Lenis (copiado de lenis.css) -------------------------------------- */
  html.lenis, html.lenis body { height: auto; }
  .lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
  .lenis [data-lenis-prevent] { overscroll-behavior: contain; }
  .lenis.lenis-smooth iframe { pointer-events: none; }
  html.motion-ok:not(.lenis) { scroll-behavior: smooth; }

  /* --- Cabecera ---------------------------------------------------------- */
  .motion-ok .site-header { transition: transform 0.5s var(--ease-out); }
  .motion-ok .site-header.is-hidden { transform: translateY(-140%); }
  .nav-panel { transition: opacity var(--dur-1) ease, visibility 0s linear var(--dur-1); }
  .nav-panel.is-open { transition: opacity var(--dur-1) ease, visibility 0s; }

  /* --- Entrada del hero -------------------------------------------------- */
  @keyframes visia-boot {
    0% { opacity: 0; }
    18% { opacity: 0.7; }
    26% { opacity: 0.08; }
    48% { opacity: 1; }
    58% { opacity: 0.4; }
    100% { opacity: 1; }
  }
  .motion-ok [data-hero-title] .line-in { opacity: 0; }
  .motion-ok [data-hero-item] { opacity: 0; transform: translateY(16px); }
  .motion-ok [data-hero-stage] { opacity: 0; transform: translateY(28px); }

  .motion-ok [data-hero].is-ready [data-hero-title] .line-in {
    opacity: 1;
    animation: visia-boot 0.9s linear both;
    animation-delay: calc(0.1s + var(--i, 0) * 0.22s);
  }
  .motion-ok [data-hero].is-ready [data-hero-item] {
    opacity: 1;
    transform: none;
    transition: opacity 0.8s var(--ease-out) var(--d, 0.5s), transform 1s var(--ease-out) var(--d, 0.5s);
  }
  .motion-ok [data-hero].is-ready [data-hero-stage] {
    opacity: 1;
    transform: none;
    transition: opacity 1s var(--ease-out) 0.35s, transform 1.4s var(--ease-out) 0.35s;
  }
  .hero__title .line-in { display: inline-block; }

  /* --- Pasos: la línea enciende cada número ------------------------------ */
  .motion-ok [data-steps] .steps__fill { transform: scaleX(var(--progress, 0)); }
  .motion-ok .step:not(.is-on) .step__num { opacity: 0.18; }
  .motion-ok .step__num { transition: opacity 0.45s ease; }
  @media (max-width: 860px) {
    .motion-ok [data-steps] .steps__fill { transform: scaleY(var(--progress, 0)); }
  }

  /* --- Nombre gigante del footer ----------------------------------------- */
  .motion-ok [data-footer-giant] .footer-giant__in { transform: translateY(var(--fy, 60%)); }

  /* --- Respuesta a acciones ---------------------------------------------- */
  .btn:active, .replay:active, .dock__cta:active, .dock__call:active { transform: scale(0.97); }
  .player__play:active .player__btn { transform: scale(0.94); }
  .swipe-dot:active span { transform: scale(1.8); }

  /* --- Movimiento reducido ----------------------------------------------- */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      transition-duration: 0.01ms !important;
      transition-delay: 0s !important;
      animation: none !important;
      scroll-behavior: auto !important;
    }
  }
}
