/*
 * Public podcast pages. Every colour here comes from the station the podcast
 * belongs to: the layout writes both themes' tokens into :root (see
 * OpenPodcastsHelper#open_podcast_theme_css) and this file never hardcodes a
 * colour of its own — which is also what makes the light/dark switch instant.
 */

:root {
  --player-height: 84px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.op-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Every link here is part of a component that colours itself. `:where` keeps
   this at zero specificity so those components never have to fight it. */
:where(.op-body a) {
  color: inherit;
  text-decoration: none;
}

/* The UA rule for [hidden] is display:none, which loses to any display an
   author sets — and most things hidden here are flex. */
.op-body [hidden] {
  display: none;
}

.op-body ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.op-body ::-webkit-scrollbar-thumb {
  background: var(--track);
  border-radius: 8px;
}

/* Mono earns its place on figures — times, durations, episode numbers, speed —
   where digits should line up between rows. Everything else, including every
   small caps label, is the same sans as the rest of the page. */
.op-mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.op-label {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.op-muted {
  color: var(--muted);
}

.op-page {
  min-height: 100vh;
  padding-bottom: calc(var(--player-height) + 56px);
}

.op-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 32px 0;
}

.op-page--episode .op-main {
  max-width: 960px;
  padding-top: 36px;
}

/* --- hero ---------------------------------------------------------------- */

.op-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.op-hero__wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, var(--brand-wash) 0%, transparent 62%);
  opacity: 0.75;
}

.op-hero--episode .op-hero__wash {
  background: linear-gradient(120deg, var(--brand-wash), transparent 58%);
  opacity: 0.6;
}

.op-hero__glow {
  position: absolute;
  top: -180px;
  right: -120px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.16;
  filter: blur(90px);
}

.op-hero__inner {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 32px 56px;
}

.op-hero--episode .op-hero__inner {
  max-width: 960px;
  padding: 28px 32px 46px;
}

.op-hero__body {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: flex-end;
}

.op-hero--episode .op-hero__body {
  gap: 32px;
  align-items: center;
}

.op-hero__text {
  flex: 1;
  min-width: 300px;
}

.op-hero__title {
  margin: 0 0 20px;
  font-size: clamp(38px, 5.4vw, 68px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.op-hero__title--episode {
  margin-bottom: 18px;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.op-hero__description {
  margin: 0 0 30px;
  max-width: 560px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--muted);
  text-wrap: pretty;
}

.op-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.op-eyebrow {
  margin: 0 0 18px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.2em;
  color: var(--brand-ink);
}

/* The episode page has no station bar, so the switch rides along with the way
   back to the list. */
.op-episode-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 44px;
}

.op-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.op-back:hover {
  color: var(--brand-ink);
}

/* --- station bar --------------------------------------------------------- */

.op-station-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 56px;
}

.op-station-bar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.op-station-bar__logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: contain;
}

/* Only reached when the station has no logo to stand for it. */
.op-station-bar__name {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-station-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* --- buttons ------------------------------------------------------------- */

.op-btn {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 15px 26px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.op-btn--sm {
  padding: 11px 18px;
  font-size: 12.5px;
  gap: 8px;
}

.op-btn--brand {
  background: var(--brand);
  color: var(--on-brand);
}

.op-btn--brand:hover {
  filter: brightness(1.08);
  color: var(--on-brand);
}

.op-btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  padding: 14px 22px;
}

.op-btn--ghost.op-btn--sm {
  padding: 10px 16px;
  font-size: 12.5px;
}

.op-btn--ghost:hover {
  border-color: var(--brand-ink);
  color: var(--brand-ink);
}

.op-icon {
  flex: none;
  display: block;
}

/* Skip back / skip forward: the arrow carries the direction, the number sits
   inside the loop so the pair reads as one control. */
.op-icon-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.op-icon-button:hover {
  color: var(--text);
}

/* Centred on the icon, not on the button, and sized to actually fit inside the
   arc — the arrow's gap is at the top, so the digits sit a hair low on purpose
   and no lower. */
.op-icon-button__count {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -42%);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  pointer-events: none;
}

