﻿/* ============================================================
   SCHOLA CANTORUM — player.css
   Liturgical audio player, cover art, track list & lyrics/meditation
   ============================================================ */

/* ── Player Container ─────────────────────────────────────── */
.player {
  max-width: 740px;
  margin: 0 auto var(--space-12);
  padding: var(--space-8);
  background: rgba(201, 168, 76, 0.035);
  border: 1px solid var(--gold-border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.player::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 50% at 50% 0%,
    rgba(201, 168, 76, 0.08) 0%,
    transparent 75%);
  pointer-events: none;
}

/* ── Header Row (Cover, Info, Wave) ───────────────────────── */
.player__header-row {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

/* Cover Art / Icon Box */
.player__cover-container {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border: 1px solid var(--gold-border);
  background: rgba(8, 6, 4, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.player__cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.player__cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.player__cover-icon {
  width: 34px;
  height: 34px;
  fill: var(--gold-dim);
  transition: fill var(--dur-med) ease;
}
.player.playing .player__cover-icon {
  fill: var(--gold);
}

/* Track Info */
.player__track-info {
  flex: 1;
  min-width: 0;
}

.player__psalm-badge {
  display: inline-block;
  font-family: var(--font-title);
  font-size: var(--text-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-1);
}

.player__track-title {
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--parchment);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-1);
}

.player__track-desc {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Wave Visualizer ──────────────────────────────────────── */
.player__wave {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  height: 44px;
  padding: 0 var(--space-2);
}

.wave-bar {
  display: inline-block;
  width: 3px;
  border-radius: 2px;
  background: var(--gold);
  opacity: 0.65;
  transform-origin: center bottom;
  animation: wave-bar 1.4s ease-in-out infinite;
}

.wave-bar:nth-child(1)  { height: 14px; animation-delay: 0.00s; }
.wave-bar:nth-child(2)  { height: 22px; animation-delay: 0.08s; }
.wave-bar:nth-child(3)  { height: 32px; animation-delay: 0.16s; }
.wave-bar:nth-child(4)  { height: 24px; animation-delay: 0.24s; }
.wave-bar:nth-child(5)  { height: 38px; animation-delay: 0.32s; }
.wave-bar:nth-child(6)  { height: 28px; animation-delay: 0.40s; }
.wave-bar:nth-child(7)  { height: 42px; animation-delay: 0.48s; }
.wave-bar:nth-child(8)  { height: 30px; animation-delay: 0.56s; }
.wave-bar:nth-child(9)  { height: 36px; animation-delay: 0.64s; }
.wave-bar:nth-child(10) { height: 22px; animation-delay: 0.72s; }
.wave-bar:nth-child(11) { height: 30px; animation-delay: 0.80s; }
.wave-bar:nth-child(12) { height: 18px; animation-delay: 0.88s; }
.wave-bar:nth-child(13) { height: 26px; animation-delay: 0.96s; }
.wave-bar:nth-child(14) { height: 16px; animation-delay: 1.04s; }

@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.22); opacity: 0.3; }
  50%       { transform: scaleY(1);    opacity: 0.95; }
}

.player__wave.paused .wave-bar { animation-play-state: paused; opacity: 0.4; }
.player__wave.idle .wave-bar   { animation: none; transform: scaleY(0.12); opacity: 0.2; }

/* ── Controls ─────────────────────────────────────────────── */
.player__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
}

.player__ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--dur-fast) ease;
}

.player__ctrl-btn:disabled {
  opacity: 0.25;
  pointer-events: none;
}

.player__ctrl-btn:not(:disabled):hover {
  color: var(--gold-light);
  transform: translateY(-1px);
}
.player__ctrl-btn:not(:disabled):active {
  transform: scale(0.92);
}

.player__ctrl-btn svg { fill: currentColor; }
.player__ctrl-btn--sm svg { width: 28px; height: 28px; }

/* Main play button */
.player__ctrl-btn--main {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-border);
  color: var(--gold);
  background: rgba(201, 168, 76, 0.05);
  transition: all var(--dur-med) ease;
}

.player__ctrl-btn--main:not(:disabled):hover {
  color: var(--bg-deep);
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 35px rgba(201, 168, 76, 0.4);
}

.player__ctrl-btn--main svg { width: 30px; height: 30px; }
.icon-pause { display: none; }
.player__ctrl-btn--main.playing .icon-play  { display: none; }
.player__ctrl-btn--main.playing .icon-pause { display: block; }

/* ── Progress Bar ─────────────────────────────────────────── */
.player__progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.player__time {
  font-family: var(--font-title);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--text-dim);
  min-width: 2.8rem;
  text-align: center;
  user-select: none;
}

.player__progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(201, 168, 76, 0.14);
  position: relative;
  cursor: pointer;
  border-radius: 2px;
}

.player__progress-bar:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.player__progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(to right, var(--gold-dim), var(--gold-light));
  border-radius: 2px;
  width: 0%;
}

