:root {
  color-scheme: dark;
  --bg: #09090d;
  --text: #fff8ec;
  --muted: rgba(255, 248, 236, .64);
  --muted-strong: rgba(255, 248, 236, .78);
  --gold: #e7c98f;
  --line: rgba(255, 255, 255, .14);
  --glass: rgba(17, 16, 23, .42);
  --glass-strong: rgba(14, 13, 19, .66);
  --max: 1320px;
  --explore-bg: url("../assets/backgrounds/library/11-master-dark-courtyard.webp");
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image: var(--explore-bg);
  background-size: cover;
  background-position: center;
  filter: saturate(1.04) contrast(1.03);
  transform: scale(1.018);
  transition: background-image .45s ease, filter .45s ease;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 225, 171, .10), transparent 28%),
    linear-gradient(to bottom, rgba(7, 7, 10, .26) 0, rgba(7, 7, 10, .46) 38%, rgba(7, 7, 10, .76) 100%);
}

button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.catalogue-status { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(var(--max), calc(100% - 34px));
  min-height: 78px;
  margin: 0 auto;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(8, 8, 11, .72), rgba(8, 8, 11, .24) 66%, transparent);
}

.topbar-spacer { grid-column: 1; }
.explore-title {
  grid-column: 2;
  margin: 0;
  font-size: clamp(1.18rem, 2vw, 1.42rem);
  font-weight: 720;
  letter-spacing: -.035em;
  text-align: center;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .5);
}

.close-explore {
  grid-column: 3;
  justify-self: end;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  color: var(--text);
  background: rgba(19, 18, 24, .38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .16),
    0 12px 38px rgba(0, 0, 0, .26);
  backdrop-filter: blur(22px) saturate(1.16);
  -webkit-backdrop-filter: blur(22px) saturate(1.16);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.close-explore svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.close-explore:hover { transform: scale(1.04); background: rgba(29, 27, 34, .54); border-color: rgba(255, 255, 255, .26); }
.close-explore:active { transform: scale(.97); }
.close-explore:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

main {
  width: min(var(--max), calc(100% - 34px));
  margin: 0 auto;
  padding: 12px 0 max(88px, calc(58px + env(safe-area-inset-bottom)));
}

.collection-home { padding: 8px 0 10px; }
.catalogue-section { margin: 0 0 44px; }
.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 4px 15px;
}
.section-title-row h2,
.section-heading h3 { margin: 0; letter-spacing: -.035em; }
.section-title-row h2 {
  font-size: clamp(1rem, 2.2vw, 1.22rem);
  font-weight: 680;
  color: rgba(255, 248, 236, .88);
}
.section-title-row p {
  max-width: 520px;
  margin: 0;
  color: rgba(255, 248, 236, .48);
  font-size: .78rem;
  line-height: 1.45;
  text-align: right;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.collection-card {
  position: relative;
  isolation: isolate;
  min-width: 0;
  aspect-ratio: 1.18 / 1;
  min-height: 220px;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 30px;
  background: rgba(15, 14, 20, .36);
  text-align: center;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .10),
    0 22px 64px rgba(0, 0, 0, .27);
  transform: translateZ(0);
  transition: transform .28s cubic-bezier(.2,.7,.2,1), box-shadow .28s ease, border-color .28s ease;
}

.collection-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(132deg,
    rgba(255, 255, 255, .68) 0%,
    rgba(255, 255, 255, .12) 18%,
    rgba(255, 255, 255, .025) 45%,
    rgba(232, 198, 136, .24) 72%,
    rgba(255, 255, 255, .03) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .72;
}

.collection-card::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 17% 12%, rgba(255, 255, 255, .28), transparent 12%),
    radial-gradient(circle at 74% 19%, rgba(255, 226, 177, .16), transparent 15%),
    linear-gradient(118deg, transparent 24%, rgba(255, 255, 255, .09) 45%, transparent 64%);
  mix-blend-mode: screen;
  opacity: .28;
  transform: translate3d(-3%, -1%, 0);
  transition: opacity .3s ease, transform .5s cubic-bezier(.2,.7,.2,1);
}

