/* ============================================================
   player.css — audio track rows, the waveform, video cards.
   ============================================================ */

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

.track { display: grid; gap: var(--sp-2); }

/* The media element lives in the DOM but is never shown; the waveform
   and the play button are the interface. */
.track > audio { display: none; }

.track__bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-2);
}

.track--row .track__bar,
.track--compact .track__bar { gap: var(--sp-2); }

.track--row .track__bar { grid-template-columns: auto auto 1fr auto; }

.track__num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 1.5rem;
}

.track__play {
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
  color: var(--accent);
  background: var(--bg);
  transition: background 160ms ease, color 160ms ease, transform 120ms ease;
  flex: none;
}

.track__play svg { width: 20px; height: 20px; fill: currentColor; }

.track__play:hover { background: var(--accent); color: #000; }
.track__play:active { transform: scale(0.94); }

.track.is-playing .track__play { background: var(--accent); color: #000; }

.track--row .track__play,
.track--compact .track__play { width: 40px; height: 40px; }

.track__title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.track--row .track__title,
.track--compact .track__title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
}

.track__desc {
  margin-top: 0.35rem;
  color: var(--text-muted);
  max-width: 55ch;
}

.track__time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.track.is-errored .track__title { color: var(--text-muted); }

.track.is-errored::after {
  content: 'Audio unavailable';
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--neon-red);
}

/* Album rows and member players are more compact than a single. */
.track--row { padding: var(--sp-2); }
.track--compact {
  padding: var(--sp-2);
  border: 1px solid var(--hairline);
  background: var(--surface);
}

/* ------------------------------------------------------------------
   Waveform
   ------------------------------------------------------------------ */

.waveform {
  --wave-bar: 3px;
  --wave-gap: 2px;
  position: relative;
  height: 64px;
  width: 100%;
  cursor: pointer;
  touch-action: none;              /* pointer drag scrubs, not scrolls */
}

.track--row .waveform,
.track--compact .waveform { height: 40px; }

.waveform canvas { width: 100%; height: 100%; }

/* Playhead */
.waveform__cursor {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--pos, 0%);
  width: 1px;
  background: var(--accent);
  opacity: 0.85;
  pointer-events: none;
}

/* Hover scrub line + time tooltip, fine pointers only. */
.waveform__tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: var(--hover-pos, 0%);
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: #000;
  background: var(--accent);
  padding: 0.15em 0.45em;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}

.waveform.is-hovered::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: var(--hover-pos, 0%);
  width: 1px;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  pointer-events: none;
}

@media (pointer: fine) {
  .waveform.is-hovered .waveform__tip { opacity: 1; }
}

.waveform:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ------------------------------------------------------------------
   Video
   ------------------------------------------------------------------ */

.video { display: grid; gap: var(--sp-2); }

.video__frame {
  position: relative;
  border: 1px solid var(--hairline);
  background: var(--surface);
  overflow: hidden;
}

.video--landscape .video__frame { aspect-ratio: 16 / 9; }
.video--portrait .video__frame  { aspect-ratio: 9 / 16; }

.video__launch {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.video__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease, filter 250ms ease;
}

.video__launch:hover .video__poster {
  transform: scale(1.03);
  filter: drop-shadow(1.5px 0 0 rgba(255, 59, 31, 0.5))
          drop-shadow(-1.5px 0 0 rgba(34, 211, 238, 0.5));
}

.video__badge {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 68px; height: 68px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.65);
  border: 2px solid var(--accent);
  color: var(--accent);
  transition: background 180ms ease, color 180ms ease;
}

.video__badge svg { width: 28px; height: 28px; fill: currentColor; }

.video__launch:hover .video__badge { background: var(--accent); color: #000; }

.video__media {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #000;
  object-fit: contain;
}

.video__frame.is-errored::after {
  content: 'Video unavailable';
  position: absolute;
  inset: auto 0 0 0;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--neon-red);
  background: rgba(0, 0, 0, 0.85);
  padding: 0.5em;
  text-align: center;
}

.video__title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.3;
}

.video__desc {
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: var(--fs-small);
}
