/* ==========================================================================
   Beattier marketing site
   Tokens mirror the app design system (project/uploads/DESIGN_SYSTEM.md).
   Dark-first; the site ships dark only, matching the app's hero theme.
   ========================================================================== */

:root {
  /* surfaces */
  --void: #0a0a0f;
  --obsidian: #13131a;
  --surface: #1c1c26;

  /* text */
  --text: #f0eef8;
  --text-secondary: #a9a7be;
  --text-muted: #7b7a8e;
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-frame: rgba(255, 255, 255, 0.14);

  /* accent */
  --accent-soft: #c4bfff;
  --accent-muted: #9b93ff;
  --accent: #7b6eff;
  --accent-deep: #5a50d4;
  --accent-glow: rgba(123, 110, 255, 0.34);
  --accent-selected-bg: rgba(123, 110, 255, 0.14);
  --accent-selected-border: rgba(123, 110, 255, 0.55);

  /* gold */
  --gold-honey: #f5c96a;
  --gold-selected-bg: rgba(232, 162, 32, 0.14);
  --gold-selected-border: rgba(232, 162, 32, 0.55);

  /* gradients */
  --brand-gradient: linear-gradient(to right, #5a50d4, #7b6eff, #9b93ff);
  --bg-gradient: linear-gradient(135deg, #0a0a0f, #13131a 55%, #17142e);

  /* shape & elevation */
  --radius-chip: 8px;
  --radius-input: 12px;
  --radius-card: 16px;
  --shadow-card: 0 6px 14px rgba(0, 0, 0, 0.34);

  /* type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* layout */
  --page-width: 1120px;
  --page-inline: clamp(20px, 4vw, 32px);

  /* motion */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------- base ---- */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-muted);
  text-decoration: none;
}

a:hover {
  color: var(--accent-soft);
}

img {
  max-width: 100%;
}

/* A class that sets `display` outranks the UA's `[hidden] { display: none }`,
   which would quietly break every `hidden` toggle on the library page. */
[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-glow);
}

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page {
  background: var(--bg-gradient);
  min-height: 100vh;
}

.shell {
  max-width: var(--page-width);
  margin: 0 auto;
  padding-inline: var(--page-inline);
}

/* ---------------------------------------------------------------- nav ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(10, 10, 15, 0.74);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

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

.brand__mark {
  border-radius: var(--radius-chip);
  display: block;
}

.brand__name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav__links {
  flex: 1;
  display: flex;
  gap: 24px;
  justify-content: flex-end;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
}

.nav-link {
  color: var(--text-secondary);
}

.nav-link:hover {
  color: var(--text);
}

.nav__back {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
}

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

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-card);
}

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

.btn--primary {
  background: var(--brand-gradient);
  padding: 14px 26px;
  box-shadow: 0 8px 24px var(--accent-glow);
  transition: transform 0.2s var(--spring), filter 0.2s;
}

.btn--primary:hover {
  transform: scale(1.03);
  filter: brightness(1.08);
}

.btn--primary:active {
  transform: scale(0.97);
}

.btn--secondary {
  background: var(--surface);
  border: 1px solid var(--border-frame);
  padding: 13px 24px;
  transition: transform 0.2s var(--spring), border-color 0.2s;
}

.btn--secondary:hover {
  transform: scale(1.03);
  border-color: var(--accent-selected-border);
}

.btn--secondary:active {
  transform: scale(0.97);
}

.btn--pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  transition: transform 0.2s var(--spring), background 0.2s;
}

.btn--pill:hover {
  background: var(--accent-muted);
  color: var(--text);
  transform: scale(1.04);
}

.btn--pill:active {
  transform: scale(0.97);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.btn-row--centered {
  justify-content: center;
  position: relative;
}

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

.hero {
  position: relative;
  overflow: hidden;
}

.hero__spotlight {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    560px at 82% 0%,
    rgba(123, 110, 255, 0.3),
    rgba(155, 147, 255, 0.12),
    transparent
  );
  pointer-events: none;
}

.hero__grid {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 88px var(--page-inline) 104px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 64px;
  align-items: center;
  position: relative;
}

.hero__copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.badge {
  margin: 0;
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  background: var(--accent-selected-bg);
  border: 1px solid var(--accent-selected-border);
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
}

.hero__title {
  margin: 0;
  font-size: clamp(38px, 7vw, 62px);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero__lede {
  margin: 0;
  font-size: 19px;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 46ch;
  text-wrap: pretty;
}

.hero__actions {
  margin-top: 8px;
}

.text-link {
  color: var(--accent-soft);
  font-size: 16px;
  font-weight: 600;
  padding: 14px 10px;
}

.hero__meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.hero__meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--text-muted);
}

.hero__device {
  display: flex;
  justify-content: center;
}

/* ------------------------------------------------------------- phones ---- */

