/* Music page (PW-027): ranked artists, recent songs (PW-058), one genre list (PW-059) and seen-live. Loaded by music.html only. */

/* Top artists: rank, name and genre, songs bar */
.music-top {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 2px;
}

.music-top li {
  display: grid;
  grid-template-columns: 2rem 1fr minmax(6rem, 36%);
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  padding: 0.7rem 1rem;
}

.music-top li[hidden] { display: none; }
.music-top .rank { font-family: var(--font-mono); color: var(--muted); }
.music-top .is-podium .rank { color: var(--accent); }
.music-top .who { display: grid; min-width: 0; }
.music-top .who strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-top .who strong a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-more { margin-top: 1rem; }
.music-more[hidden], .music-more button[hidden] { display: none; }

/* Artist links: look like text, underline on hover, a small arrow says "opens elsewhere" */
a.ext { color: inherit; text-decoration: none; }
a.ext::after { content: "\2197"; margin-left: 0.3em; font-size: 0.85em; color: var(--muted); }
a.ext:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a.ext:hover::after { color: var(--accent); }
.music-top .who strong a:focus-visible { outline-offset: -2px; } /* inside the box: the name's row clips overflow */
.music-top .songs { display: grid; gap: 0.25rem; }
.music-top .bar { height: 6px; background: var(--surface-2); }
.music-top .bar span { display: block; height: 100%; background: var(--ink); opacity: 0.7; }
.music-top .is-podium .bar span { background: var(--accent); opacity: 1; }

/* Genre mix: one list ranked by the average of artist share and song share. Name, bar and that average
   on the first line; the two shares underneath. */
.genre-chart { margin: 0; min-width: 0; }
.genre-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.genre-tabs[hidden] { display: none; }
.genre-tabs button { font: inherit; color: var(--muted); border: 1px solid var(--line); background: var(--surface); padding: 0.5rem 0.8rem; min-height: 44px; cursor: pointer; }
.genre-tabs button[aria-selected="true"] { color: var(--accent); border-color: currentColor; }
.genre-chart figcaption { margin-bottom: 0.75rem; }
.music-genres { list-style: none; display: grid; gap: 2px; }

.music-genres li {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) 1fr 3.25rem;
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.1rem;
  padding-block: 0.45rem;
  font-size: var(--step-small);
}

.music-genres .track { height: 12px; }
.music-genres .fill { display: block; height: 100%; background: var(--ink); opacity: 0.72; border-radius: 0 2px 2px 0; min-width: 2px; }
.music-genres .is-key .fill { background: var(--accent); opacity: 1; }
.music-genres .is-key .name { color: var(--accent); }
.music-genres .num { grid-column: 3; grid-row: 1; font-family: var(--font-mono); text-align: right; }
.music-genres .detail { grid-column: 1 / -1; }

/* Independent listening windows: two columns, stacked on small screens. */
.music-windows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.music-windows > div { min-width: 0; }
.music-window-title { margin-bottom: 0.75rem; font: 400 var(--step-small)/1.5 var(--font-mono); color: var(--muted); }
.music-recent { list-style: none; display: grid; gap: 2px; }
.music-recent li { display: grid; gap: 0.15rem; align-content: center; min-width: 0; background: var(--surface); padding: 0.75rem 1rem; }
.music-recent strong { font-weight: 500; overflow-wrap: anywhere; }
.music-recent .meta { overflow-wrap: anywhere; }
@media (max-width: 640px) { .music-windows { grid-template-columns: minmax(0, 1fr); } }

/* Seen live */
.music-live { list-style: none; display: flex; flex-wrap: wrap; gap: 2px; }
.music-live li { background: var(--surface); }
.music-live a { display: flex; align-items: center; min-height: 44px; padding: 0.6rem 0.9rem; }

@media (max-width: 480px) {
  .music-genres li { grid-template-columns: minmax(6.5rem, 9rem) 1fr 3rem; column-gap: 0.5rem; }
}
#musicUpdated { margin-top: 1rem; }

/* PW-053: durable sampled-play seasons, deliberately distinct from liked-song genre mix. */
.music-seasonal { border-top: 1px solid var(--line); margin-top: 1.8rem; padding-top: 1.2rem; }
.music-seasonal[hidden] { display: none; }
.music-season-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.85rem; margin-bottom: 0.7rem; }
.music-season-head h3 { margin-right: auto; }
.music-season-head select { min-height: 44px; padding: 0.4rem 0.65rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); font: inherit; }
.music-seasonal .music-genres { margin-top: 0.85rem; }
