/* Fallback colours. The build sets --bg, --tint and --accent per album on <html style>. */
:root {
  --bg: #121212;
  --tint: #363636;
  --accent: #f2f2f2;
  --fg: #fff;
  --muted: rgb(255 255 255 / 0.64);
  --faint: rgb(255 255 255 / 0.16);
  --hover: rgb(255 255 255 / 0.08);
  --bar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  line-height: 1.4;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--tint) 0, var(--bg) 560px) no-repeat, var(--bg);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.has-track { padding-bottom: calc(var(--bar-h) + var(--safe-bottom)); }
body.full-open { overflow: hidden; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
/* The public copy streams only (album.config.json "downloads": false). */
.no-downloads .if-downloads { display: none !important; }

.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }
.icon.inline { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }

/* Play/pause swaps with global playback state. */
.when-playing { display: none; }
body.playing .when-playing { display: block; }
body.playing .when-paused { display: none; }

/* ---------------------------------------------------------------- Album */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 28px) 16px 40px;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}
.cover {
  display: block;
  width: min(72vw, 340px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 6px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.55);
  background: var(--tint);
}
.eyebrow { display: none; margin: 0; font-size: 0.8125rem; font-weight: 600; }
h1 {
  margin: 0;
  font-size: clamp(1.75rem, 7vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.artist { margin: 8px 0 0; font-weight: 700; }
.meta { margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; }
.description { margin: 14px auto 0; max-width: 60ch; color: var(--muted); font-size: 0.9375rem; }
.description:empty { display: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.btn-play {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  transition: transform 0.12s ease;
}
.btn-play:hover { transform: scale(1.04); }
.btn-play:active { transform: scale(0.95); }
.btn-play .icon { width: 28px; height: 28px; }

.btn-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--muted);
}
.btn-icon:hover { color: var(--fg); }
.btn-icon[aria-pressed='true'] { color: var(--accent); }
.btn-icon[aria-pressed='true']::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.repeat[data-mode='one']::before {
  content: '1';
  position: absolute;
  top: 6px;
  right: 5px;
  min-width: 13px;
  height: 13px;
  border-radius: 7px;
  background: var(--accent);
  color: #000;
  font-size: 9px;
  font-weight: 800;
  line-height: 13px;
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--faint);
  border-radius: 19px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill:hover { border-color: var(--muted); }
.pill .icon { width: 20px; height: 20px; }
.pill-sub { color: var(--muted); font-weight: 400; }
.pill-sub:empty { display: none; }
.pill.primary { background: var(--fg); color: #000; border-color: transparent; padding: 0 22px; }
.pill.danger { color: #ff8a80; }

#download[data-state='busy'] {
  background: linear-gradient(90deg, var(--faint) var(--progress, 0%), transparent var(--progress, 0%));
  font-variant-numeric: tabular-nums;
}
#download[data-state='done'] { color: var(--accent); border-color: transparent; }

/* --------------------------------------------------------------- Tracks */

.tracks {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
}
.track {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 3.25em;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 6px;
  text-align: left;
}
.track:hover { background: var(--hover); }
.track .num {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.track .info { display: flex; flex-direction: column; min-width: 0; }
.track .title,
.track .sub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.track .sub { color: var(--muted); font-size: 0.875rem; }
.explicit {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--muted);
  color: var(--bg);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: 1px;
}
.track .dur { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; text-align: right; }
.track .saved { width: 16px; height: 16px; color: var(--accent); visibility: hidden; }
.track.is-saved .saved { visibility: visible; }
.track.is-current .title,
.track.is-current .num { color: var(--accent); }
.track.is-unavailable { opacity: 0.38; }

.eq { display: none; align-items: flex-end; gap: 2px; height: 14px; }
.eq i { display: block; width: 3px; height: 40%; background: var(--accent); border-radius: 1px; animation: eq 0.9s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -0.45s; animation-duration: 0.7s; }
.eq i:nth-child(3) { animation-delay: -0.2s; animation-duration: 1.1s; }
body.playing .track.is-current .eq { display: flex; }
body.playing .track.is-current .n { display: none; }
@keyframes eq {
  from { height: 20%; }
  to { height: 100%; }
}

.credit-list {
  display: grid;
  grid-template-columns: minmax(7em, max-content) 1fr;
  gap: 4px 20px;
  margin: 0;
  font-size: 0.9375rem;
}
.credit-list dt { color: var(--muted); }
.credit-list dd { margin: 0; }
#credits .credit-list { margin-top: 16px; }
#credits h2 { margin-bottom: 2px; }

.site-footer { margin-top: 36px; color: var(--muted); font-size: 0.8125rem; text-align: center; }
#copyright { white-space: pre-line; }
#rights-notice { max-width: 34em; margin-inline: auto; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-bottom: 12px; }
.links:empty { display: none; }
.links a { color: var(--fg); font-weight: 600; font-size: 0.875rem; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* --------------------------------------------------------------- Player bar */

.bar {
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  height: calc(var(--bar-h) + var(--safe-bottom));
  padding: 0 8px var(--safe-bottom) 10px;
  background: rgb(0 0 0 / 0.55);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  border-top: 1px solid rgb(255 255 255 / 0.06);
}
body.has-track .bar { display: grid; }
.bar-progress { position: absolute; inset: 0 0 auto; height: 2px; background: var(--faint); }
#bar-fill { height: 100%; width: 0; background: var(--fg); }

.bar-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 100%;
  text-align: left;
}
.bar-info img { width: 44px; height: 44px; border-radius: 4px; flex: none; }
.bar-text { display: flex; flex-direction: column; min-width: 0; }
.bar-text span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.np-title { font-weight: 600; }
.bar .np-title { font-size: 0.9375rem; }
.bar .np-artist { color: var(--muted); font-size: 0.8125rem; }

.controls { display: flex; align-items: center; justify-content: center; gap: 4px; }
.bar .btn-play { width: 44px; height: 44px; background: none; color: var(--fg); }
.bar .btn-play:hover { transform: none; }
.wide-only { display: none !important; }

.seek-row { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.seek-row span { min-width: 3em; }
.seek-row span:first-child { text-align: right; }

/* Range input styled as a thin progress line. --p is the played fraction. */
.seek {
  --p: 0%;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--fg) var(--p), var(--faint) var(--p));
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--fg);
}
.seek::-moz-range-track { height: 4px; border-radius: 2px; background: var(--faint); }
.seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--fg); }
.seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--fg); }

