/* Audio controls: the slim lesson player, the "Listen" play button, and the example play
   button in table cells. One treatment for all of them: Ink outline and Ink icon, Canvas
   on hover, Ink fill with White while playing. */

.lesson-audio {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem 0.75rem;
  max-width: 42rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-control-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.lesson-audio audio {
  display: block;
  width: 100%;
}

.lesson-audio.is-ready audio {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lesson-audio button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}

.lesson-audio button.lesson-audio__play {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--color-selected);
  color: var(--color-on-selected);
}

.lesson-audio__play svg {
  width: 1.05rem;
  height: 1.05rem;
}

.lesson-audio__time {
  flex: 0 0 auto;
  color: var(--color-text);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lesson-audio__seek {
  flex: 1 1 6rem;
  min-width: 4rem;
  height: 0.35rem;
  margin: 0;
  accent-color: var(--color-text);
  cursor: pointer;
}

.lesson-audio__volume {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-text);
}

.lesson-audio__volume svg {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
}

.lesson-audio__volume input[type="range"] {
  width: 3.25rem;
  height: 0.35rem;
  accent-color: var(--color-text);
  cursor: pointer;
}

/* "Listen" button before a passage (data-lesson-audio) */
.lesson-audio-play {
  margin: 0.75rem 0 1.25rem;
}

.lesson-audio-play__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--color-text);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.lesson-audio-play__btn svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

/* Inline after a table cell's text */
.pair-table .lesson-audio-play__btn {
  gap: 0;
  margin-left: 0.4rem;
  padding: 0.2rem;
  vertical-align: middle;
}

/* Play button after an example in a table cell */
.example-audio {
  position: relative;
  width: 1.75rem;
  height: 1.75rem;
  margin-left: 0.5rem;
  padding: 0;
  border: 1px solid var(--color-text);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  vertical-align: middle;
  cursor: pointer;
}

.example-audio::before {
  content: "";
  position: absolute;
  inset: 0.3rem;
  background-color: var(--color-text);
  -webkit-mask: var(--image-audio-speaker) center / contain no-repeat;
  mask: var(--image-audio-speaker) center / contain no-repeat;
}

.lesson-audio-play__btn:hover,
.lesson-audio-play__btn:focus-visible,
.example-audio:hover,
.example-audio:focus-visible {
  background: var(--color-surface-muted);
}

.lesson-audio-play__btn.is-playing,
.example-audio.is-playing {
  background: var(--color-selected);
  color: var(--color-on-selected);
}

.example-audio.is-playing::before {
  background-color: var(--color-on-selected);
}
