/* A small navigation control, using the site's existing material and type. */
.site-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.site-identity .wordmark {
  flex: 0 0 auto;
}

.site-listen {
  position: static;
}

.listen-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 1.125rem;
  color: var(--quiet);
  background: transparent;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.listen-toggle::-webkit-details-marker {
  display: none;
}

.listen-toggle::marker {
  content: "";
}

.listen-toggle:hover,
.site-listen[open] .listen-toggle {
  color: var(--ink);
  background: rgb(221 244 255 / 9%);
  border-color: rgb(231 249 255 / 13%);
}

.listen-toggle:focus-visible,
.listen-dial:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.listen-note {
  display: block;
}

.listen-live-dot {
  position: absolute;
  right: 9px;
  bottom: 8px;
  display: none;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}

.listen-toggle[data-state="playing"] {
  color: var(--ink);
}

.listen-toggle[data-state="playing"] .listen-live-dot {
  display: block;
}

.listen-panel {
  position: absolute;
  top: calc(100% + 0.625rem);
  left: 1.25rem;
  width: min(15.5rem, calc(100% - 2.5rem));
  max-height: calc(100vh - 8rem);
  max-height: calc(100dvh - 8rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0.875rem 1.25rem 1.125rem;
  border: 1px solid var(--glass-line);
  border-radius: 1.5rem;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 6%), rgb(255 255 255 / 1%) 60%),
    rgb(20 32 43 / 91%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 18px 52px rgb(4 12 19 / 25%), 0 2px 8px rgb(4 12 19 / 12%), inset 0 1px 0 rgb(255 255 255 / 16%);
}

.listen-panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-block-end: 0.125rem;
}

.listen-caption {
  color: var(--quiet);
  font-size: 0.75rem;
  font-weight: 400;
}

.listen-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -0.375rem -0.625rem -0.375rem 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--quiet);
  background: transparent;
  cursor: pointer;
}

.listen-close:hover {
  color: var(--ink);
  background: rgb(231 249 255 / 7%);
}

.listen-close > span {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
}

.listen-close > span::before,
.listen-close > span::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 0;
  width: 12px;
  height: 1px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
}

.listen-close > span::after {
  transform: rotate(-45deg);
}

.listen-panel .listen-track-title {
  margin: 0.25rem 0 0.75rem;
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
}

.listen-audio {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.75rem;
}

.listen-audio:not([controls]) {
  display: none;
}

.listen-custom[hidden],
.listen-status[hidden] {
  display: none;
}

.listen-seek {
  display: block;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.listen-seek::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: rgb(226 244 255 / 20%);
}

.listen-seek::-moz-range-track {
  height: 2px;
  border-radius: 2px;
  background: rgb(226 244 255 / 20%);
}

.listen-seek::-webkit-slider-thumb {
  width: 8px;
  height: 8px;
  margin-top: -3px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

.listen-seek::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.listen-seek:disabled {
  opacity: 0.45;
  cursor: default;
}

.listen-times,
.listen-volume-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--quiet);
  font-size: 0.6875rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.listen-wheel {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 1.375rem auto 0.875rem;
}

.listen-dial {
  position: absolute;
  inset: 0;
  border: 1px solid rgb(227 246 255 / 14%);
  border-radius: 50%;
  background: linear-gradient(145deg, rgb(255 255 255 / 6%), rgb(255 255 255 / 1%));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%);
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.listen-dial:hover,
.listen-dial:focus-visible {
  border-color: rgb(227 246 255 / 30%);
}

.listen-dial:active {
  cursor: grabbing;
}

.listen-dial::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  margin: -2px;
  border-radius: 50%;
  background: var(--accent);
  transform: rotate(calc(225deg + var(--listen-volume, 35) * 2.7deg)) translateY(-62px);
}

.listen-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: -26px;
  padding: 0;
  border: 1px solid rgb(232 250 255 / 19%);
  border-radius: 50%;
  color: var(--ink);
  background: #293e4e;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 9%);
  cursor: pointer;
}

.listen-play:hover {
  background: #334d60;
  border-color: rgb(232 250 255 / 35%);
}

.listen-play-icon {
  display: block;
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.listen-play[data-state="playing"] .listen-play-icon {
  width: 10px;
  height: 12px;
  margin-left: 0;
  border-top: 0;
  border-bottom: 0;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
}

.listen-play[data-state="loading"] .listen-play-icon {
  width: 12px;
  height: 12px;
  margin-left: 0;
  border: 1px solid rgb(232 250 255 / 25%);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: listen-loading 900ms linear infinite;
}

.listen-volume-caption {
  width: 140px;
  margin-inline: auto;
}

.listen-status {
  margin: 0.875rem 0 0;
  color: var(--quiet);
  font-size: 0.75rem;
  line-height: 1.7;
}

@keyframes listen-loading {
  to { transform: rotate(360deg); }
}

@media (max-width: 32rem) {
  .site-identity { flex-basis: 100%; gap: 0.375rem; }
  .site-identity .wordmark { flex-basis: auto; min-height: 44px; }
  .site-header--article .site-identity { flex-basis: auto; flex-shrink: 0; }
  .listen-panel { left: 0.75rem; width: min(15.5rem, calc(100% - 1.5rem)); max-height: calc(100vh - 10rem); max-height: calc(100dvh - 10rem); }
}

@media (pointer: coarse) {
  .listen-seek { height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .listen-play[data-state="loading"] .listen-play-icon { animation: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .listen-panel { background: #20303e; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .listen-panel { background: #20303e; }
}

@media (prefers-contrast: more) {
  .listen-panel { background: #172734; border-color: #b2c9d8; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .listen-dial, .listen-play { border-color: #b2c9d8; }
}

@media (forced-colors: active) {
  .listen-panel, .listen-play { background: Canvas; border: 1px solid CanvasText; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .listen-dial { border-color: CanvasText; box-shadow: none; }
  .listen-dial::after, .listen-live-dot { background: CanvasText; }
}
