/* ==========================================================================
   Barrido diagonal login → sistema (adaptado del demo de Supralux)

   Fase de entrada (login):   .sweep.is-active   → las franjas cubren la pantalla
   Fase de salida (1a página): html.intro + .sweep.is-leaving → las franjas salen
   ========================================================================== */
:root {
  --sweep-angle: -40deg;
  --sweep-navy: #01143E;
  --sweep-blue: #003087;
  --sweep-mid: #1760c4;
  --sweep-light: #4e73df;
  --sweep-lighter: #9fb8ff;
}

.sweep {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  overflow: hidden;
  visibility: hidden;
}
.sweep.is-active, html.intro .sweep { visibility: visible; pointer-events: auto; }

.sweep-stripe {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  transform: translateX(calc(-100vw - 100vh)) skewX(var(--sweep-angle));
  will-change: transform;
}
.sweep-stripe.thin  { width: 2.2vw; background: var(--sweep-light); }
.sweep-stripe.thin2 { width: 1vw;   background: var(--sweep-lighter); }
.sweep-stripe.mid   { width: 7vw;   background: var(--sweep-mid); }
.sweep-stripe.cover {
  left: -60vh;
  width: calc(100vw + 120vh);
  transform: translateX(calc(-100vw - 120vh)) skewX(var(--sweep-angle));
}
.sweep-stripe.cover.blue { background: var(--sweep-blue); }
.sweep-stripe.cover.navy { background: var(--sweep-navy); }

.sweep-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(220px, 50vw);
  transform: translate(-50%, -50%);
  opacity: 0;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, .15));
}

/* Entrada */
.sweep.is-active .thin       { animation: sweepPass .75s cubic-bezier(.55, 0, .45, 1) 0s both; }
.sweep.is-active .thin2      { animation: sweepPass .75s cubic-bezier(.55, 0, .45, 1) .08s both; }
.sweep.is-active .mid        { animation: sweepPass .8s cubic-bezier(.55, 0, .45, 1) .16s both; }
.sweep.is-active .cover.blue { animation: sweepCover .7s cubic-bezier(.7, 0, .25, 1) .22s both; }
.sweep.is-active .cover.navy { animation: sweepCover .7s cubic-bezier(.7, 0, .25, 1) .42s both; }
.sweep.is-active .sweep-mark { animation: sweepMarkIn .4s ease .85s both; }

/* Salida: la página arranca cubierta y las franjas salen a la derecha */
html.intro .sweep .cover { transform: translateX(0) skewX(var(--sweep-angle)); }
html.intro .sweep .sweep-mark { opacity: 1; }
html.intro .sweep.is-leaving .sweep-mark  { animation: sweepMarkOut .25s ease both; }
html.intro .sweep.is-leaving .cover.navy  { animation: sweepLeave .75s cubic-bezier(.7, 0, .25, 1) .1s both; }
html.intro .sweep.is-leaving .cover.blue  { animation: sweepLeave .75s cubic-bezier(.7, 0, .25, 1) .24s both; }
html.intro .sweep.is-leaving .mid   { animation: sweepPass .7s cubic-bezier(.55, 0, .45, 1) .36s both; }
html.intro .sweep.is-leaving .thin  { animation: sweepPass .7s cubic-bezier(.55, 0, .45, 1) .42s both; }
html.intro .sweep.is-leaving .thin2 { animation: sweepPass .7s cubic-bezier(.55, 0, .45, 1) .48s both; }

@keyframes sweepPass {
  from { transform: translateX(calc(-10vw - 50vh)) skewX(var(--sweep-angle)); }
  to   { transform: translateX(calc(110vw + 50vh)) skewX(var(--sweep-angle)); }
}
@keyframes sweepCover {
  from { transform: translateX(calc(-100vw - 120vh)) skewX(var(--sweep-angle)); }
  to   { transform: translateX(0) skewX(var(--sweep-angle)); }
}
@keyframes sweepLeave {
  from { transform: translateX(0) skewX(var(--sweep-angle)); }
  to   { transform: translateX(calc(100vw + 120vh)) skewX(var(--sweep-angle)); }
}
@keyframes sweepMarkIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes sweepMarkOut { to { opacity: 0; transform: translate(-50%, -50%) scale(1.06); } }

/* Sin animaciones: solo se cubre y se descubre */
@media (prefers-reduced-motion: reduce) {
  .sweep *, html.intro .sweep * { animation-duration: .01s !important; animation-delay: 0s !important; }
}
