/* EQUILIBRIUM — PASS 24
   Immersive scroll contract. One pinned world per experience, no nested fixed
   worlds, no DOM re-parenting, and no one-viewport black release gap on iOS.
   JS writes --immersive-vh / --immersive-vtop from visualViewport when present. */

:root{
  --immersive-vh:100dvh;
  --immersive-vtop:0px;
}

/* The long story holders must never become scrolling/clipping ancestors. */
.quantum-world-page[data-pass24-scroll="true"],
.quantum-world-page[data-pass24-scroll="true"] main,
.quantum-world-page[data-pass24-scroll="true"] .quantum-journey,
.trippy-page[data-pass24-scroll="true"],
.trippy-page[data-pass24-scroll="true"] main,
.trippy-page[data-pass24-scroll="true"] .trippy-journey,
.reverie-sketchbook[data-pass24-scroll="true"],
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__journey,
.lucid-room[data-pass24-scroll="true"],
.resonance-v2[data-pass24-scroll="true"]{
  overflow:visible!important;
  overflow-x:visible!important;
  clip-path:none!important;
  contain:none!important;
}

.quantum-world-page[data-pass24-scroll="true"] .quantum-journey,
.trippy-page[data-pass24-scroll="true"] .trippy-journey,
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__journey,
.lucid-room[data-pass24-scroll="true"],
.resonance-v2[data-pass24-scroll="true"]{
  position:relative!important;
}

/* Give each world enough physical runway for its narrative beats. */
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__journey{
  height:auto!important;
  min-height:520dvh!important;
}
.lucid-room[data-pass24-scroll="true"]{
  min-height:500dvh!important;
}
.resonance-v2[data-pass24-scroll="true"]{
  min-height:330dvh!important;
}
.resonance-v2[data-pass24-scroll="true"] .resonance-explain{
  position:relative!important;
  z-index:8!important;
  min-height:220dvh!important;
}

/* One and only one viewport-sized owner for every immersive world. */
.quantum-world-page[data-pass24-scroll="true"] .quantum-world-sticky,
.trippy-page[data-pass24-scroll="true"] .trippy-sticky,
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__stage,
.lucid-room[data-pass24-scroll="true"] .lucid-stage,
.resonance-v2[data-pass24-scroll="true"] .resonance-stage{
  left:0!important;
  right:0!important;
  width:100%!important;
  height:var(--immersive-vh)!important;
  min-height:0!important;
  max-height:none!important;
  margin:0!important;
  backface-visibility:hidden!important;
  -webkit-backface-visibility:hidden!important;
  isolation:isolate!important;
  overflow:hidden!important;
}

/* Before the holder reaches the viewport. */
.quantum-world-page[data-pass24-scroll="true"] .quantum-world-sticky[data-pass24-pin="start"],
.trippy-page[data-pass24-scroll="true"] .trippy-sticky[data-pass24-pin="start"],
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__stage[data-pass24-pin="start"],
.lucid-room[data-pass24-scroll="true"] .lucid-stage[data-pass24-pin="start"],
.resonance-v2[data-pass24-scroll="true"] .resonance-stage[data-pass24-pin="start"]{
  position:absolute!important;
  top:0!important;
  bottom:auto!important;
  transform:none!important;
  -webkit-transform:translateZ(0)!important;
}

/* During the whole crossing. Keep the scene fixed until the HOLDER itself has
   passed the top edge, rather than releasing one viewport too early. */
.quantum-world-page[data-pass24-scroll="true"] .quantum-world-sticky[data-pass24-pin="fixed"],
.trippy-page[data-pass24-scroll="true"] .trippy-sticky[data-pass24-pin="fixed"],
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__stage[data-pass24-pin="fixed"],
.lucid-room[data-pass24-scroll="true"] .lucid-stage[data-pass24-pin="fixed"],
.resonance-v2[data-pass24-scroll="true"] .resonance-stage[data-pass24-pin="fixed"]{
  position:fixed!important;
  top:var(--immersive-vtop)!important;
  bottom:auto!important;
  transform:none!important;
  -webkit-transform:translateZ(0)!important;
}

/* RÊVERIE keeps its desktop max-width while fixed, but becomes edge-to-edge on
   compact screens. This prevents the fixed state from jumping horizontally. */
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__stage[data-pass24-pin="fixed"]{
  left:50%!important;
  right:auto!important;
  width:min(100vw,90rem)!important;
  transform:translate3d(-50%,0,0)!important;
  -webkit-transform:translate3d(-50%,0,0)!important;
}

