/* StratLab — motion
 * Regla de oro: los keyframes definen solo el estado INICIAL ("from") y usan fill-mode
 * "backwards". El estilo base de cada elemento ES su estado final. Así, si la animación
 * no corre (reduced motion, navegador sin soporte, SSR), todo queda bien visible.
 * Solo se animan transform, opacity y stroke-dashoffset.
 * Requiere tokens.css.
 */

@keyframes sl-drop   { from { opacity: 0; transform: translateY(-70px) rotate(calc(var(--r, 0deg) * -4)); } }
@keyframes sl-rise   { from { opacity: 0; transform: translateY(28px); } }
@keyframes sl-strike { from { transform: scaleX(0); } }
@keyframes sl-draw   { from { stroke-dashoffset: 1; } }
@keyframes sl-cursor { from { opacity: 0; transform: translate(140px, 110px); } }
@keyframes sl-float  { 0%, 100% { transform: translateY(0) rotate(6deg); } 50% { transform: translateY(-16px) rotate(2deg); } }
@keyframes sl-bubble { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: .5; } 100% { transform: translateY(-34px); opacity: 0; } }
@keyframes sl-blink  { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes sl-spin   { to { transform: rotate(360deg); } }
@keyframes sl-marquee{ to { transform: translateX(-50%); } }
@keyframes sl-flow   { to { stroke-dashoffset: -40; } }
@keyframes sl-pulse  { 0%, 100% { box-shadow: 0 0 0 12px var(--brand-lima); } 50% { box-shadow: 0 0 0 22px var(--brand-lima); } }
@keyframes sl-reveal { from { opacity: 0; transform: translateY(48px); } }

/* 01 · Caída de bloques (hero). Uso: style="--r:-2deg; --d:.15s" */
.sl-drop { transform: rotate(var(--r, 0deg)); animation: sl-drop var(--dur-slow) var(--ease-pop) var(--d, 0s) backwards; }

/* Subida simple con retraso. Uso: style="--d:.6s" */
.sl-rise { animation: sl-rise 700ms var(--ease-out) var(--d, 0s) backwards; }

/* 02 · Tachado (después de que caen los bloques) */
.sl-struck { position: relative; }
.sl-struck::after {
  content: ""; position: absolute; left: -3%; right: -3%; top: 50%; height: 7px; margin-top: -3px;
  background: var(--ink); transform-origin: left center;
  animation: sl-strike var(--dur-base) ease-out 1.05s backwards;
}

/* 03 · Óvalo a mano: <svg class="sl-oval"><path pathLength="1" .../></svg> */
.sl-oval path { stroke-dasharray: 1; stroke-dashoffset: 0; animation: sl-draw 1.1s var(--ease-draw) 1.45s backwards; }

/* 04 · Cursor "stratlab.cl" */
.sl-cursor { animation: sl-cursor 800ms cubic-bezier(.2, .9, .3, 1.2) 750ms backwards; }

/* 05 · Matraz vivo */
.sl-matraz { transform-origin: 50% 100%; animation: sl-float 4.5s ease-in-out infinite; }
.sl-matraz .bub { transform-box: fill-box; animation: sl-bubble 2.6s ease-in infinite; }
.sl-matraz .eyes { transform-box: fill-box; transform-origin: center; animation: sl-blink 5s infinite; }
.sl-spin { animation: sl-spin 14s linear infinite; }

/* 06 · Cinta de servicios: contenido duplicado dentro de .sl-track (la 2ª copia con aria-hidden) */
.sl-ticker { overflow: hidden; }
.sl-track { display: flex; width: max-content; animation: sl-marquee 32s linear infinite; }
.sl-ticker:hover .sl-track { animation-play-state: paused; }

/* 07 · Datos que fluyen (líneas punteadas) y núcleo que late */
.sl-flow { stroke-dasharray: 10 10; animation: sl-flow 1.6s linear infinite; }
.sl-pulse { animation: sl-pulse 2.4s ease-in-out infinite; }

/* 08 · Aparición con scroll (CSS scroll-driven). Sin soporte = estático y visible. */
@supports (animation-timeline: view()) {
  .sl-reveal { animation: sl-reveal linear backwards; animation-timeline: view(); animation-range: entry 0% entry 70%; }
  .sl-linedraw path { stroke-dasharray: 1; animation: sl-draw linear backwards; animation-timeline: view(); animation-range: entry 10% cover 45%; }
}

/* 09 · Tarjeta: hover endereza, sube y crece la sombra */
.sl-card { transition: transform 200ms var(--ease-pop), box-shadow 200ms ease; }
.sl-card:hover { transform: rotate(0deg) translate(-4px, -4px) !important; box-shadow: var(--shadow-hard-l); }

/* 10 · Botón tipo timbre */
.sl-press { transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease; }
.sl-press:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--shadow-ink); }
.sl-press:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--shadow-ink); }

/* Accesibilidad: con "reducir movimiento" todo queda quieto en su estado final */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
