/* ============================================================
   LOOP STUDIOS — Premium player layer
   Cover art, now-playing dock, vinyl, beat-reactive glow and the
   featured "deck". Loaded after components.css; additive only.
   ============================================================ */

/* ---------- shared cover art square ---------- */
.cover-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: inherit;
  overflow: hidden;
  background: #0b0c0e;
  isolation: isolate;
}
.cover-art .cover-svg,
.cover-art .cover-photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
/* subtle living sheen that drifts across every generated cover */
.cover-art::after {
  content: "";
  position: absolute; inset: -40%;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.10) 48%, transparent 58%);
  transform: translateX(-30%);
  opacity: 0; transition: opacity .4s;
  pointer-events: none; z-index: 2;
}
.cover-art:hover::after { opacity: 1; animation: cover-sheen 1.4s cubic-bezier(.16,1,.3,1); }
@keyframes cover-sheen {
  from { transform: translateX(-40%); }
  to   { transform: translateX(40%); }
}

/* ============================================================
   NOW-PLAYING DOCK
   ============================================================ */
.np-dock {
  --np-accent: #c5a970;
  --np-glow: 0.3;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  padding: 0 clamp(12px, 3vw, 28px) max(12px, env(safe-area-inset-bottom));
  transform: translateY(140%);
  transition: transform .62s cubic-bezier(.16,1,.3,1);
  pointer-events: none;
}
.np-dock[data-open="true"] { transform: translateY(0); pointer-events: auto; }

.np-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(132px, 210px) minmax(120px, 1fr) auto auto auto auto;
  align-items: center;
  gap: clamp(12px, 1.6vw, 22px);
  padding: 12px clamp(14px, 1.8vw, 22px);
  border-radius: 20px;
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(20,23,20,0.86), rgba(8,10,9,0.92));
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  backdrop-filter: blur(26px) saturate(1.3);
  box-shadow:
    0 -1px 0 rgba(255,255,255,0.05) inset,
    0 26px 70px rgba(0,0,0,0.62),
    0 0 0 1px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}
/* thin accent line that lights up while playing */
.np-inner::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--np-accent), transparent);
  opacity: 0; transition: opacity .4s;
}
.np-dock.is-playing .np-inner::before { opacity: 0.7; }

/* ----- cover + vinyl ----- */
.np-cover {
  position: relative;
  z-index: 1;
  width: clamp(48px, 6vw, 60px);
  height: clamp(48px, 6vw, 60px);
  flex: 0 0 auto;
}
.np-art {
  position: absolute; inset: 0; z-index: 2;
  border-radius: 11px; overflow: hidden;
  display: block;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  transition: box-shadow .2s;
}
.np-dock.is-playing .np-art {
  box-shadow:
    0 4px 16px rgba(0,0,0,0.5),
    0 0 calc(10px + var(--np-glow,.3) * 30px) color-mix(in srgb, var(--np-accent) 70%, transparent);
}
.np-art .cover-svg, .np-art .cover-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
/* vinyl disc that peeks out from behind the artwork and spins */
.np-disc {
  position: absolute; z-index: 1;
  top: 50%; left: 58%;
  width: 92%; height: 92%;
  transform: translateY(-50%) translateX(0);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #2a2a2e 0 14%, #0c0c0e 15% 30%, #18181b 31% 33%, #0a0a0c 34% 47%, #161619 48% 50%, #0a0a0c 51%),
    #0a0a0c;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 0 4px 12px rgba(0,0,0,0.6);
  opacity: 0;
  transition: transform .55s cubic-bezier(.16,1,.3,1), opacity .4s;
}
.np-disc::after { /* spindle + label */
  content: ""; position: absolute; inset: 38%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--np-accent) 0 30%, color-mix(in srgb, var(--np-accent) 50%, #1a1a1d) 31% 100%);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
}
.np-dock.is-playing .np-disc {
  opacity: 1;
  transform: translateY(-50%) translateX(24%);
  animation: vinyl-spin 3.4s linear infinite;
}

