/* Playlist Atlas. One scrolling column laid out like a record sleeve: a spinning label up top,
   a sticky strip of playlists to spotlight, then eleven charts numbered as sides A, B and C. */

/* ---------- tokens ---------- */
:root {
  --bg: #fafafa; --panel: #ffffff; --ink: #121212; --ink-2: #4a4a4a; --ink-3: #6e6e6e;
  --rule: #e7e7e7; --axis: #cfcfcf; --mute: #cfcfcf; --seq-lo: #ececec;
  --accent: #1db954;
  /* Six playlist colours. The order is checked for colour-blind readers; see app.js before changing it. */
  --s1: #2a78d6; --s2: #e87ba4; --s3: #eda100; --s4: #eb6834; --s5: #6250d6; --s6: #e34948;
  --dot-lo: #c4ebd0; --dot-hi: #0b5d29;
  --vinyl: #121212; --vinyl-2: #2c2c2c;
  --focus: var(--accent);
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --panel: #242424; --ink: #ffffff; --ink-2: #b3b3b3; --ink-3: #8f8f8f;
    --rule: #262626; --axis: #3d3d3d; --mute: #434343; --seq-lo: #1e1e1e;
    --s1: #3987e5; --s2: #d55181; --s3: #c98500; --s4: #d95926; --s5: #9085e9; --s6: #e66767;
    --dot-lo: #14502a; --dot-hi: #b9f7cd;
    --vinyl: #000000; --vinyl-2: #232323;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --panel: #242424; --ink: #ffffff; --ink-2: #b3b3b3; --ink-3: #8f8f8f;
  --rule: #262626; --axis: #3d3d3d; --mute: #434343; --seq-lo: #1e1e1e;
  --s1: #3987e5; --s2: #d55181; --s3: #c98500; --s4: #d95926; --s5: #9085e9; --s6: #e66767;
  --dot-lo: #14502a; --dot-hi: #b9f7cd;
  --vinyl: #000000; --vinyl-2: #232323;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--body); }
.page { max-width: 1080px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); padding-block: 18px 56px;
  display: flex; flex-direction: column; gap: 40px; }
