/* Explorer: deep-zoom cutaway with live rooms, hotspots, encyclopedia card */
html, body.explorer { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.explorer {
  --sky: #ffffff;            /* set per cutaway from tour.still.bg */
  --sky-0: rgba(255, 255, 255, 0);
  background: var(--sky);
  touch-action: none;
  --card-w: min(440px, 36vw);
  --gap: 16px;
  --top-h: 64px;
}

.stage { position: fixed; inset: 0; overflow: hidden; }
/* OpenSeadragon forces position: relative on its element, so size it explicitly */
.osd { position: absolute; inset: 0; width: 100%; height: 100%; }
.osd .openseadragon-canvas:focus { outline: none; }

/* image-space layer: one transform per frame maps canvas px to screen px */
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; will-change: transform; contain: layout style; }
.world video {
  position: absolute; display: block; object-fit: fill; pointer-events: none;
  opacity: 0; transition: opacity 0.45s ease;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  backface-visibility: hidden;
}
.world video.is-on { opacity: 1; }
.world video.overview { transition: opacity 0.35s linear; }

/* the still's rectangle melts into the page: four strips fade its edges to the page colour */
.edges { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.edges i { position: absolute; left: 0; top: 0; display: block; transform-origin: 0 0; will-change: transform; }
.edges .e-l { background: linear-gradient(to right, var(--sky), var(--sky-0)); }
.edges .e-r { background: linear-gradient(to left, var(--sky), var(--sky-0)); }
.edges .e-t { background: linear-gradient(to bottom, var(--sky), var(--sky-0)); }
.edges .e-b { background: linear-gradient(to top, var(--sky), var(--sky-0)); }

/* the cutaway's own title art, centred over the stage for a moment when the page opens */
.title-art {
  position: absolute; left: 50%; top: 50%; width: min(55vw, 1100px); height: auto; max-height: 60vh; object-fit: contain;
  transform: translate(-50%, -50%) scale(0.97); opacity: 0; pointer-events: none; z-index: 5;
  filter: drop-shadow(0 6px 22px rgba(10, 8, 20, 0.28));
  transition: opacity 0.6s var(--ease-out), transform 1.2s var(--ease-out);
}
.title-art.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.title-art.is-out { opacity: 0; transform: translate(-50%, -50%) scale(1.01); transition: opacity 0.8s ease, transform 0.8s ease; }

/* hotspots */
.pins { position: absolute; inset: 0; pointer-events: none; }
.pin {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0;
  border: 0; background: none; cursor: pointer; pointer-events: auto; will-change: transform;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.3s ease;
}
.pin-dot {
  position: absolute; inset: 9px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, 0.94); color: var(--ink);
  font: 600 12.5px/1 var(--sans); font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1.5px rgba(23, 22, 27, 0.85), 0 3px 10px rgba(20, 16, 40, 0.28);
  transition: transform 0.25s var(--ease-out), background 0.2s ease, color 0.2s ease;
}
.pin::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  /* white pulse ring with a faint ink edge, so it reads on dark stone and on bright snow alike */
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95), 0 0 0 3px rgba(23, 22, 27, 0.22);
  animation: pin-pulse 2.8s var(--ease-out) infinite; animation-delay: var(--delay, 0s);
}
@keyframes pin-pulse { 0% { transform: scale(1); opacity: 0.85; } 70%, 100% { transform: scale(2.3); opacity: 0; } }
.pins.is-small .pin-dot { inset: 12px; font-size: 10.5px; box-shadow: 0 0 0 1.25px rgba(23, 22, 27, 0.85), 0 2px 6px rgba(20, 16, 40, 0.25); }
.pins.is-small .pin::before { inset: 12px; }
.pin:hover .pin-dot, .pin.is-hover .pin-dot, .pin:focus-visible .pin-dot { transform: scale(1.18); }
.pin.is-active .pin-dot { background: var(--accent); color: #fff; box-shadow: 0 0 0 1.5px #fff, 0 3px 12px rgba(120, 30, 16, 0.4); }
.pin.is-active::before { animation: none; opacity: 0; }
.pin:focus-visible { outline: none; }
.pin:focus-visible .pin-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.pins.is-dim .pin:not(.is-active) { opacity: 0.55; }
.pins.is-hidden .pin { opacity: 0; pointer-events: none; }

.hover-label {
  position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap;
  padding: 6px 11px; border-radius: 8px; background: rgba(23, 22, 27, 0.88); color: #fff;
  font: 500 13px/1.2 var(--sans); letter-spacing: 0.01em;
  opacity: 0; transform: translate(-50%, -100%); transition: opacity 0.15s ease;
}
.hover-label.is-on { opacity: 1; }
.hover-label b { font-weight: 600; color: #ffd9c9; margin-right: 6px; font-variant-numeric: tabular-nums; }

.loader { position: absolute; left: 0; right: 0; top: 0; height: 2px; overflow: hidden; pointer-events: none; transition: opacity 0.5s ease; }
.loader span { position: absolute; top: 0; bottom: 0; width: 30%; background: var(--accent); animation: load 1.2s var(--ease-in-out) infinite; }
@keyframes load { from { left: -30%; } to { left: 100%; } }
body:not(.is-loading) .loader { opacity: 0; }

/* chrome */
.topbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 10; pointer-events: none;
  display: flex; align-items: flex-start; gap: 12px;
  padding: max(var(--gap), env(safe-area-inset-top)) max(var(--gap), env(safe-area-inset-right)) 0 max(var(--gap), env(safe-area-inset-left));
}
.topbar > * { pointer-events: auto; }
.back {
  display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 14px 0 11px; border-radius: 12px;
  color: var(--ink); text-decoration: none; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: var(--shadow-1);
  font: 500 17px/1 var(--serif);
}
.back svg { width: 22px; height: 22px; }
.title-block {
  min-width: 0; height: 44px; padding: 6px 14px 0; border-radius: 12px; pointer-events: none;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow-1);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
.title-block .kicker { margin: 0; color: var(--accent-ink); font-size: 10px; line-height: 1; }
.title-block h1 {
  margin: 2px 0 0; font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.1; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.controls { margin-left: auto; display: flex; gap: 8px; flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px 0 13px;
  border-radius: 12px; border: 1px solid var(--glass-line); background: var(--glass); color: var(--ink); cursor: pointer;
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: var(--shadow-1);
  font: 500 14px/1 var(--sans); letter-spacing: 0.01em; white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: rgba(255, 255, 255, 0.95); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn-icon { width: 44px; padding: 0; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #2b2933; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.btn-ghost:hover { background: rgba(23, 22, 27, 0.06); }

#btn-tour .i-stop { display: none; }
#btn-tour[aria-pressed="true"] .i-stop { display: block; }
#btn-tour[aria-pressed="true"] .i-play { display: none; }
#btn-sound .i-on { display: none; }
#btn-sound[aria-pressed="true"] .i-on { display: block; }
#btn-sound[aria-pressed="true"] .i-off { display: none; }
#btn-sound[aria-pressed="true"] { color: var(--accent-ink); }
#btn-anim .i-play { display: none; }
#btn-anim[aria-pressed="false"] .i-play { display: block; }
#btn-anim[aria-pressed="false"] .i-pause { display: none; }

.zoombar {
  position: fixed; z-index: 10; left: max(var(--gap), env(safe-area-inset-left)); bottom: max(var(--gap), env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
}

/* stop rail (table of contents) */
.rail {
  position: fixed; z-index: 9; left: 50%; bottom: max(var(--gap), env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 2px; padding: 4px; border-radius: 14px; max-width: calc(100vw - 2 * 76px);
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow-1);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  overflow-x: auto; scrollbar-width: none; transition: opacity 0.3s ease, transform 0.4s var(--ease-out);
}
.rail::-webkit-scrollbar { display: none; }
.rail button {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 9px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; white-space: nowrap; color: var(--ink-2); font: 500 13px/1 var(--sans);
}
.rail button:hover { background: rgba(23, 22, 27, 0.06); color: var(--ink); }
.rail button .n {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.25px currentColor; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.rail button[aria-current="true"] { color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(23, 20, 40, 0.12); }
.rail button[aria-current="true"] .n { background: var(--accent); color: #fff; box-shadow: none; }

.hint {
  position: fixed; z-index: 8; left: 50%; bottom: calc(max(var(--gap), env(safe-area-inset-bottom)) + 58px); transform: translate(-50%, 6px);
  margin: 0; padding: 9px 15px; border-radius: 999px; background: rgba(23, 22, 27, 0.86); color: #fff;
  font: 500 13px/1.3 var(--sans); white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s var(--ease-out);
}
.hint.is-on { opacity: 1; transform: translate(-50%, 0); }

/* one-time "Turn on sound" pill under the speaker button */
.sound-hint {
  --arrow-x: 22px;
  position: fixed; z-index: 12; top: 70px; right: 16px; margin: 0;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 9px 11px; border-radius: 999px;
  background: var(--accent); color: #fff; font: 600 13.5px/1 var(--sans); letter-spacing: 0.01em; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(120, 30, 16, 0.32); pointer-events: none;
  opacity: 0; transform: translateY(-6px); transition: opacity 0.4s ease, transform 0.5s var(--ease-out);
}
.sound-hint svg { width: 17px; height: 17px; flex: none; }
.sound-hint::before {
  content: ""; position: absolute; top: -5px; right: calc(var(--arrow-x) - 6px); width: 12px; height: 12px;
  background: var(--accent); transform: rotate(45deg); border-radius: 2px;
}
.sound-hint.is-on { opacity: 1; transform: none; animation: hint-nudge 1.6s var(--ease-in-out) 0.6s 2; }
@keyframes hint-nudge { 0%, 100% { transform: none; } 50% { transform: translateY(3px); } }

/* "Animation coming soon" (a cutaway shown as a still for now) */
.status-pill {
  align-self: center; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 10px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow-1); color: var(--ink-2);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  font: 600 11px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
}
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(178, 58, 38, 0.18); }
.status-pill[hidden] { display: none; }

/* encyclopedia card: side panel on wide screens */
.card {
  position: fixed; z-index: 20; top: calc(max(var(--gap), env(safe-area-inset-top)) + 56px); right: max(var(--gap), env(safe-area-inset-right));
  bottom: max(var(--gap), env(safe-area-inset-bottom)); width: var(--card-w); min-width: 340px;
  display: flex; flex-direction: column; background: var(--card); border-radius: 18px; box-shadow: var(--shadow-2);
  transform: translateX(calc(100% + 40px)); transition: transform 0.55s var(--ease-out), visibility 0s linear 0.55s; visibility: hidden;
}
.card[hidden] { display: flex; }
.card.is-open { transform: none; visibility: visible; transition: transform 0.55s var(--ease-out), visibility 0s; }
.card-grip { display: none; }
.card-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 24px 8px; scrollbar-width: thin; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px -10px 0 0; }
.card-head .kicker { margin: 0; color: var(--accent-ink); }
.card-title {
  margin: 6px 0 0; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.06; letter-spacing: -0.016em; outline: none;
}
.card-dek { margin: 6px 0 0; font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.35; color: var(--ink-2); }

.bubble { margin: 18px 0 0; }
.bubble-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.bubble-tabs:empty { display: none; }
.bubble-tabs button {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--rule); background: #fff; cursor: pointer;
  font: 500 12.5px/1.1 var(--sans); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bubble-tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.bubble-stage {
  position: relative; border-radius: 14px; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 1px rgba(23, 22, 27, 0.07), 0 6px 22px rgba(23, 20, 40, 0.08);
  aspect-ratio: 4 / 3; max-height: 42vh; width: 100%;
}
.bubble-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.bubble-progress { position: absolute; left: 12px; right: 12px; bottom: 9px; height: 2px; border-radius: 2px; background: rgba(23, 22, 27, 0.08); overflow: hidden; }
.bubble-progress span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(23, 22, 27, 0.4); }
.bubble-cap { margin: 9px 2px 0; font: 600 11.5px/1.3 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }

.facts { list-style: none; margin: 18px 0 8px; padding: 0; counter-reset: fact; }
.facts li {
  position: relative; padding: 12px 0 12px 34px; border-top: 1px solid var(--rule);
  font-family: var(--serif); font-size: 17.5px; line-height: 1.45; color: var(--ink);
}
.facts li::before {
  counter-increment: fact; content: counter(fact); position: absolute; left: 0; top: 15px;
  font: 600 11.5px/1 var(--sans); color: var(--accent-ink); font-variant-numeric: tabular-nums;
  width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; box-shadow: inset 0 0 0 1.25px rgba(143, 43, 26, 0.45);
  margin-top: -3px;
}

.card-foot {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 12px;
  border-top: 1px solid var(--rule);
}
.card-foot .btn { height: 44px; }
.card-foot .btn svg { width: 16px; height: 16px; }
.btn-next { padding: 0 14px 0 16px; background: var(--ink); color: #fff; border-color: var(--ink); backdrop-filter: none; -webkit-backdrop-filter: none; max-width: 70%; }
.btn-next:hover { background: #2b2933; }
.next-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.next-k { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.65; }
.next-t { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tour-timer { position: absolute; left: 0; right: 0; top: -1px; height: 2px; overflow: hidden; opacity: 0; transition: opacity 0.3s ease; }
.tour-timer span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); }
body.is-touring .tour-timer { opacity: 1; }

/* wide screens: chrome makes room for the open card */
@media (min-width: 821px) {
  body.card-open .rail { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
}

/* phones and small tablets: card becomes a bottom sheet */
@media (max-width: 820px) {
  body.explorer { --gap: 12px; }
  .back-text, .hide-phone { display: none; }
  .back { width: 44px; padding: 0; justify-content: center; }
  .title-block { display: flex; align-items: center; padding: 0 12px; flex: 1; }
  .title-block .kicker { display: none; }
  .title-block h1 { margin: 0; font-size: 17px; }
  .controls { gap: 6px; }
  .controls .btn-label { display: none; }
  .controls .btn { width: 44px; padding: 0; }
  .controls #btn-tour { width: auto; padding: 0 13px 0 10px; }
  .controls #btn-tour .btn-label { display: inline; }
  .zoombar { display: none; }
  .rail { left: var(--gap); right: var(--gap); transform: none; max-width: none; justify-content: flex-start; }
  .rail button .t { display: none; }
  .rail button { padding: 0 5px; height: 34px; }
  .rail { gap: 0; padding: 3px; }
  .rail { justify-content: space-between; }
  .hint { bottom: calc(max(var(--gap), env(safe-area-inset-bottom)) + 56px); }
  .status-pill { position: fixed; top: calc(max(var(--gap), env(safe-area-inset-top)) + 52px); left: max(var(--gap), env(safe-area-inset-left)); height: 26px; font-size: 10px; }
  .title-art { width: 90vw; max-height: 40vh; }

  .card {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; min-width: 0; max-height: 58dvh; border-radius: 18px 18px 0 0;
    transform: translateY(calc(100% + 20px));
    padding-bottom: env(safe-area-inset-bottom);
  }
  .card.is-open { transform: none; }
  .card-grip { display: block; position: absolute; left: 50%; top: 7px; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: rgba(23, 22, 27, 0.18); }
  .card-scroll { padding: 16px 16px 6px; }
  .card-title { font-size: 27px; }
  .card-dek { font-size: 16px; }
  .bubble-stage { max-height: 30dvh; }
  .facts li { font-size: 16.5px; padding: 10px 0 10px 32px; }
  .facts li::before { top: 13px; }
  body.card-open .rail { opacity: 0; pointer-events: none; }
  .card-foot { padding: 8px 10px 10px; }
  .card-foot #card-prev span { display: none; }
}

@media (max-width: 420px) {
  .title-block h1 { font-size: 15.5px; }
}
@media (max-width: 340px) {
  .title-block { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pin::before { display: none; }
}
.btn[hidden] { display: none; }

/* brand lockups (Ocean & Gold): horizontal logo on the pill, the mark alone where the pill is icon-only */
.back .back-logo { display: block; height: 24px; width: auto; }
.back .back-mark { display: none; width: 24px; height: 24px; }
@media (max-width: 820px) { .back .back-mark { display: block; } .back .back-logo { display: none; } }