/* --- theme toggle --------------------------------------------------------- */

.op-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.op-theme-toggle:hover {
  border-color: var(--brand-ink);
  color: var(--brand-ink);
}

/* Both icons ship on every render so a Turbo cache restore cannot leave a stale
   one behind; the theme decides which is on screen. */
.op-theme-toggle__light,
:root[data-theme="light"] .op-theme-toggle__dark {
  display: none;
}

:root[data-theme="light"] .op-theme-toggle__light {
  display: flex;
}

/* --- toast ---------------------------------------------------------------- */

.op-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-height) + 22px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 34px var(--shadow);
  /* Out of the way for the pointer and for the accessibility tree until it has
     something to say. */
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.op-toast.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

.op-toast .op-icon {
  color: var(--brand-ink);
}

.op-toast.is-failed .op-icon {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .op-toast {
    transition: opacity 0.18s ease, visibility 0.18s;
    transform: translate(-50%, 0);
  }
}

/* --- volume --------------------------------------------------------------- */

.op-volume {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

/* `--filled` is set by the player as the slider moves: a range input draws no
   progress of its own in Chrome, so the played part is painted into the track. */
.op-volume__slider {
  --filled: 100%;
  width: 0;
  opacity: 0;
  height: 4px;
  margin: 0;
  appearance: none;
  background: linear-gradient(to right, var(--brand) var(--filled), var(--track) var(--filled));
  border-radius: 999px;
  cursor: pointer;
  transition: width 0.16s ease, opacity 0.16s ease;
}

/* Firefox does have one, and it would sit on top of the gradient. */
.op-volume__slider::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--brand);
}

.op-volume:hover .op-volume__slider,
.op-volume__slider:focus-visible {
  width: 74px;
  opacity: 1;
}

.op-volume__slider::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 1px 4px var(--shadow);
}

.op-volume__slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--brand);
}

/* One of the three marks is on screen at a time. */
.op-volume__button .op-icon:nth-child(2),
.op-volume__button .op-icon:nth-child(3),
.is-quiet .op-volume__button .op-icon:nth-child(1),
.is-muted .op-volume__button .op-icon:nth-child(1) {
  display: none;
}

.is-quiet .op-volume__button .op-icon:nth-child(2),
.is-muted .op-volume__button .op-icon:nth-child(3) {
  display: block;
}

.is-muted .op-volume__button .op-icon:nth-child(2) {
  display: none;
}

.op-speed {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 8px 11px;
  border-radius: 8px;
  cursor: pointer;
}

.op-speed:hover {
  border-color: var(--brand-ink);
  color: var(--brand-ink);
}

/* Play/pause icons swap on `is-playing`, wherever they are. */
.op-icon--pause,
.is-playing .op-icon--play {
  display: none;
}

.is-playing .op-icon--pause {
  display: inline;
}

.op-btn__label {
  white-space: nowrap;
}

/* --- covers -------------------------------------------------------------- */

.op-cover {
  position: relative;
  flex: none;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--brand-wash), var(--surface));
}

.op-cover__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.op-cover--lg {
  width: 268px;
  height: 268px;
  border-radius: 20px;
  box-shadow: 0 30px 70px var(--shadow);
}

.op-cover--md {
  width: 180px;
  height: 180px;
  border-radius: 16px;
  box-shadow: 0 24px 60px var(--shadow);
}

.op-cover--sm {
  width: 104px;
  height: 104px;
}

.op-cover--xs {
  width: 52px;
  height: 52px;
  border-radius: 10px;
}

.op-cover__play {
  position: absolute;
  inset: 0;
  border: none;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s;
}

.op-cover__play:hover,
.op-cover__play:focus-visible,
.is-playing .op-cover__play,
.op-episode:hover .op-cover__play {
  opacity: 1;
}

