/*
 * The artist directory (artists/index.html) and the artist pages
 * (artists/<slug>.html), both written by tools/generate-artist-pages.cjs.
 * Palette, fonts and reset come from css/app.css, the parts (page head,
 * sections, chips, fields, buttons, empty states, footer) from css/ui.css.
 * This file adds only what those lack: the artist head with its photo and
 * Follow button, the booking rows (laid out like the timetable's My plan
 * rows), the sets-per-week graph (js/artist-activity.js) and the directory
 * grid (js/artist-directory.js).
 */

/* ---------- artist head ---------- */
.artist-head {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  column-gap: 16px;
  align-items: end;
}
.artist-head > :not(.artist-photo):not(.artist-head-name) { grid-column: 1 / -1; }
.artist-head { position: relative; }
[data-artist-hero][aria-busy="true"]::after { position: absolute; top: 4px; right: 0; }
.artist-photo {
  width: 84px; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  display: grid; place-items: center;
  background: var(--chip); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.artist-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.artist-photo span { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; color: var(--muted); }
.artist-head-name { min-width: 0; }
.artist-back { display: inline-block; color: var(--muted); text-decoration: none; }
.artist-back::before { content: "‹ " / ""; }
.artist-back:hover { color: var(--ink); }
.artist-head .page-title { max-width: none; overflow-wrap: anywhere; }
.artist-head .lede { margin-top: 14px; }
.artist-head .summary { margin: 12px 0 0; }
.artist-chips { margin: 8px 0 0; }
/* No Spotify link: its place in the row would still take a gap. */
.artist-chips li:has(> [hidden]) { display: none; }
.artist-genre { color: var(--muted); font-weight: 500; }
.artist-genre:hover { background: none; }

/* Follow, under the name (added by js/artist-api-page.js). */
.artist-follow { margin-top: 14px; }
.artist-follow-button[aria-pressed="true"]::before {
  content: ""; width: 10px; height: 5px; margin-top: -3px;
  border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg);
}
.artist-follow-button[aria-busy="true"] { opacity: .7; }
.artist-follow-note { margin: 8px 0 0; max-width: 60ch; color: var(--muted); font-size: 13px; line-height: 1.45; }
.artist-follow-note:empty { margin: 0; }

@media (min-width: 701px) {
  .artist-head { grid-template-columns: 132px minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .artist-head > :not(.artist-photo):not(.artist-head-name) { grid-column: 2; }
  .artist-photo { width: 132px; grid-row: 1 / span 4; }
  .artist-head-name { padding-top: 6px; }
  .artist-photo span { font-size: 64px; }
}

/* ---------- bookings ---------- */
.artist-count {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 8px;
  background: var(--chip); color: var(--muted);
  font-family: var(--body); font-size: 13px; font-weight: 700; line-height: 1.4;
  font-variant-numeric: tabular-nums; vertical-align: 4px;
}
/* One column on phones; on wider screens the rows fill the width in columns. */
.artist-booking-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 6px 8px;
  margin-top: 12px;
}
.artist-booking-list .empty { grid-column: 1 / -1; margin: 0; }
.artist-booking-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 44px; gap: 12px; align-items: center;
  padding: 10px 10px 10px 12px; border-radius: 12px;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.artist-booking-date { line-height: 1.15; font-variant-numeric: tabular-nums; }
