/* motion.css · estándar de movimiento del kit (31/10/2026), adaptado a la web del prompt de motion graphics de estudio
   (Remotion: resortes, stagger, acción secundaria, cámara, continuidad, trazos). Es funcionalidad, no diseño: cada demo
   pone su estética. Se enlaza ANTES del CSS de la demo; motion.js trae resorte(), palabras(), camara() y transicion().
   Guía: referencias/motion.md.

   Resortes (masa, amortiguación, rigidez) del prompt, calculados como curvas CSS linear() con su duración de asiento:
   ui 0.8/15/200 (rápido, rebote 10 %) · cine 1.2/28/100 (sin rebote) · enfasis 1/12/180 (rebote 20 %).
   Sin linear() (navegadores viejos) quedan cubic-bezier parecidos. Nada se mueve en lineal. */
:root {
  --resorte-ui: cubic-bezier(.2, .9, .25, 1.12); --dur-ui: 700ms;
  --resorte-cine: cubic-bezier(.16, 1, .3, 1); --dur-cine: 1200ms;
  --resorte-enfasis: cubic-bezier(.3, 1.5, .4, 1); --dur-enfasis: 1200ms;
  --salida: cubic-bezier(.16, 1, .3, 1);   /* opacidades y barridos de color (Easing.bezier(0.16, 1, 0.3, 1)) */
  --escalon: 70ms;                         /* stagger entre hermanos: 4 fotogramas a 60 fps (el prompt pide 3 a 6) */
}
@supports (animation-timing-function: linear(0, 1)) {
  :root {
    --resorte-ui: linear(0, 0.038, 0.125, 0.243, 0.375, 0.509, 0.637, 0.752, 0.851, 0.932, 0.998, 1.043, 1.073, 1.09, 1.097, 1.096, 1.089, 1.079, 1.066, 1.053, 1.04, 1.028, 1.018, 1.009, 1.003, 0.997, 0.994, 0.992, 0.991, 0.991, 0.991, 0.992, 0.993, 0.994, 0.996, 0.997, 0.998, 0.999, 0.999, 1, 1); --dur-ui: 680ms;
    --resorte-cine: linear(0, 0.045, 0.136, 0.24, 0.342, 0.434, 0.516, 0.587, 0.648, 0.7, 0.744, 0.782, 0.815, 0.843, 0.866, 0.886, 0.903, 0.918, 0.93, 0.941, 0.949, 0.957, 0.963, 0.969, 0.973, 0.977, 0.981, 0.984, 0.986, 0.988, 0.99, 0.991, 0.993, 0.994, 0.995, 0.996, 0.996, 0.997, 0.997, 0.998, 1); --dur-cine: 1480ms;
    --resorte-enfasis: linear(0, 0.053, 0.183, 0.359, 0.551, 0.736, 0.899, 1.029, 1.122, 1.18, 1.204, 1.203, 1.182, 1.149, 1.112, 1.073, 1.037, 1.006, 0.983, 0.968, 0.96, 0.957, 0.96, 0.966, 0.973, 0.981, 0.989, 0.996, 1.001, 1.005, 1.008, 1.009, 1.009, 1.008, 1.006, 1.005, 1.003, 1.001, 1, 0.999, 1); --dur-enfasis: 1000ms;
  }
}

/* entradas al bajar (.r + .ver de motion.js o del script de la demo): sube con resorte cine y aparece con curva de salida */
.js .r:not(.ver), .js .r-escalera:not(.ver) > * { opacity: 0; }
.js .r.ver { animation: m-sube var(--dur-cine) var(--resorte-cine) var(--d, 0s) backwards, m-aparece .6s var(--salida) var(--d, 0s) backwards; }
/* rejillas: resorte rápido y escalonado hasta 8 elementos (decenas de tarjetas animándose a la vez traban el scroll) */
.js .r-escalera.ver > * { animation: m-sube var(--dur-ui) var(--resorte-cine) calc(var(--d, 0s) + min(var(--i, 0), 8) * var(--escalon)) backwards, m-aparece .45s var(--salida) calc(var(--d, 0s) + min(var(--i, 0), 8) * var(--escalon)) backwards; }
.js .r.r-giro.ver { animation-name: m-sube-giro, m-aparece; }
.js .r.m-pop.ver, .js .r-escalera.ver > .m-pop { animation-name: m-pop, m-aparece; animation-duration: var(--dur-enfasis), .4s; animation-timing-function: var(--resorte-enfasis), var(--salida); }
@keyframes m-sube { from { transform: translateY(24px); } }
@keyframes m-sube-giro { from { transform: translateY(40px) rotate(-7deg) scale(.94); } }
@keyframes m-aparece { from { opacity: 0; } }
@keyframes m-pop { from { transform: scale(.3) rotate(-14deg); } }

/* titulares palabra a palabra (motion.palabras): cada palabra sube desde detrás de su máscara, con stagger */
.m-pal { display: inline-block; overflow: hidden; vertical-align: top; padding: .34em .06em .34em; margin: -.34em -.06em -.34em; } /* holgura para letras de interlineado apretado (Anton .88) */
.m-pal > span { display: inline-block; }
.js .m-palabras:not(.ver) .m-pal > span { transform: translateY(1.7em); }
.js .m-palabras.ver .m-pal > span { animation: m-palabra var(--dur-ui) var(--resorte-ui) calc(var(--d, 0s) + var(--j, 0) * var(--escalon)) both; }
@keyframes m-palabra { from { transform: translateY(1.7em) rotate(5deg); } }

/* barrido de máscara (acción secundaria: el contenedor se abre y su texto entra después, con --d-hijo) */
.js .m-barrido:not(.ver) { clip-path: inset(0 100% 0 0); }
.js .m-barrido.ver { animation: m-barrido var(--dur-ui) var(--resorte-ui) var(--d, 0s) both; }
.js .m-barrido.ver > * { animation: m-sube var(--dur-ui) var(--resorte-ui) calc(var(--d, 0s) + var(--d-hijo, 120ms)) backwards, m-aparece .4s var(--salida) calc(var(--d, 0s) + var(--d-hijo, 120ms)) backwards; }
@keyframes m-barrido { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -4% 0 0); } }

/* trazo SVG que se dibuja (path con pathLength="1") al entrar su contenedor .ver */
.m-trazo path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.ver .m-trazo path, .m-trazo.ver path { animation: m-traza .9s var(--salida) var(--d-trazo, .35s) forwards; }
@keyframes m-traza { to { stroke-dashoffset: 0; } }

/* continuidad entre vistas (motion.transicion → View Transitions): elementos compartidos con view-transition-name */
::view-transition-group(*) { animation-duration: var(--dur-ui); animation-timing-function: var(--resorte-ui); }
::view-transition-old(root) { animation: m-vt-sale .22s var(--salida) both; }
::view-transition-new(root) { animation: m-vt-entra var(--dur-ui) var(--resorte-ui) both; }
@keyframes m-vt-sale { to { opacity: 0; transform: scale(.98); } }
@keyframes m-vt-entra { from { opacity: 0; transform: translateY(18px); } }

@media (prefers-reduced-motion: reduce) {
  .js .r:not(.ver), .js .r-escalera:not(.ver) > *, .js .m-palabras:not(.ver) .m-pal > span, .js .m-barrido:not(.ver) { opacity: 1; transform: none; clip-path: none; }
  .r, .r-escalera > *, .m-pal > span, .m-barrido, .m-barrido > *, .m-trazo path { animation: none !important; }
  .m-trazo path { stroke-dashoffset: 0; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
