/* ══════════════════════════════════════════════════════════
   CHRISTIAN LIU — audio-player.css
   ──────────────────────────────────────────────────────────
   Global audio player bar + shared track row component.
   Scoped to .audio-player and .track-row.
══════════════════════════════════════════════════════════ */

/* ── Body offset when player is visible ─────────────────── */
body.player-visible { padding-bottom: 88px; }

/* ── Player clears the sidebar nav on subpages ───────────── */
body:not([data-section="home"]) .audio-player {
  left: var(--nav-width);
}

@media (max-width: 1024px), (max-height: 500px) and (min-width: 1025px) {
  body:not([data-section="home"]) .audio-player {
    left: 36px;
  }
}

/* ── Player bar ─────────────────────────────────────────── */
.audio-player {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  min-height: 68px;
  height: auto;
  background: var(--color-ground);
  border-top: 1px solid rgba(28, 24, 18, 0.12);
  box-shadow: 0 -4px 24px rgba(28, 24, 18, 0.06);
  display: flex;
  align-items: center;
  z-index: 50;
  transform: translateY(100%);
  transition: transform 340ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  will-change: transform;
}

.audio-player.is-open {
  transform: translateY(0);
  pointer-events: all;
}

@media (max-width: 600px) {
  .audio-player { min-height: 76px; height: auto; }
}

/* ── Close button ───────────────────────────────────────── */
.audio-player__close {
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-muted);
  transition: color 150ms ease;
}
.audio-player__close:hover { color: var(--color-ink); }

/* ── Play / pause button ────────────────────────────────── */
.audio-player__play-btn {
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.audio-player__play-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-play);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 180ms cubic-bezier(0.16, 1, 0.3, 1),
              transform  180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.audio-player__play-btn:hover .audio-player__play-icon {
  background: #bf3b1b;
  transform: scale(1.04);
}

.audio-player__play-btn:active .audio-player__play-icon {
  transform: scale(0.96);
}

.ap-icon-play,
.ap-icon-pause {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 80ms ease;
  pointer-events: none;
}

/* ── Right content column (info + progress) ─────────────── */
.audio-player__right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 8px 16px 8px 8px;
}

/* ── Track info block ───────────────────────────────────── */
.audio-player__info {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.audio-player__title-inner {
  display: inline;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink);
  letter-spacing: 0.01em;
}

.audio-player__source {
  display: inline;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-muted);
}

.audio-player__source:not(:empty)::before {
  content: ' · ';
  opacity: 0.6;
}

/* ── Progress row (scrubber + timestamp) ────────────────── */
.audio-player__progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Scrubber ───────────────────────────────────────────── */
.audio-player__scrubber {
  flex: 1;
  min-width: 60px;
  padding: 7px 0;
  cursor: pointer;
  outline: none;
}

.audio-player__scrubber:focus-visible {
  outline: 2px solid var(--color-play);
  outline-offset: 8px;
  border-radius: 2px;
}

.audio-player__track-line {
  position: relative;
  height: 2px;
  background: rgba(200, 169, 122, 0.40);
  border-radius: 1px;
}

.audio-player__fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--color-play);
  border-radius: 1px;
  pointer-events: none;
}

.audio-player__dot {
  position: absolute;
  top: 50%; left: 0%;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-play);
  transform: translate(-50%, -50%);
  transition: width 120ms ease, height 120ms ease;
  pointer-events: none;
}

.audio-player__scrubber:hover .audio-player__dot {
  width: 14px; height: 14px;
}

/* ── Timestamp ──────────────────────────────────────────── */
.audio-player__timestamp {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 68px;
  text-align: right;
  padding: 0;
  flex-shrink: 0;
}

/* ── Mobile: stacked layout with X top-right ────────────── */
@media (max-width: 600px) {
  body.player-visible { padding-bottom: 84px; }

  /* Close button: pulled out of flex flow, pinned top-right */
  .audio-player__close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
  }

  /* Right: column — title, subtitle, scrubber */
  .audio-player__right {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 8px 36px 8px 4px;
  }

  /* Info: show title and subtitle stacked as separate lines */
  .audio-player__info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: normal;
    text-overflow: clip;
    gap: 1px;
  }

  .audio-player__title-inner {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .audio-player__source {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .audio-player__source:not(:empty)::before {
    content: none;
  }

  /* Hide timestamp */
  .audio-player__timestamp { display: none; }
}

/* ══════════════════════════════════════════════════════════
   SHARED TRACK ROW
══════════════════════════════════════════════════════════ */

.track-list { display: flex; flex-direction: column; }

.track-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(28, 24, 18, 0.07);
  border-left: 2px solid transparent;
  transition: background-color 160ms ease, border-left-color 160ms ease;
  margin: 0 -8px;
}


.track-row:hover:not(.track-row--unavailable) {
  background-color: rgba(28, 24, 18, 0.03);
}

.track-row--active { border-left-color: var(--color-play); }

/* ── Row play button ────────────────────────────────────── */
.track-row__play {
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: default;
}

.track-row__play-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-play);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: background 150ms ease, transform 120ms ease;
}

.track-row__play-icon:hover { background: #bf3b1b; transform: scale(1.06); }

.track-row--unavailable .track-row__play-icon {
  opacity: 0.4;
  cursor: not-allowed;
}

.ap-row-icon-play,
.ap-row-icon-pause {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

/* ── Row info ───────────────────────────────────────────── */
.track-row__info { min-width: 0; }

.track-row__title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.track-row__meta {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

/* ── Row right ──────────────────────────────────────────── */
.track-row__right { flex-shrink: 0; text-align: right; }

.track-row__duration {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-muted);
  opacity: 0.6;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.track-row--unavailable .track-row__duration { display: none; }

.track-row__coming {
  display: none;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--color-muted);
  opacity: 0.45;
  white-space: nowrap;
}

.track-row--unavailable .track-row__coming { display: block; }
