/* ==========================================================================
   player.css — the player bar fixed to the bottom of every page
   Pair with <body class="has-player"> (adds room at the bottom of the page).
   ========================================================================== */

/* ---- The bar itself: fixed to the bottom of the screen -------------------- */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  height: 78px;
  background: var(--black);
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 clamp(14px, 2.2vw, 34px);
  font-size: 1.8rem;
  line-height: 1;
}

/* ---- Tabs (Listen live | Play offcast) sitting on top of the bar ---------- */

.player__tabs {
  position: absolute;
  left: 50%;
  top: -37px;
  transform: translateX(-50%);
  height: 38px;
  display: flex;
  align-items: stretch;
  background: var(--black);
  border-radius: 8px 8px 0 0;
  padding: 0 6px;
}

.player__tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 1.8rem;
  text-transform: uppercase;
  letter-spacing: 0;
  opacity: 0.85;
  transition:
    color 0.2s,
    opacity 0.2s;
}

.player__tab:hover {
  opacity: 1;
}

.player__tab[aria-selected="true"] {
  color: var(--red);
  opacity: 1;
}

.player__tab svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player__tab--live svg {
  stroke: var(--red);
  fill: var(--red);
}

.player__tab:focus-visible,
.player__btn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---- Left: cover, track name --------------------------------------- */

.player__now {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player__cover {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 2px;
  object-fit: cover;
  background: #222;
}

.player__track {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
}

.player__track.is-scrolling {
  text-overflow: clip;
}

.player__track b {
  font-weight: normal;
  color: var(--red);
  text-transform: uppercase;
  margin-right: 6px;
}

.player__track .js-track-separator {
  margin: 0 0.35em;
}

.player__now .heart {
  flex: none;
}

/* ---- Centre: transport controls + volume ---------------------------------- */

.player__controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.player__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid #8a8a8a;
  border-radius: 50%;
  background: transparent;
  color: #bdbdbd;
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s,
    transform 0.15s;
}

.player__btn:hover {
  color: #fff;
  border-color: #fff;
}

.player__btn:active {
  transform: scale(0.94);
}

.player__btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.player__btn--skip {
  width: 48px;
  height: 48px;
  border-color: transparent;
  color: #a8a8a8;
}

.player__btn--skip:hover {
  color: #fff;
  border-color: transparent;
}

.player__btn--skip svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 44px;
  height: 44px;
}

.player__btn--skip small {
  position: absolute;
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
}

.player__btn--play {
  width: 44px;
  height: 44px;
  border-color: var(--red);
  color: var(--red);
}

.player__btn--play:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.player__btn--play svg {
  width: 20px;
  height: 20px;
}

.player__btn--play .i-pause {
  display: none;
}

.player.is-playing .player__btn--play .i-play {
  display: none;
}

.player.is-playing .player__btn--play .i-pause {
  display: block;
}

.player__vol {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
}

.player__mute {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: #bdbdbd;
  flex: none;
}

.player__mute svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player__mute .i-muted {
  display: none;
}

.player__mute.amplitude-muted .i-on {
  display: none;
}

.player__mute.amplitude-muted .i-muted {
  display: block;
}

.player__range {
  -webkit-appearance: none;
  appearance: none;
  width: 74px;
  height: 14px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.player__range::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(
    to right,
    var(--red) var(--fill, 70%),
    #555 var(--fill, 70%)
  );
}

.player__range::-moz-range-track {
  height: 2px;
  border-radius: 1px;
  background: #555;
}

.player__range::-moz-range-progress {
  height: 2px;
  background: var(--red);
}

.player__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--red);
  border: 0;
}

.player__range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  border: 0;
}

/* ---- Right: who is on air -------------------------------------------------- */

.player__air {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: #fff;
  text-transform: uppercase;
  white-space: nowrap;
}

.player__air-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  line-height: 1.1;
}

.player__air-kicker {
  color: var(--red);
}

