/* A selected sleeve turns in front of the archive. The real buttons remain in
   the scrolling shelf, so their hit areas, labels and keyboard order stay put. */
.tape-shelf { position: relative; }
.tape-shelf__showcase {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  perspective: 1800px;
  perspective-origin: 50% 50%;
}
.tape-showcase {
  position: absolute;
  width: var(--spine-width);
  height: var(--case-height);
}
.tape-showcase__box {
  width: 100%;
  height: 100%;
  position: relative;
}
.tape-showcase__spine, .tape-showcase__front {
  position: absolute;
  top: 0;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 720ms cubic-bezier(.2,.7,.18,1), opacity 300ms ease;
}
.tape-showcase__spine {
  left: 0;
  width: var(--spine-width);
  transform: perspective(1400px) rotateY(0);
}
.tape-showcase__front {
  top: 0;
  height: var(--cover-height);
  left: calc((var(--spine-width) - var(--cover-width)) / 2);
  width: var(--cover-width);
  transform: perspective(1400px) rotateY(90deg);
  opacity: 0;
  filter: drop-shadow(9px 13px 12px #0009);
}
.tape-showcase.is-open .tape-showcase__spine { transform: perspective(1400px) rotateY(-90deg); opacity: 0; }
.tape-showcase.is-open .tape-showcase__front {
  /* A small turn exposes the printed left spine, like a box on a shelf. */
  transform: translate(var(--open-offset), -12px) perspective(1400px) rotateY(-6deg);
  opacity: 1;
  /* Catch clicks on the visible cover so they cannot activate a different,
     physically obscured tape. The accessible shelf buttons remain unchanged. */
  pointer-events: auto;
}
.tape-showcase__replica {
  box-sizing: border-box; position: relative; display: flex; flex-direction: column; align-items: stretch;
  width: 100%; height: 100%; min-width: 0; padding: 4px; border-radius: 3px; text-align: center;
  transform: rotate(var(--spine-angle, 0deg));
}
.tape-showcase__front .tape-cover {
  width: 100%; height: 100%; max-width: none; aspect-ratio: auto;
}
@media (min-width: 1024px) {
  /* The measured row reserves room for a cover. Let the shifting spines and
     their shadows use that room without a clipping box. */
  .tape-shelf__stacks { overflow: visible; }
  /* Hand over between the real spine and its replica in one frame. Fading the
     original after the replica disappears leaves a visible gap in the row. */
  .tape-shelf__stacks .project-tape { transition: transform 620ms cubic-bezier(.2,.7,.18,1), box-shadow .18s; }
  .tape-shelf__stacks .project-tape.is-presented { opacity: 0; }
  .tape-shelf__stacks .project-tape.is-parting-left { transform: translateX(var(--part-left)); }
  .tape-shelf__stacks .project-tape.is-parting-right { transform: translateX(var(--part-right)); }
  .tape-shelf__stacks .project-tape.is-adjacent.is-parting-left { transform: translateX(var(--part-left)) rotate(-2deg); }
  .tape-shelf__stacks .project-tape.is-adjacent.is-parting-right { transform: translateX(var(--part-right)) rotate(2deg); }
  .tape-shelf__stacks .project-tape--art.is-parting-left { transform: translateX(var(--part-left)) rotate(-4deg); }
  .tape-shelf__stacks .project-tape--art.is-parting-right { transform: translateX(var(--part-right)) rotate(-4deg); }
  .tape-shelf__stacks .project-tape--art.is-adjacent.is-parting-right { transform: translateX(var(--part-right)) rotate(-3deg); }
  .tape-shelf:has(.project-tape.is-presented:focus-visible) .tape-showcase.is-open .tape-showcase__front { outline: 2px solid #fff5ce; outline-offset: 4px; }
  .tape-shelf:has(.project-tape--bentos.is-presented:focus-visible) .tape-showcase.is-open .tape-showcase__front { outline-color: #caff65; }
}
/* On narrower layouts the spines need the full row to remain individually
   visible and clickable; keep the original flat shelf, as on phones. */
@media (max-width: 1023px) { .tape-shelf__showcase { display: none; } }
/* If a future collection cannot retain readable spines beside a cover,
   keep every cassette reachable through the same scrolling flat shelf. */
.tape-shelf.is-flat .tape-shelf__showcase { display: none; }
.tape-shelf.is-flat .tape-shelf__stacks { justify-content: flex-start; overflow-x: auto; overflow-y: hidden; }
.tape-shelf.is-flat .tape-shelf__scroll-hint { display: inline; }
.tape-shelf.is-flat .tape-shelf__format { display: none; }
@media (prefers-reduced-motion: reduce) {
  .tape-showcase__spine, .tape-showcase__front, .tape-shelf__stacks .project-tape { transition: none; }
}
html.is-tape-paused .tape-showcase__spine, html.is-tape-paused .tape-showcase__front,
html.is-tape-paused .tape-shelf__stacks .project-tape { transition: none !important; }
