/* Today's episode player bar (ADR 0157), in a sheet of its own: linked only on a page that draws a player
   (`shows_player`, app/podcast.py), so no other page carries the bar's rules. Phone first, and its colours,
   fonts and custom properties from tokens.css, as site.css (ADR 0017). */

/* An orange bar, darker towards its foot, with white controls, up to 400 pixels wide. Each button and slider
   is 48 pixels tall, the site's tap size (ADR 0042), where today's bar was 40. The browser's own player shows
   until episode-player.js has run. */
.episode-player {
  display: flex;
  align-items: center;
  max-width: 400px;
  margin: 0;
  padding: 0 0.5rem 0 0.25rem;
  border-radius: 2px;
  background: linear-gradient(transparent, var(--colour-player-shade)), var(--colour-orange);
  color: var(--colour-white);
}

.episode-player[hidden] {
  display: none;
}

.episode-player__play,
.episode-player__mute {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--tap-target);
  height: var(--tap-target);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.episode-player__icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.episode-player__icon--pause,
.episode-player.is-playing .episode-player__icon--play,
.episode-player.is-muted .episode-player__waves {
  display: none;
}

.episode-player.is-playing .episode-player__icon--pause {
  display: block;
}

/* Today's times: 11 pixel bold white figures, each the same width so the bar does not move as they count. */
.episode-player__time {
  flex: none;
  padding: 0 0.375rem;
  font-size: 0.6875rem;
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}

/* The sliders: today's rails, light over the orange, filled white as far as the episode has played and as
   loud as it plays (episode-player.js sets --played and --level). */
.episode-player__seek,
.episode-player__volume {
  height: var(--tap-target);
  margin: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  appearance: none;
}

.episode-player__seek {
  flex: 1 1 auto;
  min-width: var(--tap-target);
  margin: 0 0.25rem;
}

.episode-player__seek:disabled {
  cursor: default;
}

/* The volume slider: on a computer only, as today's bar leaves it out on a touch screen, where a phone sets its
   own volume. The sound button stays everywhere. */
.episode-player__volume {
  display: none;
  flex: none;
  width: 3.125rem;
  margin-left: 0.25rem;
}

@media (min-width: 24em) and (pointer: fine) {
  .episode-player__volume {
    display: block;
  }
}

.episode-player__seek::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--colour-player-played) var(--played),
    var(--colour-player-rail) var(--played));
}

.episode-player__volume::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--colour-player-played) var(--level),
    var(--colour-player-volume-rail) var(--level));
}

.episode-player__seek::-moz-range-track {
  height: 10px;
  border-radius: 2px;
  background: var(--colour-player-rail);
}

.episode-player__volume::-moz-range-track {
  height: 8px;
  border-radius: 2px;
  background: var(--colour-player-volume-rail);
}

.episode-player input::-moz-range-progress {
  height: 100%;
  border-radius: 2px;
  background: var(--colour-player-played);
}

/* Each slider's handle shows while the pointer is over the bar or the slider has the keyboard, as today's
   shows its handle only under the pointer. */
.episode-player input::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  appearance: none;
}

.episode-player:hover input:enabled::-webkit-slider-thumb,
.episode-player input:focus-visible::-webkit-slider-thumb {
  background: var(--colour-white);
}

.episode-player__volume::-webkit-slider-thumb {
  margin-top: -1px;
}

.episode-player input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.episode-player:hover input:enabled::-moz-range-thumb,
.episode-player input:focus-visible::-moz-range-thumb {
  background: var(--colour-white);
}

/* The ring inside each control, in navy, which shows on today's orange (about 5.7 to 1, less towards the
   bar's darker foot) where the site's blue ring does not (about 1.9 to 1). */
.episode-player :focus-visible {
  outline-color: var(--colour-navy);
  outline-offset: -3px;
}

/* Today's orange button to the same address under the player (ADR 0099, 0141), drawn only beside a player, so
   its rules are here too. */
.post__download {
  display: block;
  max-width: 312px;
  margin: 1rem 0;
}

/* Today's orange button: Futura, today's small words (ADR 0157). At least 48 pixels tall, the site's tap size
   (ADR 0042), where today's was 36. Underlined only where the player sits in a post's words, as today's
   underlines every link there; above the words it is not (ADR 0169). */
.post__download-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-target);
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--colour-orange);
  border-radius: 0.25rem;
  background: var(--colour-orange);
  color: var(--colour-white);
  font-family: var(--font-heading);
  font-size: var(--text-small);
  font-weight: var(--weight-bold);
  line-height: var(--line-small);
  text-align: center;
  text-decoration: none;
}

.post__body .post__download-link {
  text-decoration: underline;
}