/* --------------------------------------------------------------- Now playing */

.full {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: calc(var(--safe-top) + 8px) 24px calc(var(--safe-bottom) + 28px);
  background: linear-gradient(180deg, var(--tint), var(--bg) 80%);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.32s;
}
.full.open { transform: none; visibility: visible; transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
.full > * { width: 100%; max-width: 520px; }

.full-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; }
.full-context { display: flex; flex-direction: column; min-width: 0; font-size: 0.8125rem; }
.full-context small { color: var(--muted); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.08em; }
.full-context strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* The art takes whatever height is left and stays square within it. */
.full-art-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}
.full-art {
  display: block;
  width: min(100cqw, 100cqh);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.5);
}

.full-meta { display: flex; align-items: center; gap: 12px; }
.full-meta-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.full-meta .np-title { font-size: 1.375rem; font-weight: 700; }
.full-meta .np-artist { color: var(--muted); }
.full-meta-text span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.full-meta .pill { height: 32px; padding: 0 14px; font-size: 0.8125rem; }

.full-seek .times {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.controls.big { justify-content: space-between; }
.controls.big .btn-icon { width: 56px; height: 56px; color: var(--fg); }
.controls.big .btn-icon[aria-pressed='true'] { color: var(--accent); }
.controls.big [data-action='shuffle'],
.controls.big [data-action='repeat'] { color: var(--muted); }
.controls.big [data-action='prev'] .icon,
.controls.big [data-action='next'] .icon { width: 34px; height: 34px; }
.controls.big .btn-play { width: 68px; height: 68px; background: var(--fg); }
.controls.big .btn-play .icon { width: 32px; height: 32px; }

/* --------------------------------------------------------------- Dialog, toast */

dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 0;
  border-radius: 14px;
  background: #1f1f1f;
  color: var(--fg);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.6);
}
dialog::backdrop { background: rgb(0 0 0 / 0.6); }
dialog h2 { margin: 0 0 16px; font-size: 1.25rem; }
dialog h3 { margin: 20px 0 6px; font-size: 1rem; }
dialog p { margin: 0 0 10px; }
dialog ol { margin: 0 0 10px; padding-left: 1.25em; }
dialog li { margin-bottom: 4px; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; padding: 0; font-weight: 700; }
.hint { color: var(--muted); font-size: 0.8125rem; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--faint);
  border-radius: 10px;
  cursor: pointer;
}
.option:has(input:checked) { border-color: var(--accent); background: var(--hover); }
.option input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.option span { display: flex; flex-direction: column; }
.option small { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 20px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--bar-h) + 16px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--fg);
  color: #000;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast button { flex: none; color: inherit; font-weight: 800; text-decoration: underline; }

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

@media (min-width: 900px) {
  :root { --bar-h: 88px; }
  main { padding-top: 56px; padding-inline: 32px; }
  .hero { flex-direction: row; align-items: flex-end; text-align: left; gap: 32px; }
  .cover { width: 300px; }
  .eyebrow { display: block; }
  .description { margin-left: 0; }
  .actions { justify-content: flex-start; }

  .bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr); padding-inline: 16px; }
  .bar-progress { display: none; }
  .bar-info img { width: 56px; height: 56px; }
  .bar-center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .bar .btn-play { width: 38px; height: 38px; background: var(--fg); color: #000; }
  .bar .btn-play .icon { width: 22px; height: 22px; }
  .bar .btn-play:hover { transform: scale(1.05); }
  .bar-end { justify-content: flex-end; }
  .wide-only { display: flex !important; }
  .bar .btn-icon.wide-only { display: grid !important; }
}

@media (prefers-reduced-motion: reduce) {
  .eq i { animation: none; height: 60%; }
  .full, .full.open, .toast { transition: none; }
}
