/* ==========================================================================
   assets/css/music.css
   Scoped to .music-page and .music-modal — no global side effects.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */

.music-page .music-subtitle {
  margin-top: -0.5rem;
  margin-bottom: 2rem;
  opacity: 0.5;
  font-size: 0.95rem;
  text-align: center;
}

.music-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.75rem;
  margin-bottom: 4rem;
}

@media (max-width: 900px) {
  .music-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .music-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* --------------------------------------------------------------------------
   Track card
   -------------------------------------------------------------------------- */

.track-card {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.track-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: #e8e8e8;
  margin-bottom: 0.6rem;
}

.track-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.track-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.track-card:hover .track-cover-wrap img {
  transform: scale(1.04);
}

.track-card:hover .track-play-icon {
  opacity: 1;
}

.track-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-title {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  /* clamp to one line */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.track-meta {
  font-size: 0.78rem;
  opacity: 0.45;
}

/* --------------------------------------------------------------------------
   Modal shell
   -------------------------------------------------------------------------- */

.music-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.music-modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  background: #1c1c1e;
  color: #f5f5f5;
  border-radius: 16px;
  display: flex;
  flex-direction: row;
  width: min(880px, 100%);
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   Close button
   -------------------------------------------------------------------------- */

.btn-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5f5f5;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   Player column (left)
   -------------------------------------------------------------------------- */

.player-col {
  flex: 0 0 340px;
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  background: #1c1c1e;
}

/* --------------------------------------------------------------------------
   Spinning disc
   -------------------------------------------------------------------------- */

.player-disc-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  flex-shrink: 0;
}

/* outer groove ring */
.disc-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: #2a2a2e;
  box-shadow:
    inset 0 0 0 2px #3a3a3e,
    0 4px 20px rgba(0, 0, 0, 0.5);
}

.player-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* center spindle dot */
.disc-center {
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #1c1c1e;
  border: 3px solid #3a3a3e;
  z-index: 2;
  pointer-events: none;
}

/* spin animation */
@keyframes disc-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.player-cover.is-playing {
  animation: disc-spin 8s linear infinite;
}

.player-cover.is-paused {
  animation: disc-spin 8s linear infinite;
  animation-play-state: paused;
}

/* --------------------------------------------------------------------------
   Track info (inside modal)
   -------------------------------------------------------------------------- */

.player-info {
  text-align: center;
  width: 100%;
}

.player-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.player-meta {
  font-size: 0.8rem;
  opacity: 0.45;
  margin: 0 0 0.5rem;
}

.player-description {
  font-size: 0.82rem;
  opacity: 0.55;
  margin: 0;
  line-height: 1.5;
  min-height: 1.2em; /* prevent layout shift when empty */
}

/* --------------------------------------------------------------------------
   Transport controls
   -------------------------------------------------------------------------- */

.player-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.player-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.time-label {
  font-size: 0.72rem;
  opacity: 0.45;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 2.4em;
}

#time-total {
  text-align: right;
}

/* progress range input */
.progress-bar {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  /* filled portion via inline style updated by JS */
  background-image: linear-gradient(
    to right,
    rgba(255,255,255,0.8) var(--progress, 0%),
    rgba(255,255,255,0.15) var(--progress, 0%)
  );
}

.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.progress-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.player-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.btn-transport {
  background: none;
  border: none;
  color: #f5f5f5;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-transport:hover {
  opacity: 1;
}

.btn-transport:active {
  transform: scale(0.92);
}

.btn-play-pause {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
}

.btn-play-pause:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* --------------------------------------------------------------------------
   Lyrics column (right)
   -------------------------------------------------------------------------- */

.lyrics-col {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 2rem 2rem;
  background: #141416;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lyrics-col.is-hidden {
  display: none;
}

.lyrics-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.35;
  margin: 0 0 1.25rem;
  flex-shrink: 0;
}

.lyrics-body {
  flex: 1;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.85;
  letter-spacing: 0.01em;
  opacity: 0.8;
  white-space: pre-line;
  /* subtle scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.lyrics-body::-webkit-scrollbar {
  width: 4px;
}

.lyrics-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Responsive: stack on mobile
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .modal-panel {
    flex-direction: column;
    max-height: 92vh;
    border-radius: 14px;
  }

  .player-col {
    flex: 0 0 auto;
    padding: 2rem 1.5rem 1.25rem;
  }

  .player-disc-wrap {
    width: 150px;
    height: 150px;
  }

  .lyrics-col {
    flex: 1;
    padding: 1rem 1.5rem 1.5rem;
    max-height: 220px;
  }
}
