/* Feat. Path — web version styles.
   Neo-brutalist: off-white paper, black ink, flat colors, 2px strokes and hard
   shadows (no blur, no gradients, square corners). There's a single theme. The
   tokens also feed the canvas graph and the SVG charts (read with
   getComputedStyle). Text on a colored block is always ink: orange on paper is
   only 3.1:1, so orange is never the color of body text. */

/* ------------------------------------------------------------------------ */
/* Fonts (static/fonts, OFL): variable, latin + latin-ext                    */
/* ------------------------------------------------------------------------ */
@font-face {
  font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("../fonts/space-grotesk-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------------------ */
/* Tokens                                                                   */
/* ------------------------------------------------------------------------ */
:root {
  --paper: #f4f4f0;
  --ink: #050505;
  --white: #ffffff;
  --orange: #ff4500;
  --lime: #ccff00;
  --pink: #ff3ea5;
  --yellow: #ffe600;
  --muted: #5a5a55;   /* 6.3:1 on paper */
  --rule: #d9d9d2;    /* decorative lines and placeholders only */
  /* one flat color per artist without picture (static/js/ui.js, avatar) */
  --tone-0: var(--orange);
  --tone-1: var(--lime);
  --tone-2: var(--pink);
  --tone-3: var(--yellow);

  --stroke: 2px solid var(--ink);
  --shadow-sm: 2px 2px 0 0 var(--ink);
  --shadow: 4px 4px 0 0 var(--ink);
  --shadow-lg: 6px 6px 0 0 var(--ink);

  /* read by the canvas graph (graph.js) */
  --graph-edge: rgb(5 5 5 / 0.14);  /* the only alpha: overlapping links show where it's dense */
  --graph-node: #8c8c86;
  --chart-bar: var(--ink);

  --font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --topbar-h: 64px;
  color-scheme: light;
}

/* ------------------------------------------------------------------------ */
/* Base                                                                     */
/* ------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
  scroll-padding-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* paper grain over everything, to break the flat digital look; never catches the pointer */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main { flex: 1; }
::selection { background: var(--lime); color: var(--ink); }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
h1 { font-size: clamp(2.6rem, 7.5vw, 5.6rem); line-height: 0.95; text-transform: uppercase; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; text-transform: uppercase; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* links: ink with an orange underline; text links light up in lime */
a { color: var(--ink); text-decoration: underline 2px var(--orange); text-underline-offset: 3px; }
:where(.prose, .lede, .notice, figcaption) a:hover { background: var(--lime); text-decoration-color: var(--ink); }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.container { width: min(1120px, 100%); margin-inline: auto; padding-inline: 20px; }
.narrow { width: min(760px, 100%); }
.muted { color: var(--muted); }

.icon {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: square; stroke-linejoin: miter;
}

/* raw system data in a box: 49,222 ARTISTS · 149,511 COLLABORATIONS */
.data-tag {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  background: var(--white); border: var(--stroke); box-shadow: var(--shadow-sm);
  font: 500 0.76rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
}
.data-tag::before { content: ""; flex: none; width: 8px; height: 8px; background: var(--lime); outline: 2px solid var(--ink); }

.lede { font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 34em; }

/* words set on a black block, like a label stuck on the title. An inline-block:
   an inline background is as tall as the font (~1.3em) and would cover the
   line above, while a block is as tall as its lines (0.95em each) */
.highlight { display: inline-block; padding: 0.02em 0.12em 0; background: var(--ink); color: var(--lime); }

/* ------------------------------------------------------------------------ */
/* Top bar, tab bar, footer                                                 */
/* ------------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  /* the inset is 0 in the browser and the status bar height once installed */
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--paper);
  border-bottom: var(--stroke);
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 24px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--ink); text-decoration: none;
  font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; text-transform: uppercase;
}
.brand img { border: var(--stroke); }

.nav { display: flex; gap: 6px; margin-left: auto; }
.nav a {
  padding: 8px 12px; border: 2px solid transparent;
  color: var(--ink); text-decoration: none;
  font: 600 0.78rem/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
}
.nav a:hover { border-color: var(--ink); background: var(--white); }
.nav a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.footer {
  padding-block: 40px 32px;
  color: var(--muted); font: 500 0.72rem/1.5 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase;
}

.tabbar { display: none; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--ink); color: var(--lime); border: var(--stroke); box-shadow: 4px 4px 0 0 var(--orange);
  font: 600 0.82rem/1.3 var(--font-mono); letter-spacing: 0.02em; text-transform: uppercase;
  animation: toast-in 0.15s ease-out;
}
@keyframes toast-in { from { transform: translate(-50%, 8px); } }

