/* Runtime states only; the scene styling lives in gate.css and world.css. */

#gate[data-ni-beat="intro"] .ni-unlock,
#gate[data-ni-beat="unsealing"] .ni-unlock,
#gate[data-ni-beat="reading"] .ni-unlock { visibility: hidden; }
.ni-unlock { opacity: var(--ni-unlock, 1); }

/* Hidden from the first paint (the beat attribute arrives with the theme JS), so the folleto never flashes */
#gate:not([data-ni-beat="reading"]) .ni-page {
  opacity: 0;
  pointer-events: none;
}
#gate:not([data-ni-beat="reading"]) .ni-page :is(button, a) { visibility: hidden; }
/* Failsafe: if the theme JS never sets a beat, the folleto still appears after 6 s */
#gate:not([data-ni-beat]) .ni-page,
#gate:not([data-ni-beat]) .ni-page :is(button, a) { animation: ni-failsafe 0s linear 6s forwards; }
@keyframes ni-failsafe { to { opacity: 1; pointer-events: auto; visibility: visible; } }
#gate[data-ni-beat="unsealing"] .ni-page {
  transform: translate(var(--ni-from-x, 0), var(--ni-from-y, 0)) scale(var(--ni-from-s, 1));
}
#gate[data-ni-beat="reading"] .ni-page {
  transform: none;
  opacity: 1;
  pointer-events: auto;
  transition: transform 900ms cubic-bezier(.2,.7,.2,1), opacity 400ms;
}

body.is-gate-locked #language-control { display: none; }
body.is-gate-locked:has(#gate[data-ni-beat="reading"]) #language-control { display: inline-flex; }

.ni-reprint[hidden] { display: none; }
.ni-reprint {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 110;
}
.ni-reprint__sheet {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 calc(100% - var(--ni-sweep)) 0);
}
.ni-reprint__roller {
  position: absolute;
  top: var(--ni-sweep);
  transform: translateY(-50%);
}

.ni-plate { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
:is(#hero, #dedicatoria, #counter, #familia, #historia, #itinerario, #vestimenta, #regalos, #rsvp, #captura, #secreto, #kc-footer) {
  position: relative;
  isolation: isolate;
}
.ni-plate ~ .kc-container { position: relative; z-index: 1; }
.ni-plate__color { opacity: 0; }
.ni-plate.is-lit .ni-plate__color { opacity: 1; }
.ni-plate.is-static .ni-plate__line { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  #gate[data-ni-beat="unsealing"] .ni-page,
  #gate[data-ni-beat="reading"] .ni-page { transition: none; }
}
