/* ---------------- cover flow carousel ---------------- */

.carousel {
  position: fixed;
  inset: 0;
  z-index: 20;
  touch-action: pan-y;              /* we take over horizontal gestures */
  overscroll-behavior: contain;
}

.carousel__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.cover {
  position: absolute;
  top: var(--cover-axis);
  left: 50%;
  width: var(--cover-size);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  /* JS owns --tx / --sc / --op; only transform+opacity are animated. */
  transform: translate(-50%, -50%) translate3d(var(--tx, 0px), 0, 0) scale(var(--sc, 1));
  opacity: var(--op, 1);
  will-change: transform, opacity;
  -webkit-tap-highlight-color: transparent;
}

/* The snap itself. Removed while a drag is in progress so the covers
   track the finger, then re-applied for the settle. */
.carousel.is-snapping .cover {
  transition:
    transform var(--snap-duration) var(--snap-ease),
    opacity   var(--snap-duration) var(--snap-ease);
}

.cover:focus-visible { outline: none; }
.cover:focus-visible .cover__art {
  box-shadow: 0 0 0 3px var(--petal-200), var(--shadow-cover);
}

/* selected panel - the release-selected.png asset, faded in on the
   centre cover only */
.cover__panel {
  position: absolute;
  left: 50%;
  top: -4.5%;
  width: 130%;
  height: 137%;
  transform: translateX(-50%);
  background: url('/static/assets/release-selected.png') center / 100% 100% no-repeat;
  opacity: 0;
  transition: opacity var(--snap-duration) var(--snap-ease);
  pointer-events: none;
  mix-blend-mode: screen;
}

.cover.is-active .cover__panel { opacity: .6; }

.cover__art {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow-cover);
  background: var(--violet-800);
  filter: brightness(var(--dim, 1));
}

.cover.is-active .cover__art {
  box-shadow: var(--shadow-float), var(--glow-active);
}

.cover__art--empty {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
  background: linear-gradient(150deg, var(--violet-700), var(--violet-900));
}

/* Each cover carries its own title and date - never shared. */
.cover__meta {
  position: absolute;
  top: 100%;
  left: -12%;
  right: -12%;
  margin-top: 6.3%;
  padding: 0;
  transform: scale(var(--msc, 1));
  transform-origin: top center;
  text-shadow: 0 1px 4px rgba(43, 15, 46, .8);
}

.cover__title {
  display: block;
  margin: 0;
  font-family: var(--font-body);
  font-size: calc(var(--cover-size) * .082);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.cover__date {
  display: block;
  margin: .35em 0 0;
  font-size: calc(var(--cover-size) * .075);
  line-height: 1.3;
  opacity: .92;
}

/* hint arrows */
.carousel__hint {
  position: fixed;
  top: var(--cover-axis);
  transform: translateY(-50%);
  z-index: 25;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: var(--radius-pill);
  background: rgba(43, 15, 46, .35);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  opacity: .55;
  transition: opacity 200ms ease, transform 200ms cubic-bezier(.2, .9, .3, 1.2);
}
.carousel__hint:hover { opacity: 1; }
.carousel__hint:active { transform: translateY(-50%) scale(.94); }
.carousel__hint:focus-visible {
  outline: none;
  opacity: 1;
  box-shadow: 0 0 0 3px var(--petal-200);
}
.carousel__hint[disabled] { opacity: .12; cursor: default; }
.carousel__hint--prev { left: clamp(8px, 2vw, 30px); }
.carousel__hint--next { right: clamp(8px, 2vw, 30px); }

.carousel__empty {
  position: fixed;
  top: var(--cover-axis);
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 22;
  text-align: center;
  font-size: 18px;
  color: rgba(255, 255, 255, .9);
  text-shadow: 0 1px 4px rgba(43, 15, 46, .8);
}

@media (max-width: 760px) {
  :root { --cover-size: clamp(128px, 38vw, 220px); }
  .carousel__hint { display: none; }
}

/* Mobile: one large cover with the next one just breaking the edge, as in
   music-mobile-hamburger-menu-closed.jpg. */
@media (max-width: 760px) {
  :root {
    --cover-size: 54vw;
    --cover-axis: 35%;
  }
  .cover__title { font-size: calc(var(--cover-size) * .092); }
  .cover__date  { font-size: calc(var(--cover-size) * .085); }
}

/* ---------------- add-a-release tile (admin only) ----------------
   Occupies the slot to the left of the newest release, so scrolling left
   from the latest cover reaches it. */

/* Specificity has to beat `.cover.is-active .cover__art`, which would
   otherwise paint the active-cover drop shadow and glow around an
   invisible square. */
.cover--add .cover__art--add,
.cover--add.is-active .cover__art--add {
  display: grid;
  place-items: center;
  background: none;
  box-shadow: none;
  filter: none;
  border-radius: 0;
}

.cover__add-circle {
  display: grid;
  place-items: center;
  width: 46%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-pill);
  /* 35% transparent circle behind the + */
  background: rgba(255, 255, 255, .35);
  border: 1px solid rgba(255, 255, 255, .45);
  box-shadow: 0 2px 8px rgba(43, 15, 46, .3), 0 14px 34px rgba(43, 15, 46, .28);
  backdrop-filter: blur(2px);
  transition: transform 220ms cubic-bezier(.2, .9, .3, 1.25),
              background-color 220ms ease;
}

.cover__add-circle svg {
  width: 46%;
  height: 46%;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 3px rgba(43, 15, 46, .55));
}

.cover--add:hover .cover__add-circle {
  transform: scale(1.07);
  background: rgba(255, 255, 255, .46);
}
.cover--add:active .cover__add-circle { transform: scale(.96); }
.cover--add:focus-visible .cover__add-circle {
  box-shadow: 0 0 0 3px var(--petal-200), 0 2px 8px rgba(43, 15, 46, .3);
}
/* no selected-panel treatment on the add tile */
.cover--add .cover__panel { display: none; }
