/* What every screen shows while it waits (`loading.js`, the `aviso_espera`
   macro of `_info_notice.html`): grey bars in the shape of what is coming,
   with a soft light sweeping across them; a spinner; a blue waiting notice;
   and a short fade when the real content arrives. Each screen writes its own
   skeleton with these pieces; nothing here knows the shape of a screen.
   Loaded by `base.html` after `style.css`, so it can use its tokens. */

:root {
  /* The grey bars of a skeleton and the light that sweeps across them. */
  --hueso: #2c3036;
  --hueso-brillo: #3a3f46;
}

/* The bars. `.hueso` stands for a line of text: it keeps the text's own
   font size, so it is as tall as the line it replaces, and draws its bar as
   wide as `--ancho` (70% unless the screen says otherwise). `.hueso-barra` is
   a bar of its own, `.hueso-bloque` turns a real element (a button, a field)
   into a grey block of its exact size, and `.hueso-circulo` is a round one
   (a photo, a ring). */
.hueso { position: relative; display: block; color: transparent; user-select: none; }
.hueso::before {
  content: "";
  position: absolute;
  inset-block: 0.3em;
  inset-inline-start: 0;
  width: var(--ancho, 70%);
  max-width: 100%;
  border-radius: 6px;
}
.hueso::before,
.hueso-bloque,
.hueso-barra,
.hueso-circulo {
  background-image: linear-gradient(90deg, var(--hueso) 0%, var(--hueso-brillo) 50%, var(--hueso) 100%);
  background-size: 220% 100%;
  background-position: 0 0;
}
.hueso-bloque { border-color: transparent; box-shadow: none; color: transparent; user-select: none; pointer-events: none; }
.hueso-barra { display: block; width: 94%; height: 0.7rem; border-radius: 6px; }
.hueso-circulo { display: block; width: var(--diametro, 3rem); aspect-ratio: 1; border-radius: 50%; }

@keyframes hueso-recorre { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* The spinner. It draws with the text colour inside a button, so it reads
   on a plain button and on the accent one alike. */
.rueda {
  flex: none;
  display: inline-block;
  box-sizing: border-box;
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid var(--aviso-borde);
  border-top-color: var(--acento);
  border-radius: 50%;
}
.rueda-pequena { width: 0.9rem; height: 0.9rem; border-width: 2px; }
button .rueda,
.boton .rueda {
  vertical-align: -0.15em;
  margin-inline-end: 0.5rem;
  border-color: color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
}

@keyframes rueda-gira { to { transform: rotate(360deg); } }

/* The waiting notice: the blue informative notice (`.aviso-info`) with the
   spinner where the «ℹ» goes, as wide as its sentence, centered, with the
   standard room around it. `.aviso-pequeno` (style.css) is the same notice
   inside a card or a posting, a little smaller and closer to what follows. */
.aviso-espera { width: fit-content; max-width: 100%; margin: 1.25rem auto 1.5rem; }
.aviso-espera.aviso-pequeno { margin: 0 auto 0.6rem; }
.aviso-pequeno .rueda { width: 1rem; height: 1rem; }

/* While a screen waits, its skeleton takes the place of what was there:
   the content stays in the page, out of sight, and comes back if the wait
   ends without a new page (`loading.js`). */
[data-espera-activa] > :not([data-espera-muestra]) { display: none !important; }

/* A screen that is already full only dims while it waits (the spinner says
   it is working); it takes no clicks until it is done. */
.espera-atenuada { opacity: 0.55; pointer-events: none; }
/* A button that waits keeps its full colour and its text: it is busy, not off. */
button[aria-busy="true"]:disabled,
.boton[aria-busy="true"]:disabled { opacity: 1; cursor: progress; }

/* The real content arriving where the skeleton was. */
@keyframes llega { from { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  .hueso::before,
  .hueso-bloque,
  .hueso-barra,
  .hueso-circulo { animation: hueso-recorre 1.4s ease-in-out infinite; }
  .rueda { animation: rueda-gira 1s linear infinite; }
  .llega { animation: llega 0.35s ease both; }
}