.player__progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.6);
  opacity: 0;
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
  pointer-events: none;
}

.player__progress-bar:hover .player__progress-thumb { opacity: 1; }
.player__progress-bar:active .player__progress-thumb {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.3);
}

/* ── Footer Row: Lyrics button & Volume ───────────────────── */
.player__footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--gold-border-subtle);
}

.player__action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--gold-border-subtle);
  background: rgba(201, 168, 76, 0.03);
  transition: all var(--dur-fast) ease;
}

.player__action-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.player__action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--gold);
  color: var(--gold-light);
}

.player__volume-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.player__vol-btn {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  transition: color var(--dur-fast) ease;
}
.player__vol-btn:hover { color: var(--gold); }
.player__vol-btn svg { width: 20px; height: 20px; fill: currentColor; }

.player__vol-bar {
  width: 85px;
  height: 4px;
  background: rgba(201, 168, 76, 0.14);
  position: relative;
  cursor: pointer;
  border-radius: 2px;
}

.player__vol-bar:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.player__vol-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--gold-dim);
  border-radius: 2px;
  pointer-events: none;
}

/* ── Track List Wrapper ───────────────────────────────────── */
.track-list-wrapper {
  max-width: 740px;
  margin: 0 auto var(--space-12);
}

.track-list-header {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--gold-border);
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.track-list-header__order { text-align: center; }
.track-list-header__title { padding-left: var(--space-2); }
.track-list-header__action { text-align: right; }

.track-list {
  list-style: none;
}

.track-list__item {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--gold-border-subtle);
  cursor: pointer;
  transition: all var(--dur-fast) ease;
  position: relative;
}

.track-list__item:hover {
  background: rgba(201, 168, 76, 0.05);
}

.track-list__item--active {
  background: rgba(201, 168, 76, 0.08);
}
.track-list__item--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold);
}

.track-list__num {
  font-family: var(--font-title);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  text-align: center;
  user-select: none;
}
.track-list__item--active .track-list__num { color: var(--gold); font-weight: 600; }

.track-list__info { min-width: 0; }

.track-list__title-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.track-list__title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--parchment);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
  transition: color var(--dur-fast) ease;
}
.track-list__item--active .track-list__title,
.track-list__item:hover .track-list__title {
  color: var(--gold-light);
}

.track-list__psalm {
  font-family: var(--font-title);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.track-list__desc-snippet {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-list__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.track-list__dur {
  font-family: var(--font-title);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.track-list__lyrics-btn {
  font-family: var(--font-title);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 4px 10px;
  border: 1px solid var(--gold-border);
  background: rgba(201, 168, 76, 0.03);
  transition: all var(--dur-fast) ease;
  white-space: nowrap;
}

.track-list__lyrics-btn:hover {
  background: var(--gold);
  color: var(--bg-deep);
  border-color: var(--gold);
}

/* ── Lyrics & Meditation Panel ────────────────────────────── */
.lyrics-panel {
  max-width: 740px;
  margin: 0 auto var(--space-12);
  padding: var(--space-8);
  border: 1px solid var(--gold-border);
  background: rgba(245, 236, 215, 0.035);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  position: relative;
}

.lyrics-panel[hidden] { display: none; }

.lyrics-panel__inner {
  max-width: 600px;
  margin: 0 auto;
}

.lyrics-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--gold-border-subtle);
}

.lyrics-panel__psalm {
  font-family: var(--font-title);
  font-size: var(--text-xs);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-1);
}

.lyrics-panel__title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--parchment);
}

.lyrics-panel__close {
  flex-shrink: 0;
  color: var(--text-dim);
  padding: var(--space-2);
  transition: color var(--dur-fast) ease;
}
.lyrics-panel__close:hover { color: var(--gold); }
.lyrics-panel__close svg { width: 24px; height: 24px; fill: currentColor; }

.lyrics-panel__desc {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: center;
  margin-bottom: var(--space-6);
  padding: 0 var(--space-4);
}

.lyrics-panel__divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-8);
}
.lyrics-panel__divider span {
  color: var(--gold-dim);
  font-size: 0.8rem;
}

.lyrics-panel__body {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--text-primary);
  line-height: 2.1;
  white-space: pre-line;
  text-align: center;
}

/* ── Responsive adjustments ───────────────────────────────── */
@media (max-width: 640px) {
  .player { padding: var(--space-6) var(--space-4); }

  .player__header-row {
    flex-wrap: wrap;
    gap: var(--space-4);
  }

  .player__wave { order: 3; width: 100%; justify-content: center; height: 32px; }

  .track-list-header { display: none; }

  .track-list__item {
    grid-template-columns: 2.2rem 1fr auto;
    padding: var(--space-4) var(--space-2);
  }

  .track-list__lyrics-btn span { display: none; }
  
  .player__footer-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }

  .player__volume-group {
    justify-content: flex-end;
  }
}
