/* ── Audio page: record grid + now-playing bar (audio.php / js/audio.js) ── */

.jukebox {
  --navy: #023546;
  --navy-hover: #04516b;
  --viz: #4fa3c0;
  width: 100%;          /* auto margins on a flex child would otherwise shrink it to its content */
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  text-align: center;
}
.jukebox h1 {
  color: var(--navy);
  margin-bottom: 0.25em;
}
.jukebox-hint,
.jukebox-empty {
  color: #555;
  margin-bottom: 2rem;
}

/* ── Grid: 2 records on phones, more as the screen widens ── */
.record-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: 2rem 1.5rem;
}
@media (min-width: 400px) {
  .record-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 700px) {
  .record-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
/* A single record shouldn't stretch across the whole page */
.record-grid:has(> li:only-child) {
  grid-template-columns: minmax(0, 320px);
  justify-content: center;
}

/* ── Record button ── */
.record-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.5rem;
  border: 0;
  border-radius: 12px;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.record-card:hover {
  transform: translateY(-4px);
}
.record-card:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 4px;
}
.record-card.is-current {
  background-color: rgba(2, 53, 70, 0.07);
}
.record-title {
  margin-top: 0.6rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.25;
}
.record-artist {
  font-size: 0.9rem;
  color: #555;
}

/* ── The vinyl itself (pure CSS, scales with the card) ── */
.vinyl {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    /* light sheen */
    conic-gradient(from 30deg, transparent 0 10%, rgba(255, 255, 255, 0.14) 15%, transparent 22% 60%, rgba(255, 255, 255, 0.1) 65%, transparent 72%),
    /* grooves */
    repeating-radial-gradient(circle at center, #111 0 2px, #1e1e1e 2px 4px),
    #111;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 0 0 4px #0a0a0a;
}
.vinyl-label {
  position: absolute;
  inset: 32%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--label, #e8b04a);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5);
}
.vinyl-label img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.vinyl-label-text {
  padding: 0 12%;
  font-size: clamp(0.55rem, 1.6vw, 0.8rem);
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  overflow-wrap: anywhere;
}
/* spindle hole */
.vinyl::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5%;
  height: 5%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #f4f4f4;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Spin while playing; pausing freezes it at its current angle */
.record-card.is-current .vinyl {
  animation: vinyl-spin 1.8s linear infinite;
  animation-play-state: paused;
}
.record-card.is-playing .vinyl {
  animation-play-state: running;
}
@keyframes vinyl-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .record-card.is-current .vinyl { animation: none; }
  .record-card:hover { transform: none; }
}

/* ── Now-playing bar: sticks to the bottom of the screen while scrolling ── */
.now-playing {
  position: sticky;
  bottom: 0;
  z-index: 50;
  margin-top: 2.5rem;
  padding: 0.75rem 1rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "viz      viz"
    "info     mute"
    "controls controls"
    "seek     seek"
    "status   status";
  align-items: center;
  gap: 0.5rem 1rem;
  border-radius: 12px 12px 0 0;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}
.now-playing[hidden] {
  display: none;
}
@media (min-width: 700px) {
  .now-playing {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.4fr) auto;
    grid-template-areas:
      "viz  viz      viz  viz"
      "info controls seek mute"
      "status status status status";
    border-radius: 12px;
    bottom: 1rem;
  }
}

.visualizer {
  grid-area: viz;
  width: 100%;
  height: 40px;
  opacity: 0.25;
  transition: opacity 0.3s ease;
}
.now-playing.is-playing .visualizer {
  opacity: 1;
}

.np-info {
  grid-area: info;
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}
.np-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-artist {
  font-size: 0.85rem;
  opacity: 0.8;
}

.np-controls {
  grid-area: controls;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}
.np-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.np-btn[hidden] {
  display: none;
}
.np-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.np-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.np-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.np-play {
  width: 52px;
  height: 52px;
  background: #fff;
  color: var(--navy);
}
.np-play:hover {
  background: #dfeff4;
}
.np-play .icon-pause,
.now-playing.is-playing .np-play .icon-play {
  display: none;
}
.now-playing.is-playing .np-play .icon-pause {
  display: block;
}
.np-mute {
  grid-area: mute;
}
.np-mute .icon-muted,
.np-mute[aria-pressed="true"] .icon-sound {
  display: none;
}
.np-mute[aria-pressed="true"] .icon-muted {
  display: block;
}

.np-seek {
  grid-area: seek;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.np-time {
  min-width: 2.6em;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.np-seek input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--viz);
  cursor: pointer;
}

.np-status {
  grid-area: status;
  margin: 0;
  font-size: 0.85rem;
  min-height: 0;
}
.np-status:empty {
  display: none;
}
