/* Boveda (web/src/visor/boveda.ts). Tema claro institucional (29/11/2026): cuatro hojas claras con juntas rojo MINSA
   y los logos MINSA · Peru Responde en el centro (se arman con marca/armado.ts). Va enlazada en el <head> para
   pintarse cerrada desde el primer cuadro (assets/arranque/boveda-cabeza.js pone html.boveda-cerrada).
   Clases en <html>:
     boveda-cerrada  la boveda se ve (cerrada)
     boveda-larga    primera entrada de la sesion: los logos se arman (~2,7 s) y laten mientras carga
     boveda-corta    recarga: los logos se arman rapido (~1,2 s) y laten
   La junta roja es la barra de avance (--avance) y debajo del rotulo van el paso y las pildoras de cada carga.
     boveda-abre     una onda de luz acompaña la apertura de las hojas en diagonal
   Solo la primera carga: el cambio de pestana va con el filete de la cabecera (web/src/visor/boveda.ts, conBoveda). */

html:not(.boveda-cerrada) #boveda { display: none; }
.boveda { --avance: 0; position: fixed; inset: 0; z-index: 10000; overflow: hidden; }
html.boveda-abre .boveda { pointer-events: none; }
.boveda-hoja { position: absolute; width: 50%; height: 50%; background: linear-gradient(var(--g), #ffffff, #e7ebf1); }
.boveda-hoja::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(var(--g), transparent 0 14px, #003da508 14px 15px); }
.boveda-hoja.h1 { left: 0; top: 0; --hx: -101%; --hy: -101%; --g: 135deg; }
.boveda-hoja.h2 { right: 0; top: 0; --hx: 101%; --hy: -101%; --g: 225deg; }
.boveda-hoja.h3 { left: 0; bottom: 0; --hx: -101%; --hy: 101%; --g: 45deg; }
.boveda-hoja.h4 { right: 0; bottom: 0; --hx: 101%; --hy: 101%; --g: 315deg; }
/* La junta es la barra de avance de la entrada: tenue de fondo y, encima, la roja crece desde el centro con --avance
   (0..1, lo pone boveda.ts cuando responde cada carga). */
.boveda-junta { position: absolute; background: #e11f1a2e; }
.boveda-junta > i { position: absolute; inset: 0; background: #E11F1A; box-shadow: 0 0 14px #e11f1a66; transform: scaleX(var(--avance)); transition: transform .35s ease-out; }
.boveda-junta.v > i { transform: scaleY(var(--avance)); }

/* Debajo del rotulo: el paso actual y una pildora por carga (gira, verde con su dato o ambar si no respondio). */
.boveda-bajo { position: absolute; left: 16px; right: 16px; top: calc(50% + clamp(112px, 17vmin, 176px)); display: grid; justify-items: center; gap: 14px;
  font: 13px/1.4 'Aptos', 'Segoe UI', system-ui, sans-serif; color: #4A5A72; }
.boveda-paso { min-height: 1.4em; font-variant-numeric: tabular-nums; text-align: center; }
.boveda-paso b { color: #14223A; }
.boveda-paso .total { font-size: 17px; }
.boveda-fuentes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 720px; }
.boveda-fu { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 9px; border-radius: 999px; background: #ffffffd9;
  border: 1px solid #dde3ec; font-size: 12px; color: #4A5A72; transition: background .3s, border-color .3s; }
.boveda-fu > i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #b8c3d3; border-top-color: #003DA5; animation: boveda-gira .8s linear infinite; }
.boveda-fu b { color: #14223A; font-variant-numeric: tabular-nums; font-weight: 600; }
.boveda-fu b:empty { display: none; }
.boveda-fu.lista > i { animation: none; border: 0; background: #2E8B71; box-shadow: 0 0 0 3px #2e8b5726; }
.boveda-fu.caida { background: #FFF3D6; border-color: #f0d79a; color: #6B4A06; }
.boveda-fu.caida > i { animation: none; border: 0; background: #E0A526; }
.boveda-corte { position: absolute; top: max(20px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 6px 16px; border-radius: 999px; background: #ffffffcc; border: 1px solid #dde3ec; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 13px 'Aptos', 'Segoe UI', system-ui, sans-serif; color: #3A4A63; animation: boveda-aparece .4s both; }
.boveda-corte b { color: #14223A; }
.boveda-saltar { position: absolute; right: 24px; bottom: max(18px, env(safe-area-inset-bottom, 0px)); font: 12px 'Aptos', 'Segoe UI', system-ui, sans-serif; color: #7A879A; }
.boveda-saltar kbd { font: inherit; border: 1px solid #cfd7e3; border-radius: 4px; padding: 0 5px; background: #fff; }
html.boveda-larga .boveda-bajo, html.boveda-corta .boveda-bajo { animation: boveda-aparece .4s .3s both; }
html.boveda-larga .boveda, html.boveda-corta .boveda { cursor: pointer; }
html.boveda-abre .boveda-bajo, html.boveda-abre .boveda-corte, html.boveda-abre .boveda-saltar { animation: boveda-apaga .3s both; }
@media (hover: none), (max-width: 760px) { .boveda-saltar { display: none; } }
@media (max-width: 480px) { .boveda-fu { font-size: 12px; padding: 3px 10px 3px 8px; } .boveda-fuentes { gap: 6px; } }
@keyframes boveda-gira { to { transform: rotate(360deg); } }
.boveda-junta.h { left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; }
.boveda-junta.v { top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; }
.boveda-halo { position: absolute; inset: 0; margin: auto; width: 70vmin; height: 70vmin; border-radius: 50%; background: radial-gradient(circle, #003da51f, transparent 62%); }
.boveda-logo { position: absolute; inset: 0; margin: auto; width: clamp(240px, 38vmin, 420px); height: clamp(110px, 17.5vmin, 194px); display: grid; place-items: center; filter: drop-shadow(0 10px 28px #0f2a4a29); }
.boveda-logo img, .boveda-logo svg { width: 100%; height: 100%; display: block; overflow: visible; }
.boveda-rotulo { position: absolute; left: 0; right: 0; top: calc(50% + clamp(78px, 12vmin, 128px)); text-align: center;
  font: 700 13px 'Aptos', 'Segoe UI', system-ui, sans-serif; letter-spacing: .4em; color: #58595B; }
.boveda-onda { position: absolute; inset: 0; margin: auto; width: 80px; height: 80px; border-radius: 50%; border: 2px solid #003DA5;
  box-shadow: 0 0 16px #003da544, inset 0 0 16px #003da522; opacity: 0; }

/* Primera entrada: aparecen la junta, el halo y el rotulo. */
html.boveda-larga .boveda-junta { animation: boveda-aparece .3s .1s both; }
html.boveda-larga .boveda-halo { animation: boveda-aparece .5s .2s both; }
/* El latido empieza cuando terminan de armarse los logos (~2,7 s; 1,2 s al recargar; web/src/marca/arranque.ts); sin JS el <img> aparece. */
html.boveda-larga .boveda-logo { animation: boveda-late 1.6s 2.7s infinite ease-in-out; }
html.boveda-larga .boveda-logo img { animation: boveda-aparece .5s .9s both; }
html.boveda-larga .boveda-rotulo { animation: boveda-sube .5s .6s both; }
html.boveda-corta .boveda-logo { animation: boveda-late 1.6s 1.2s infinite ease-in-out; }


/* Se abre. */
html.boveda-abre .boveda-logo { animation: boveda-estalla .45s both cubic-bezier(.2, .8, .3, 1); }
html.boveda-abre .boveda-onda { animation: boveda-onda .8s .05s both cubic-bezier(.1, .7, .3, 1); }
html.boveda-abre .boveda-halo, html.boveda-abre .boveda-rotulo { animation: boveda-apaga .35s both; }
html.boveda-abre .boveda-junta { animation: boveda-apaga .3s .1s both; }
html.boveda-abre .boveda-hoja { animation: boveda-abre .62s .12s both cubic-bezier(.7, 0, .2, 1); }

@keyframes boveda-abre { to { transform: translate(var(--hx), var(--hy)); visibility: hidden; } }
@keyframes boveda-aparece { from { opacity: 0; } }
@keyframes boveda-apaga { to { opacity: 0; } }
@keyframes boveda-sube { from { opacity: 0; transform: translateY(10px) scaleX(1.12); } }
@keyframes boveda-late { 50% { transform: scale(1.03); } }
@keyframes boveda-estalla { 40% { transform: scale(1.12); } to { transform: scale(1.3); opacity: 0; } }
@keyframes boveda-onda { from { transform: scale(.3); opacity: 1; } to { transform: scale(14); opacity: 0; } }
@keyframes boveda-funde { to { opacity: 0; } }

/* Movimiento reducido: sin hojas ni onda, solo un fundido. */
@media (prefers-reduced-motion: reduce) {
  .boveda * { animation: none !important; transition: none !important; }
  html.boveda-abre .boveda { animation: boveda-funde .25s both; }
}
