/*
 * Pantalla de carga unica: CSS critico, servido desde el origen (`/splash.css`).
 *
 * Es la UNICA fuente de estas reglas. `index.html` la enlaza en el <head> ANTES del bundle (bloquea el
 * render a proposito: la pantalla sale con el primer byte, sin JavaScript ni fuentes y sin destello) y
 * `app/shell/LoadingScreen.tsx` produce el mismo marcado, asi que React toma el relevo sin que se note.
 *
 * Va como fichero y no como `<style>` en linea porque la CSP de nginx no declara `style-src` (cae en
 * `default-src 'self'`): un `<style>` o un atributo `style=` en el HTML estatico se bloquean.
 *
 * Los colores son hexadecimales: es la excepcion documentada de `tokens.css` (aqui aun no existe
 * `tokens.css`). `src/styles/splash.test.ts` exige que coincidan con el.
 */

:root {
  color-scheme: light dark;
  --ls-bg: #ffffff;
  --ls-ink: #111b21;
  --ls-muted: #54656f;
  --ls-seal: #008069;
  --ls-on-seal: #ffffff;
  --ls-track: #e4e8ea;
  --ls-font: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ls-display: 'Bricolage Grotesque Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ls-bg: #111b21;
    --ls-ink: #e9edef;
    --ls-muted: #aebac1;
    --ls-seal: #008069;
    --ls-on-seal: #ffffff;
    --ls-track: #2a3942;
  }
}

html,
body {
  margin: 0;
  background: var(--ls-bg);
}

.ls {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ls-bg);
  color: var(--ls-ink);
  font-family: var(--ls-font);
}

/* Dentro del shell (esperas que no son de arranque): ocupa el cuerpo, no la ventana. */
.ls[data-variant='pane'] {
  position: absolute;
  z-index: 1;
}

.ls-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  text-align: center;
}

.ls-seal {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  background: var(--ls-seal);
  color: var(--ls-on-seal);
}

/* Altura reservada: el nombre llega despues (la configuracion no existe en el HTML) y no mueve el sello. */
.ls-name {
  box-sizing: border-box;
  margin: 0;
  min-height: 2.25rem;
  font-family: var(--ls-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 2.25rem;
  letter-spacing: -0.02em;
}

.ls-name[data-reveal='fade'] {
  animation: ls-fade 320ms ease-out both;
}

.ls-bar {
  position: relative;
  display: block;
  width: 12rem;
  height: 3px;
  overflow: hidden;
  border-radius: 9999px;
  background: var(--ls-track);
}

.ls-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--ls-ink);
  transform-origin: left center;
  transform: scaleX(var(--ls-p, 0.08));
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ls-bar[data-indeterminate='true'] .ls-fill {
  right: auto;
  width: 40%;
  transform: none;
  transition: none;
  animation: ls-slide 1.4s ease-in-out infinite;
}

.ls-lock {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  color: var(--ls-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.ls-lock svg {
  flex: none;
}

/* Solo para lectores de pantalla: el estado de la espera sigue anunciandose. */
.ls-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@keyframes ls-fade {
  from {
    opacity: 0;
  }
}

@keyframes ls-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ls-fill {
    transition: none;
  }

  .ls-bar[data-indeterminate='true'] .ls-fill {
    animation: none;
  }

  .ls-name[data-reveal='fade'] {
    animation: none;
  }
}