.op-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
}

.op-play--sm {
  width: 44px;
  height: 44px;
  border: none;
  cursor: pointer;
}

.op-play--sm:hover {
  filter: brightness(1.08);
}

/* --- sections and episode rows ------------------------------------------- */

.op-section {
  padding-top: 8px;
}

.op-section + .op-section,
.op-episode-detail + .op-section {
  padding-top: 52px;
}

.op-sort {
  position: relative;
  flex: none;
}

.op-sort__trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* Safari draws its own marker on <summary> whatever `list-style` says. */
.op-sort__trigger::-webkit-details-marker {
  display: none;
}

.op-sort__trigger:hover,
.op-sort[open] .op-sort__trigger {
  border-color: var(--brand-ink);
  color: var(--brand-ink);
}

.op-sort__value {
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  font-size: 12.5px;
}

/* The trigger's chevron, and only that one — the check mark on the current
   option lives inside the same open <details>. */
.op-sort[open] .op-sort__trigger .op-icon {
  transform: rotate(180deg);
}

.op-sort__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 40px var(--shadow);
}

.op-sort__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.op-sort__option:hover {
  background: var(--raised);
}

.op-sort__option[aria-current] {
  color: var(--brand-ink);
  font-weight: 600;
}

.op-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 8px;
}

.op-section__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.op-section__label {
  margin: 0 0 18px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.op-episodes {
  display: flex;
  flex-direction: column;
}

/* The separator is drawn on a pseudo-element, not as a border: a border on a
   rounded box curves at both ends, which reads as the outline of a card that
   failed to close rather than as a rule between rows. */
.op-episode {
  position: relative;
  display: flex;
  gap: 24px;
  padding: 26px 20px;
  margin: 0 -20px;
  border-radius: 16px;
  transition: background 0.18s;
}

.op-episode::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: var(--line);
}

.op-episode:hover {
  background: var(--surface);
}

/* The title's link, stretched over the card. Everything the listener can click
   instead of opening the episode is lifted above it. */
.op-episode__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.op-episode .op-cover,
.op-episode .op-share-row {
  position: relative;
  z-index: 1;
}

/* The row is the hover target, so the title answers wherever the pointer is
   inside it — not only when it happens to be over the words. */
.op-episode:hover .op-episode__link {
  color: var(--brand-ink);
}

/* One measure for the whole row: title, prose and the meta line all end at the
   same place, so the share links land on the edge of a block instead of
   floating off in the white space at the far side of a wide screen. */
.op-episode__info {
  flex: 1;
  min-width: 0;
  max-width: 780px;
}

.op-episode__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 9px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
}

/* One strip, not three loose labels. */
.op-episode__meta > * + * {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.op-episode__meta > * + *::before {
  content: "·";
  opacity: 0.55;
  letter-spacing: 0;
}

.op-episode__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.op-episode__link {
  color: var(--text);
}

.op-episode__link:hover {
  color: var(--brand-ink);
}

/* Prose, so it gets the prose tone. The measure comes from the row. */
.op-episode__notes {
  margin: 0 0 16px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Sixteen share links down a list of eight episodes will out-shout eight
   titles if they are given the same weight. They stay visible — hiding a
   feature behind hover loses it on touch entirely — but they sit back until
   the row is the one being read. */
/* Against the right edge of the card, level with its middle. */
.op-share-row {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

.op-share-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.18s, border-color 0.18s, color 0.18s;
}

.op-episode:hover .op-share-button,
.op-share-button:focus-visible {
  opacity: 1;
}

.op-share-button:hover {
  border-color: var(--brand-ink);
  color: var(--brand-ink);
  opacity: 1;
}

.op-share-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}

.op-share-link:hover {
  color: var(--brand-ink);
}

.op-eq {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--brand-ink);
}

.op-eq__bar {
  width: 2px;
  height: 9px;
  background: var(--brand-ink);
  animation: op-eq 0.9s ease-in-out infinite;
}

