/* ==========================================================================
   Tracklist section
   Signature element: tracks rendered as a glitching data readout, echoing
   the disc-artwork concept of a tracklist etched into the record itself.
   ========================================================================== */

.tracklist-section {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tracklist-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 64px;
  align-items: start;
}

.tracklist-visuals {
  position: sticky;
  top: 110px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tracklist-visuals__caption {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bone-dim);
  letter-spacing: 0.06em;
  text-align: center;
}

.tracklist-visuals__frame {
  display: block;
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  padding: 8px;
  background: var(--ink);
  cursor: zoom-in;
  transition: border-color 0.2s var(--ease);
}

.tracklist-visuals__frame:hover,
.tracklist-visuals__frame:focus-visible {
  border-color: var(--flare);
}

.tracklist-visuals__frame:hover .tracklist-visuals__zoom-hint,
.tracklist-visuals__frame:focus-visible .tracklist-visuals__zoom-hint {
  opacity: 1;
}

.tracklist-visuals__zoom-hint {
  position: absolute;
  inset: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(10, 10, 12, 0.72);
  color: var(--bone);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

/* Always show the hint on touch devices, since there's no hover state */
@media (hover: none) {
  .tracklist-visuals__zoom-hint {
    opacity: 1;
    background: rgba(10, 10, 12, 0.45);
  }
}

.tracklist-visuals__frame img {
  width: 100%;
  height: auto;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.track-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s var(--ease);
}

.track-row:hover {
  background: var(--surface-2);
}

.track-row.is-playing {
  background: color-mix(in srgb, var(--flare) 7%, var(--surface));
}

.track-row__index {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--bone-dim);
  font-variant-numeric: tabular-nums;
}

.track-row.is-playing .track-row__index {
  color: var(--flare);
}

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

.track-row__title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  color: var(--bone);
}

.track-row__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bone-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Custom-styled audio control — wraps the native <audio> element so the
   browser's default chrome is fully replaced. */
.track-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.track-player__toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--bone);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.15s var(--ease);
}

.track-player__toggle:hover,
.track-player__toggle:focus-visible {
  border-color: var(--flare);
}

.track-player__toggle:active {
  transform: scale(0.94);
}

.track-row.is-playing .track-player__toggle {
  background: var(--flare);
  border-color: var(--flare);
  color: var(--ink);
}

.track-player__toggle svg {
  width: 14px;
  height: 14px;
}

.track-player__scrub {
  width: 120px;
  height: 3px;
  background: var(--line);
  position: relative;
  border-radius: 999px;
  overflow: hidden;
}

.track-player__scrub-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--flare);
  transition: width 0.1s linear;
}

.track-player__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--bone-dim);
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.track-player audio {
  display: none;
}

.tracklist-note {
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bone-dim);
  letter-spacing: 0.04em;
}

@media (max-width: 900px) {
  .tracklist-layout {
    grid-template-columns: 1fr;
  }

  .tracklist-visuals {
    position: static;
  }

  .tracklist-visuals__frame {
    max-width: 280px;
  }

  .track-row {
    grid-template-columns: 32px minmax(0, 1fr);
    row-gap: 12px;
  }

  .track-player {
    grid-column: 1 / -1;
  }

  .track-player__scrub {
    width: 100%;
    flex: 1;
  }
}
