/* Pantalla de carga de BEL. La trae index.html antes de que llegue JavaScript y la repite el
   componente Carga de React con las mismas clases. Va suelta, sin las variables de base.css,
   porque se pinta antes de que esa hoja exista: trae su propia letra y su propio reinicio. */

/* La misma Barlow Condensed de @fontsource, servida aparte para que la carga no salte de letra. */
@font-face {
  font-family: "BEL Titular"; font-style: normal; font-weight: 700; font-display: block;
  src: url("/fuentes/barlow-condensed-700.woff2") format("woff2");
}

.carga {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 1.5rem 1rem 5rem;
  background: #fff; overflow: hidden; text-align: center;
  font-family: Verdana, "DejaVu Sans", "Segoe UI", sans-serif;
}
/* Los escalones de marca de agua y la franja azul del pie, como el membrete del manual. */
.carga::before {
  content: ""; position: absolute; right: -3vmin; bottom: 3.4rem; width: 56vmin; height: 49vmin;
  background: rgba(22, 91, 119, .06);
  -webkit-mask: url("/escalones.svg") no-repeat right bottom / contain;
  mask: url("/escalones.svg") no-repeat right bottom / contain;
  animation: carga-subir 1.2s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(0s - var(--desfase, 0s));
}
:where(.carga) p { margin: 0; }
.carga::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.6rem; background: #165b77; }
.carga-pie {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; height: 2.6rem; line-height: 2.6rem;
  font: 700 .8rem/2.6rem "BEL Titular", "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .4em; text-transform: uppercase; color: rgba(255, 255, 255, .85);
}

.carga-centro { position: relative; z-index: 1; display: grid; justify-items: center; }
.carga-isotipo { stroke: none; stroke-linecap: butt; stroke-linejoin: miter; width: 6.5rem; height: 6.5rem; overflow: visible; filter: drop-shadow(0 .9rem 1.4rem rgba(0, 120, 151, .28)); }
.carga-isotipo rect {
  fill: #007897; transform-box: fill-box; transform-origin: center;
  animation: carga-bloque .7s cubic-bezier(.3, 1.35, .5, 1) both;
  animation-delay: calc(0s - var(--desfase, 0s));
}
/* Cada escalón se dibuja de abajo hacia arriba y se borra en el mismo sentido: una escalera que sube. */
.carga-isotipo path {
  fill: none; stroke: #fff; stroke-width: 3; stroke-dasharray: 1 1; stroke-dashoffset: 1;
  animation: carga-escalon 2.6s cubic-bezier(.65, 0, .35, 1) infinite both;
  animation-delay: calc(var(--i, 0) * .11s + .3s - var(--desfase, 0s));
}
.carga-isotipo path:nth-of-type(2) { --i: 1; }
.carga-isotipo path:nth-of-type(3) { --i: 2; }
.carga-isotipo path:nth-of-type(4) { --i: 3; }
.carga-isotipo path:nth-of-type(5) { --i: 4; }
.carga-isotipo path:nth-of-type(6) { --i: 5; }

.carga-marca {
  margin-top: 1.7rem; padding-left: .3em;
  font: 700 2rem/1 "BEL Titular", "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .3em; text-transform: uppercase; color: #848383;
}
.carga-marca b { color: #165b77; }
.carga-texto { margin-top: .75rem; padding-left: .28em; font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: #55636a; }
.carga-texto::after { content: ""; display: inline-block; width: 1.4em; text-align: left; animation: carga-puntos 1.4s steps(1) infinite; }
.carga-barra { position: relative; display: block; width: 11rem; height: 3px; margin-top: 1.2rem; border-radius: 99px; background: #e2ecf0; overflow: hidden; }
.carga-barra i {
  position: absolute; top: 0; bottom: 0; left: 0; width: 40%; border-radius: inherit;
  background: linear-gradient(90deg, #165b77, #62b4d4);
  animation: carga-barra 1.5s cubic-bezier(.65, 0, .35, 1) infinite;
  animation-delay: calc(0s - var(--desfase, 0s));
}
.carga-marca, .carga-texto, .carga-barra, .carga-mas {
  animation: carga-subir .6s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(.35s - var(--desfase, 0s));
}

/* Aviso: la misma pantalla quieta, con un mensaje en vez de la espera. */
.carga.aviso .carga-isotipo path { animation: none; stroke-dashoffset: 0; }
.carga.aviso .carga-texto {
  margin-top: 1.1rem; padding: 0; max-width: 30rem;
  font: 700 1.7rem/1.1 "BEL Titular", "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: .04em; color: #165b77;
}
.carga.aviso .carga-texto::after { display: none; animation: none; }
.carga-mas { display: grid; justify-items: center; gap: 1.1rem; max-width: 28rem; margin-top: .7rem; color: #55636a; font-size: .9rem; line-height: 1.5; }

/* En línea: solo la escalera y la espera, dentro de otra pantalla. */
.carga.en-linea { position: static; padding: 0; background: none; overflow: visible; }
.carga.en-linea::before, .carga.en-linea::after { content: none; }
.carga.en-linea .carga-isotipo { width: 4.2rem; height: 4.2rem; }

@keyframes carga-bloque { from { opacity: 0; transform: scale(.6) rotate(-8deg); } }
@keyframes carga-escalon {
  0%, 6% { stroke-dashoffset: 1; }
  36%, 70% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1; }
}
@keyframes carga-barra { from { transform: translateX(-100%); } to { transform: translateX(275%); } }
@keyframes carga-subir { from { opacity: 0; transform: translateY(.6rem); } }
@keyframes carga-puntos { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes carga-latir { 50% { opacity: .35; } }

@media (max-width: 30rem) {
  .carga-marca { font-size: 1.6rem; }
  .carga-pie { letter-spacing: .28em; }
}
@media (prefers-reduced-motion: reduce) {
  .carga::before, .carga-isotipo rect, .carga-marca, .carga-texto, .carga-barra, .carga-mas { animation: none; }
  .carga-isotipo path { animation: none; stroke-dashoffset: 0; }
  .carga-barra i { width: 100%; animation: carga-latir 2s ease-in-out infinite; }
}