.op-eq__bar:nth-child(2) {
  animation-delay: 0.2s;
}

.op-eq__bar:nth-child(3) {
  animation-delay: 0.45s;
}

@keyframes op-eq {
  0%,
  100% {
    transform: scaleY(0.35);
  }
  50% {
    transform: scaleY(1);
  }
}

.op-load-more {
  display: flex;
  justify-content: center;
  padding: 38px 0 12px;
}

.op-load-more .op-btn {
  padding: 15px 34px;
}

/* --- episode detail ------------------------------------------------------ */

/* --- the scrubber --------------------------------------------------------- */

/* One control, two sizes. Modelled on where every player landed: a slim track
   that thickens under the pointer, the loaded range behind the played one, and
   a knob that appears when you can grab it. */
.op-scrubber {
  --scrubber-height: 4px;
  --scrubber-knob: 0;
  position: relative;
  display: flex;
  align-items: center;
  height: 18px;
  flex: 1;
  min-width: 60px;
  cursor: pointer;
  touch-action: none;
}

.op-scrubber:hover,
.op-scrubber:focus-visible,
.op-scrubber.is-dragging {
  --scrubber-height: 6px;
  --scrubber-knob: 1;
}

.op-scrubber:focus-visible {
  outline: none;
}

.op-scrubber:focus-visible .op-scrubber__track {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand-ink);
}

.op-scrubber__track {
  position: relative;
  width: 100%;
  height: var(--scrubber-height);
  border-radius: 999px;
  background: var(--track);
  transition: height 0.14s ease;
}

.op-scrubber__buffer,
.op-scrubber__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
}

/* What the browser has downloaded, the way YouTube and Spotify show it. */
.op-scrubber__buffer {
  background: var(--muted);
  opacity: 0.35;
}

.op-scrubber__fill {
  background: var(--brand);
}

.op-scrubber__knob {
  position: absolute;
  top: 50%;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  transform: translate(50%, -50%) scale(var(--scrubber-knob));
  transition: transform 0.14s ease;
  box-shadow: 0 2px 6px var(--shadow);
}

/* On the episode page it is the main control on the screen, so it is bigger and
   says it is draggable without being hovered first. */
.op-scrubber--page {
  --scrubber-height: 7px;
  --scrubber-knob: 1;
  height: 28px;
  width: 100%;
}

.op-scrubber--page:hover,
.op-scrubber--page:focus-visible,
.op-scrubber--page.is-dragging {
  --scrubber-height: 9px;
}

.op-scrubber--page .op-scrubber__knob {
  width: 16px;
  height: 16px;
}

.op-scrubber__legend {
  display: flex;
  justify-content: space-between;
  padding: 10px 4px 0;
  font-size: 11px;
  color: var(--muted);
}

.op-episode-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  padding: 44px 0 0;
}

.op-episode-detail__notes {
  flex: 1;
  min-width: 320px;
}

.op-notes {
  margin: 0;
  font-size: 16px;
  line-height: 1.75;
  max-width: 68ch;
  color: var(--text-soft);
  text-wrap: pretty;
  white-space: pre-line;
}

.op-episode-detail__rights {
  border-top: 1px solid var(--line);
  margin: 34px 0 0;
  padding-top: 18px;
  font-size: 11px;
  line-height: 1.8;
  letter-spacing: 0.1em;
}

/* No fixed width: the column is as wide as the longest label needs and no
   wider, so the buttons do not stretch into dead space and the notes get the
   room back. */
.op-episode-detail__share {
  flex: none;
}

.op-share-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: fit-content;
  gap: 9px;
}

.op-share-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.op-share-item:hover {
  border-color: var(--brand-ink);
  color: var(--brand-ink);
}

.op-up-next__row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 16px;
  margin: 0 -16px;
  border-top: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  transition: background 0.18s;
}

.op-up-next__row:hover {
  background: var(--surface);
  color: var(--text);
}

.op-up-next__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 10.5px;
}