.artist-booking-date b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; }
.artist-booking-date small { display: block; color: var(--muted); font-size: 11px; }
.artist-booking-main { min-width: 0; }
.artist-booking-main h3 {
  margin: 0;
  font-family: var(--display); font-size: 17px; font-weight: 700; line-height: 1.05; text-transform: uppercase;
}
.artist-booking-main h3 a { color: inherit; text-decoration: none; }
.artist-booking-main h3 a:hover { color: var(--accent); }
.artist-booking-set, .artist-booking-meta { margin: 3px 0 0; font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.artist-booking-set strong { font-weight: 600; }
.artist-booking-set span, .artist-booking-meta { color: var(--muted); }
.artist-booking-set > span::before { content: "· " / ""; }
.artist-booking-time { white-space: nowrap; }
.artist-booking-mark {
  width: 44px; height: 44px; border-radius: 10px; overflow: hidden;
  display: grid; place-items: center;
  background: var(--chip);
}
.artist-booking-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
/* An official logo sits on the background colour that comes with it. */
.artist-booking-mark.is-logo { padding: 6px; background: var(--artist-event-logo-bg, var(--chip)); }
.artist-booking-mark.is-logo img { object-fit: contain; }
.artist-booking-mark:not(:has(img)) { visibility: hidden; }
.artist-booking-more:has(button) { margin-top: 10px; }
/* The smallest phones keep the room for the text. */
@media (max-width: 359px) {
  .artist-booking-row { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; }
  .artist-booking-mark { display: none; }
}

/* ---------- sets per week (js/artist-activity.js) ---------- */
.artist-activity {
  --activity-gap: 4px;
  --activity-1: color-mix(in srgb, var(--accent) 30%, var(--panel-2));
  --activity-2: color-mix(in srgb, var(--accent) 55%, var(--panel-2));
  --activity-3: color-mix(in srgb, var(--accent) 78%, var(--panel-2));
  --activity-4: var(--accent);
}
.artist-activity-summary strong { color: var(--ink); }
.artist-activity-years { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.artist-activity-years .chip { height: 30px; padding: 0 11px; font-variant-numeric: tabular-nums; }
.artist-activity-panel {
  padding: 14px; border-radius: 14px;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong);
}
/* The cell size follows the frame width, so the quarters sit in one row on wide
   screens, two by two on tablets and below each other on phones. */
.artist-activity-frame { container-type: inline-size; margin-bottom: 12px; }
.artist-activity-graph { --cell: 12px; display: flex; flex-wrap: wrap; gap: 12px var(--activity-gap); }
@container (min-width: 1px) {
  .artist-activity-graph { --cell: min(26px, calc((100cqi - 13 * var(--activity-gap)) / 14)); }
}
@container (min-width: 420px) {
  .artist-activity-graph { --cell: min(22px, calc((100cqi - 26 * var(--activity-gap)) / 27)); }
}
@container (min-width: 760px) {
  .artist-activity-graph { --cell: min(28px, calc((100cqi - (var(--weeks) - 1) * var(--activity-gap)) / var(--weeks))); }
}
.artist-activity-quarter { display: grid; gap: 6px; }
.artist-activity-months,
.artist-activity-weeks { display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); gap: var(--activity-gap); }
.artist-activity-months span { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.artist-activity-week,
.artist-activity-legend i {
  display: block; width: var(--cell); height: var(--cell); padding: 0; border: 0; border-radius: 3px;
  background: var(--chip);
}
button.artist-activity-week { cursor: pointer; }
button.artist-activity-week:hover,
button.artist-activity-week:focus-visible,
button.artist-activity-week.is-pinned { outline: 2px solid var(--ink); outline-offset: 1px; }
.artist-activity-week.is-now { box-shadow: inset 0 0 0 2px var(--ink); }
.artist-activity [data-level="1"] { background: var(--activity-1); }
.artist-activity [data-level="2"] { background: var(--activity-2); }
.artist-activity [data-level="3"] { background: var(--activity-3); }
.artist-activity [data-level="4"] { background: var(--activity-4); }
.artist-activity-foot { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 18px; }
.artist-activity-detail { flex: 1 1 260px; min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.artist-activity-detail p { margin: 0; }
.artist-activity-detail strong { color: var(--ink); font-weight: 600; }
.artist-activity-detail ul { display: grid; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none; }
.artist-activity-detail li span { display: inline-block; min-width: 82px; font-weight: 600; color: var(--ink); }
.artist-activity-detail a { color: var(--accent); font-weight: 600; text-decoration: none; }
.artist-activity-legend { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.artist-activity-legend i { --cell: 11px; }
@media (max-width: 520px) {
  .artist-activity-years { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
}

/* ---------- directory ---------- */
.artist-directory-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 12px; }
@media (min-width: 480px) {
  .artist-directory-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .artist-directory-search { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .artist-directory-controls { grid-template-columns: minmax(240px, 560px) repeat(2, max-content); }
  .artist-directory-search { grid-column: auto; }
}
.artist-directory-count { margin: 20px 0 8px; }
.artist-directory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 8px; }
.artist-directory-grid { position: relative; min-height: 120px; }
.artist-directory-grid.is-loading > * { opacity: .6; }
.artist-directory-grid.is-loading::after { position: absolute; top: 44px; left: calc(50% - 16px); z-index: 2; }
/* A loading wheel, only when it takes a moment: a quick load shows nothing. */
.artist-directory-grid.is-loading::after,
[data-artist-hero][aria-busy="true"]::after {
  content: ""; display: block; flex: none; width: 32px; height: 32px; box-sizing: border-box; opacity: 0;
  border: 3px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%;
  animation: artist-wheel-spin .8s linear infinite, artist-wheel-in .2s .35s forwards;
}
@keyframes artist-wheel-spin { to { transform: rotate(360deg); } }
@keyframes artist-wheel-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .artist-directory-grid.is-loading::after,
  [data-artist-hero][aria-busy="true"]::after { animation-duration: 2.4s, .2s; }
}
.artist-directory-card {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 14px;
  background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-strong);
  color: inherit; text-decoration: none;
}
.artist-directory-card:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.artist-directory-card > img,
.artist-directory-card > span {
  grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  display: grid; place-items: center;
  background: var(--chip); color: var(--muted);
  font-family: var(--display); font-weight: 800; font-size: 21px; line-height: 1;
}
.artist-directory-card strong {
  align-self: end; min-width: 0;
  font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.artist-directory-card small { align-self: start; color: var(--muted); font-size: 12px; }
.artist-directory-empty { grid-column: 1 / -1; margin: 0; }
.artist-directory-count { scroll-margin-top: 12px; outline: none; }
.artist-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin: 22px 0 8px; }
.artist-pager[hidden] { display: none; }
.artist-pager .chip { min-width: 44px; min-height: 44px; justify-content: center; font-variant-numeric: tabular-nums; text-decoration: none; }
.artist-pager .chip[aria-disabled="true"] { opacity: .45; cursor: default; }
.artist-pager .chip[aria-disabled="true"]:hover { background: none; }
.artist-pager-gap { padding: 0 2px; color: var(--muted); }
