/* =============================================================
   LIFETIME RECORDS — player.css
   Full-width persistent bar player at the bottom of every page.
   Ports the design from /Projects/HTML Audio Player/bar.html and
   reskins it with the LR palette (ink / paper / neon / red).
   ============================================================= */

:root {
  --lr-bar-h: 76px;
}

/* Reserve space at the bottom of every page once the bar appears, so
   page content (footer especially) doesn't get hidden behind it. */
body.lr-player-active {
  padding-bottom: var(--lr-bar-h);
}

.bar-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--lr-bar-h);
  background: var(--ink);
  color: var(--paper);
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto 1fr auto;
  align-items: center;
  padding: 0 16px;
  gap: 18px;
  z-index: 1000;
  font-family: var(--font-body);
  /* Triple-safety hidden: visibility, opacity, AND transform. If any
     one of these fails to apply (mobile Safari layout race, etc.) the
     others still keep the bar invisible until JS adds .is-visible. */
  visibility: hidden;
  opacity: 0;
  /* iOS Safari can lose `position: fixed` for elements when an ancestor
     uses `overflow: hidden` (which we have on body). Forcing a
     compositor layer with translateZ(0) + will-change: transform locks
     the bar to its own GPU layer so it stays anchored to the viewport
     bottom on mobile instead of scrolling with the page. */
  transform: translate3d(0, 100%, 0);
  -webkit-transform: translate3d(0, 100%, 0);
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  pointer-events: none;
  transition:
    transform .35s var(--ease-out),
    opacity .25s var(--ease-out),
    visibility 0s linear .35s;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
}
.bar-player.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  pointer-events: auto;
  transition:
    transform .35s var(--ease-out),
    opacity .25s var(--ease-out),
    visibility 0s linear 0s;
}

/* ---- Track info (left) ---- */
.bar-track {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.bar-art {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.bar-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bar-art svg {
  opacity: 0.4;
  fill: var(--paper);
}
.bar-meta {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.bar-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--paper);
}
.bar-artist {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Controls ---- */
.bar-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.bar-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color .15s, background .15s, transform .15s;
  padding: 0;
}
.bar-btn:hover { color: var(--paper); background: rgba(255, 255, 255, 0.06); }
.bar-btn:active { transform: scale(0.92); }
.bar-btn-sm { width: 34px; height: 34px; }
.bar-btn-sm.active { color: var(--neon); }
.bar-btn-sm.active:hover { color: var(--neon); }
.bar-btn-play {
  width: 40px;
  height: 40px;
  background: var(--neon);
  color: var(--ink);
  margin: 0 4px;
}
.bar-btn-play:hover {
  background: var(--neon);
  color: var(--ink);
  filter: brightness(1.05);
}

/* ---- Waveform / progress ---- */
.bar-waveform-section {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.bar-time {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
  flex-shrink: 0;
}
.bar-waveform {
  flex: 1;
  height: 42px;
  cursor: pointer;
  position: relative;
  min-width: 80px;
}
.bar-waveform canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Right-side actions ---- */
.bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.bar-actions .bar-btn-soundcloud,
.bar-actions .bar-btn-spotify {
  color: var(--neon);
}
.bar-actions .bar-btn-soundcloud:hover,
.bar-actions .bar-btn-spotify:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--neon);
}

/* ---- Close button — same hover-rotate pattern as the modal close. ---- */
.bar-btn-close {
  color: rgba(255, 255, 255, 0.55);
  transition: color .15s, background .15s, transform .35s var(--ease-out);
}
.bar-btn-close:hover {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(90deg);
}

/* ---- Resume chip ----------------------------------------------------
   Small floating circle (cover-art thumbnail) that replaces the bar
   when the user clicks ×. Click it to bring the bar back at the same
   track + position. ----------------------------------------------- */
.bar-resume {
  position: fixed;
  bottom: 1rem;
  right: var(--gutter);
  z-index: 1000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--paper);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(20px) scale(.85);
  pointer-events: none;
  transition: transform .35s var(--ease-out), opacity .35s var(--ease-out), box-shadow .2s;
}
.bar-resume[hidden] { display: none; }
.bar-resume.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.bar-resume:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.bar-resume__art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--ink-2);
}
.bar-resume__icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.55);
  color: var(--neon);
  opacity: 0;
  transition: opacity .15s;
}
.bar-resume:hover .bar-resume__icon { opacity: 1; }

@media (max-width: 480px) {
  .bar-resume { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .bar-resume,
  .bar-resume.is-visible,
  .bar-resume:hover {
    transition: opacity .2s;
    transform: none;
  }
}

/* ---- Responsive ---- */
@media (max-width: 1080px) {
  .bar-player { grid-template-columns: minmax(140px, 200px) auto 1fr auto; gap: 12px; }
}
@media (max-width: 760px) {
  .bar-player {
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
      "track controls actions";
    gap: 10px;
    padding: 0 10px;
  }
  .bar-track { grid-area: track; }
  .bar-controls { grid-area: controls; gap: 0; }
  .bar-waveform-section { display: none; }
  .bar-actions { grid-area: actions; }
  .bar-art { width: 40px; height: 40px; }
  .bar-btn-sm { width: 32px; height: 32px; }
  .bar-btn-play { width: 36px; height: 36px; }
  #btnShuffle, #btnRepeat, #btnPrev { display: none; }
}
@media (max-width: 480px) {
  .bar-artist { display: none; }
  .bar-actions .bar-btn-soundcloud,
  .bar-actions .bar-btn-spotify { display: none; }
}

/* ---- Active-track state on the homepage release cards. Outline +
        neon accent applied to whichever card matches the bar player's
        current SC index. ---- */
[data-sc-index].is-playing .release__art,
[data-sc-index].is-playing .featured__art {
  outline: 2px solid var(--neon);
  outline-offset: 4px;
}