.stack { display: flex; flex-direction: column; gap: 52px; min-width: 0; }
h1, h2, h3, p, ol { margin: 0; }
a { color: inherit; text-decoration-color: var(--focus); text-decoration-thickness: 2px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
code { font: 0.92em var(--mono); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.back { font: 500 13px var(--mono); color: var(--ink-2); }
.solid, .ghost { border-radius: 999px; padding: 8px 18px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.solid { background: var(--accent); color: #000; border: 1px solid var(--accent); }
.solid:hover { filter: brightness(1.08); }
.ghost { background: transparent; border: 1px solid var(--axis); font-weight: 500; }
.ghost:hover { border-color: var(--ink-3); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.foot { font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--rule); padding-top: 16px; }

/* ---------- landing ---------- */
/* has-saved is set in index.html while a library from an earlier visit is being brought back. */
#restoring { display: none; }
.has-saved #restoring { display: block; }
.has-saved #landing { display: none; }
.intro-title { font: 800 clamp(28px, 5vw, 44px)/1.05 var(--display); letter-spacing: -0.02em; margin-bottom: 10px; }
.start { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.steps { padding-left: 22px; display: flex; flex-direction: column; gap: 14px; color: var(--ink-2); }
.steps b { color: var(--ink); font-weight: 600; }
.steps li::marker { font: 500 14px var(--mono); color: var(--ink-3); }
.drop { border: 2px dashed var(--axis); border-radius: 12px; padding: 28px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 12px; text-align: center; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop-title { font-weight: 600; font-size: 17px; }
.status { font-size: 14.5px; color: var(--ink-2); min-height: 1.5em; }
.status.bad { color: var(--ink); font-weight: 500; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; }
.eyebrow { font: 500 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.hero h1 { font: 800 clamp(30px, 6.2vw, 62px)/1.02 var(--display); letter-spacing: -0.025em; text-wrap: balance; margin-block: 10px 14px; }
.dek { color: var(--ink-2); font-size: clamp(16px, 1.7vw, 18px); max-width: 60ch; }
.hero .actions { margin-top: 18px; }
.deck { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vinyl { width: clamp(112px, 20vw, 184px); aspect-ratio: 1; border-radius: 50%; position: relative;
  background: repeating-radial-gradient(circle, var(--vinyl) 0 2px, var(--vinyl-2) 2px 3px);
  box-shadow: 0 0 0 1px var(--axis); animation: spin 7s linear infinite; }
.vinyl::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 20deg, transparent 0 38deg, rgba(255,255,255,.16) 55deg, transparent 72deg 200deg, rgba(255,255,255,.11) 218deg, transparent 236deg); }
.vinyl::after { content: ""; position: absolute; inset: 32%; border-radius: 50%;
  background: radial-gradient(circle, var(--bg) 0 9%, var(--focus) 10% 100%); transition: background .3s; }
.now { font: 500 11.5px var(--mono); color: var(--ink-3); text-align: center; max-width: 22ch; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- spotlight strip ---------- */
.spot { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding-block: 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-block: 1px solid var(--rule); }
.spot-title { font: 500 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); flex: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; min-width: 0; padding-block: 3px; scrollbar-width: thin; }
.chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; flex: none; cursor: pointer;
  border: 1px solid var(--axis); background: transparent; font: 500 13.5px var(--body); padding: 6px 11px; border-radius: 999px; }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--accent); color: #000; border-color: var(--accent); }
.chip[aria-pressed="true"] .dot { outline: 1.5px solid #000; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chip-n { font: 400 11.5px var(--mono); opacity: .65; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 24px; }
.stat-label { font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.stat-value { font: 700 clamp(22px, 3.3vw, 34px)/1.15 var(--display); letter-spacing: -0.02em; margin-block: 4px 2px; }
.stat-sub { font-size: 13.5px; color: var(--ink-2); }

/* ---------- sides and chart blocks ---------- */
.side { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; border-top: 2px solid var(--ink); padding-top: 10px;
  font: 700 14px var(--display); letter-spacing: .04em; text-transform: uppercase; }
.side span { font: 400 15px var(--body); letter-spacing: 0; text-transform: none; color: var(--ink-2); }
.chart { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.trk { font: 500 12px var(--mono); color: var(--ink-3); border: 1px solid var(--axis); border-radius: 999px; padding: 1px 8px; }
h3 { font: 700 clamp(17px, 2.2vw, 21px)/1.2 var(--display); letter-spacing: -0.01em; }
.shot { border: 0; background: transparent; cursor: pointer; font: 500 12px var(--mono); color: var(--ink-3); padding: 2px 4px;
  text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 3px; }
.shot:hover { color: var(--ink); }
.take { grid-column: 2 / -1; color: var(--ink-2); font-size: 15px; max-width: 68ch; }
.note { font-size: 13px; color: var(--ink-3); max-width: 76ch; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; }
.empty { color: var(--ink-2); padding-block: 28px; border-block: 1px solid var(--rule); }

/* ---------- bars ---------- */
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 36%) minmax(0, 1fr); gap: 10px; align-items: center; font-size: 14px; border-radius: 4px; }
.bar-row:hover .bar-fill, .bar-row:focus-visible .bar-fill { filter: brightness(1.12); }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-fill { height: 14px; flex: 0 0 calc(var(--w) * (100% - 3.6em)); min-width: 2px; background: var(--focus);
  border-radius: 0 4px 4px 0; transform-origin: left; animation: grow .5s cubic-bezier(.2, .7, .2, 1) both; }
.bar-val { font: 500 12.5px var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
@keyframes grow { from { transform: scaleX(0); } }

.bar-row.tappable { cursor: pointer; }
/* Artist pairs are long, so their labels get more of the row. */
.bars.pairs .bar-row { grid-template-columns: minmax(0, 54%) minmax(0, 1fr); }

/* ---------- upright bars ---------- */
.cols { display: grid; grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); align-items: end; }
.col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.col-val { font: 500 11px var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; min-height: 16px; margin-bottom: 3px; }
.col-bar { width: min(calc(100% - 2px), 30px); background: var(--focus); border-radius: 4px 4px 0 0; }
.col:hover .col-bar, .col:focus-visible .col-bar { filter: brightness(1.12); }
.col-tick { width: 100%; border-top: 1px solid var(--axis); padding-top: 5px; min-height: 22px; text-align: center;
  font: 11px var(--mono); color: var(--ink-3); white-space: nowrap; }
/* Length ticks mark where a step starts, so they sit at the column's left edge. */
.cols.hist .col-tick { text-align: left; }
.cols.hist .col-bar { width: calc(100% - 2px); border-radius: 3px 3px 0 0; }

/* ---------- plots ---------- */
.plot { position: relative; width: 100%; }
.plot canvas { display: block; width: 100%; touch-action: pan-y; }
.plot svg.over { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
svg text { font-family: var(--mono); font-size: 11px; fill: var(--ink-3); }
svg text.quad { letter-spacing: .08em; text-transform: uppercase; font-size: 10.5px; fill: var(--ink-2); }
svg text.halo, svg text.quad { paint-order: stroke; stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; }
svg text.cent { font-family: var(--body); font-size: 13px; font-weight: 600; fill: var(--ink); }
svg text.name { font-family: var(--body); font-size: 12.5px; fill: var(--ink-2); }
svg text.name.on { fill: var(--ink); font-weight: 600; }
.ring { position: absolute; left: 0; top: 0; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); align-items: center; }
.legend .key { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend i.sq { border-radius: 2px; }
.legend .grad { width: 120px; height: 10px; border-radius: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; border: 1px solid var(--axis); border-radius: 999px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pin { font-size: 14px; color: var(--ink-2); min-height: 1.5em; }
.pin strong { color: var(--ink); }
.mood-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.corners { display: flex; flex-direction: column; gap: 16px; }
.corner-label { font: 500 11.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.corner-track { font-weight: 600; }
.corner-artist { font-size: 14px; color: var(--ink-2); }

/* ---------- bulk paste note ---------- */
.pastes { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between;
  border: 1px solid var(--axis); border-radius: 10px; padding: 14px 16px; }
.pastes p { flex: 1 1 320px; min-width: 0; font-size: 14.5px; color: var(--ink-2); max-width: 74ch; }
.switch { display: inline-flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; font-size: 14px; font-weight: 500; padding: 4px; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--axis); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); transition: transform .2s; }
.switch[aria-checked="true"] .track { background: var(--focus); }
.switch[aria-checked="true"] .track::after { transform: translateX(16px); }

/* ---------- heat grids ---------- */
.heat { display: grid; gap: 2px; font: 12px var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.heat .cell { border-radius: 3px; min-height: 26px; display: grid; place-items: center; font-size: 11.5px; }
.heat .cell:hover, .heat .cell:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }
.heat .cell.blank { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); }
.heat .rowlab { display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; text-align: right; font-family: var(--body); font-size: 13px; color: var(--ink-2); }
.heat .collab { text-align: center; padding-bottom: 4px; line-height: 1.25; }
.heat .collab b { display: block; font-weight: 500; color: var(--ink-2); }

/* ---------- tooltip, dialog, notes ---------- */
#tip { position: fixed; z-index: 20; pointer-events: none; background: var(--panel); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 8px; padding: 9px 11px; font-size: 13px; line-height: 1.4; max-width: min(300px, calc(100vw - 16px));
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.tip-title { font-weight: 600; }
.tip-sub { color: var(--ink-2); }
.tip-row { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.tip-row strong { font: 500 12.5px var(--mono); font-variant-numeric: tabular-nums; }
.tip-row span:last-child { color: var(--ink-2); }
.tip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }

/* The share sheet: sized so a tall phone-shaped picture and its buttons fit on one phone screen. */
.share-dialog { border: 1px solid var(--axis); border-radius: 14px; background: var(--panel); color: var(--ink); padding: 14px;
  width: min(520px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); }
.share-dialog[open] { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.share-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.share-dialog img { display: block; max-width: 100%; max-height: calc(100dvh - 190px); width: auto; height: auto; border-radius: 8px; }
.share-dialog .actions { justify-content: center; width: 100%; }
.shot-mark { font: 500 12px var(--mono); color: var(--ink-3); }
.on-touch { display: none; }

.notes { border-top: 1px solid var(--rule); padding-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.notes h2 { font: 700 13px var(--display); letter-spacing: .04em; text-transform: uppercase; }
.notes ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); max-width: 80ch; }

/* Hidden while a chart is being turned into a picture. */
.shooting .shot, .shooting .pin, .shooting .seg { visibility: hidden; }

@media (max-width: 760px) {
  .stack { gap: 40px; }
  .duo, .mood-grid, .start { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .deck { flex-direction: row; justify-content: flex-start; order: -1; }
  .now { text-align: left; }
  .heat .cell { min-height: 22px; }
  .heat .cell span { display: none; }
}
/* Phones and tablets (the touch class is set in index.html): no drag and drop, and bigger things to tap. */
.touch .on-mouse { display: none; }
.touch .on-touch { display: revert; }
.touch .solid, .touch .ghost { min-height: 46px; padding-inline: 22px; }
.touch .share-dialog .actions > * { flex: 1 1 auto; }
.touch .chip { padding-block: 9px; }
.touch .shot { padding: 8px 6px; font-size: 13px; }
.touch .seg button { padding: 8px 14px; }
.touch .drop { border-style: solid; }
@media (prefers-reduced-motion: reduce) {
  .vinyl, .bar-fill { animation: none; }
}
