/* /music – the songs and the player. Uses the tokens from base.css/theme.css ("B, greener"). Phone first.
   Look D = A + C (the owner's pick, 5 Nov 2026, of four: A a list with a bottom bar, B Apu fren covers, C a radio on top;
   sheets in docs/concepts/music-*.jpg): a big "radio" with a turning APU record on top, a list with a play button per
   row under it, and on phones the radio docks as a bar at the bottom once it has scrolled out of view (.is-docked,
   set by music.js). On desktop the radio keeps its own column and never docks. */

.mu .tool-head { padding-bottom: 2px; }
.mu-stats { margin-top: 12px; }
/* Session 29: the quiet link to the submit page, under the heading (only where /music/submit is built). */
.mu-send { margin: 6px 0 0; font-size: 14px; }
.mu-send a { color: var(--muted); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.mu-send a:hover { color: var(--lime); }
.mu-stats b { color: var(--lime); font-weight: 600; }

svg .s { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.i-pause { display: none; }
[data-state="playing"] .i-play, [data-state="loading"] .i-play { display: none; }
[data-state="playing"] .i-pause, [data-state="loading"] .i-pause { display: block; }

/* ---------- search + the sort control (sticky, as on the media kit) ---------- */
/* Session 25: the sort dropdown sits at the right of the search field (the owner's pick); the count of matches is inside
   the field, at its right end. */
.mu-search { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; margin: 14px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter); background: rgba(15, 30, 11, .9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.mu-search[hidden] { display: none; }
.mu-search__field { position: relative; flex: 1; min-width: 0; display: flex; }
.mu-search__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mu-search__input { flex: 1; min-width: 0; width: 100%; height: 46px; padding: 0 16px 0 44px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: rgba(0, 0, 0, .3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b9f96' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E") no-repeat 16px center / 18px; color: var(--text); font: inherit; font-size: 16px; transition: border-color .15s; }
.mu-search__input::placeholder { color: var(--muted); opacity: 1; }
.mu-search__input:focus { border-color: var(--lime); }
.mu-search__status { position: absolute; top: 50%; right: 16px; transform: translateY(-50%); margin: 0; pointer-events: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mu-search__status:empty { display: none; }
.mu-search__field:has(.mu-search__status:not(:empty)) .mu-search__input { padding-right: 84px; }
.mu-sort { flex: none; max-width: 46%; height: 46px; padding: 0 34px 0 14px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: rgba(0, 0, 0, .3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1f666' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; color: var(--text); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; -webkit-appearance: none; appearance: none; text-overflow: ellipsis; transition: border-color .15s; }
.mu-sort:hover, .mu-sort:focus { border-color: var(--lime); outline: none; }
.mu-sort option { background: #0e1a0b; color: var(--text); }
@media (min-width: 720px) {
  .mu-search { gap: 12px; margin: 10px 0 0; padding: 12px 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .mu-search__input, .mu-sort { background-color: #0e1a0b; box-shadow: 0 10px 28px rgba(0, 0, 0, .45); }
  .mu-search__field:has(.mu-search__status:not(:empty)) .mu-search__input { padding-right: 120px; }
  .mu-search__status { right: 22px; }
  .mu-sort { padding: 0 40px 0 18px; background-position: right 16px center; }
}
/* Why most played or trending reads newest first (no plays yet); empty otherwise. */
.mu-sort-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.mu-sort-note:empty { display: none; }
.mu-empty { margin-top: 32px; color: var(--muted); }

/* ---------- the list: a play button per row, the title, its length, share, download ---------- */
.mu-list { list-style: none; margin: 6px 0 0; padding: 0; }
.mu-song { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid rgba(243, 249, 238, .07); scroll-margin: 90px 0 130px; }
.mu-song[hidden] { display: none; }
.mu-song__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 4px 8px 0; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.mu-song__icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(161, 246, 102, .1); border: 1.5px solid var(--border-strong); color: var(--lime); transition: background .15s, border-color .15s; }
.mu-song__icon svg { width: 18px; height: 18px; fill: currentColor; }
.mu-song__title { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 400; font-size: 20px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu-song__name { flex: 1; min-width: 0; display: grid; gap: 1px; }
.mu-song__by { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
/* Session 32: a song's credits on a line of their own under the title (links can't sit inside the play link). */
.mu-song--credits { flex-wrap: wrap; }
.mu-song--credits .mu-song__main { min-height: 50px; padding-bottom: 0; }
.mu-song__credits { flex-basis: 100%; min-width: 0; margin: -6px 0 0; padding: 0 0 10px 52px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.mu-cr { overflow-wrap: anywhere; }
a.mu-cr { color: #c9d8bd; text-decoration: none; white-space: nowrap; }
a.mu-cr:hover, a.mu-cr:focus-visible { color: var(--lime); text-decoration: underline; }
.mu-cr__ico { display: inline-block; width: 14px; height: 14px; margin-right: 3px; vertical-align: -2px; color: var(--lime); }
.mu-song__credits .cr-sep { color: var(--muted); }
.mu-song__time { flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
/* Only in most played (all time) and trending (last 7 days), only on songs with plays (session 25, the owner's pick). */
.mu-song__plays { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: .85; }
.mu-song__share, .mu-song__dl { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: color .15s, background .15s; }
.mu-song__share svg, .mu-song__dl svg { width: 21px; height: 21px; }
.mu-song__share:hover, .mu-song__dl:hover, .mu-song__share:focus-visible, .mu-song__dl:focus-visible { color: var(--lime); background: rgba(161, 246, 102, .1); }
.mu-song__main:hover .mu-song__icon { border-color: var(--lime); }
.mu-song[aria-current] .mu-song__title { color: var(--lime); }
.mu-song[aria-current] .mu-song__icon { background: var(--lime); border-color: var(--lime); color: #0c120a; }
.mu-song[data-state="loading"] .mu-song__icon { animation: mu-pulse 1s ease-in-out infinite; }

/* ---------- the player: the radio ---------- */
/* flow-root: the radio's top margin counts in the slot's height, which holds its place while the player is docked */
.mu-slot { display: flow-root; }
/* Session 20 (Alexander): the controls sit next to the record and "now playing" takes the whole width under them,
   so a long title wraps instead of being cut off with "…". */
.mu-player { position: relative; z-index: 1; display: grid; grid-template-areas: "record buttons" "title title" "seek seek"; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px 14px; margin-top: 14px; padding: 16px; border: 1.5px solid var(--border-strong); border-radius: 20px; background: radial-gradient(120% 90% at 0% 0%, rgba(116, 168, 74, .35), transparent 60%), rgba(13, 25, 10, .92); box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.mu-player[hidden] { display: none; }
.mu-player__now { display: contents; }
.mu-player__title { grid-area: title; min-width: 0; margin-top: 6px; font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.1; overflow-wrap: anywhere; }
.mu-player__title::before { content: "now playing"; display: block; margin-bottom: 6px; font-family: var(--font-ui); font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--lime); }
.mu-player[data-state="paused"] .mu-player__title::before { content: "paused"; }
.mu-player__seek { grid-area: seek; display: flex; align-items: center; gap: 10px; }
.mu-player__time { flex: none; min-width: 2.6em; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mu-player__time:last-child { text-align: right; }
.mu-player__buttons { grid-area: buttons; display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.mu-btn { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; transition: background .15s, color .15s; }
.mu-btn svg { width: 26px; height: 26px; fill: currentColor; }
.mu-btn:hover { background: rgba(243, 249, 238, .08); }
.mu-btn--shuffle { color: var(--muted); }
.mu-btn--shuffle[aria-pressed="true"] { color: var(--lime); }
.mu-btn--shuffle[aria-pressed="true"]::after { content: ""; position: absolute; width: 4px; height: 4px; margin-top: 32px; border-radius: 50%; background: var(--lime); }
.mu-btn--play { width: 60px; height: 60px; background: var(--lime); color: #0c120a; }
.mu-btn--play:hover { background: #b6fb84; }
.mu-btn--play svg { width: 32px; height: 32px; }
.mu-player[data-state="loading"] .mu-btn--play { animation: mu-pulse 1s ease-in-out infinite; }
/* The volume slider: its row only exists once music.js has seen that this browser obeys it (.has-volume; not iPhones). */
.mu-volume { grid-area: volume; align-self: start; display: none; align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.mu-volume svg { flex: none; width: 20px; height: 20px; fill: currentColor; }
.mu-volume .mu-seek { flex: 1 1 200px; }
.mu-player.has-volume { grid-template-areas: "record buttons" "record volume" "title title" "seek seek"; }
.mu-player.has-volume .mu-player__buttons { align-self: end; }
.mu-player.has-volume .mu-volume { display: flex; }
/* A shared link loads its song; where the browser wants a tap before sound, the play button and the row ask for it. */
.mu-player.is-ready .mu-btn--play, .mu:has(.mu-player.is-ready) .mu-song[aria-current] .mu-song__icon { animation: mu-ready 1.4s ease-in-out infinite; }
@keyframes mu-pulse { 50% { opacity: .55; } }
@keyframes mu-ready { 0%, 100% { box-shadow: 0 0 0 0 rgba(161, 246, 102, .6); } 60% { box-shadow: 0 0 0 12px rgba(161, 246, 102, 0); } }
/* the record: the APU logo as its label, turning while a song plays */
.mu-player::before { content: ""; grid-area: record; width: 92px; height: 92px; border-radius: 50%; background: url("/assets/img/apu-logo-384.png") center / 40% no-repeat, repeating-radial-gradient(circle, #101010 0 2px, #1b1b1b 2px 4px); box-shadow: 0 0 0 3px #253a1d, 0 10px 26px rgba(0, 0, 0, .5); animation: mu-spin 6s linear infinite paused; }
.mu-player[data-state="playing"]::before { animation-play-state: running; }
@keyframes mu-spin { to { transform: rotate(1turn); } }

/* ---------- the player docked: a bar stuck to the bottom (phones, once the radio has scrolled away) ---------- */
.mu-player.is-docked { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0; grid-template-areas: "buttons ." "title title" "seek seek"; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding: 8px max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter))) calc(8px + env(safe-area-inset-bottom)); border: 0; border-top: 1.5px solid var(--border-strong); border-radius: 0; background: rgba(12, 24, 9, .95); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 -12px 32px rgba(0, 0, 0, .45); animation: mu-dock .22s var(--ease); }
.mu-player.is-docked::before, .mu-player.is-docked .mu-player__title::before { content: none; }
.mu-player.is-docked .mu-player__title { margin-top: 2px; font-family: var(--font-ui); font-weight: 700; font-size: 15px; line-height: 1.3; }
.mu-player.is-docked .mu-player__buttons { align-self: center; justify-content: flex-start; }
.mu-player.is-docked .mu-btn { width: 40px; height: 40px; }
.mu-player.is-docked .mu-btn svg { width: 22px; height: 22px; }
.mu-player.is-docked .mu-btn--shuffle[aria-pressed="true"]::after { margin-top: 30px; }
.mu-player.is-docked .mu-btn--play { width: 48px; height: 48px; margin: 0 2px; }
.mu-player.is-docked .mu-btn--play svg { width: 24px; height: 24px; }
@keyframes mu-dock { from { transform: translateY(100%); } }
body:has(.mu-player.is-docked) { padding-bottom: 150px; }
/* In the bar the slider sits next to the buttons, from 360 px up; narrower phones have no room for it. */
.mu-player.is-docked.has-volume { grid-template-areas: "buttons ." "title title" "seek seek"; }
.mu-player.is-docked.has-volume .mu-volume { display: none; }
@media (min-width: 360px) {
  .mu-player.is-docked.has-volume { grid-template-areas: "buttons volume" "title title" "seek seek"; }
  .mu-player.is-docked.has-volume .mu-volume { display: flex; align-self: center; gap: 6px; }
  .mu-player.is-docked .mu-volume svg { width: 18px; height: 18px; }
  .mu-player.is-docked .mu-volume .mu-seek { flex: 1; }
}
@media (min-width: 720px) {
  .mu-player.is-docked { grid-template-areas: "buttons title seek"; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 0 20px; padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .mu-player.is-docked.has-volume { grid-template-areas: "buttons title seek volume"; grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) 130px; }
  .mu-player.is-docked .mu-player__title { margin-top: 0; font-size: 16px; }
  body:has(.mu-player.is-docked) { padding-bottom: 90px; }
}

/* The progress bar: a range input, so it drags with a finger, a mouse or the arrow keys. --p is the played part. */
.mu-seek { flex: 1; min-width: 0; height: 24px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; --p: 0%; }
.mu-seek::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--lime) var(--p), rgba(243, 249, 238, .18) var(--p)); }
.mu-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border: 0; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(161, 246, 102, .18); }
.mu-seek::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(243, 249, 238, .18); }
.mu-seek::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--lime); }
.mu-seek::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--lime); }
.mu-seek:focus-visible { outline: none; }
.mu-seek:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(161, 246, 102, .5); }
.mu-seek:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgba(161, 246, 102, .5); }

.mu-toast { position: fixed; left: 50%; bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 30; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: var(--mint); color: #0c120a; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); overflow-wrap: anywhere; }
.mu-toast[hidden] { display: none; }

/* ---------- desktop: the radio in its own column, in view the whole time ---------- */
@media (min-width: 1040px) {
  .mu { display: grid; grid-template-columns: 400px minmax(0, 1fr); column-gap: 40px; align-items: start; }
  .mu > * { grid-column: 2; }
  .mu > .tool-head { grid-column: 1 / -1; }
  .mu > .mu-slot { grid-column: 1; grid-row: 2 / span 6; position: sticky; top: 20px; }
  .mu-player { margin-top: 18px; grid-template-areas: "record" "buttons" "title" "seek"; grid-template-columns: minmax(0, 1fr); padding: 28px; }
  .mu-player.has-volume { grid-template-areas: "record" "buttons" "volume" "title" "seek"; }
  .mu-player::before { justify-self: center; width: 200px; height: 200px; margin-bottom: 6px; }
  .mu-player__buttons { justify-content: center; gap: 14px; }
  .mu-btn { width: 48px; height: 48px; }
  .mu-btn--play { width: 68px; height: 68px; }
  .mu-volume .mu-seek { flex: 0 1 200px; }
  /* Session 24 (Alexander): the title takes the card's whole width (into its padding) and is one size smaller,
     so most titles fit on one or two lines. */
  .mu-player__title { margin: 14px -18px 0; font-size: 32px; line-height: 1.15; text-align: center; }
  .mu-search { margin-top: 6px; }
}
