/* The rotunda: one base photograph, a transparent WebGL canvas on top, and hit areas registered to the art. */
#app, #rotunda, #room, #section { position: fixed; inset: 0; }
#rotunda { overflow: hidden; background: #0c1614; }
body:not([data-view='rotunda']) #rotunda { visibility: hidden; }
body[data-transition] #rotunda { visibility: visible; }

.stage-backdrop {
  position: absolute; inset: -40px; background: url('../assets/rotunda_v58_norugs.webp') center/cover no-repeat; filter: blur(28px) brightness(.5) saturate(.9);
}
.stage { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
.stage-frame {
  position: relative; flex: none; aspect-ratio: 1670 / 942;
  width: min(100vw, calc(100dvh * 1670 / 942)); /* contain: the whole rotunda is always visible on landscape screens */
  transform: translate3d(var(--pan, 0px), 0, 0); transform-origin: 50% 50%; will-change: transform;
}
#base, #fx, #stills, #clips { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#base { object-fit: fill; user-select: none; -webkit-user-drag: none; }
#fx { pointer-events: none; }
#stills, #clips { pointer-events: none; }
#stills img { position: absolute; opacity: 0; transition: opacity 1.2s ease; }
#stills img.on { opacity: 1; }
#stills.quick img { transition-duration: .6s; }
#clips video { position: absolute; opacity: 0; transition: opacity .5s ease; object-fit: fill; }
#clips video.on { opacity: 1; }

/* door hit areas */
#doors { position: absolute; inset: 0; }
.door-hit {
  position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); border: 0; padding: 0; background: transparent;
  border-radius: 46% 46% 6px 6px / 30% 30% 6px 6px; -webkit-tap-highlight-color: transparent;
}
.door-hit:focus-visible { outline: 3px solid #ffe9b8; outline-offset: -2px; box-shadow: 0 0 0 6px #14272599; }
.door-tip {
  position: absolute; left: 50%; bottom: 9%; transform: translate(-50%, 8px); min-width: max-content; padding: 9px 16px; border-radius: 10px; text-align: center;
  background: #142725e8; border: 1px solid #f3d29a55; opacity: 0; pointer-events: none; transition: opacity .45s var(--ease-out), transform .45s var(--ease-out);
}
.door-tip strong { display: block; font: 500 calc(21px * var(--text-scale))/1.1 var(--display); color: var(--cream); }
.door-tip small { display: block; margin-top: 3px; font-size: calc(12px * var(--text-scale)); color: var(--cream-soft); }
.door-hit:hover .door-tip, .door-hit:focus-visible .door-tip { opacity: 1; transform: translate(-50%, 0); }
body[data-busy] .door-tip { opacity: 0 !important; }
body[data-busy] .door-hit { cursor: default; }

/* nav icons painted into the art: transparent buttons registered to the artwork */
#artNav button {
  position: absolute; left: var(--cx); top: var(--cy); width: max(var(--w), 44px); height: max(var(--h), 44px); transform: translate(-50%, -50%);
  border: 0; background: transparent; border-radius: 12px; -webkit-tap-highlight-color: transparent;
}
#artNav button:hover { background: radial-gradient(closest-side, #fff3d61f, transparent); }
#topNav { display: none; }

#pathLabel { position: absolute; right: 20px; bottom: calc(74px + var(--safe-b)); z-index: 5; opacity: 0; transform: translateY(6px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
#pathLabel.on { opacity: 1; transform: none; }
#pathPreview { position: absolute; right: 20px; bottom: calc(18px + var(--safe-b)); z-index: 5; }
#skipBuild { position: absolute; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 6; }
body[data-busy] #pathPreview, body[data-busy] #siteFooter, body[data-busy] #mobileDoors, body[data-busy] #topNav { opacity: 0; pointer-events: none; }
body[data-busy='preview'] #pathPreview { opacity: 1; pointer-events: auto; }
#pathPreview, #siteFooter, #mobileDoors, #topNav { transition: opacity .5s var(--ease-out); }

#mobileDoors { display: none; }

#siteFooter { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 172px calc(14px + var(--safe-b)) 20px; pointer-events: none; }
#siteFooter > * { pointer-events: auto; }
.footer-links { display: flex; gap: 4px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 9px; color: #fff3da; font-size: calc(13px * var(--text-scale)); text-decoration: none; text-shadow: 0 1px 6px #000c, 0 0 2px #000; }
.footer-links a:hover { text-decoration: underline; }
.footer-notify { min-height: 44px; padding: 0 14px; border: 0; background: transparent; color: #fff3da; font: 500 calc(13px * var(--text-scale))/1 var(--body); letter-spacing: .02em; text-shadow: 0 1px 6px #000c, 0 0 2px #000; border-radius: 999px; }
.footer-notify:hover { text-decoration: underline; }

/* portrait screens: the art covers the screen and the camera pans to the chosen door */
@media (max-aspect-ratio: 1/1) {
  .stage { display: block; }
  .stage-frame { position: absolute; top: 0; left: 50%; width: auto; height: 100dvh; margin-left: calc(-0.5 * 100dvh * 1670 / 942); }   /* centred, wider than the screen */
  .stage { cursor: grab; touch-action: pan-y; }
  #artNav { display: none; }
  #topNav {
    position: absolute; top: calc(10px + var(--safe-t)); right: calc(10px + var(--safe-r)); z-index: 5; display: flex; gap: 2px; padding: 4px; border-radius: 14px;
    background: #142725d9; border: 1px solid #f3d29a44; backdrop-filter: blur(6px);
  }
  #topNav button { display: grid; justify-items: center; gap: 2px; min-width: 52px; min-height: 48px; padding: 6px 4px; border: 0; background: transparent; color: var(--cream); font-size: 10.500px; letter-spacing: .02em; border-radius: 10px; }
  #topNav svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.500; stroke-linecap: round; stroke-linejoin: round; }
  #mobileDoors {
    position: absolute; left: 50%; bottom: calc(58px + var(--safe-b)); transform: translateX(-50%); z-index: 5; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    width: min(460px, calc(100vw - 24px)); padding: 8px; border-radius: 16px; background: #142725d9; border: 1px solid #f3d29a44; backdrop-filter: blur(6px);
  }
  #mobileDoors button { min-height: 48px; border-radius: 10px; border: 1px solid #f3d29a55; background: #1c2b29; color: var(--cream); font: 500 15px/1.1 var(--body); }
  #mobileDoors button:active { background: #2a4340; }
  #pathPreview { right: 12px; bottom: calc(186px + var(--safe-b)); }
  #pathLabel { right: 12px; bottom: calc(240px + var(--safe-b)); }
  #siteFooter { padding: 0 8px calc(6px + var(--safe-b)); background: linear-gradient(180deg, transparent, #0c1614cc 60%); }
  .door-tip { display: none; }
}
/* short landscape screens (phones on their side) */
@media (max-height: 480px) and (min-aspect-ratio: 1/1) {
  #siteFooter { padding-right: 150px; padding-bottom: calc(4px + var(--safe-b)); }
  #pathPreview { bottom: calc(6px + var(--safe-b)); right: 10px; }
  #pathLabel { bottom: calc(56px + var(--safe-b)); right: 10px; }
  .door-tip strong { font-size: 16px; } .door-tip small { display: none; }
}
