/* Infinite Radio: the station's page, on the site's palette (site.css) in the studio's type, Inter, with Lucide's icons
   drawn inline. One player: the play button beside the song on air, its progress, the controls and what comes next, as
   a card; the station's genres under it, then what it played. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/inter-regular-subset.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/inter-medium-subset.woff2") format("woff2");
}

:root {
  --radio-accent-ink: #1d1206;
  --radio-accent-tint: rgba(255, 163, 72, 0.14);
  --radio-accent-edge: rgba(255, 163, 72, 0.55);
  --radio-ease: cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-color: var(--line-hi) var(--bg);
}

.radio-page {
  font-family: "Inter", var(--sans);
  font-feature-settings: "kern";
}

.radio-page ::selection {
  color: var(--text);
  background: rgba(255, 163, 72, 0.32);
}

.radio-page :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.radio {
  max-width: 820px;
  padding-top: 56px;
  padding-bottom: 72px;
}

.radio h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.radio .lede {
  max-width: 62ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1.6;
}

.radio-icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* on mobile data, a question before the engine fetches more sounds: a band above the page's title */

.radio-ask {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 24px;
  padding: 10px 12px 10px 16px;
  color: var(--text);
  font-size: 14px;
  background: var(--radio-accent-tint);
  border: 1px solid var(--radio-accent-edge);
  border-radius: 12px;
}

.radio-ask[hidden] {
  display: none;
}

.radio-ask p {
  margin: 0;
}

.radio-ask-buttons {
  display: flex;
  gap: 8px;
}

.radio-ask .radio-btn {
  height: 32px;
}

/* the player */

.radio-player {
  margin: 36px 0 20px;
  padding: 24px 24px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.25);
}

.radio-now {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
}

.radio-onair {
  min-width: 0;
}

.radio-onair h2 {
  margin: 0;
  overflow: hidden;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.radio-meta {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.45;
}

/* the play button: round, of the accent; play or pause by the station's state, and a ring that turns while the first
   song is written and while its first bars play before the rest is rendered */

.radio-play {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 68px;
  height: 68px;
  padding: 0;
  color: var(--radio-accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 10px 24px -10px rgba(255, 163, 72, 0.7);
  cursor: pointer;
  transition: background 160ms ease, transform 220ms var(--radio-ease), box-shadow 220ms var(--radio-ease);
}

.radio-play-icon {
  grid-area: 1 / 1;
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: opacity 160ms ease, transform 220ms var(--radio-ease);
}

.radio-play-start {
  /* the triangle sits a little right of the middle, where the eye puts its centre */
  translate: 2px 0;
}

.radio-play-stop {
  opacity: 0;
  transform: scale(0.6);
}

.radio-play[data-playing="true"] .radio-play-start,
.radio-player[data-state="early"] .radio-play-start {
  opacity: 0;
  transform: scale(0.6);
}

.radio-play[data-playing="true"] .radio-play-stop,
.radio-player[data-state="early"] .radio-play-stop {
  opacity: 1;
  transform: none;
}

.radio-play:hover:not(:disabled) {
  background: var(--accent-hi);
  box-shadow: 0 14px 28px -10px rgba(255, 163, 72, 0.8);
  transform: scale(1.04);
}

.radio-play:active:not(:disabled) {
  transform: scale(0.97);
}

.radio-play:disabled {
  color: var(--text-dim);
  background: var(--raised-hi);
  box-shadow: none;
  cursor: progress;
}

.radio-play::after {
  position: absolute;
  inset: -5px;
  content: "";
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 200ms ease;
}

.radio-player[data-state="starting"] .radio-play::after,
.radio-player[data-state="early"] .radio-play::after {
  opacity: 1;
  animation: radio-turn 900ms linear infinite;
}

@keyframes radio-turn {
  to {
    rotate: 1turn;
  }
}

/* on air: a dot that breathes while the station plays */

.radio-live {
  display: none;
  gap: 8px;
  align-items: center;
  align-self: start;
  margin: 4px 0 0;
  padding: 5px 11px 5px 9px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.radio-player:is([data-state="early"], [data-state="playing"], [data-state="paused"]) .radio-live {
  display: inline-flex;
}

.radio-live-paused,
.radio-player[data-state="paused"] .radio-live-on {
  display: none;
}

.radio-player[data-state="paused"] .radio-live-paused {
  display: inline;
}

.radio-dot {
  width: 8px;
  height: 8px;
  background: var(--text-faint);
  border-radius: 50%;
}

.radio-player:is([data-state="early"], [data-state="playing"]) .radio-dot {
  background: var(--bad);
  box-shadow: 0 0 0 3px rgba(240, 94, 86, 0.18);
  animation: radio-breathe 1.8s ease-in-out infinite;
}

@keyframes radio-breathe {
  50% {
    opacity: 0.45;
  }
}

/* the song's progress, and its clock in figures that keep their width */

.radio-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 22px;
}

.radio-progress {
  height: 6px;
  overflow: hidden;
  background: var(--raised-hi);
  border-radius: 999px;
}

.radio-progress div {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 250ms linear;
}

.radio-time {
  min-width: 11ch;
  margin: 0;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
}

.radio-time:empty::before {
  content: "0:00 / 0:00";
  opacity: 0.6;
}

/* the recordings the song on air samples: a row each, the button that plays the original beside its credit */

.radio-sampled {
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line-soft);
}

.radio-sampled-title {
  margin: 0 0 8px;
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
}

.radio-sampled-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.radio-sampled-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

.radio-original {
  flex: none;
  min-width: 4.5em;
  height: 28px;
  padding: 0 12px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.radio-original:hover {
  background: var(--raised-hi);
  border-color: var(--line-hi);
}

.radio-original[aria-pressed="true"] {
  color: var(--accent-hi);
  background: var(--radio-accent-tint);
  border-color: var(--radio-accent-edge);
}

.radio-credit a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-hi);
  text-underline-offset: 3px;
}

