/* ============================================================
   Music Index page (#music): search, filter panel, artist cards, "+N" genre popup, "Find on…" menu.
   Every class here starts with mx- and is scoped to this page, so nothing else on the site is affected.
   Data lives in js/data/artists.js, behaviour in js/music.js.
   ============================================================ */

/* overflow: clip (not hidden) so the search bar can stay stuck to the top while scrolling */
#music.view { overflow: clip; }
#music .wrap { width: 100%; }

#music .rhead { gap: 16px; padding-bottom: 8px; }
#music .rhead .lede { max-width: 34em; }
.mx-credit {
  align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 999px;
  font-size: 14px; text-decoration: none; color: var(--soft);
  background: rgba(43, 200, 215, 0.1); border: 1px solid rgba(43, 200, 215, 0.3); transition: 0.25s;
}
.mx-credit b { color: var(--ice); font-weight: 600; }
.mx-credit:hover, .mx-credit:focus-visible { background: rgba(43, 200, 215, 0.2); border-color: rgba(43, 200, 215, 0.6); }

/* ---- search bar + filter ---- */
.mx-barwrap { position: sticky; top: 98px; z-index: 5; padding-top: 14px; padding-bottom: 18px; }
.mx-barwrap::before {
  /* reaches up past the nav (top: -110px) so no strip of cards shows between the nav fade and this bar, and stays solid until just below the bar */
  content: ""; position: absolute; top: -110px; bottom: -14px; left: 50%; width: 100vw; transform: translateX(-50%); z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.25s;
  background: linear-gradient(180deg, rgba(20, 15, 67, 0.94) calc(100% - 36px), rgba(20, 15, 67, 0));
}
.mx-barwrap.sc::before { opacity: 1; }
.mx-row { display: flex; align-items: center; gap: 12px; }
.mx-q {
  flex: 1; min-width: 0; min-height: 52px; padding: 0 22px; font: inherit; color: var(--ink);
  -webkit-appearance: none; appearance: none; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(28, 22, 96, 0.72); backdrop-filter: blur(12px); transition: 0.2s;
  box-shadow: 0 14px 40px -18px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.mx-q::placeholder { color: var(--mute); }
.mx-q:focus { outline: none; border-color: var(--lav); box-shadow: 0 0 0 4px rgba(191, 192, 248, 0.2), 0 14px 40px -18px rgba(0, 0, 0, 0.7); }
.mx-fbtn {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--ink); background: rgba(20, 15, 67, 0.5); border: 1.5px solid rgba(150, 160, 255, 0.4);
  backdrop-filter: blur(8px); transition: 0.25s;
}
.mx-fbtn:hover, .mx-fbtn[aria-expanded="true"] { background: rgba(150, 160, 255, 0.16); border-color: var(--lav); transform: translateY(-2px); }
.mx-fbtn b {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px;
  background: linear-gradient(135deg, #7f1fea, #4f6bf0); color: #fff;
}
.mx-fbtn b[hidden] { display: none; }
.mx-count {
  flex: none; padding: 8px 16px; border-radius: 999px; background: rgba(43, 200, 215, 0.12); border: 1px solid rgba(43, 200, 215, 0.32);
  color: var(--ice); font-weight: 600; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap;
}
.mx-active { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mx-active[hidden] { display: none; }
.mx-ac {
  font: inherit; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px 5px 14px;
  border-radius: 999px; cursor: pointer; color: #fff; background: linear-gradient(135deg, #7f1fea, #4f6bf0); border: 0;
}
.mx-ac::after { content: "\00d7"; font-size: 16px; line-height: 1; opacity: 0.85; }
.mx-ac:hover::after { opacity: 1; }

/* ---- filter panel ---- */
.mx-filters {
  position: relative; margin-top: 12px; padding: 18px 20px; border-radius: 26px; background: rgba(28, 22, 96, 0.92); border: 1px solid var(--line);
  backdrop-filter: blur(14px); box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  max-height: min(46vh, 420px); overflow-y: auto; overscroll-behavior: contain;
}
.mx-filters[hidden] { display: none; }
.mx-ftop { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.mx-seg { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(20, 15, 67, 0.6); border: 1px solid var(--line); }
.mx-sg { font: inherit; font-size: 14px; font-weight: 600; padding: 7px 16px; border-radius: 999px; border: 0; cursor: pointer; color: var(--soft); background: none; transition: 0.2s; }
.mx-sg.on { background: linear-gradient(135deg, #7f1fea, #4f6bf0); color: #fff; }
.mx-gs {
  flex: 1 1 200px; min-width: 0; min-height: 40px; padding: 0 16px; font: inherit; font-size: 15px; color: var(--ink);
  -webkit-appearance: none; appearance: none; border-radius: 999px; border: 1px solid var(--line); background: rgba(20, 15, 67, 0.6);
}
.mx-gs::placeholder { color: var(--mute); }
.mx-gs:focus { outline: none; border-color: var(--lav); }
.mx-clear { margin-left: auto; font: inherit; font-size: 13px; letter-spacing: 0.04em; color: var(--lav); background: none; border: 0; cursor: pointer; text-decoration: underline; }
.mx-fsec { margin-bottom: 18px; }
.mx-fsec[hidden] { display: none; }
.mx-fh { margin-bottom: 10px; color: var(--ice); font-weight: 600; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.mx-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.mx-gp {
  font: inherit; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  color: var(--ice); background: rgba(43, 200, 215, 0.08); border: 1px solid rgba(43, 200, 215, 0.3); transition: 0.2s;
}
.mx-gp small { opacity: 0.7; font-size: 11px; margin-left: 4px; }
.mx-gp:hover { background: rgba(43, 200, 215, 0.18); }
.mx-gp.plat { color: var(--soft); background: rgba(150, 160, 255, 0.1); border-color: rgba(150, 160, 255, 0.35); }
.mx-gp[aria-pressed="true"] { background: linear-gradient(135deg, #7f1fea, #4f6bf0); border-color: transparent; color: #fff; }
.mx-gp[hidden] { display: none; }
.mx-none { color: var(--mute); text-align: center; padding: 12px 0; }
.mx-none[hidden] { display: none; }
.mx-done { position: sticky; bottom: -18px; margin: 0 -20px -18px; padding: 14px 20px 18px; display: flex; justify-content: center; background: linear-gradient(180deg, rgba(28, 22, 96, 0), rgba(28, 22, 96, 0.97) 40%); }
.mx-donebtn {
  min-height: 44px; padding: 0 28px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #7f1fea, #4f6bf0); border: 0;
}

/* ---- artist cards ---- */
.mx-gridwrap { padding-bottom: 56px; }
.mx-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); align-items: stretch; }
.mx-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding: 22px; background: var(--card);
  border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.mx-card[hidden] { display: none; }
.mx-card::after {
  content: ""; position: absolute; inset: auto -30% -60% auto; width: 140px; height: 140px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(43, 200, 215, 0.22), transparent 70%);
}
.mx-card h3 { font-size: 22px; line-height: 1.2; font-weight: 700; overflow-wrap: anywhere; position: relative; z-index: 1; }
.mx-genres { display: flex; flex-wrap: wrap; gap: 6px; position: relative; z-index: 1; }
.mx-genres span {
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; line-height: 1.5;
  color: var(--ice); background: rgba(43, 200, 215, 0.1); border: 1px solid rgba(43, 200, 215, 0.26);
}
.mx-genres span[hidden] { display: none; }
.mx-more {
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; line-height: 1.5; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  color: #fff; background: linear-gradient(135deg, #7f1fea, #4f6bf0); border: 1px solid transparent;
}
.mx-more:hover { box-shadow: 0 6px 16px -6px rgba(127, 31, 234, 0.9); }
.mx-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; position: relative; z-index: 1; }
.mx-find {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--soft); background: transparent; border: 1.5px dashed rgba(150, 160, 255, 0.45); transition: 0.25s;
}
.mx-find:hover, .mx-find:focus-visible { color: #fff; border-style: solid; border-color: var(--lav); background: rgba(150, 160, 255, 0.16); transform: translateY(-2px); }
.mx-empty { grid-column: 1 / -1; text-align: center; color: var(--mute); padding: 56px 0; font-size: 18px; }
.mx-empty[hidden] { display: none; }

/* ---- popups (genre list and "Find on…" menu), opened next to the button ---- */
.mx-pop {
  position: fixed; inset: auto; margin: 0; z-index: 30; color: var(--ink); background: rgba(28, 22, 96, 0.97); border: 1px solid var(--line);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(150, 160, 255, 0.25);
}
.mx-pop[open] { animation: mxpop 0.14s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes mxpop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.mx-genpop { width: min(320px, calc(100vw - 24px)); max-height: min(60vh, 420px); overflow-y: auto; padding: 14px 16px 16px; border-radius: 20px; }
.mx-genpop h3 { font-size: 16px; line-height: 1.2; font-weight: 700; margin-bottom: 10px; overflow-wrap: anywhere; }
.mx-genpop div { display: flex; flex-wrap: wrap; gap: 6px; }
.mx-genpop span { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; color: var(--ice); background: rgba(43, 200, 215, 0.1); border: 1px solid rgba(43, 200, 215, 0.26); }
.mx-menu { min-width: 170px; max-width: calc(100vw - 16px); padding: 6px; border-radius: 16px; }
.mx-menu a { display: block; padding: 9px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; }
.mx-menu a:hover, .mx-menu a:focus-visible { background: linear-gradient(135deg, #7f1fea, #4f6bf0); color: #fff; outline: none; }

@media (max-width: 640px) {
  #music.view { padding-top: calc(clamp(102px, 11.6dvh, 120px) + env(safe-area-inset-top, 0px)); }
  .mx-barwrap { top: 86px; }
  #music .rhead { padding-left: 18px; padding-right: 18px; }
  #music .rhead h1 { text-align: center; }
  .mx-row { flex-wrap: wrap; }
  .mx-q { flex: 1 1 100%; padding: 0 16px; font-size: 15px; }
  .mx-count { margin-left: auto; padding: 6px 10px; font-size: 10px; letter-spacing: 0.06em; }
  .mx-fbtn { min-height: 44px; padding: 0 16px; }
  .mx-clear { margin-left: 0; }
  .mx-grid { grid-template-columns: 1fr; }
  .mx-credit { font-size: 13px; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .mx-pop[open] { animation: none; }
}

/* "Music Index" button on the Radio page: on phones it gets its own full-width row like "Follow the artists" */
@media (max-width: 640px) {
  #radio .col .row .btn:nth-child(4) { grid-column: 1 / -1; }
}