.op-up-next__title {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: normal;
  text-wrap: pretty;
}

/* --- footer -------------------------------------------------------------- */

.op-footer {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 22px 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
}

.op-footer__link {
  color: var(--brand-ink);
}

.op-footer__link:hover {
  color: var(--text);
}

/* --- the fixed player ---------------------------------------------------- */

.op-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}

/* Idle: still there, still the same height, just plainly not usable — the page
   never reflows when the listener finally presses play. */
.op-player.is-empty .op-player__inner {
  opacity: 0.55;
}

.op-player.is-empty .op-player__now {
  pointer-events: none;
}

.op-player.is-empty .op-cover--xs {
  background: var(--raised);
}

.op-player.is-empty .op-player__episode {
  font-weight: 500;
  color: var(--muted);
}

/* A brand-coloured play button still reads as "press me" however faded it is,
   so while there is nothing to press it is not brand-coloured. */
.op-player.is-empty .op-play--sm {
  background: var(--raised);
  color: var(--muted);
}

.op-player [disabled] {
  cursor: default;
}

.op-player [disabled]:hover {
  color: inherit;
  border-color: var(--line);
  filter: none;
}

.op-player__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}

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

.op-player__titles {
  min-width: 0;
  width: 230px;
}

.op-player__episode {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-player__podcast {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-player__transport {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.op-player__timeline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.op-player__time {
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

/* --- light theme ---------------------------------------------------------- */

/* The colour tokens all come from the layout; these are the few places where a
   pale page wants a different amount of something, not a different colour. */
:root[data-theme="light"] .op-hero__glow {
  opacity: 0.3;
}

:root[data-theme="light"] .op-hero__wash {
  opacity: 1;
}

:root[data-theme="light"] .op-player {
  box-shadow: 0 -18px 40px -30px var(--shadow);
}

:root[data-theme="light"] .op-speed {
  background: var(--surface);
}

/* --- toast ---------------------------------------------------------------- */

.op-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-height) + 22px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 34px var(--shadow);
  /* Out of the way for the pointer and for the accessibility tree until it has
     something to say. */
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.op-toast.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

.op-toast .op-icon {
  color: var(--brand-ink);
}

.op-toast.is-failed .op-icon {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .op-toast {
    transition: opacity 0.18s ease, visibility 0.18s;
    transform: translate(-50%, 0);
  }
}

/* --- volume --------------------------------------------------------------- */

.op-volume {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

/* `--filled` is set by the player as the slider moves: a range input draws no
   progress of its own in Chrome, so the played part is painted into the track. */
.op-volume__slider {
  --filled: 100%;
  width: 0;
  opacity: 0;
  height: 4px;
  margin: 0;
  appearance: none;
  background: linear-gradient(to right, var(--brand) var(--filled), var(--track) var(--filled));
  border-radius: 999px;
  cursor: pointer;
  transition: width 0.16s ease, opacity 0.16s ease;
}

/* Firefox does have one, and it would sit on top of the gradient. */
.op-volume__slider::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--brand);
}

.op-volume:hover .op-volume__slider,
.op-volume__slider:focus-visible {
  width: 74px;
  opacity: 1;
}

.op-volume__slider::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 1px 4px var(--shadow);
}

.op-volume__slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--brand);
}

/* One of the three marks is on screen at a time. */
.op-volume__button .op-icon:nth-child(2),
.op-volume__button .op-icon:nth-child(3),
.is-quiet .op-volume__button .op-icon:nth-child(1),
.is-muted .op-volume__button .op-icon:nth-child(1) {
  display: none;
}

.is-quiet .op-volume__button .op-icon:nth-child(2),
.is-muted .op-volume__button .op-icon:nth-child(3) {
  display: block;
}

.is-muted .op-volume__button .op-icon:nth-child(2) {
  display: none;
}

.op-speed {
  background: var(--surface);
}

/* --- touch ---------------------------------------------------------------- */