.radio-credit a:hover {
  text-decoration-color: var(--accent);
}

.radio-role {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12px;
}

/* the controls: one kind of button, each with its icon; a disabled one plainly so */

.radio-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}

.radio-song-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.radio-btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 15px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.radio-btn:hover:not(:disabled, [aria-disabled="true"]) {
  background: var(--raised-hi);
  border-color: var(--line-hi);
}

.radio-btn:active:not(:disabled, [aria-disabled="true"]) {
  background: var(--line);
}

.radio-btn:disabled,
.radio-btn[aria-disabled="true"] {
  color: var(--text-faint);
  background: transparent;
  border-color: var(--line-soft);
  cursor: not-allowed;
  opacity: 0.7;
}

.radio-btn[aria-disabled="true"] {
  pointer-events: none;
}

/* a button the page hides (Every genre, while no genre is chosen) stays hidden whatever its display */
.radio-btn[hidden] {
  display: none;
}

.radio-btn-icon {
  width: 40px;
  padding: 0;
}

.radio-btn-quiet {
  height: 32px;
  padding: 0 12px;
  color: var(--text-dim);
  font-size: 13px;
  background: transparent;
}

.radio-volume {
  display: flex;
  gap: 6px;
  align-items: center;
}

.radio-volume-off,
.radio-player[data-muted="true"] .radio-volume-on {
  display: none;
}

.radio-player[data-muted="true"] .radio-volume-off {
  display: block;
}

