
.bf-audio {
  --bf-a-accent: var(--brand, #6c8cff);
  --bf-a-ink: var(--brand-ink, #fff);
  --bf-a-surface: var(--surface, color-mix(in srgb, var(--text, #fff) 5%, transparent));
  --bf-a-line: var(--line, color-mix(in srgb, var(--text, #fff) 14%, transparent));
  --bf-a-radius: var(--radius, 14px);
  margin: 0 0 40px;
  color: var(--text, #fff);
}

/* ---------- now playing ---------- */

.bf-audio-hero {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(20px, 3.5vw, 38px);
  align-items: center;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid var(--bf-a-line);
  border-radius: var(--bf-a-radius);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--bf-a-accent) 13%, transparent), transparent 60%),
    var(--bf-a-surface);
}

.bf-audio-art {
  position: relative;
  aspect-ratio: 1;
  border-radius: calc(var(--bf-a-radius) - 2px);
  overflow: hidden;
  background: color-mix(in srgb, var(--text, #fff) 8%, transparent);
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, .85);
}
.bf-audio-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bf-audio-art-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: clamp(46px, 9vw, 76px); opacity: .28;
}
/* Slow drift while playing. It reads as "this is alive" without asking the
   visitor to look at it, and it is the only motion on the page. */
.bf-audio.is-playing .bf-audio-art img { animation: bf-audio-breathe 14s ease-in-out infinite; }
@keyframes bf-audio-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }

.bf-audio-meta { min-width: 0; }
.bf-audio-eyebrow {
  margin: 0 0 8px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--bf-a-accent); font-weight: 600;
}
.bf-audio-title {
  font-family: var(--font-display, inherit); font-weight: 400;
  font-size: clamp(1.5rem, 3.4vw, 2.5rem); line-height: 1.1; margin: 0 0 6px;
  overflow-wrap: anywhere;
}
.bf-audio-artist { margin: 0; color: var(--muted, #aaa); font-size: .96rem; }
.bf-audio-caption {
  margin: 12px 0 0; color: var(--muted, #aaa); font-size: .92rem; line-height: 1.6;
  max-width: 46ch;
}

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

.bf-audio-scrub { margin: 22px 0 10px; }
.bf-audio-bar {
  position: relative; height: 6px; border-radius: 999px; cursor: pointer;
  background: color-mix(in srgb, var(--text, #fff) 16%, transparent);
  touch-action: none;
}
/* The hit area is 22px tall even though the bar is 6px: a 6px drag target is
   unusable on a phone. */
.bf-audio-bar::before { content: ""; position: absolute; inset: -8px 0; }
.bf-audio-bar-buffered {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--text, #fff) 12%, transparent);
}
.bf-audio-bar-played {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px;
  background: var(--bf-a-accent);
}
.bf-audio-bar-thumb {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: var(--bf-a-accent); pointer-events: none;
  opacity: 0; transition: opacity .15s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.bf-audio-bar:hover .bf-audio-bar-thumb,
.bf-audio-bar:focus-visible .bf-audio-bar-thumb,
.bf-audio.is-seeking .bf-audio-bar-thumb { opacity: 1; }
.bf-audio-times {
  display: flex; justify-content: space-between; margin-top: 7px;
  font-size: 12px; color: var(--quiet, var(--muted, #888));
  font-variant-numeric: tabular-nums;
}

/* ---------- controls ---------- */

.bf-audio-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bf-audio-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0; flex: 0 0 auto;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  color: var(--text, #fff); opacity: .78;
  transition: opacity .18s ease, background .18s ease, transform .18s ease;
}
.bf-audio-btn:hover { opacity: 1; background: color-mix(in srgb, var(--text, #fff) 9%, transparent); }
.bf-audio-btn:active { transform: scale(.94); }
.bf-audio-btn[aria-pressed="true"] { opacity: 1; color: var(--bf-a-accent); }
.bf-audio-btn svg { width: 20px; height: 20px; fill: currentColor; pointer-events: none; }
.bf-audio-play {
  width: 58px; height: 58px; opacity: 1;
  background: var(--bf-a-accent); color: var(--bf-a-ink);
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--bf-a-accent) 80%, transparent);
}
.bf-audio-play:hover { background: var(--bf-a-accent); filter: brightness(1.08); }
.bf-audio-play svg { width: 24px; height: 24px; }
.bf-audio-spacer { flex: 1 1 auto; min-width: 0; }
.bf-audio-rate {
  min-width: 44px; height: 44px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--bf-a-line); background: transparent; color: var(--muted, #aaa);
  font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer;
}
.bf-audio-rate:hover { color: var(--text, #fff); }
.bf-audio-volume { display: flex; align-items: center; gap: 4px; }
.bf-audio-volume input {
  width: 84px; accent-color: var(--bf-a-accent); cursor: pointer; background: transparent;
}

/* ---------- track list ---------- */

.bf-audio-listhead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin: 34px 0 10px;
}
.bf-audio-listhead h3 {
  margin: 0; font-family: var(--font-display, inherit); font-weight: 400;
  font-size: 1.15rem; letter-spacing: .02em;
}
.bf-audio-count { font-size: 12px; color: var(--quiet, var(--muted, #888)); }

.bf-audio-list { list-style: none; margin: 0; padding: 0; }
.bf-audio-row {
  display: grid;
  grid-template-columns: 40px 52px minmax(0, 1fr) auto;
  align-items: center; gap: 14px;
  padding: 9px 10px; border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.bf-audio-row + .bf-audio-row { margin-top: 2px; }
.bf-audio-row:hover { background: color-mix(in srgb, var(--text, #fff) 6%, transparent); }
.bf-audio-row.is-current {
  background: color-mix(in srgb, var(--bf-a-accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--bf-a-accent) 32%, transparent);
}
.bf-audio-row.is-missing { opacity: .45; cursor: default; }
.bf-audio-row.is-missing:hover { background: transparent; }

.bf-audio-rownum {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; cursor: inherit;
  color: var(--quiet, var(--muted, #888)); font: inherit; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.bf-audio-row:hover .bf-audio-rownum { color: var(--text, #fff); }
.bf-audio-rownum svg { width: 15px; height: 15px; fill: currentColor; }
.bf-audio-rownum .bf-audio-n { display: block; }
.bf-audio-rownum .bf-audio-glyph { display: none; }
.bf-audio-row:hover .bf-audio-rownum .bf-audio-n,
.bf-audio-row.is-current .bf-audio-rownum .bf-audio-n { display: none; }
.bf-audio-row:hover .bf-audio-rownum .bf-audio-glyph,
.bf-audio-row.is-current .bf-audio-rownum .bf-audio-glyph { display: block; }
.bf-audio-row.is-current .bf-audio-rownum { color: var(--bf-a-accent); }

.bf-audio-rowart {
  width: 52px; height: 52px; border-radius: 8px; object-fit: cover; display: block;
  background: color-mix(in srgb, var(--text, #fff) 8%, transparent);
}
.bf-audio-rowmeta { min-width: 0; }
.bf-audio-rowtitle {
  display: block; font-weight: 600; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bf-audio-row.is-current .bf-audio-rowtitle { color: var(--bf-a-accent); }
.bf-audio-rowsub {
  display: block; font-size: .82rem; color: var(--muted, #aaa);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bf-audio-rowtime {
  font-size: 12.5px; color: var(--quiet, var(--muted, #888));
  font-variant-numeric: tabular-nums;
}

/* Equalizer on the playing row. Pure CSS, three bars. */
.bf-audio-eq { display: none; gap: 2px; align-items: flex-end; height: 14px; }
.bf-audio-row.is-current.is-playing-row .bf-audio-eq { display: flex; }
.bf-audio-row.is-current.is-playing-row .bf-audio-rowtime { display: none; }
.bf-audio-eq i {
  display: block; width: 3px; border-radius: 1px; background: var(--bf-a-accent);
  animation: bf-audio-eq .9s ease-in-out infinite;
}
.bf-audio-eq i:nth-child(1) { height: 60%; animation-delay: -.5s; }
.bf-audio-eq i:nth-child(2) { height: 100%; animation-delay: -.2s; }
.bf-audio-eq i:nth-child(3) { height: 40%; }
@keyframes bf-audio-eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

/* ---------- states ---------- */

.bf-audio-empty {
  padding: 34px; text-align: center; color: var(--muted, #aaa);
  border: 1px dashed var(--bf-a-line); border-radius: var(--bf-a-radius);
}
.bf-audio-error {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px; font-size: .88rem;
  color: var(--text, #fff);
  background: color-mix(in srgb, #e5484d 18%, transparent);
  border: 1px solid color-mix(in srgb, #e5484d 40%, transparent);
}
.bf-audio-note {
  margin: 10px 0 0; font-size: .82rem; color: var(--quiet, var(--muted, #888));
}

/* The native element is the no-JS fallback: visible and usable until the
   runtime boots, then hidden in favour of the custom chrome. */
.bf-audio-native { width: 100%; margin-top: 14px; }
.bf-audio.is-booted .bf-audio-native { display: none; }
.bf-audio:not(.is-booted) .bf-audio-controls,
.bf-audio:not(.is-booted) .bf-audio-scrub { display: none; }

:where(.bf-audio) :focus-visible {
  outline: 2px solid var(--bf-a-accent); outline-offset: 2px; border-radius: 8px;
}

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

@media (max-width: 720px) {
  .bf-audio-hero {
    grid-template-columns: 1fr;
    gap: 18px;
    text-align: center;
    padding: 16px;
  }
  .bf-audio-art { width: min(74%, 260px); margin: 0 auto; }
  .bf-audio-caption { margin-left: auto; margin-right: auto; }
  .bf-audio-controls { justify-content: center; }
  /* Volume is the OS's job on a phone, and the slider only steals width. */
  .bf-audio-volume { display: none; }
  .bf-audio-spacer { display: none; }
  .bf-audio-rate { margin-left: 6px; }
  .bf-audio-row { grid-template-columns: 34px 44px minmax(0, 1fr) auto; gap: 10px; padding: 8px 6px; }
  .bf-audio-rowart { width: 44px; height: 44px; }
  .bf-audio-rownum { width: 34px; }
}

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