/* ------------------------------------------------------------------------ */
/* Buttons: blocks on a hard shadow that sink into it when pressed           */
/* ------------------------------------------------------------------------ */
:is(.btn, .chip, .icon-btn, .swap) {
  border: var(--stroke); border-radius: 0; box-shadow: var(--shadow);
  background: var(--white); color: var(--ink); cursor: pointer;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, background 0.08s;
}
@media (hover: hover) {  /* touch screens would keep the hover after a tap */
  :is(.btn, .chip, .icon-btn, .swap):hover { transform: translate(2px, 2px); box-shadow: var(--shadow-sm); }
}
:is(.btn, .chip, .icon-btn, .swap):active { transform: translate(4px, 4px); box-shadow: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px;
  font: 700 0.92rem/1 var(--font); letter-spacing: 0.02em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
}
.btn-lime { background: var(--lime); }
.btn-accent { background: var(--orange); }
.btn-ink { background: var(--ink); color: var(--paper); }

/* as tall as .btn: they share a row, and blocks of two heights break its edges */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 14px;
  background: var(--paper);
  font-weight: 600; font-size: 0.9rem; white-space: nowrap;
}
.chip .icon { width: 1em; height: 1em; }

.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; }
@media (pointer: coarse) {  /* a finger needs 44px */
  .icon-btn { width: 44px; height: 44px; }
}

/* ------------------------------------------------------------------------ */
/* Hero and search                                                          */
/* ------------------------------------------------------------------------ */
.hero { padding-block: clamp(40px, 7vw, 88px) 44px; }
.hero-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.hero h1 { max-width: 13em; }
.hero .lede { margin-bottom: 12px; }

.page-head { padding-block: clamp(36px, 6vw, 64px) 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.page-head h1 { font-size: clamp(2.2rem, 5.5vw, 4.2rem); }

/* [ artist A ] ━━━ (→) ━━━ [ artist B ] */
.search {
  width: min(980px, 100%);
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(72px, 10vw, 140px) minmax(0, 1fr); align-items: stretch;
}
.search-single { grid-template-columns: 1fr; width: min(520px, 100%); margin-top: 8px; }

.combo {
  position: relative; min-width: 0;
  background: var(--white); border: var(--stroke); box-shadow: var(--shadow);
  transition: box-shadow 0.08s;
}
.combo:focus-within { box-shadow: 4px 4px 0 0 var(--orange); }  /* 3.1:1, enough for a focus mark */
.combo label {
  position: absolute; top: -2px; left: -2px;
  padding: 4px 8px;
  background: var(--ink); color: var(--paper);
  font: 600 0.68rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
  pointer-events: none;
}
.combo-field { display: flex; align-items: center; gap: 12px; min-height: 80px; padding: 24px 12px 12px; }
.combo-field input {
  flex: 1; min-width: 0; height: 44px;
  padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 700 1.15rem/1.2 var(--font); text-overflow: ellipsis;
}
.combo-field input::placeholder { color: var(--muted); font-weight: 400; }
/* the empty slot and the chosen artist are the same size, so the name doesn't
   jump sideways when it's picked (.avatar sets its own --size, hence the child) */
.combo-avatar .avatar { --size: 38px; }
.combo-avatar:empty {
  width: 38px; height: 38px; flex: none;
  border: 2px dashed var(--ink);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23050505' stroke-width='2.2' stroke-linecap='square'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='m19 19-3.5-3.5'/%3E%3C/svg%3E") center/18px no-repeat;
}
.combo-clear {
  position: relative;
  display: grid; place-items: center; width: 28px; height: 28px; flex: none; padding: 0;
  border: var(--stroke); background: var(--paper); color: var(--ink); cursor: pointer;
}
.combo-clear::after { content: ""; position: absolute; inset: -10px; }  /* a 44px target around the small box */
.combo-clear .icon { width: 14px; height: 14px; }
.combo-clear:hover { background: var(--lime); }

.combo-list {
  position: absolute; z-index: 30; top: calc(100% + 8px); left: -2px; right: -2px;
  max-height: min(380px, 60vh); overflow-y: auto;
  margin: 0; padding: 0; list-style: none;
  background: var(--white); border: var(--stroke); box-shadow: var(--shadow-lg);
}
.combo-list li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; font-weight: 600; }
.combo-list li + li { border-top: 1px solid var(--rule); }
.combo-list li[aria-selected="true"] { background: var(--lime); }
.combo-list li .avatar { --size: 32px; }
.combo-list mark { background: none; color: var(--ink); font-weight: 700; text-decoration: underline 2px var(--orange); text-underline-offset: 2px; }
.combo-list .combo-empty { justify-content: center; color: var(--muted); cursor: default; font: 500 0.8rem/1.4 var(--font-mono); text-transform: uppercase; }

