/* The 3D binder's stage (binder-gl.js): a canvas over the Collection workspace while the book opens, closes, or is
   turned round in the "View book" view. The HTML binder under it is hidden (but laid out, so the book can land on it)
   while <html data-bgl> is set, and fades back in when it goes. */

.bgl-layer { position: fixed; z-index: 4; left: 0; top: 0; width: 0; height: 0; pointer-events: none; opacity: 0; contain: strict;
  transition: opacity 240ms ease; }
.bgl-layer[hidden] { display: none; }
.bgl-layer.is-live { pointer-events: auto; }
.bgl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.bgl-layer[data-mode="orbit"] .bgl-canvas { cursor: grab; }
.bgl-layer[data-mode="orbit"] .bgl-canvas:active { cursor: grabbing; }

/* the HTML binder steps aside (important: it beats the view swap's own fade-in animations) */
:root[data-bgl] #workspace > :is(.bd-index, .bd-book, .bd-pager) { opacity: 0 !important; pointer-events: none; }
#workspace > :is(.bd-index, .bd-book, .bd-pager) { transition: opacity 240ms ease; }
:root[data-bgl-cut] #workspace > :is(.bd-index, .bd-book, .bd-pager) { transition: none; }
/* the orbit view has the whole stage: the title line goes quiet too */
:root[data-bgl="orbit"] #workspace > .bd-head { opacity: .35; pointer-events: none; transition: opacity 240ms ease; }

/* the orbit view's controls, under the book */
.bgl-ui { position: absolute; left: 50%; bottom: clamp(16px, 4vh, 40px); translate: -50% 8px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  opacity: 0; visibility: hidden; transition: opacity 220ms ease, translate 320ms var(--ease, ease), visibility 0s 220ms; }
.bgl-layer.is-orbit .bgl-ui { opacity: 1; visibility: visible; translate: -50% 0; transition: opacity 260ms ease 80ms, translate 360ms var(--ease, ease) 80ms, visibility 0s; }
.bgl-hint { margin: 0; font: 500 12.5px/1 var(--sans, system-ui); letter-spacing: .02em; color: var(--bone-3, #a89c8c); text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
.bgl-open { min-height: 42px; padding-inline: 22px; box-shadow: 0 10px 28px rgba(0, 0, 0, .55); }
.bgl-open:focus-visible { outline: 2px solid var(--focus, #f3d3a3); outline-offset: 3px; }

/* a quiet hint while the book opens */
.bgl-skip { position: absolute; right: 18px; bottom: 14px; margin: 0; font: 500 11.5px/1 var(--sans, system-ui); color: var(--bone-3, #a89c8c); opacity: 0;
  transition: opacity 300ms ease; pointer-events: none; }
.bgl-layer[data-mode="intro"] .bgl-skip { opacity: .55; transition-delay: 500ms; }
@media (hover: none) { .bgl-skip { display: none; } }

/* the pager's "View book" sits where "Close binder" was */
.bd-view { display: inline-flex; align-items: center; gap: 7px; }
.bd-view::before { content: ""; width: 14px; height: 14px; flex: none; opacity: .85;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7'/%3E%3Cpath d='M21 4v5h-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7'/%3E%3Cpath d='M21 4v5h-5'/%3E%3C/svg%3E") center / contain no-repeat; }

@media (prefers-reduced-motion: reduce) {
  #workspace > :is(.bd-index, .bd-book, .bd-pager), .bgl-layer, .bgl-ui { transition-duration: 160ms; }
}
