/* Tokens. Light and dark are each selected, not flipped: the sequential ramp
   runs light-to-dark on the light surface and dark-to-light on the dark one,
   so "a lot" is always the step furthest from the surface. */
:root {
  color-scheme: light;
  --page: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0f0ee;
  --text: #191919;
  --text-2: #666666;
  --grid: #e7e7e7;
  --axis: #c2c2c2;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #257de0;
  --accent-strong: #1b64be;
  --hover: rgba(37, 125, 224, 0.08);
  --q0: #ececea;
  --q1: #cce3fd; --q2: #9dc8f7; --q3: #6aabf1; --q4: #338ced;
  --q5: #2370cd; --q6: #1757ac; --q7: #0e3d7e;
  --hero-ink: #ffffff;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0b0b0b;
    --surface: #161616;
    --surface-2: #222222;
    --text: #efefef;
    --text-2: #9c9c9c;
    --grid: #2a2a2a;
    --axis: #474747;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #338ced;
    --accent-strong: #6aabf1;
    --hover: rgba(51, 140, 237, 0.14);
    --q0: #222222;
    --q1: #0e3d7e; --q2: #0f4a96; --q3: #1757ac; --q4: #2370cd;
    --q5: #338ced; --q6: #6aabf1; --q7: #b6d5f8;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 15px/1.5 var(--font);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
[hidden] { display: none !important; }

/* Hero: the period's top album art, blurred, behind the name. */
.hero { position: relative; overflow: hidden; background: #0e1726; color: var(--hero-ink); padding: 44px 0 22px; }
.hero-bg {
  position: absolute; inset: -40px; background-size: cover; background-position: center;
  filter: blur(40px) saturate(1.3); opacity: .55; transform: scale(1.1); transition: background-image .6s;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5, 10, 20, .35), rgba(5, 10, 20, .75));
}
.hero > * { position: relative; z-index: 1; }
.hero-inner { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.hero-text { flex: 1 1 260px; min-width: 0; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; opacity: .75; }
.hero h1 { margin: 2px 0 2px; font-size: clamp(28px, 5vw, 44px); line-height: 1.1; font-weight: 700; }
.hero h1 a:hover { color: inherit; text-decoration: underline; text-underline-offset: 4px; }
.sub { margin: 0; opacity: .8; }
.hero-figure { text-align: right; }
.hero-figure .big { font-size: clamp(40px, 7vw, 64px); font-weight: 650; line-height: 1; }
.hero-figure .lbl { opacity: .75; font-size: 13px; }

.now {
  margin-top: 22px; display: inline-flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px; padding: 6px 16px 6px 6px; max-width: 100%;
}
.now img, .now .ph { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.now .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now .lbl { font-size: 12px; opacity: .75; display: flex; align-items: center; gap: 6px; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; }
.eq i { width: 3px; background: #6aabf1; border-radius: 1px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%,100% { height: 3px; } 50% { height: 10px; } }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; height: 8px; } }

.banner { margin-top: 16px; }
.banner .card { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.meter { flex: 1 1 200px; height: 8px; border-radius: 999px; background: var(--q1); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Filters: one row above everything they scope. */
.filters {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding-top: 14px; padding-bottom: 14px; background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--page); border-color: var(--text); font-weight: 600; }
.years .chip { font-variant-numeric: tabular-nums; padding: 5px 10px; }
.search { position: relative; margin-left: auto; }
.search input {
  font: inherit; width: 220px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.q-results {
  position: absolute; right: 0; top: calc(100% + 6px); width: 280px; list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
}
.q-results a { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 8px; }
.q-results a:hover, .q-results a:focus { background: var(--hover); color: var(--text); }
.q-results .n { color: var(--text-2); font-variant-numeric: tabular-nums; }

main { padding-bottom: 40px; transition: opacity .2s; }
main.loading { opacity: .45; }

h2 { font-size: 18px; margin: 0 0 2px; font-weight: 650; }
.section-sub { color: var(--text-2); margin: 0 0 14px; font-size: 13px; }
.section-title { margin: 34px 0 12px; display: flex; align-items: baseline; gap: 12px; }
.section-title h2 { font-size: 22px; }
.section-title .rule { flex: 1; height: 1px; background: var(--border); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
  min-width: 0;
}
.grid { display: grid; gap: 16px; margin-top: 16px; }
.g-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
@media (max-width: 520px) { .g-2, .g-3 { grid-template-columns: 1fr; } .search { margin-left: 0; width: 100%; } .search input { width: 100%; } }

/* Stat tiles */
.tile .lbl { color: var(--text-2); font-size: 13px; }
.tile .val { font-size: 28px; font-weight: 650; line-height: 1.2; margin-top: 2px; }
.tile .note { color: var(--text-2); font-size: 12px; margin-top: 2px; }

/* Charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tick text, .axis-label { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .bar { fill: var(--accent); transition: opacity .12s; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.clickable { cursor: pointer; }
.chart.hovering .bar { opacity: .45; }
.chart.hovering .bar.on { opacity: 1; }
.chart .peak-label { fill: var(--text); font-size: 11px; font-weight: 600; }

.tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: 260px;
}
.tip .v { font-weight: 650; font-size: 15px; }
.tip .k { color: var(--text-2); }

/* Heatmap (listening clock) */
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 11px; }
.heat .hl { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: visible; min-width: 0; }
.heat .dl { color: var(--text-2); align-self: center; }
.cell { aspect-ratio: 1; border-radius: 3px; background: var(--q0); min-height: 10px; }
.cell:hover, .ecell:hover { outline: 2px solid var(--text); outline-offset: -1px; }
.legend-ramp { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; margin-top: 10px; }
.legend-ramp .sw { display: flex; gap: 2px; }
.legend-ramp .sw i { width: 14px; height: 10px; border-radius: 2px; }

/* Artist eras */
.eras { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 64px; gap: 6px 12px; align-items: center; }
.eras .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eras .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eras .strip { display: flex; gap: 1px; height: 22px; }
.ecell { flex: 1; background: var(--q0); border-radius: 2px; min-width: 1px; }
.eras .tot { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.eras .axis { grid-column: 2; display: flex; justify-content: space-between; color: var(--text-2); font-size: 11px; }

/* Top lists */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 26px 40px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.row + .row { border-top: 1px solid var(--grid); }
.row .rk { color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; font-size: 13px; }
.row .nm { min-width: 0; }
.row .t1, .row .t2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t1 { font-weight: 550; }
.row .t2 { color: var(--text-2); font-size: 13px; }
.row .pl { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; text-align: right; }
.row .bar4 { grid-column: 3 / 5; height: 4px; border-radius: 2px; background: var(--q0); margin-top: -2px; }
.row .bar4 > i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: block; }
.thumb.round { border-radius: 50%; }
.ph { display: grid; place-items: center; color: var(--text-2); font-weight: 650; font-size: 14px; background: var(--surface-2); }
.more { margin-top: 10px; font: inherit; font-size: 13px; background: none; border: 0; color: var(--accent-strong); cursor: pointer; padding: 4px 0; }

.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 14px; }
.cover img, .cover .ph { width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; }
.cover img { display: block; }
.cover .ph { font-size: 28px; }
.cover .t1 { margin-top: 6px; font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cover .t2 { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Facts & milestones */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.fact .lbl { color: var(--text-2); font-size: 13px; }
.fact .val { font-size: 22px; font-weight: 650; }
.fact .note { color: var(--text-2); font-size: 13px; }
.miles { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--grid); }
.miles li { position: relative; padding: 0 0 14px 10px; }
.miles li::before {
  content: ""; position: absolute; left: -25px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface);
}
.miles li.next::before { background: var(--surface); border: 2px solid var(--accent); width: 6px; height: 6px; }
.miles .n { font-weight: 650; font-variant-numeric: tabular-nums; }
.miles .d { color: var(--text-2); font-size: 13px; }

details.table { margin-top: 10px; font-size: 13px; }
details.table summary { color: var(--text-2); cursor: pointer; }
details.table .scroll { max-height: 300px; overflow: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--grid); }
td.num, th.num { text-align: right; }

/* Artist page */
.ahead { display: flex; gap: 22px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ahead img, .ahead .ph { width: 132px; height: 132px; border-radius: 16px; object-fit: cover; font-size: 44px; }
.ahead h2 { font-size: clamp(26px, 4vw, 38px); line-height: 1.1; }
.back { display: inline-block; margin-top: 18px; color: var(--text-2); font-size: 14px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--hover); color: var(--accent-strong); font-size: 13px; font-weight: 600; }
.empty { color: var(--text-2); padding: 30px 0; text-align: center; }

.foot { color: var(--text-2); font-size: 13px; padding-top: 20px; padding-bottom: 40px; border-top: 1px solid var(--border); }
.foot a { text-decoration: underline; text-underline-offset: 3px; }

/* Sequential steps last, so they win over each cell's empty-state colour. */
.q1 { background: var(--q1); } .q2 { background: var(--q2); } .q3 { background: var(--q3); } .q4 { background: var(--q4); }
.q5 { background: var(--q5); } .q6 { background: var(--q6); } .q7 { background: var(--q7); }