/* the link between the two boxes: a black line with the swap button on it */
.search-link { position: relative; display: grid; place-items: center; }
.search-link::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; margin-top: -1px; border-top: var(--stroke); }
.swap { position: relative; width: 48px; height: 48px; display: grid; place-items: center; padding: 0; }
.swap .icon { width: 22px; height: 22px; }
.swap .icon-swap { display: none; }
@media (hover: hover) {  /* the arrow reads A to B; on hover it says what a click does */
  .swap:hover .icon-arrow { display: none; }
  .swap:hover .icon-swap { display: block; }
}

/* "or try" and its examples wrap as one group, so on a narrow screen they move
   to the next line together instead of leaving "or try" beside the button */
.hero-actions, .hero-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.hero-actions { margin-top: 14px; }
.hero-or {
  font: 600 0.72rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap;
  /* centered on the blocks with their 4px shadow, which the eye counts as part
     of them; centered on the faces alone, the words look 2px too high */
  translate: 0 2px;
}

/* ------------------------------------------------------------------------ */
/* Cards, sections, notices, skeletons, avatars                             */
/* ------------------------------------------------------------------------ */
.card { background: var(--white); border: var(--stroke); box-shadow: var(--shadow); }

.section { margin-top: 52px; }
.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px;
  margin-bottom: 18px; padding-bottom: 10px; border-bottom: var(--stroke);
}

.notice {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; margin-bottom: 18px;
  background: var(--white); border: var(--stroke); box-shadow: var(--shadow-sm);
  font-weight: 500;
}
.notice-warn { background: var(--yellow); }

/* no shimmer (that would be a gradient): flat blocks that blink in steps */
.skeleton { background: var(--rule); animation: blink 1.1s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0.45; } }

.avatar {
  --size: 40px;
  position: relative; flex: none; overflow: hidden;
  display: inline-grid; place-items: center;
  width: var(--size); height: var(--size);
  background: var(--tone, var(--tone-0)); border: var(--stroke); color: var(--ink);
  font: 700 calc(var(--size) * 0.34)/1 var(--font-mono); letter-spacing: -0.04em;
}
.avatar::before { content: attr(data-initials); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1); }
.avatar-lg { --size: 64px; }
.avatar.skeleton { background: var(--rule); }