.player__air .js-producer-name-display,
.player__show {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player__show {
  font-size: 1.3rem;
  color: #bdbdbd;
}

.player__avatar {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
}

@media (max-width: 900px) {
  .player {
    grid-template-columns: minmax(0, 1fr) auto;
    height: 70px;
  }
  .player__air,
  .player__btn--skip,
  .player__vol {
    display: none;
  }
  .player__tabs {
    top: -34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .player *,
  .player {
    transition: none !important;
  }
}

/* neutralise the site's global img rules (auto margins / max-width) inside the bar */
.player img {
  margin: 0;
}

.player a:hover {
  color: inherit;
}

.player__tab[aria-selected="true"]:hover {
  color: var(--red);
}

/* Transport row. The wrapper is a flex row in full mode and disappears in mini. */
.playlist-control-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.player .js-show-on-playlist-mode {
  display: none;
}

/* Mini: Listen Live sits above the bar. Play and volume stay centred in it. */
.player.mini {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
}

.player.mini .player__source {
  position: absolute;
  left: 50%;
  top: -37px;
  transform: translateX(-50%);
  z-index: 1;
  height: 38px;
  display: flex;
  align-items: center;
  background: var(--black);
  border-radius: 8px 8px 0 0;
  padding: 0 16px;
}

.player.mini .player__controls,
.player.mini .playlist-control-wrapper {
  display: contents;
}

.player.mini .player__vol {
  display: flex;
  margin-left: 0;
}

.player.mini .player__source a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .player.mini .player__source {
    top: -34px;
  }
}

.player.mini .player__source svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: var(--red);
  stroke: var(--red);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Full-mode progress, overlaid on the top edge. Shown once offcast mode is on. */
.player__progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  opacity: 0;
  pointer-events: none;
}

.player__progress:has(.js-progress-bar.interactive) {
  opacity: 1;
  pointer-events: auto;
}

.player__progress progress,
.player__progress .js-song-slider {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  margin: 0;
  border: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.player__progress .amplitude-buffered-progress {
  z-index: 1;
}

.player__progress .js-progress-bar {
  z-index: 2;
}

.player__progress .js-song-slider {
  z-index: 3;
  display: none;
  cursor: pointer;
  background: transparent;
}

.player__progress .amplitude-buffered-progress::-webkit-progress-bar {
  background: #333;
}

.player__progress .js-progress-bar::-webkit-progress-bar {
  background: transparent;
}

.player__progress .amplitude-buffered-progress::-webkit-progress-value {
  background: #555;
}

.player__progress .js-progress-bar::-webkit-progress-value {
  background: var(--red);
}

.player__progress .js-progress-bar::-moz-progress-bar {
  background: var(--red);
}

.player__progress .amplitude-buffered-progress::-moz-progress-bar {
  background: #555;
}

.player__progress .js-song-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
}

.player__progress .js-song-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 0;
  border-radius: 50%;
  background: var(--red);
}

.player__progress .js-song-slider::-moz-range-track {
  height: 4px;
  background: transparent;
  border: 0;
}

.player__progress .js-song-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--red);
}

.js-playlist-control.disabled,
.js-playlist-control:disabled {
  opacity: 0.35;
  cursor: default;
}

.player__btn--play.play-pause-loading svg {
  visibility: hidden;
}

.player__btn--play.play-pause-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid var(--red);
  border-right-color: transparent;
  border-radius: 50%;
  animation: player-spin 0.7s linear infinite;
}

.player__btn--play:disabled {
  cursor: progress;
}

@keyframes player-spin {
  to {
    transform: rotate(360deg);
  }
}

.player__tabs > .js-play-radio,
.player__tabs > .js-play-podcasts {
  display: contents;
}

/* Mobile box sits above the bar. It is out of the grid so it cannot resize the player. */
.player__ad {
  display: none;
}

@media (max-width: 900px) {
  .player__ad {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 38px);
    z-index: 2;
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 0 12px 8px;
    overflow: visible;
    background: transparent;
    border: 0;
    aspect-ratio: auto;
    max-height: none;
    text-align: center;
  }

  .player__ad iframe,
  .player__ad img,
  .player__ad > * {
    max-width: 100%;
  }
}