.radio-volume input {
  width: 120px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.radio-player[data-muted="true"] .radio-volume input {
  opacity: 0.45;
}

/* what comes next, along the card's foot */

.radio-next {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  margin: 22px -24px 0;
  padding: 16px 24px;
  border-top: 1px solid var(--line-soft);
}

.radio-next-label {
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
}

.radio-next .radio-meta {
  margin: 0;
  font-size: 14px;
}

.radio-status {
  margin: 0 -24px;
  padding: 0 24px 16px;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.5;
}

.radio-status:empty {
  display: none;
}

/* the station's genres: a row that opens on a list of chips by family, each lit while the station keeps to it */

.radio-genres {
  margin: 0 0 40px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
}

.radio-genres summary {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
  color: var(--text);
  list-style: none;
  border-radius: 14px;
  cursor: pointer;
  transition: background 140ms ease;
}

.radio-genres summary::-webkit-details-marker {
  display: none;
}

.radio-genres summary:hover {
  background: var(--raised);
}

.radio-genres[open] summary {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.radio-genres-title {
  font-weight: 500;
}

.radio-genres-said {
  overflow: hidden;
  color: var(--text-dim);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.radio-genres-count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 13px;
  white-space: nowrap;
}

.radio-chevron {
  margin-left: 4px;
  color: var(--text-dim);
  transition: rotate 220ms var(--radio-ease);
}

.radio-genres[open] .radio-chevron {
  rotate: 180deg;
}

.radio-genres-body {
  padding: 4px 18px 22px;
  border-top: 1px solid var(--line-soft);
}

.radio-genres-intro {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 12px 0 18px;
}

.radio-genres-intro p {
  max-width: 62ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
}

.radio-genre-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 22px 28px;
  align-items: start;
}

.radio-genre-list fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  align-items: flex-start;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.radio-genre-list legend {
  float: left;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
}

.radio-chip {
  position: relative;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.radio-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.radio-chip .radio-icon {
  width: 0;
  height: 15px;
  margin-right: -6px;
  color: var(--accent);
  stroke-width: 2.5;
  opacity: 0;
  transition: width 160ms var(--radio-ease), margin 160ms var(--radio-ease), opacity 120ms ease;
}

.radio-chip:hover {
  color: var(--text);
  border-color: var(--line-hi);
}

.radio-chip:has(input:checked) {
  color: var(--text);
  background: var(--radio-accent-tint);
  border-color: var(--radio-accent-edge);
}

.radio-chip:has(input:checked) .radio-icon {
  width: 15px;
  margin-right: 0;
  opacity: 1;
}

.radio-chip:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* what the station played: newest first, each its title over what it was */

.radio-history h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 500;
}

.radio-played {
  margin: 0;
  padding: 0;
  list-style: none;
}

.radio-played li {
  display: grid;
  gap: 2px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}

.radio-played-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}

.radio-played-meta {
  color: var(--text-dim);
  font-size: 14px;
}

.radio-empty {
  display: none;
  margin: 0;
  padding: 12px 0;
  color: var(--text-faint);
  font-size: 14px;
  border-top: 1px solid var(--line-soft);
}

.radio-played:empty + .radio-empty {
  display: block;
}

.radio-foot {
  max-width: 68ch;
  margin: 36px 0 0;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
}

.radio-foot a {
  color: var(--text-dim);
  text-decoration: underline;
  text-decoration-color: var(--line-hi);
  text-underline-offset: 3px;
}

.radio-foot a:hover {
  color: var(--text);
  text-decoration-color: var(--accent);
}

@media (max-width: 640px) {
  .radio {
    padding-top: 36px;
  }

  .radio-player {
    padding: 18px 18px 0;
    border-radius: 16px;
  }

  .radio-now {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
  }

  .radio-live {
    grid-column: 1 / -1;
    justify-self: start;
    margin: 0;
  }

  .radio-play {
    width: 58px;
    height: 58px;
  }

  .radio-play-icon {
    width: 24px;
    height: 24px;
  }

  .radio-onair h2 {
    font-size: 21px;
    white-space: normal;
  }

  .radio-song-links {
    width: 100%;
    margin-left: 0;
  }

  .radio-song-links .radio-btn {
    flex: 1 1 0;
  }

  .radio-volume {
    flex: 1;
  }

  .radio-volume input {
    flex: 1;
    width: auto;
  }

  .radio-next {
    margin: 18px -18px 0;
    padding: 14px 18px;
  }

  .radio-status {
    margin: 0 -18px;
    padding: 0 18px 14px;
  }

  .radio-genres-intro {
    flex-direction: column;
  }
}

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