/* ----- meta ----- */
.np-meta { min-width: 0; position: relative; z-index: 2; }
.np-title-wrap { overflow: hidden; position: relative; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
.np-title {
  display: inline-block; white-space: nowrap;
  font-family: var(--display); font-weight: 700; font-size: 1rem;
  letter-spacing: -0.01em; color: var(--fg);
}
.np-title-wrap.is-marquee .np-title { animation: np-marquee 9s linear infinite; }
.np-dock:not(.is-playing) .np-title-wrap.is-marquee .np-title { animation-play-state: paused; }
@keyframes np-marquee {
  0%, 12% { transform: translateX(0); }
  88%, 100% { transform: translateX(calc(-100% + 6ch)); }
}
.np-sub {
  display: flex; align-items: center; gap: 8px; margin-top: 3px;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.04em; color: var(--fg-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.np-sub .np-dot { opacity: 0.5; }
.np-bpm { color: var(--np-accent); }

/* ----- waveform scrubber ----- */
.np-wave-wrap { position: relative; height: 42px; min-width: 90px; }
.np-wave { width: 100%; height: 100%; display: block; }
.np-scrub {
  position: absolute; inset: 0; cursor: pointer; outline: none;
  border-radius: 6px;
}
.np-scrub:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--np-accent) 60%, transparent); }

.np-times {
  font-family: var(--mono); font-size: 0.7rem; color: var(--fg-4);
  letter-spacing: 0.04em; white-space: nowrap; display: flex; gap: 5px;
}
.np-times .np-cur { color: var(--fg-2); }
.np-times .np-sep { opacity: 0.4; }

/* ----- transport buttons ----- */
.np-controls { display: flex; align-items: center; gap: 8px; }
.np-btn {
  display: grid; place-items: center; cursor: pointer;
  border: 0; background: transparent; color: var(--fg-3);
  width: 38px; height: 38px; border-radius: 50%;
  transition: color .18s, background .18s, transform .12s;
}
.np-btn svg { width: 20px; height: 20px; }
.np-btn:hover { color: var(--fg); background: rgba(255,255,255,0.06); }
.np-btn:active { transform: scale(0.92); }
.np-btn:focus-visible { outline: 2px solid var(--np-accent); outline-offset: 2px; }

.np-play-main {
  width: 46px; height: 46px;
  background: var(--grad); color: var(--ink-on-accent);
  box-shadow: 0 6px 18px rgba(196,201,209,0.26);
}
.np-play-main:hover { transform: scale(1.06); box-shadow: var(--glow-strong); }
.np-dock.is-playing .np-play-main {
  background: var(--grad-gold); color: var(--ink-on-gold);
  box-shadow: 0 6px 20px rgba(197,169,112,0.4);
}
/* icon swap: the two SVGs are siblings inside the play/mute buttons */
.np-play svg:nth-child(2) { display: none; }
.np-dock.is-playing .np-play svg:nth-child(1) { display: none; }
.np-dock.is-playing .np-play svg:nth-child(2) { display: block; }

/* ----- volume ----- */
.np-vol { display: flex; align-items: center; gap: 6px; }
.np-mute svg:nth-child(2) { display: none; }
.np-mute.is-muted svg:nth-child(1) { display: none; }
.np-mute.is-muted svg:nth-child(2) { display: block; color: var(--fg-4); }
.np-vol-range {
  -webkit-appearance: none; appearance: none;
  width: 84px; height: 4px; border-radius: 999px; cursor: pointer;
  background: linear-gradient(90deg, var(--fg-2) 0 calc(var(--np-vol, .85) * 100%), rgba(255,255,255,0.14) calc(var(--np-vol, .85) * 100%) 100%);
}
.np-vol-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  transition: transform .12s;
}
.np-vol-range::-webkit-slider-thumb:hover { transform: scale(1.18); }
.np-vol-range::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }

.np-close {
  display: grid; place-items: center; cursor: pointer;
  border: 0; background: transparent; color: var(--fg-4);
  width: 34px; height: 34px; border-radius: 50%;
  transition: color .18s, background .18s, transform .12s;
}
.np-close svg { width: 17px; height: 17px; }
.np-close:hover { color: var(--fg); background: rgba(255,255,255,0.06); }
.np-close:active { transform: scale(0.92); }
.np-close:focus-visible { outline: 2px solid var(--np-accent); outline-offset: 2px; }

@keyframes vinyl-spin { to { transform: translateY(-50%) translateX(24%) rotate(360deg); } }

/* lift the footer so the dock never covers content */
body.has-np-dock { scroll-padding-bottom: 120px; }
body.has-np-dock .footer { padding-bottom: 120px; }