/* ------------------------------------------------------------------------ */
/* Result: chain, playlist, graph                                           */
/* ------------------------------------------------------------------------ */
.result { padding-top: 32px; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.result-head h2 { margin-top: 14px; }

.chain-card { padding: 32px 14px 24px; overflow: hidden; }
.chain {
  display: flex; align-items: flex-start; margin: 0; padding: 0 12px 8px; list-style: none;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.chain-artist {
  flex: 0 0 132px; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  animation: rise 0.3s ease-out both; animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.chain-artist .avatar { --size: 76px; box-shadow: var(--shadow); }
.chain-artist:first-child .avatar, .chain-artist:last-child .avatar { box-shadow: 4px 4px 0 0 var(--orange); }
.chain-artist > div { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.chain-name { font-weight: 700; line-height: 1.2; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.chain-name:hover { background: var(--lime); }
.chain-meta { font: 500 0.7rem/1.2 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

.chain-link { flex: 1 0 120px; position: relative; height: 76px; animation: rise 0.3s ease-out both; animation-delay: calc(var(--i, 0) * 60ms); }
.chain-link::before { content: ""; position: absolute; left: -14px; right: -14px; top: 50%; margin-top: -1px; border-top: var(--stroke); }
/* the track between two artists, like a ticket stub */
.track-pill {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% + 16px);
  padding: 5px 9px;
  background: var(--white); border: var(--stroke); box-shadow: var(--shadow-sm);
  font: 600 0.72rem/1.2 var(--font-mono); white-space: nowrap;
}
.track-pill span { overflow: hidden; text-overflow: ellipsis; }
.track-pill .icon { width: 12px; height: 12px; }
.track-pill.skeleton { width: 90px; height: 28px; }

/* auto-fit: a short path's cards share the width instead of leaving a column empty */
.tracks { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.track {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 12px;
  animation: rise 0.3s ease-out both; animation-delay: calc(var(--i, 0) * 50ms);
}
.track-cover {
  position: relative; width: 64px; height: 64px; overflow: hidden;
  display: grid; place-items: center;
  background: var(--tone, var(--tone-0)); border: var(--stroke); color: var(--ink);
}
.track-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.track-cover .icon { width: 26px; height: 26px; }
/* who the track links: two lines before it's cut, since both names matter */
.track-step {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  margin-bottom: 2px;
  font: 500 0.7rem/1.3 var(--font-mono); letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted);
}
.track-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artists { font-size: 0.88rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-name.skeleton { height: 18px; width: 70%; margin-block: 3px; }
.track-artists.skeleton { height: 14px; width: 45%; }
.track-actions { display: flex; gap: 8px; }
.play-btn { background: var(--lime); }
.track iframe { grid-column: 1 / -1; width: 100%; height: 80px; border: var(--stroke); background: var(--paper); }

.graph-card { overflow: hidden; }
.graph {
  position: relative; height: var(--graph-h, 520px);
  /* graph paper: a 24px square drawn as an SVG tile */
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M24 .5H.5V24' fill='none' stroke='%23e3e3dc'/%3E%3C/svg%3E") 0 0 / 24px 24px;
  touch-action: none; cursor: grab; user-select: none;
}
.graph.is-dragging { cursor: grabbing; }
.graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.graph-loading { position: absolute; inset: 16px; }
.graph-tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  padding: 8px 10px; max-width: 240px;
  background: var(--ink); color: var(--paper); border: var(--stroke); box-shadow: 4px 4px 0 0 var(--orange);
  font-size: 0.88rem; line-height: 1.35;
  transform: translate(-50%, calc(-100% - 16px));
}
.graph-tooltip strong { display: block; }
.graph-tooltip span { color: var(--lime); font: 500 0.72rem/1.3 var(--font-mono); text-transform: uppercase; }
.graph-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  padding: 8px 12px;
  background: var(--ink); color: var(--lime); border: var(--stroke);
  font: 600 0.72rem/1 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase;
  pointer-events: none; white-space: nowrap;
}
.graph-controls { position: absolute; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 10px; }
.graph-legend {
  display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 16px; border-top: var(--stroke);
  font: 600 0.7rem/1 var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase;
}
.graph-legend span { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; display: inline-block; border: var(--stroke); }
.dot-path { background: var(--orange); }
.dot-other { background: var(--graph-node); }

/* ------------------------------------------------------------------------ */
/* Explore                                                                  */
/* ------------------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
/* top-aligned: cards in a row share their height, and centered contents would
   put the labels at different heights whenever a caption wraps */
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat-artist { flex-direction: row; align-items: center; gap: 16px; }
.stat-artist h2 { font-size: 1.4rem; }
.stat-label { font: 600 0.7rem/1.3 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.stat-value { font: 700 2.2rem/1.1 var(--font-mono); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.stat-accent { background: var(--lime); }
.stat-accent .muted { color: var(--ink); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card { padding: 20px 20px 12px; display: flex; flex-direction: column; gap: 6px; }
.chart { margin-top: 10px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
/* histogram bars: not ".bar", whose CSS height would override the rect's */
.chart .hist-bar { fill: var(--chart-bar); }
.chart .hist-bar:hover { fill: var(--muted); }
.chart .hist-bar.is-highlight { fill: var(--orange); stroke: var(--ink); stroke-width: 2; }
.chart .axis { fill: var(--ink); font-family: var(--font-mono); font-size: 11px; }
.chart .baseline { stroke: var(--ink); stroke-width: 2; }
.chart .marker { stroke: var(--ink); stroke-width: 2; }
.chart .marker-label { fill: var(--ink); font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.chart-skeleton { height: 220px; }

.rank-list { margin: 0; padding: 0; list-style: none; }
.rank-list > li + li { border-top: var(--stroke); }
.rank-row {
  display: grid; grid-template-columns: 32px 40px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 10px 14px; color: var(--ink); text-decoration: none;
}
.rank-row:hover { background: var(--lime); }
.rank { font: 700 0.85rem/1 var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.rank-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rank-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 12px; border: var(--stroke); background: var(--paper); }
.bar span { display: block; height: 100%; background: var(--orange); }
.rank-value { font: 700 1rem/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.rank-value small { margin-left: 4px; color: var(--muted); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; }

/* ------------------------------------------------------------------------ */
/* Numbers                                                                  */
/* ------------------------------------------------------------------------ */
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.metric { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.metric-value { font: 700 clamp(2rem, 4vw, 2.8rem)/1.05 var(--font-mono); letter-spacing: -0.06em; font-variant-numeric: tabular-nums; }
.metric:nth-child(1) { background: var(--lime); }
.metric:nth-child(5) { background: var(--orange); }
.metric:nth-child(1) .muted, .metric:nth-child(5) .muted { color: var(--ink); }  /* grey on orange is 2:1 */

/* ------------------------------------------------------------------------ */
/* About                                                                    */
/* ------------------------------------------------------------------------ */
.prose { display: flex; flex-direction: column; gap: 26px; padding-bottom: 20px; }
.prose h2 { font-size: 1.5rem; margin-bottom: 10px; }
.step { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 18px; }
/* the heading's first line centered on the number block beside it */
.step h2 { min-height: 44px; display: flex; align-items: center; margin-bottom: 4px; }
.step-number {
  display: grid; place-items: center; width: 44px; height: 44px;
  background: var(--ink); color: var(--lime); box-shadow: 3px 3px 0 0 var(--orange);
  font: 700 1.1rem/1 var(--font-mono);
}
.figure { margin: 18px 0 8px; display: flex; flex-direction: column; gap: 12px; }
.figure figcaption { font: 500 0.76rem/1.5 var(--font-mono); }
.cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 24px; margin-block: 12px;
  background: var(--lime);
}
.cta h2 { margin-bottom: 4px; }
.cta .muted { color: var(--ink); }

/* ------------------------------------------------------------------------ */
/* Small screens: stacked search, vertical chain, tab bar                   */
/* ------------------------------------------------------------------------ */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-artist { grid-column: 1 / -1; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root { --topbar-h: 56px; }
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .nav { display: none; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--paper); border-top: var(--stroke);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 9px 0 8px;
    color: var(--ink); text-decoration: none;
    font: 600 0.64rem/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
  }
  .tabbar a + a { border-left: var(--stroke); }
  .tabbar .icon { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { background: var(--ink); color: var(--lime); }

  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }

  .hero { padding-top: 32px; }
  /* the examples stack one per line, with "or try" as their heading */
  .hero-or { flex-basis: 100%; translate: none; }
  .hero-examples { margin-top: 8px; }  /* nearer the examples it names than the button above */
  h1 { font-size: clamp(2.3rem, 11vw, 3.4rem); }
  .page-head h1 { font-size: clamp(2rem, 9vw, 2.8rem); }

  /* the boxes stack; the link turns vertical and the arrow points down */
  .search { grid-template-columns: 1fr; }
  .search-link { height: 60px; }
  .search-link::before { left: 50%; right: auto; top: 0; bottom: 0; margin: 0 0 0 -1px; border-top: 0; border-left: var(--stroke); }
  .swap .icon-arrow { transform: rotate(90deg); }

  .result-head { flex-direction: column; align-items: flex-start; }

  .chain-card { padding: 18px; }
  .chain { flex-direction: column; align-items: stretch; overflow: visible; padding: 0; }
  .chain-artist { flex: none; flex-direction: row; text-align: left; gap: 14px; }
  .chain-artist .avatar { --size: 52px; }
  .chain-artist > div { align-items: flex-start; }
  /* the 2px line runs through the middle of the 52px avatars: from 25px to 27px */
  .chain-link { flex: none; height: auto; min-height: 52px; margin-left: 26px; padding: 12px 0 12px 25px; display: flex; align-items: center; }
  .chain-link::before { left: -1px; right: auto; top: -8px; bottom: -8px; margin: 0; border-top: 0; border-left: var(--stroke); }
  .track-pill { position: static; transform: none; max-width: 100%; }

  .tracks { grid-template-columns: 1fr; }
  .graph { height: var(--graph-h-mobile, 420px); }

  .stats, .grid-2, .metrics { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-accent { grid-column: 1 / -1; }
  /* the two half-width cards: a label that wraps would drop its number below its neighbour's */
  .stat:not(.stat-artist, .stat-accent) .stat-label { min-height: 2.6em; }
  .step { grid-template-columns: 1fr; gap: 12px; }
  .step h2 { min-height: 0; }  /* the number sits above, not beside */

  /* room for the names: a narrower rank column, and the unit goes (the
     section's caption already says what the numbers are) */
  .rank-row { grid-template-columns: 20px 40px minmax(0, 1fr) auto; gap: 12px; }
  .rank-value small { display: none; }
}

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