/* Composited vinyl record layers — color selector + future reuse */

.layered-record {
  /* Label SVG 510 / disc SVG viewBox 1190 */
  --layered-record-label-scale: 0.4285714286;
  /* Disc SVG viewBox 1190 — texture PNG 1200px artboard */
  --layered-record-texture-scale: 0.991666667;
  --layered-record-shadow: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.22));
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
}

.layered-record__stack {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  /* Self-contained blend group: the disc blends against the in-stack backdrop
     and the texture composites over the disc, independent of carousel transforms. */
  isolation: isolate;
}

/* 0 — blend backdrop: a continuation of the panel background, positioned via
   --record-bd-* (set by the colors section) so it lines up with the real scene.
   Transparent unless a translucent context fills it. */
.layered-record__backdrop {
  grid-area: 1 / 1;
  z-index: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-image: var(--record-bd-image, none);
  background-size: var(--record-bd-size, cover);
  background-position: var(--record-bd-pos, center);
  background-repeat: no-repeat;
  filter: blur(var(--record-bd-blur, 6px));
  opacity: 0;
  pointer-events: none;
}

/* 1 — colored record disc (SVG) */
.layered-record__record {
  grid-area: 1 / 1;
  z-index: 1;
  position: relative;
  width: 100%;
  height: 100%;
  color: var(--record-color, #141412);
  filter: var(--layered-record-shadow);
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.layered-record__record-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 2 — groove / highlight texture (transparent PNG) */
.layered-record__texture {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: var(--texture-opacity, 1);
  transform: translate(-50%, -50%) scale(var(--layered-record-texture-scale));
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
}

/* 3 — spinning label + logo */
.layered-record__label-group {
  grid-area: 1 / 1;
  z-index: 3;
  position: relative;
  width: calc(100% * var(--layered-record-label-scale));
  aspect-ratio: 1 / 1;
  transform-origin: center center;
  animation: layered-record-spin 1.818181818s linear infinite;
}

.layered-record[data-static] .layered-record__label-group {
  animation: none;
}

.layered-record__label-svg,
.layered-record__logo-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.layered-record__label-svg {
  color: var(--label-color, #141412);
}

.layered-record__logo-svg {
  color: var(--logo-color, #f4f4f4);
}

/* 33 RPM — one revolution per 60/33 seconds */
@keyframes layered-record-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .layered-record__label-group {
    animation: none;
  }
}

/* ── Colors section — per-layer opacity + blend (both finishes) ────────────
   Effects are driven by CSS vars set per record/subtype from the CMS. Opaque
   defaults are no-ops (opacity 1, blend normal); translucent defaults give the
   glassy look. The disc darkens against the backdrop (a continuation of the
   panel scene); the texture lightens over the disc. */
.colors-right .layered-record__record {
  opacity: var(--record-opacity, 1);
  mix-blend-mode: var(--record-blend-mode, normal);
}

.colors-right .layered-record__texture {
  mix-blend-mode: var(--texture-blend-mode, normal);
}

.colors-right.is-translucent .layered-record__backdrop {
  opacity: 1;
}

.colors-right.is-translucent .layered-record__record {
  filter: brightness(1.1) saturate(0.85);
}