.collection-image,
.collection-shade {
  position: absolute;
  inset: 0;
}
.collection-image {
  z-index: -3;
  background-size: cover;
  background-position: center;
  filter: saturate(.98) contrast(1.03);
  transform: scale(1.025);
  transition: transform .58s cubic-bezier(.2,.7,.2,1), filter .35s ease;
}
.collection-shade {
  z-index: -2;
  background:
    radial-gradient(circle at 50% 48%, rgba(5, 5, 8, .08) 0, rgba(5, 5, 8, .18) 34%, rgba(5, 5, 8, .50) 100%),
    linear-gradient(to top, rgba(5, 5, 8, .58), rgba(5, 5, 8, .02) 58%);
}

.collection-copy {
  position: absolute;
  inset: 22px;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  pointer-events: none;
}
.collection-copy small {
  display: block;
  margin-bottom: 7px;
  color: rgba(255, 238, 209, .74);
  font-size: .66rem;
  font-weight: 760;
  letter-spacing: .13em;
  text-transform: uppercase;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .6);
}
.collection-copy strong {
  display: block;
  max-width: 13ch;
  font-size: clamp(1.18rem, 2.15vw, 1.78rem);
  line-height: 1.02;
  letter-spacing: -.045em;
  text-wrap: balance;
  text-shadow: 0 3px 24px rgba(0, 0, 0, .78);
}
.collection-copy span {
  display: block;
  margin-top: 10px;
  color: rgba(255, 248, 236, .62);
  font-size: .73rem;
  line-height: 1.3;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .72);
}

.collection-card:hover {
  transform: translateY(-5px) scale(1.008);
  border-color: rgba(255, 255, 255, .20);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .14),
    0 30px 78px rgba(0, 0, 0, .34);
}
.collection-card:hover .collection-image { transform: scale(1.065); filter: saturate(1.08) contrast(1.04); }
.collection-card:hover::after { opacity: .48; transform: translate3d(4%, 2%, 0); }
.collection-card:active { transform: translateY(-1px) scale(.992); }
.collection-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.collection-detail {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding-top: 6px;
}

.back-button,
.quiet-button,
.song-more,
.retry-button,
.release-more {
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--text);
  background: rgba(22, 20, 28, .44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(20px) saturate(1.12);
  -webkit-backdrop-filter: blur(20px) saturate(1.12);
  cursor: pointer;
}
.back-button,
.quiet-button,
.song-more,
.retry-button {
  border-radius: 999px;
}
.back-button {
  min-height: 42px;
  padding: 0 15px;
  margin: 0 0 16px;
  color: rgba(255, 248, 236, .82);
}
.quiet-button { min-height: 38px; padding: 0 13px; color: var(--muted-strong); }
.back-button:hover,
.quiet-button:hover,
.song-more:hover,
.retry-button:hover,
.release-more:hover {
  border-color: rgba(255, 255, 255, .26);
  background: rgba(34, 31, 40, .58);
}

.detail-head {
  position: relative;
  overflow: hidden;
  max-width: 920px;
  margin: 0 auto 24px;
  padding: clamp(32px, 6vw, 62px) clamp(22px, 6vw, 64px);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 226, 177, .10), transparent 38%),
    rgba(17, 16, 22, .42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .10),
    0 30px 90px rgba(0, 0, 0, .28);
  backdrop-filter: blur(26px) saturate(1.12);
  -webkit-backdrop-filter: blur(26px) saturate(1.12);
  text-align: center;
}
.detail-head::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255,255,255,.06), transparent 30%, transparent 72%, rgba(231,201,143,.05));
}
.eyebrow {
  position: relative;
  margin: 0 0 10px;
  color: var(--gold);
  font-size: .7rem;
  line-height: 1;
  font-weight: 780;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.detail-head h2 {
  position: relative;
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  line-height: .96;
  letter-spacing: -.06em;
  text-wrap: balance;
  outline: none;
  text-shadow: 0 4px 28px rgba(0, 0, 0, .42);
}
.detail-head > p:not(.eyebrow) {
  position: relative;
  max-width: 650px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: .96rem;
  line-height: 1.6;
}
.detail-meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.detail-meta span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 999px;
  color: rgba(255, 248, 236, .66);
  background: rgba(255, 255, 255, .035);
  font-size: .76rem;
}