/* The play button over an episode's art only appears on hover, which on a phone
   means never. Where there is no hover it is simply always there. */
@media (hover: none) {
  .op-cover__play {
    opacity: 1;
    background: var(--overlay);
  }

  .op-cover__play .op-play {
    width: 34px;
    height: 34px;
  }
}

/* --- tablet --------------------------------------------------------------- */

@media (max-width: 1000px) {
  .op-main,
  .op-hero__inner,
  .op-hero--episode .op-hero__inner {
    padding-left: 24px;
    padding-right: 24px;
  }

  .op-hero__inner {
    padding-bottom: 44px;
  }

  .op-cover--lg {
    width: 208px;
    height: 208px;
  }

  .op-episode-detail {
    gap: 32px;
  }

  .op-episode-detail__share {
    width: 100%;
  }

  .op-share-list {
    width: auto;
  }

  .op-player__titles {
    width: 180px;
  }

  /* --- toast ---------------------------------------------------------------- */

.op-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-height) + 22px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 34px var(--shadow);
  /* Out of the way for the pointer and for the accessibility tree until it has
     something to say. */
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.op-toast.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

.op-toast .op-icon {
  color: var(--brand-ink);
}

.op-toast.is-failed .op-icon {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .op-toast {
    transition: opacity 0.18s ease, visibility 0.18s;
    transform: translate(-50%, 0);
  }
}

/* --- volume --------------------------------------------------------------- */

.op-volume {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

/* `--filled` is set by the player as the slider moves: a range input draws no
   progress of its own in Chrome, so the played part is painted into the track. */
.op-volume__slider {
  --filled: 100%;
  width: 0;
  opacity: 0;
  height: 4px;
  margin: 0;
  appearance: none;
  background: linear-gradient(to right, var(--brand) var(--filled), var(--track) var(--filled));
  border-radius: 999px;
  cursor: pointer;
  transition: width 0.16s ease, opacity 0.16s ease;
}

/* Firefox does have one, and it would sit on top of the gradient. */
.op-volume__slider::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--brand);
}

.op-volume:hover .op-volume__slider,
.op-volume__slider:focus-visible {
  width: 74px;
  opacity: 1;
}

.op-volume__slider::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 1px 4px var(--shadow);
}

.op-volume__slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--brand);
}

/* One of the three marks is on screen at a time. */
.op-volume__button .op-icon:nth-child(2),
.op-volume__button .op-icon:nth-child(3),
.is-quiet .op-volume__button .op-icon:nth-child(1),
.is-muted .op-volume__button .op-icon:nth-child(1) {
  display: none;
}

.is-quiet .op-volume__button .op-icon:nth-child(2),
.is-muted .op-volume__button .op-icon:nth-child(3) {
  display: block;
}

.is-muted .op-volume__button .op-icon:nth-child(2) {
  display: none;
}

.op-speed {
    display: none;
  }
}

/* --- phone ---------------------------------------------------------------- */

