/*
 * Carga de arranque de /meta-human, ANTES del JS.
 *
 * Réplica en CSS puro de `AvatarStreamLoader` (src/layouts): mismo fondo
 * (`--inverse`), halo, ondas, arcos y logo 3D (póster) con las mismas medidas
 * y tiempos. `KioskLoaderHost` la retira en el mismo commit en que pinta la de
 * React, así que de la una a la otra no hay salto. Sólo se ve con la clase
 * `boot-kiosk` en <html>, que pone `boot-kiosk.js` si la ruta es /meta-human.
 * Sin inline styles ni scripts: respeta una CSP estricta.
 *
 * Si cambia AvatarStreamLoader, cambiar acá también (hay un test que compara
 * las medidas clave: src/layouts/KioskLoaderHost.test.tsx).
 */
#boot-loader {
  display: none;
}
html.boot-kiosk #boot-loader {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  background: hsl(222.2 47.4% 11.2%);
  font-family:
    ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol", "Noto Color Emoji";
  pointer-events: none;
  overflow: hidden;
}
html.boot-kiosk body {
  background: hsl(222.2 47.4% 11.2%);
}
#boot-loader .bl-halo {
  position: absolute;
  width: 60vmin;
  height: 60vmin;
  border-radius: 9999px;
  background: color-mix(in srgb, #4f46e5 10%, transparent);
  filter: blur(64px);
  animation: bl-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
#boot-loader .bl-orb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 10rem;
  height: 10rem;
}
#boot-loader .bl-wave {
  position: absolute;
  inset: 1.5rem;
  border-radius: 9999px;
  border: 2px solid #4f46e5;
  animation: bl-ping 2.1s cubic-bezier(0, 0, 0.2, 1) infinite;
}
#boot-loader .bl-wave-2 {
  animation-delay: 700ms;
}
#boot-loader .bl-wave-3 {
  animation-delay: 1400ms;
}
#boot-loader .bl-arc {
  position: absolute;
  border-radius: 9999px;
  border: 2px solid transparent;
  border-top-color: color-mix(in srgb, #fff 80%, transparent);
  inset: 0;
  animation: bl-spin 1.4s linear infinite;
}
#boot-loader .bl-arc-2 {
  inset: 0.75rem;
  border-width: 1px;
  border-top-color: transparent;
  border-bottom-color: color-mix(in srgb, #4f46e5 30%, transparent);
  animation-duration: 2.2s;
  animation-direction: reverse;
}
#boot-loader .bl-logo {
  position: relative;
  width: 8rem;
  height: 8rem;
  background: url("/loader/mindlab-logo3d-poster.webp") center / contain
    no-repeat;
  animation: bl-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
/* Lugar del texto de espera (2 líneas de AvatarStreamLoader: 28 + 8 + 20 px):
   el texto no se pinta antes de conocer el idioma del agente, pero el orbe
   tiene que quedar en el mismo lugar. */
#boot-loader .bl-text {
  height: 3.5rem;
}
@keyframes bl-pulse {
  50% {
    opacity: 0.5;
  }
}
@keyframes bl-ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}
@keyframes bl-spin {
  to {
    transform: rotate(360deg);
  }
}
/* «Reducir movimiento»: póster quieto, sin ondas ni arcos. */
@media (prefers-reduced-motion: reduce) {
  #boot-loader .bl-halo,
  #boot-loader .bl-logo {
    animation: none;
  }
  #boot-loader .bl-wave,
  #boot-loader .bl-arc {
    display: none;
  }
}