.release-section,
.songs-section {
  margin-top: 16px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 28px;
  background: rgba(15, 14, 20, .52);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .07),
    0 28px 86px rgba(0, 0, 0, .24);
  backdrop-filter: blur(28px) saturate(1.1);
  -webkit-backdrop-filter: blur(28px) saturate(1.1);
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-heading h3 { font-size: 1.32rem; }
.section-heading > span { color: var(--muted); font-size: .82rem; }

.release-rail,
.essential-release-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(164px, 202px);
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 3px 3px 9px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.release-card {
  position: relative;
  min-width: 0;
  scroll-snap-align: start;
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: transform .22s ease, color .22s ease;
}
.release-cover {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(55, 51, 67, .8), rgba(20, 19, 27, .9));
  box-shadow: 0 15px 40px rgba(0, 0, 0, .26);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.release-card:hover .release-cover { transform: translateY(-3px); border-color: rgba(255, 255, 255, .24); box-shadow: 0 20px 50px rgba(0,0,0,.32); }
.release-card.active .release-cover {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-color: rgba(231, 201, 143, .62);
  box-shadow: 0 22px 56px rgba(0, 0, 0, .36), 0 0 0 6px rgba(231, 201, 143, .055);
  transform: translateY(-2px);
}
.release-card.active::after {
  content: "Selected";
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  color: #18151a;
  background: rgba(255, 248, 236, .92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .02em;
  pointer-events: none;
}
.release-card.active .release-title { color: var(--gold); }
.release-card.active .release-meta { color: rgba(255, 248, 236, .76); }
.release-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.release-cover.fallback { display: grid; place-items: center; }
.release-cover.fallback span {
  display: grid;
  place-items: center;
  width: 56%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 50%;
  background: rgba(255, 255, 255, .035);
  color: #ddc9a5;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.05em;
}
.release-title { display: block; margin-top: 10px; font-weight: 720; font-size: .9rem; line-height: 1.25; }
.release-meta { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; line-height: 1.35; }

.song-list { display: grid; }
.song-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(120px, .55fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 6px;
  border-top: 1px solid rgba(255, 255, 255, .075);
  border-radius: 14px;
  transition: background .18s ease;
}
.song-row:first-child { border-top-color: transparent; }
.song-row:hover { background: rgba(255, 255, 255, .035); }
.song-art {
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: linear-gradient(145deg, #2a2834, #17161e);
}
.song-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.song-art.fallback { display: grid; place-items: center; color: #cdb991; font-weight: 800; }
.song-copy { min-width: 0; }
.song-copy strong,
.song-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-copy strong { font-size: .92rem; }
.song-copy span,
.song-release { color: var(--muted); font-size: .76rem; }
.song-release { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 999px;
  color: #15141a;
  background: rgba(255, 250, 240, .94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 8px 24px rgba(0,0,0,.18);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 800;
}
.play-link:hover { background: #fffaf1; }

.empty { padding: 32px 10px; color: var(--muted); text-align: center; }
.song-more,
.retry-button {
  justify-self: start;
  min-height: 42px;
  margin-top: 16px;
  padding: 0 16px;
}
.retry-button:disabled { cursor: wait; opacity: .6; }
.release-more {
  scroll-snap-align: start;
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 200px;
  padding: 20px;
  border-style: dashed;
  border-radius: 20px;
  text-align: left;
}
.release-more strong { font-size: .96rem; }
.release-more span { color: var(--muted); font-size: .75rem; line-height: 1.45; }

.catalogue-error {
  display: grid;
  justify-items: center;
  gap: 9px;
  max-width: 620px;
  margin: 70px auto;
  padding: 34px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 28px;
  background: rgba(16,15,21,.58);
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  text-align: center;
}
.catalogue-error strong { font-size: clamp(1.35rem, 4vw, 1.9rem); letter-spacing: -.035em; }
.catalogue-error p { margin: 0; color: var(--muted); line-height: 1.6; }
.catalogue-error .retry-button { justify-self: center; margin-top: 8px; }

.release-card:focus-visible,
.back-button:focus-visible,
.quiet-button:focus-visible,
.play-link:focus-visible,
.song-more:focus-visible,
.retry-button:focus-visible,
.release-more:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.essential-release-section {
  display: block;
  margin-bottom: 52px;
  padding: 18px 18px 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 30px;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 227, 178, .075), transparent 30%),
    rgba(14, 13, 19, .46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    0 28px 84px rgba(0, 0, 0, .24);
  backdrop-filter: blur(24px) saturate(1.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
}
.essential-release-section .section-title-row { margin: 0 3px 16px; }
.essential-release-section .section-title-row h2 { color: rgba(255, 248, 236, .96); }
.essential-release-rail {
  grid-auto-columns: minmax(190px, 228px);
  gap: 14px;
  padding: 4px 3px 10px;
}
.essential-release-card {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 26px;
  background: rgba(255, 255, 255, .025);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  transition: transform .24s cubic-bezier(.2,.7,.2,1), border-color .24s ease, background .24s ease, box-shadow .24s ease;
}
.essential-release-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 18px 42px rgba(0, 0, 0, .22);
}
.essential-release-card .release-cover { border-radius: 20px; }
.essential-release-card .release-title { margin-top: 11px; font-size: .92rem; }
.essential-release-card .release-meta { padding-bottom: 2px; }

@media (max-width: 1080px) {
  .collection-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .song-row { grid-template-columns: 50px minmax(0, 1fr) auto; }
  .song-release { display: none; }
}

@media (max-width: 780px) {
  .collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-card { aspect-ratio: 1.06 / 1; min-height: 210px; border-radius: 26px; }
  .section-title-row p { display: none; }
  .detail-head { border-radius: 28px; }
  .essential-release-rail { grid-auto-columns: minmax(170px, 202px); }
}

@media (max-width: 560px) {
  :root { --explore-bg: url("../assets/backgrounds/library/11-master-dark-courtyard.webp"); }
  .topbar,
  main { width: min(100% - 22px, var(--max)); }
  .topbar { min-height: 70px; padding-top: max(8px, env(safe-area-inset-top)); }
  .close-explore { width: 42px; height: 42px; }
  main { padding-top: 8px; }
  .catalogue-section { margin-bottom: 34px; }
  .section-title-row { margin-bottom: 11px; }
  .collection-grid { grid-template-columns: 1fr; gap: 11px; }
  .collection-card { aspect-ratio: 1.46 / 1; min-height: 184px; border-radius: 24px; }
  .collection-copy { inset: 18px; }
  .collection-copy strong { max-width: 15ch; font-size: clamp(1.3rem, 7vw, 1.72rem); }
  .collection-copy span { font-size: .7rem; }
  .collection-detail { padding-top: 2px; }
  .back-button { margin-bottom: 12px; }
  .detail-head { padding: 32px 20px; border-radius: 24px; }
  .detail-head h2 { font-size: clamp(2.4rem, 13vw, 4rem); }
  .detail-head > p:not(.eyebrow) { font-size: .9rem; }
  .release-section,
  .songs-section { margin-left: -1px; margin-right: -1px; padding: 15px; border-radius: 23px; }
  .section-heading { align-items: center; }
  .section-heading h3 { font-size: 1.16rem; }
  .quiet-button { font-size: .75rem; padding-inline: 11px; }
  .release-rail { grid-auto-columns: minmax(145px, 168px); gap: 10px; margin-right: -15px; padding-right: 15px; }
  .release-cover { border-radius: 17px; }
  .song-row { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; padding-inline: 3px; }
  .song-art { width: 46px; height: 46px; border-radius: 10px; }
  .play-link { min-width: 58px; padding-inline: 11px; }
  .song-more { justify-self: stretch; width: 100%; }
  .release-more { min-height: 168px; }
  .catalogue-error { margin: 44px auto; padding: 25px 20px; }
  .essential-release-section {
    margin-inline: -1px;
    margin-bottom: 36px;
    padding: 14px 14px 12px;
    border-radius: 24px;
  }
  .essential-release-section .section-title-row { margin-bottom: 12px; }
  .essential-release-rail {
    grid-auto-columns: minmax(150px, 172px);
    gap: 10px;
    margin-right: -14px;
    padding-right: 14px;
  }
  .essential-release-card { padding: 8px; border-radius: 20px; }
  .essential-release-card .release-cover { border-radius: 16px; }
  .release-card.active::after { top: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