@media (max-width: 720px) {
  :root {
    --player-height: 62px;
  }

  .op-page {
    padding-bottom: calc(var(--player-height) + env(safe-area-inset-bottom, 0px) + 32px);
  }

  .op-main,
  .op-hero__inner,
  .op-hero--episode .op-hero__inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  /* Cover on top of the text and centred, the way a phone reads a podcast page.
     The text stays left-aligned: a long episode title is far harder to read
     ragged on both sides. */
  .op-hero__body,
  .op-hero--episode .op-hero__body {
    flex-direction: column;
    align-items: center;
    gap: 38px;
  }

  .op-hero__inner {
    padding-bottom: 32px;
  }

  .op-hero--episode .op-hero__inner {
    padding-bottom: 30px;
  }

  .op-hero__text {
    min-width: 0;
    width: 100%;
  }

  .op-hero__title {
    font-size: clamp(30px, 8vw, 40px);
    line-height: 1.04;
    margin-bottom: 14px;
  }

  .op-hero__title--episode {
    font-size: clamp(23px, 6.4vw, 30px);
    line-height: 1.15;
  }

  .op-hero__description {
    font-size: 14.5px;
    margin-bottom: 22px;
  }

  .op-hero__glow {
    width: 320px;
    height: 320px;
    top: -140px;
    right: -100px;
  }

  .op-cover--lg {
    width: min(232px, 62vw);
    height: min(232px, 62vw);
    border-radius: 18px;
  }

  .op-cover--md {
    width: min(184px, 50vw);
    height: min(184px, 50vw);
  }

  .op-cover--sm {
    width: 68px;
    height: 68px;
    border-radius: 10px;
  }

  .op-hero__actions {
    width: 100%;
    gap: 10px;
  }

  .op-hero__actions .op-btn {
    flex: 1;
    justify-content: center;
    padding: 14px 14px;
    font-size: 13px;
    gap: 9px;
  }

  /* "Tocar último episódio" needs the room; "Compartilhar" does not. */
  .op-hero__actions .op-btn--brand {
    flex: 1.5;
  }

  .op-episode-nav {
    margin-bottom: 26px;
  }

  .op-station-bar {
    margin-bottom: 26px;
    gap: 12px;
  }

  /* The feed is a link with the RSS mark and nothing else — the word costs a
     third of the bar and says less than the icon does. */
  .op-station-bar__actions .op-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    border-radius: 999px;
  }

  .op-station-bar__actions .op-btn > *:not(.op-icon) {
    display: none;
  }

  .op-section__title {
    font-size: 19px;
  }

  /* Decoration, and the only thing on this row that can be dropped. */
  .op-section__head .op-label {
    display: none;
  }

  /* Date and duration go under the play button instead of wrapping into it, and
     lose some tracking so they fit on one line. */
  .op-hero--episode .op-hero__actions > .op-label {
    width: 100%;
    font-size: 10.5px;
    letter-spacing: 0.06em;
  }

  /* The list is a scan on a phone: art, date, title, how long. The legacy page
     hid the description here too. */
  .op-episode {
    gap: 14px;
    padding: 18px 12px;
    margin: 0 -12px;
    border-radius: 12px;
  }

  .op-episode__notes {
    display: none;
  }

  .op-episode__title {
    font-size: 15.5px;
    margin-bottom: 10px;
  }

  .op-episode__meta {
    margin-bottom: 7px;
  }

    .op-share-row {
    gap: 8px;
  }

  .op-episode-detail {
    flex-direction: column;
    gap: 34px;
    padding-top: 32px;
  }

  .op-episode-detail__notes {
    min-width: 0;
  }

  .op-notes {
    font-size: 15px;
    line-height: 1.7;
  }

  .op-section + .op-section,
  .op-episode-detail + .op-section {
    padding-top: 36px;
  }

  .op-up-next__title {
    font-size: 14.5px;
  }

  .op-footer {
    flex-direction: column;
    gap: 8px;
  }

  /* The bar becomes the phone player: art, what is playing, one button. Seeking
     moves to the line across the top, which stays tappable. */
  .op-player__inner {
    padding: 9px 14px;
    padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
  }


  .op-player__now {
    flex: 1;
    gap: 12px;
  }

  .op-player__titles {
    width: auto;
    flex: 1;
  }

  .op-player__episode {
    font-size: 13px;
  }

  .op-player__podcast {
    margin-top: 3px;
    font-size: 9.5px;
  }

  .op-cover--xs {
    width: 44px;
    height: 44px;
    border-radius: 8px;
  }

  .op-icon-button {
    display: none;
  }

  /* The bar on a phone is art, title, play — nothing else, the way a mini
     player is everywhere. Seeking belongs to the episode page, which is one tap
     away through this bar. */
  .op-player__timeline,
  .op-volume {
    display: none;
  }

  .op-player__transport {
    gap: 0;
  }

  .op-play--sm {
    width: 40px;
    height: 40px;
  }
}
