/* ==========================================================================
   Base común de las demos vivas (LLAnim). Ver public/assets/js/anim/ll-anim.js.
   - .lla             raíz (container query, data-state / data-paused / data-fade / data-instant)
   - .lla__stage      caja responsive: aspect-ratio = --lla-w / --lla-h (sin unidades)
   - .lla__canvas     lienzo de --lla-w x --lla-h px que se escala entero al ancho
   Colores: cada animación define sus variables --lla-* (claro) y las redefine en
   html[data-theme="dark"]. Aquí no hay colores fijos: solo currentColor.
   ========================================================================== */

.lla {
  --lla-ease: cubic-bezier(.2, .8, .2, 1);
  position: relative;
  width: 100%;
  max-width: 100%;
  container-type: inline-size;
  -webkit-user-select: none;
  user-select: none;
}

.lla,
.lla *,
.lla *::before,
.lla *::after {
  box-sizing: border-box;
}

.lla__stage {
  --lla-w: 960;
  --lla-h: 540;
  position: relative;
  width: 100%;
  aspect-ratio: var(--lla-w) / var(--lla-h);
}

.lla__canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--lla-w) * 1px);
  height: calc(var(--lla-h) * 1px);
  transform-origin: 0 0;
  transform: scale(var(--lla-scale, 1));
}

/* Escala sin JS donde el navegador sabe dividir longitudes (JS la vuelve a fijar igual). */
@supports (width: calc(1px * tan(atan2(1px, 2px)))) {
  .lla__canvas {
    --lla-scale: tan(atan2(100cqw, calc(var(--lla-w) * 1px)));
  }
}

/* Fuera de pantalla / pestaña oculta: congela keyframes. */
.lla[data-paused] *,
.lla[data-paused] *::before,
.lla[data-paused] *::after {
  animation-play-state: paused !important;
}

/* Cambios de estado sin transición (reset del loop, estado final). */
.lla[data-instant] *,
.lla[data-instant] *::before,
.lla[data-instant] *::after {
  transition: none !important;
  animation: none !important;
}

/* Capa que se desvanece durante el reset. */
.lla .lla-fade {
  transition: opacity .4s var(--lla-ease);
}

.lla[data-fade] .lla-fade {
  opacity: 0;
}

/* Cursor de escritura de LLAnim.type() */
.lla .is-typing::after {
  content: '';
  display: inline-block;
  width: 1px;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: -.2em;
  background: currentColor;
  animation: lla-blink 1s steps(1, end) infinite;
}

@keyframes lla-blink {
  50% { opacity: 0; }
}

/* Spinner genérico (usa el color del texto) */
.lla .lla-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: lla-spin .7s linear infinite;
}

@keyframes lla-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .lla *,
  .lla *::before,
  .lla *::after {
    transition: none !important;
    animation: none !important;
  }
}
