/* zoominside.xyz zoom tours: additions on top of explorer.css (same chrome: Nunito, dark glass pill, ring pins) */

/* the picture is drawn by zoom-gl.js (WebGL) under OpenSeadragon's own canvas, which stays empty */
.zgl { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.zoomtour .openseadragon-canvas > canvas:not(.zgl) { visibility: hidden; }

/* the live clip (e.g. the butterfly's head turn): one <video>, placed by a transform from its registration on the still */
.clip-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.clip {
  position: absolute; left: 0; top: 0; display: block; transform-origin: 0 0; object-fit: fill; opacity: 0;
  max-width: none; max-height: none;          /* site.css caps every video at 100 %: this one is sized by its transform */
  will-change: transform, opacity; backface-visibility: hidden; pointer-events: none;
}
body.is-clip .osd { cursor: ns-resize; }

/* the iPhone's electron-cloud veil: one screen-blend layer over the flat atom fields, fading with depth */
.veil { position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: screen; opacity: 0; }

/* re-rooting between sections: the last frame held while the next section draws */
.freeze { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.freeze[hidden] { display: none; }

/* the Dive's fades (to black, and in from the centre: the film's pass through the pupil) */
.fade { position: absolute; inset: 0; z-index: 2; background: #000; opacity: 0; pointer-events: none; will-change: opacity; }

/* rings where you can go deeper: the explorer's hollow ring, faint, breathing slowly; a spot off screen waits at the edge */
.zrings .pin { opacity: 0; transition: opacity 0.45s ease; }
.zrings .pin:not(.is-on) { pointer-events: none; }        /* a ring switched off (it stays in the DOM) never takes a tap */
.zrings .pin.is-on { opacity: 0.78; transition-duration: 0s; }   /* a ring shows at once (never a frame without a pointer), fades out slowly */
.zrings .pin.is-on:hover, .zrings .pin.is-on:focus-visible { opacity: 1; }
.zrings .pin::before { animation: zring 2.8s var(--ease-out) infinite; }
.zrings .pin.is-wave::before { animation: zring-strong 1.1s var(--ease-out) 2; }
@keyframes zring { 0% { transform: scale(1); opacity: 0.55; } 70%, 100% { transform: scale(2.4); opacity: 0; } }
@keyframes zring-strong { 0% { transform: scale(1); opacity: 0.95; } 100% { transform: scale(3); opacity: 0; } }
.zrings .pin.is-clip .pin-dot { border-style: dashed; }
.zrings .pin.is-edge.is-on { opacity: 0.55; }
body.is-clip .zrings .pin, body.is-diving .zrings .pin { opacity: 0 !important; pointer-events: none; }

/* the level's label, on arrival: a dark glass pill at the bottom; tap = its fact card */
.zlabel {
  position: fixed; z-index: 9; left: 50%; bottom: max(calc(var(--gap) + 2px), env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 10px; max-width: min(92vw, 640px); margin: 0; padding: 10px 12px 10px 18px;
  border: 1px solid var(--glass-dark-line); border-radius: 999px; background: rgba(17, 22, 29, 0.66); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  font: 800 15px/1.2 var(--font); text-align: left; white-space: nowrap;
  opacity: 0; transform: translate(-50%, 8px); transition: opacity 0.45s ease, transform 0.6s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.zlabel[hidden] { display: inline-flex; visibility: hidden; }
.zlabel.is-on { opacity: 1; transform: translate(-50%, 0); visibility: visible; }
.zlabel:hover { background: rgba(17, 22, 29, 0.78); }
.zlabel:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.zl-title { flex: none; }
.zl-fact { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: rgba(255, 255, 255, 0.82); }
.zl-fact::before { content: "·"; margin-right: 10px; color: rgba(255, 255, 255, 0.45); }
.zl-more { width: 18px; height: 18px; opacity: 0.75; }
.zoomtour .zlabel { padding: 10px 20px; pointer-events: none; cursor: default; }
.zoomtour .zl-fact, .zoomtour .zl-more { display: none; }

/* the Dive: a thin progress line along the top while it runs */
.dive-bar { position: fixed; z-index: 11; left: 0; right: 0; top: 0; height: 2px; pointer-events: none; opacity: 0; transition: opacity 0.4s linear; }
.dive-bar span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--orange); }
body.is-diving .dive-bar { opacity: 1; }
body.is-diving:not(.is-awake) :is(.back, .zoombar, .hint) { opacity: 0; pointer-events: none; }
body.is-diving:not(.is-awake) :is(#btn-sound, #btn-full) { width: 0; padding: 0; opacity: 0; pointer-events: none; }
body.is-diving .ctl-tour { background: var(--blue); }
#btn-dive .i-stop { display: none; }
#btn-dive[aria-pressed="true"] .i-stop { display: block; }
#btn-dive[aria-pressed="true"] .i-play { display: none; }

/* every explainer (the level window, a tapped point's story) is the explorer's own card on the right, as on the site's other tours
   (a bottom sheet on phones): title and text, never a Source or a pager */
.zoomtour .card :is(.card-foot, .more, .facts) { display: none !important; }

/* a level with a story: the pill shows the (i), and a click or tap opens the level's explainer (title + story) in the card on the
   right */
.zoomtour .zlabel.has-story { padding: 10px 14px 10px 20px; }
.zoomtour .zlabel.has-story.is-on { pointer-events: auto; cursor: pointer; }
.zoomtour .zlabel.has-story .zl-more { display: block; flex: none; }
body.is-diving .zlabel { pointer-events: none !important; }

/* the live scale bar: a length and a bar with end ticks, bottom left, following the zoom */
.zscale {     /* right of the zoom buttons (bottom left on desktop); bottom left where they are hidden (phones, touch) */
  position: fixed; z-index: 9; left: calc(max(var(--gap), env(safe-area-inset-left)) + 142px); bottom: calc(max(var(--gap), env(safe-area-inset-bottom)) + 9px);
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px; pointer-events: none;
  color: #fff; font: 800 13px/1 var(--font); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  opacity: 0; transition: opacity 0.4s linear;
}
.zscale.is-on { opacity: 0.94; }
.zs-bar { display: block; height: 7px; border: 2px solid #fff; border-top: 0; box-shadow: 0 2px 3px -1px rgba(0, 0, 0, 0.5); }
.zscale.is-text .zs-bar { display: none; }               /* past the deepest measured level: the film's text, no bar */
body.is-diving:not(.is-awake) .zscale.is-on { opacity: 0.8; }

@media (pointer: coarse) { .zscale { left: max(calc(var(--gap) + 4px), env(safe-area-inset-left)); } }
@media (max-width: 820px) {
  .zscale { left: max(calc(var(--gap) + 4px), env(safe-area-inset-left)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 54px); font-size: 12px; }
  .zlabel { bottom: max(14px, env(safe-area-inset-bottom)); padding: 9px 10px 9px 15px; font-size: 14px; gap: 8px; }
  .zl-fact { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .zl-fact::before { display: none; }
  .zlabel { flex-wrap: wrap; row-gap: 2px; border-radius: 22px; width: max-content; max-width: calc(100vw - 2 * var(--gap) - 8px); }
  .zl-title { flex-basis: calc(100% - 30px); }
  .zl-more { position: absolute; right: 12px; top: 12px; }
  body.card-open .zlabel { opacity: 0; pointer-events: none; }   /* (the heading stays at the bottom; a phone's card sheet covers it) */
  .zoomtour .zlabel.has-story { padding: 9px 12px 9px 16px; flex-wrap: nowrap; }
  .zoomtour .zlabel.has-story .zl-title { flex: 0 1 auto; flex-basis: auto; min-width: 0; white-space: normal; }
  .zoomtour .zlabel.has-story .zl-more { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .zrings .pin::before { animation: none; }
}

/* About on phones: on the scale bar's row, clear of the level label at the bottom */
@media (max-width: 820px) { .about-link { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 50px); } }