/* ----- responsive dock ----- */
@media (max-width: 880px) {
  .np-inner {
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas:
      "cover meta controls close"
      "wave  wave wave    wave";
    row-gap: 8px;
  }
  .np-cover { grid-area: cover; }
  .np-meta { grid-area: meta; }
  .np-controls { grid-area: controls; }
  .np-close { grid-area: close; }
  .np-wave-wrap { grid-area: wave; height: 34px; }
  .np-times, .np-vol { display: none; }
}
@media (max-width: 520px) {
  .np-inner { gap: 10px; padding: 10px 12px; }
  .np-prev, .np-next { display: none; }
  .np-wave-wrap { height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .np-dock { transition: none; }
  .np-dock.is-playing .np-disc { animation: none; }
  .np-title-wrap.is-marquee .np-title { animation: none; }
  .cover-art:hover::after { animation: none; }
}

/* ============================================================
   FEATURED DECK  (big player.js "lg" layout)
   ============================================================ */
.player-deck {
  grid-template-columns: clamp(132px, 24%, 210px) 1fr;
  gap: clamp(20px, 3vw, 34px);
  align-items: stretch;
  overflow: hidden;
}
.player-deck.is-playing {
  border-color: var(--gold-line);
  box-shadow: 0 0 0 1px rgba(197,169,112,0.22), 0 26px 60px rgba(0,0,0,0.5);
}
.deck-cover {
  position: relative;
  align-self: center;
  width: 100%;
  aspect-ratio: 1 / 1;
}
.deck-cover .cover-art {
  border-radius: var(--r);
  box-shadow: 0 18px 44px rgba(0,0,0,0.5);
  z-index: 2; position: relative;
  transition: transform .5s cubic-bezier(.16,1,.3,1);
}
.player-deck.is-playing .deck-cover .cover-art { transform: scale(0.965); }
/* vinyl peeking out the right edge of the deck cover */
.deck-disc {
  position: absolute; z-index: 1;
  top: 50%; left: 50%;
  width: 86%; height: 86%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #29292d 0 12%, #0b0b0d 13% 30%, #17171a 31% 33%, #0a0a0c 34% 48%, #151518 49% 51%, #0a0a0c 52%),
    #0a0a0c;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.05);
  opacity: 0;
  transition: transform .6s cubic-bezier(.16,1,.3,1), opacity .45s;
}
.deck-disc::after {
  content: ""; position: absolute; inset: 40%; border-radius: 50%;
  background: radial-gradient(circle, var(--cover-accent, var(--gold)) 0 28%, #161619 29%);
}
.player-deck.is-playing .deck-disc {
  opacity: 1;
  transform: translate(-22%, -50%);
  animation: deck-spin 4s linear infinite;
}
@keyframes deck-spin { to { transform: translate(-22%, -50%) rotate(360deg); } }

/* play button overlaps bottom-left of the cover */
.deck-play.play-btn {
  position: absolute; z-index: 3;
  left: 12px; bottom: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.5);
}
.player-deck.is-playing .deck-play.play-btn {
  background: var(--grad-gold); color: var(--ink-on-gold);
  box-shadow: var(--gold-glow);
}

@media (max-width: 560px) {
  .player-deck { grid-template-columns: 1fr; }
  .deck-cover { max-width: 240px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .player-deck.is-playing .deck-disc { animation: none; }
}

/* ============================================================
   BEAT CARD COVERS — use procedural cover-art when no photo
   ============================================================ */
.beat-card .cover-art { position: absolute; inset: 0; border-radius: 0; }
.beat-card .beat-cover.has-art { background: none; }
.beat-card .beat-cover.has-art .beat-cover-title { display: none; }

/* ============================================================
   COMPACT ROW PLAYER — cover thumb with play overlay
   ============================================================ */
.player-thumb {
  position: relative;
  width: clamp(54px, 6vw, 64px);
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  border-radius: 13px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  transition: box-shadow .3s;
}
.player-thumb .cover-art { border-radius: 13px; }
/* scrim keeps the play glyph legible over any cover */
.player-thumb::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(circle at 50% 58%, rgba(0,0,0,0.5), rgba(0,0,0,0.12));
  opacity: 0.82; transition: opacity .25s; pointer-events: none;
}
.player-row:hover .player-thumb::after { opacity: 0.95; }
.player-thumb .play-btn.sm {
  position: absolute; inset: 0; margin: auto; z-index: 2;
  width: 38px; height: 38px;
}
.player.is-playing .player-thumb {
  box-shadow:
    0 6px 18px rgba(0,0,0,0.4),
    0 0 0 1px color-mix(in srgb, var(--cover-accent) 55%, transparent),
    0 0 22px color-mix(in srgb, var(--cover-accent) 40%, transparent);
}
.player.is-playing .player-thumb .play-btn.sm {
  background: var(--grad-gold); color: var(--ink-on-gold);
}