/* Once the holder is fully behind the top edge, park the scene at its end. */
.quantum-world-page[data-pass24-scroll="true"] .quantum-world-sticky[data-pass24-pin="end"],
.trippy-page[data-pass24-scroll="true"] .trippy-sticky[data-pass24-pin="end"],
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__stage[data-pass24-pin="end"],
.lucid-room[data-pass24-scroll="true"] .lucid-stage[data-pass24-pin="end"],
.resonance-v2[data-pass24-scroll="true"] .resonance-stage[data-pass24-pin="end"]{
  position:absolute!important;
  top:auto!important;
  bottom:0!important;
  transform:none!important;
  -webkit-transform:translateZ(0)!important;
}

.quantum-world-page[data-pass24-scroll="true"] .quantum-world-sticky,
.trippy-page[data-pass24-scroll="true"] .trippy-sticky{z-index:4!important}
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__stage{z-index:2!important}
.lucid-room[data-pass24-scroll="true"] .lucid-stage{z-index:2!important}
.resonance-v2[data-pass24-scroll="true"] .resonance-stage{z-index:3!important}

/* The next readable layer crosses over the still-living world instead of waiting
   for the world to slide away into black. */
.trippy-page[data-pass24-scroll="true"] .trippy-manifest{
  position:relative!important;
  z-index:9!important;
  background:linear-gradient(180deg,rgba(5,5,16,.16),#050510 15%,#050510 100%)!important;
}
.quantum-world-page[data-pass24-scroll="true"] .quantum-manifesto{z-index:9!important}
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__tabs,
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__portfolio{position:relative!important;z-index:8!important}
.lucid-room[data-pass24-scroll="true"] .lucid-beats{position:relative!important;z-index:6!important}

/* World/canvas coverage follows the real visible viewport. */
.quantum-world-page[data-pass24-scroll="true"] .quantum-world,
.quantum-world-page[data-pass24-scroll="true"] .quantum-world-runtime,
.trippy-page[data-pass24-scroll="true"] .trippy-world,
.trippy-page[data-pass24-scroll="true"] .trippy-canon-runtime,
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__cosmos,
.reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__cosmos canvas,
.lucid-room[data-pass24-scroll="true"] .lucid-canvas,
.lucid-room[data-pass24-scroll="true"] .lucid-canvas canvas,
.resonance-v2[data-pass24-scroll="true"] .resonance-world,
.resonance-v2[data-pass24-scroll="true"] .resonance-world canvas{
  min-height:var(--immersive-vh)!important;
}

/* RÊVERIE place actions stay interactive even though the story overlay is mostly
   visual. */
.reverie-place-story .reverie-place-beat[data-active="true"]{pointer-events:auto!important}
.reverie-place-story .reverie-place-beat[data-active="true"]>div{pointer-events:auto!important}
.pass24-place-actions{display:flex!important;flex-wrap:wrap!important;gap:.42rem!important;margin-top:.72rem!important;pointer-events:auto!important;position:relative!important;z-index:80!important}
.pass24-place-actions button,.pass24-place-actions a{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;min-height:44px!important;padding:.62rem .78rem!important;border:1px solid rgba(128,234,239,.5)!important;border-radius:999px!important;background:rgba(4,11,19,.88)!important;color:#f7fcff!important;text-decoration:none!important;font:800 .58rem/1 system-ui,sans-serif!important;letter-spacing:.08em!important;text-transform:uppercase!important;box-shadow:0 .5rem 1.5rem rgba(0,0,0,.28),0 0 1.2rem rgba(103,230,241,.08)!important;backdrop-filter:blur(10px)!important;-webkit-backdrop-filter:blur(10px)!important;pointer-events:auto!important;touch-action:manipulation!important;cursor:pointer!important
}
.pass24-place-actions a{border-color:rgba(241,201,112,.72)!important;background:linear-gradient(120deg,rgba(241,201,112,.22),rgba(255,174,68,.1))!important;color:#ffe9ae!important;box-shadow:0 .5rem 1.6rem rgba(0,0,0,.3),0 0 1.4rem rgba(245,196,87,.16)!important}
.reverie-kaguya-enter-pass23{pointer-events:auto!important;touch-action:manipulation!important;z-index:90!important}

@media(max-width:820px){
  .reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__journey{min-height:590dvh!important}
  .lucid-room[data-pass24-scroll="true"]{min-height:540dvh!important}
  .resonance-v2[data-pass24-scroll="true"]{min-height:360dvh!important}
  .reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__stage[data-pass24-pin="fixed"]{width:100vw!important}
  .pass24-place-actions{justify-content:flex-start!important}
  .reverie-place-beat[data-align="right"] .pass24-place-actions{justify-content:flex-end!important}
}

@media(prefers-reduced-motion:reduce){
  .quantum-world-page[data-pass24-scroll="true"] .quantum-world-sticky,
  .trippy-page[data-pass24-scroll="true"] .trippy-sticky,
  .reverie-sketchbook[data-pass24-scroll="true"] .reverie-sketchbook__stage,
  .lucid-room[data-pass24-scroll="true"] .lucid-stage,
  .resonance-v2[data-pass24-scroll="true"] .resonance-stage{transition:none!important}
}