.phone {
  border: 1px solid var(--border-frame);
  background: var(--obsidian);
}

.phone--hero {
  width: min(330px, 82vw);
  border-radius: 52px;
  padding: 11px;
  box-shadow: 0 48px 90px rgba(0, 0, 0, 0.55), 0 0 110px rgba(123, 110, 255, 0.22);
}

.phone--card {
  width: 100%;
  max-width: 300px;
  border-radius: 46px;
  padding: 10px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 0 80px rgba(123, 110, 255, 0.14);
}

.phone--gold {
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 0 80px rgba(232, 162, 32, 0.14);
}

.phone__screen {
  overflow: hidden;
  background: var(--void);
  position: relative;
  /* True device proportion (1320×2868 screenshots, 600×1304 resampled);
     keeps every frame the same size even if a screenshot arrives at an
     odd height. */
  aspect-ratio: 600 / 1304;
}

.phone--hero .phone__screen {
  border-radius: 42px;
}

.phone--card .phone__screen {
  border-radius: 37px;
}

/* Dynamic Island, floating over the screenshot's status bar */
.phone__island {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #000;
  z-index: 2;
}

.phone--hero .phone__island {
  top: 12px;
  width: 96px;
  height: 29px;
}

.phone--card .phone__island {
  top: 11px;
  width: 88px;
  height: 26px;
}

.phone__shot {
  width: 100%;
  height: auto;
  display: block;
}

/* ----------------------------------------------------------- sections ---- */

.section {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--page-inline) 96px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.section--features {
  padding-top: 32px;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 60ch;
  position: relative;
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-muted);
}

.section-title {
  margin: 0;
  font-size: clamp(29px, 4.5vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------------------------------------------------------- how it works - */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.card--step {
  padding: 28px;
  gap: 12px;
}

.card--feature {
  padding: 24px;
  gap: 14px;
}

.step__number {
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.card__title {
  font-size: 17px;
  font-weight: 600;
}

.card--step .card__title {
  margin-top: 6px;
}

.card__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* ----------------------------------------------------------- features ---- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.feature__icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-input);
  background: var(--accent-selected-bg);
  border: 1px solid var(--accent-selected-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-soft);
}

.feature__icon--gold {
  background: var(--gold-selected-bg);
  border-color: var(--gold-selected-border);
  color: var(--gold-honey);
}

/* ------------------------------------------------------------ screens ---- */

.screens {
  border-top: 1px solid var(--border);
  background: rgba(19, 19, 26, 0.6);
  overflow: hidden;
}

.screens__inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 88px var(--page-inline) 96px;
  display: flex;
  flex-direction: column;
  gap: 48px;
  position: relative;
}

.screens__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 32px;
  position: relative;
}

.screen {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.screen__caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
}

.screen__title {
  font-size: 17px;
  font-weight: 700;
}

.screen__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 32ch;
}

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

.footer {
  border-top: 1px solid var(--border);
}

.footer__row {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 32px var(--page-inline);
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.footer__brand-name {
  font-size: 14px;
  font-weight: 700;
}

.footer__legal {
  display: flex;
  gap: 16px;
  align-items: center;
}

.footer__copy {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.footer__link {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

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

.footer__social {
  display: flex;
  gap: 10px;
  align-items: center;
}

.social-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color 0.2s, border-color 0.2s;
}

.social-icon:hover {
  color: var(--accent-soft);
  border-color: var(--accent-selected-border);
}

/* ------------------------------------------------------------ privacy ---- */

.legal {
  --page-width: 760px;
}

.legal .nav__inner {
  padding-inline: var(--page-inline);
}

.legal__body {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 72px var(--page-inline) 96px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.legal__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legal__title {
  margin: 0;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.legal__meta {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.legal__section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.legal__section h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.legal__section p {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.legal__section ul {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legal__section li {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.legal__section strong {
  color: var(--text);
  font-weight: 700;
}

.legal .footer__row {
  padding: 28px var(--page-inline);
  gap: 16px;
}

/* ------------------------------------------------------- live stats ------ */

/* Landing-page strip. Ships with em-dash placeholders and is filled in by
   js/landing-stats.js, so a stale number is never rendered; if the fetch fails
   the section removes itself. */

.stats {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 8px var(--page-inline) 8px;
}

.stats__inner {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.02);
  padding: 26px clamp(20px, 3vw, 30px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.stats__note {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat__value {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color 0.4s var(--ease-out);
}

.stats[aria-busy="true"] .stat__value {
  color: var(--text-muted);
}

.stat__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------------------------------------------------------- library ------ */

.nav-link.is-current {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

.lib {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 40px var(--page-inline) 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.lib__head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lib__title {
  margin: 0;
  font-size: clamp(30px, 4.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.lib__lede {
  margin: 0;
  font-size: 16px;
  color: var(--text-secondary);
}

.lib__note {
  margin: 6px 0 0;
  max-width: 62ch;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

.lib__status {
  margin: 0;
  padding: 48px 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

.lib__body {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
}

.lib__main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.lib__side {
  position: sticky;
  top: 84px;
  /* Fill the viewport rather than a fixed height, so the tracklist below only
     scrolls on albums long enough to actually need it. */
  max-height: calc(100vh - 104px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* -- controls -- */

.lib__controls {
  display: flex;
  gap: 10px;
}

.field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-input);
  padding: 10px 14px;
  min-width: 0;
}

.field:focus-within {
  border-color: var(--accent-selected-border);
}

.field__icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.field input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
}

.field input::placeholder {
  color: var(--text-muted);
}

.select {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-input);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
  cursor: pointer;
}

.select:focus-visible {
  border-color: var(--accent-selected-border);
}

.lib__filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}

.pill:hover {
  border-color: var(--accent-selected-border);
  color: var(--text);
}

.pill.is-active {
  background: var(--accent-selected-bg);
  border-color: var(--accent-selected-border);
  color: var(--accent-soft);
}

.lib__filters-end {
  display: flex;
  align-items: center;
  gap: 16px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

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

.toggle input {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 15px;
  height: 15px;
  border: 1px solid var(--border-frame);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background 0.18s, border-color 0.18s;
}

.toggle input::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  transform: scale(0);
  background: var(--void);
  transition: transform 0.18s var(--spring);
}

.toggle input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle input:checked::before {
  transform: scale(1);
}

.toggle input:focus-visible {
  outline: 2px solid var(--accent-muted);
  outline-offset: 2px;
}

.lib__count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* -- album grid -- */

.albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.album {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-card);
  background: transparent;
  border: 1px solid transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.album:hover {
  background: rgba(255, 255, 255, 0.04);
}

.album.is-selected {
  background: var(--accent-selected-bg);
  border-color: var(--accent-selected-border);
}

.album__art,
.detail__art-inner {
  position: relative;
  overflow: hidden;
  background: var(--obsidian);
  box-shadow: var(--shadow-card);
}

.album__art {
  aspect-ratio: 1;
  border-radius: var(--radius-input);
}

.album__art img,
.detail__art-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album__score {
  position: absolute;
  top: 8px;
  right: 8px;
  font-weight: 900;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  background: rgba(10, 10, 15, 0.82);
  padding: 3px 9px;
  border-radius: var(--radius-chip);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.album__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
  min-width: 0;
}

.album__title,
.album__artist,
.track__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.album__artist {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.album:focus-visible,
.pill:focus-visible {
  outline: 2px solid var(--accent-muted);
  outline-offset: 3px;
  border-radius: var(--radius-chip);
}

.lib__empty {
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 32px 0;
}

/* -- side panels -- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.panel__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel__block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* min-height:0 lets a flex child shrink below its content, which is what allows
   the tracklist to scroll instead of pushing the panel past the viewport. */
.panel__block--grow {
  flex: 1;
  min-height: 0;
}

.detail {
  min-height: 0;
  overflow: hidden;
}

.detail[aria-busy="true"] {
  opacity: 0.6;
}

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

.detail__art {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
}

.detail__art-inner {
  width: 100%;
  height: 100%;
  border-radius: 14px;
}

.detail__meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.detail__title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.detail__sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
}

.detail__counts {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.detail__score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.detail__score {
  font-weight: 900;
  font-size: 42px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.detail__score-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* -- track score spread -- */

.spread {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 72px;
}

.spread__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}

.spread__bar {
  width: 100%;
  border-radius: 4px 4px 2px 2px;
  min-height: 2px;
  transition: height 0.35s var(--ease-out);
}

.spread__label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* -- track averages -- */

.tracks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  /* Long tracklists scroll; fading the bottom edge stops the clipped row from
     reading as a rendering fault. */
  mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), transparent);
}

.track {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.track.is-unrated {
  opacity: 0.45;
}

.track__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.track__name {
  font-size: 13px;
  font-weight: 600;
}

.track__bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.track__fill {
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 0.35s var(--ease-out);
}

.track__score {
  font-weight: 900;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* --------------------------------------------------------- responsive ---- */

@media (max-width: 980px) {
  .lib__body {
    grid-template-columns: 1fr;
  }

  /* Sticky only makes sense beside the grid; stacked, it would pin the panel
     over the albums the reader is scrolling through. */
  .lib__side {
    position: static;
    max-height: none;
  }

  /* Let the whole tracklist run inline; a scroll box inside a scrolling page
     is worse than a long list. */
  .detail {
    overflow: visible;
  }

  .tracks {
    overflow-y: visible;
    mask-image: none;
    -webkit-mask-image: none;
  }

  .stats__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 880px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 48px;
    padding-top: 56px;
    padding-bottom: 72px;
  }

  .footer__row {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
}

@media (max-width: 560px) {
  .albums {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 12px;
  }

  .lib__controls {
    flex-wrap: wrap;
  }

  .field {
    flex-basis: 100%;
  }

  .select {
    flex: 1;
  }

  .panel {
    padding: 20px;
  }

  .detail__head {
    gap: 12px;
  }

  .detail__art {
    width: 64px;
    height: 64px;
  }

  .detail__score {
    font-size: 34px;
  }
}

@media (max-width: 560px) {
  .nav-link {
    display: none;
  }

  /* Keep the current-page marker visible so the library page still says where
     you are once the other links collapse. */
  .nav-link.is-current {
    display: inline;
  }
}

/* ------------------------------------------------------------- motion ---- */

/* Scroll reveal: the hidden state is applied by main.js so the page stays
   fully visible without JavaScript. */
[data-reveal].is-hidden {
  opacity: 0;
  transform: translateY(26px);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

[data-reveal] {
  transition: opacity 0.6s var(--ease-out) var(--reveal-delay, 0ms),
    transform 0.6s var(--ease-out) var(--reveal-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
