/* NATURE ONE 2026 — Lineup Explorer
   ---------------------------------------------------------------
   Direction: an operations board for a night on a decommissioned
   missile base. Chrome is achromatic on purpose — the six genre
   hues are the only colour that carries meaning anywhere in the UI.
   Palette validated with dataviz/scripts/validate_palette.js in
   both modes (light warns sub-3:1 on 3 slots → genre always ships
   with its text label, never colour alone).
*/

/* ---------------------------------------------------------- tokens */

:root {
  --font-display: "Liberation Sans Narrow", "Arial Narrow", "Helvetica Neue",
                  system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono",
               "DejaVu Sans Mono", monospace;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;

  --lane-h: 42px;
  --lane-label-w: 190px;
  --header-h: 34px;

  --dur-fast: 120ms;
  --dur-med: 220ms;
}

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #212120;
  --surface-3: #2a2a28;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-3: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.22);
  --critical: #d03b3b;

  /* blue / yellow / magenta / green — the only 4-slot subset of the documented
     palette that clears the all-pairs gate in both modes. "other" is neutral
     on purpose: it means "no genre listed", not a fifth identity. */
  --fam-techno: #3987e5;
  --fam-house: #c98500;
  --fam-hard: #d55181;
  --fam-trance: #008300;
  --fam-other: #898781;

  /* the night arc: dusk → deep night → dawn, lightest at either end */
  --night-edge: rgba(255, 255, 255, 0.13);
  --night-deep: rgba(255, 255, 255, 0.00);
}

:root[data-theme="light"] {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f1ed;
  --surface-3: #e7e6e0;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.12);
  --border-strong: rgba(11, 11, 11, 0.28);
  --critical: #d03b3b;

  --fam-techno: #2a78d6;
  --fam-house: #eda100;
  --fam-hard: #e87ba4;
  --fam-trance: #008300;
  --fam-other: #898781;

  --night-edge: rgba(11, 11, 11, 0.00);
  --night-deep: rgba(11, 11, 11, 0.13);
}

/* ------------------------------------------------------------ base */

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

body {
  margin: 0;
  padding: 0 0 var(--dock-space, 0);
  background: var(--plane);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }

.wrap {
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: clamp(12px, 3vw, 28px);
}

:where(a, button, input, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- header */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--plane);
}

.header-inner {
  display: flex;
  align-items: flex-end;
  gap: clamp(16px, 4vw, 48px);
  padding-block: 18px 14px;
  flex-wrap: wrap;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5.2vw, 54px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 0.92;
  text-transform: uppercase;
  font-stretch: condensed;
}
.brand h1 span { color: var(--ink-3); }

.brand .motto {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* the one decorative flourish: a hazard rule, borrowed from the base */
.brand::after {
  content: "";
  display: block;
  height: 5px;
  margin-top: 10px;
  border-radius: 1px;
  background: repeating-linear-gradient(
    -45deg,
    var(--border-strong) 0 6px,
    transparent 6px 12px
  );
}

.facts {
  display: flex;
  gap: clamp(14px, 3vw, 34px);
  margin-left: auto;
  padding-bottom: 4px;
}
.facts > div { text-align: right; }
.facts dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.facts dd {
  font-family: var(--font-mono);
  font-size: clamp(16px, 2.4vw, 22px);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.theme-toggle { align-self: center; }

/* tabs */

.tabs {
  display: flex;
  gap: 2px;
}
.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 16px 11px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  transition: color var(--dur-fast);
}
.tabs button:hover { color: var(--ink-2); }
.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ------------------------------------------------------- filter bar */

.filterbar[hidden] { display: none; }

.filterbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--plane) 94%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.filterbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  padding-block: 12px 10px;
}

.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-group.grow { flex: 1 1 220px; }

.filter-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}
.segmented button {
  appearance: none;
  border: 0;
  background: none;
  padding: 6px 13px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--plane);
}
.segmented.small button { padding: 4px 10px; font-size: 11px; }

/* Day is the filter people reach for first when planning a festival, so it
   carries more weight than the rest of the bar and is fenced off from it. */
#day-filter button { padding: 7px 18px; font-size: 13px; font-weight: 600; }
#day-group {
  padding-right: 16px;
  margin-right: 2px;
  border-right: 1px solid var(--border);
}
#day-group .filter-label { color: var(--ink-2); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 10px;
  height: 34px;
  color: var(--ink-3);
}
.search:focus-within { border-color: var(--border-strong); }
.search input {
  flex: 1;
  min-width: 0;
  appearance: none;
  background: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

/* dropdowns */

.dropdown { position: relative; }
.dropdown > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-2px) rotate(45deg);
}
.dropdown[open] > summary { border-color: var(--border-strong); }

.dropdown-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: max(260px, 100%);
  max-height: min(58vh, 460px);
  overflow-y: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.dropdown-panel .group-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 8px 4px;
}
.opt {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  background: none;
  border-radius: 6px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.opt:hover { background: var(--surface-2); }
.opt .box {
  flex: none;
  width: 15px; height: 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: 3px;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
  color: var(--plane);
}
.opt[aria-pressed="true"] .box { background: var(--ink); border-color: var(--ink); }
.opt[aria-pressed="true"] .box::after { content: "✓"; }
.opt .opt-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .opt-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.chip:hover { border-color: var(--border-strong); }
.chip.toggle[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--plane);
}
.chip.ghost { background: none; }
.chip .star { font-size: 13px; }

.pill-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.chip.toggle[aria-pressed="true"] .pill-count { color: var(--plane); opacity: 0.75; }
.pill-count:empty { display: none; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--border-strong); }

/* legend */

.legend-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 10px;
}
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
}
.legend .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.result-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}

/* Genre family colours — the only hues in the UI.
   --fam-ink is the label colour that wins on that fill: measured, not guessed
   (worst case 4.46:1, all others 5:1+). Only green takes white. */
.fam-techno { --fam: var(--fam-techno); --fam-ink: #0b0b0b; }
.fam-house  { --fam: var(--fam-house);  --fam-ink: #0b0b0b; }
.fam-hard   { --fam: var(--fam-hard);   --fam-ink: #0b0b0b; }
.fam-trance { --fam: var(--fam-trance); --fam-ink: #ffffff; }
.fam-other  { --fam: var(--fam-other);  --fam-ink: #0b0b0b; }

/* ------------------------------------------------------------ views */

#main { padding-block: 22px 60px; min-height: 50vh; }

.stage-section { margin-bottom: 34px; }

.stage-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.stage-head h2 {
  font-family: var(--font-display);
  font-size: clamp(19px, 2.6vw, 26px);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-stretch: condensed;
}
.tier-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--ink-2);
}
.tier-badge[data-tier="headfloor"] {
  background: var(--ink);
  color: var(--plane);
  border-color: var(--ink);
}
.stage-head .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 10px;
}

.filter-group[hidden] { display: none; }

/* ------------------------------------------------------- day grouping */

.day-group + .day-group { margin-top: 20px; }

.day-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.day-head .label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: none;
  color: var(--ink-2);
}
button.label { cursor: pointer; }
button.label:hover { border-color: var(--ink); color: var(--ink); }
.day-head .label[aria-pressed="true"]::after {
  content: " ×";
  opacity: 0.6;
}
.day-head .span { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.04em; }
.day-head .rule { flex: 1; height: 1px; background: var(--border); }

/* The night the set falls on. Achromatic by design — hue belongs to genre —
   so the two nights are told apart by fill, not colour. */
.day-badge {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  color: var(--ink-2);
}
.day-badge[data-daypos="1"],
.day-head .label[data-daypos="1"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--plane);
}
.day-badge[data-daypos="2"] { border-style: dashed; }

/* ------------------------------------------------------------ card */

.card {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--fam, var(--ink-3));
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.card:hover { background: var(--surface-2); }
.card.is-playing { border-color: var(--border-strong); background: var(--surface-2); }

.avatar {
  width: 52px; height: 52px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-3);
  display: grid;
  place-items: center;
}
.avatar.monogram {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fam, var(--ink-2));
  background: color-mix(in srgb, var(--fam, var(--ink-3)) 18%, var(--surface-3));
}

.card-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }

.card-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.1;
  text-transform: uppercase;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  /* keep clear of the star/play buttons pinned to the card's top-right */
  padding-right: 62px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.card-name:hover { text-decoration: underline; text-underline-offset: 3px; }

.card-slot {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 7px;
}
.card-slot .stage-name { color: var(--ink-3); }
.card-slot + .card-slot { margin-top: -3px; }

.genres { display: flex; flex-wrap: wrap; gap: 3px 8px; }
.genres li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-2);
}
.genres .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--fam, var(--ink-3));
  flex: none;
}

.card-actions {
  position: absolute;
  top: 9px;
  right: 9px;
  display: flex;
  gap: 4px;
}

.mini-btn {
  display: grid;
  place-items: center;
  width: 27px; height: 27px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--ink-3);
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
}
.mini-btn:hover { color: var(--ink); background: var(--surface-3); transform: scale(1.08); }
.mini-btn[aria-pressed="true"] { color: var(--ink); }
.mini-btn.play[data-playable="false"] { border-style: dashed; }
.mini-btn.is-playing { background: var(--ink); color: var(--plane); border-color: var(--ink); }

.card.is-fav { border-top-color: var(--border-strong); }
.card.is-fav .mini-btn.fav { color: var(--ink); }

.clash-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--critical);
}

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty strong { display: block; font-size: 17px; color: var(--ink-2); margin-bottom: 6px; }

/* ------------------------------------------------------- timetable */

.tt-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tt-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-left: auto;
}

.tt-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.tt-grid { position: relative; min-width: max-content; }

/* hour header — the signature: luminance traces the arc of the night */
.tt-hours {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  height: var(--header-h);
  margin-left: var(--lane-label-w);
  background:
    linear-gradient(90deg, var(--night-edge), var(--night-deep) 40%,
                    var(--night-deep) 70%, var(--night-edge)),
    var(--surface-2);
  border-bottom: 1px solid var(--baseline);
}
.tt-hour {
  position: relative;
  flex: none;
  border-left: 1px solid var(--grid);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  padding: 9px 0 0 6px;
}
.tt-hour[data-midnight="true"] {
  border-left-color: var(--baseline);
  color: var(--ink-2);
}

.tt-lane {
  position: relative;
  display: flex;
  height: var(--lane-h);
  border-bottom: 1px solid var(--grid);
}
.tt-lane:last-child { border-bottom: 0; }

.tt-label {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: none;
  width: var(--lane-label-w);
  padding: 5px 10px;
  background: var(--surface-2);
  border-right: 1px solid var(--baseline);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
}
.tt-label .name {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-label .meta {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tt-label[data-tier="headfloor"] { background: var(--surface-3); }

.tt-track { position: relative; flex: 1; }

.tt-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--fam, var(--ink-3));
  color: var(--fam-ink, #fff);
  padding: 0 7px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  /* 2px surface gap between neighbouring fills */
  box-shadow: 0 0 0 2px var(--surface);
  transition: filter var(--dur-fast), transform var(--dur-fast);
}
.tt-block:hover { filter: brightness(1.18); transform: translateY(-1px); }
.tt-block.dim { opacity: 0.22; }
.tt-block.is-playing { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.tt-block.is-fav::after {
  content: "★";
  position: absolute;
  top: 2px; right: 4px;
  font-size: 9px;
  opacity: 0.9;
}
.tt-block.is-clash { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--critical); }

.tt-now {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--critical);
  z-index: 4;
  pointer-events: none;
}

.clash-panel {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--critical);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--critical) 9%, var(--surface));
}
.clash-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--critical);
  margin-bottom: 8px;
}
.clash-panel li {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  padding: 2px 0;
}
.clash-panel .vs { color: var(--ink-3); padding: 0 4px; }

/* --------------------------------------------------------- tooltip */

.tooltip {
  position: fixed;
  z-index: 60;
  max-width: 280px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  font-size: 12.5px;
}
.tooltip .t-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.tooltip .t-time {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.tooltip .t-stage { color: var(--ink-3); font-size: 12px; }
.tooltip .t-genres { margin-top: 5px; color: var(--ink-2); font-size: 11.5px; }
.tooltip .t-hint {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------------------------------------------------------- stages */

.stage-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.stage-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.stage-card img { width: 100%; height: 150px; object-fit: cover; display: block; }
.stage-card .body { padding: 14px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.stage-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
}
.stage-card .desc { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.stage-card .foot { margin-top: auto; display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------- detail */

.detail {
  width: min(760px, calc(100vw - 24px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}
.detail::backdrop { background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(3px); }
.detail-inner { max-height: min(88vh, 900px); overflow-y: auto; padding: 20px; }

.detail-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.detail-head .avatar { width: 84px; height: 84px; font-size: 30px; }
.detail-head h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  overflow-wrap: anywhere;
}
.detail-close { margin-left: auto; }

.detail-sets { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.detail-set {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 11px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--fam, var(--ink-3));
}
.detail-set .when {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.detail-set .where { color: var(--ink-2); font-size: 13px; }
.detail-set .dur { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

.detail-bio { font-size: 14px; line-height: 1.62; color: var(--ink-2); margin: 14px 0; }

.detail-links { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12.5px;
  text-decoration: none;
  cursor: pointer;
}
.link-btn:hover { border-color: var(--border-strong); }

.detail-players { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 16px; }
.detail-players iframe { width: 100%; height: 352px; border: 0; border-radius: var(--r-md); background: var(--surface-2); }

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}

.no-player {
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: 13px;
}

/* ------------------------------------------------------------ dock */

.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.42);
}
.dock[hidden] { display: none; }

.dock-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-block: 10px;
}

.dock-artist {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: none;
  width: min(260px, 34vw);
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.dock-artist .avatar { width: 44px; height: 44px; font-size: 16px; flex: none; }
.dock-artist .t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dock-artist .n {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-artist:hover .n { text-decoration: underline; text-underline-offset: 3px; }
.dock-artist .s {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-embed { flex: 1; min-width: 0; }
.dock-embed iframe { width: 100%; height: 80px; border: 0; border-radius: var(--r-md); display: block; }
.dock-embed .no-player { padding: 9px 12px; font-size: 12.5px; }
.dock-embed .search-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }

/* YouTube is a video player doing an audio player's job: it's driven entirely
   through the IFrame API and replaced visually by .dock-transport, so the frame
   is shrunk out of sight rather than laid out. It must stay rendered — both
   `display:none` and `visibility:hidden` stop playback outright — so it gets
   taken out of flow instead, which also keeps the dock at its usual height. */
.dock-embed[data-service="youtube"] { flex: 0 0 0; }
.dock-embed[data-service="youtube"] iframe {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------ transport */

.dock-transport { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.dock-transport[hidden] { display: none; }
.tt-buttons { display: flex; align-items: center; gap: 2px; flex: none; }
.tt-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }

.tt-title {
  font-size: 12.5px;
  line-height: 1.2;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tt-row { display: flex; align-items: center; gap: 9px; }
.tt-seek { flex: 1; min-width: 0; }
.tt-time {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.dock-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* Volume. Only SoundCloud exposes one, so the control disables itself on
   Spotify rather than sitting there doing nothing silently. */
.dock-volume {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-right: 4px;
}
.dock-volume[hidden] { display: none; }
.dock-volume[data-available="false"] { opacity: 0.42; }

.icon-btn.ghost { background: none; border-color: transparent; }
.icon-btn.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border); }
.icon-btn:disabled { cursor: not-allowed; }

/* Shared by the volume control and the transport's seek bar — same 4px track,
   same thumb, so the dock reads as one instrument. Only the width differs. */
.slider {
  --fill: 0%;
  appearance: none;
  height: 18px;
  background: none;
  cursor: pointer;
}
#volume-range { width: 92px; }
.slider:disabled { cursor: not-allowed; }

.slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--ink) 0 var(--fill),
    var(--surface-3) var(--fill) 100%
  );
}
.slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}
.slider::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--ink);
}

.slider::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: var(--ink);
  border: 0;
  transition: transform var(--dur-fast);
}
.slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ink);
  border: 0;
}
.slider:hover:not(:disabled)::-webkit-slider-thumb { transform: scale(1.18); }
.slider:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 3px; }

/* --------------------------------------------------------- footer */

.site-footer {
  padding-block: 26px 40px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-3);
}
.site-footer a { color: var(--ink-2); }

/* ----------------------------------------------------- responsive */

/* Narrow: the dock stacks so the player keeps a usable width. `display:contents`
   dissolves the actions group so volume, service and close can each be placed
   on their own row — otherwise they crowd the artist name down to an ellipsis.
   Selectors are scoped through .dock to outrank the 860px block that follows. */
@media (max-width: 720px) {
  .dock .dock-inner { flex-wrap: wrap; gap: 8px 12px; }
  .dock .dock-actions { display: contents; }
  .dock .dock-artist { order: 1; flex: 1 1 auto; width: auto; min-width: 0; }
  .dock #dock-close { order: 2; }
  .dock .dock-embed { order: 3; flex-basis: 100%; }
  /* On YouTube the frame is a 1px stub, so it mustn't claim a row of its own —
     the transport is what belongs there. */
  .dock .dock-embed[data-service="youtube"] { flex-basis: 0; }
  .dock .dock-transport { order: 3; flex-basis: 100%; }
  .dock .dock-volume { order: 4; flex: 0 0 auto; padding-right: 0; }
  .dock #dock-service { order: 5; margin-left: auto; }
  .dock #volume-range { width: 108px; }
}

@media (max-width: 860px) {
  /* the bar wraps here, so the day divider would hang in empty space */
  #day-group { border-right: 0; padding-right: 0; }
  #day-group .segmented { width: 100%; }
  #day-filter button { flex: 1; }
  .facts { width: 100%; margin-left: 0; justify-content: space-between; }
  .facts > div { text-align: left; }
  .theme-toggle { position: absolute; top: 18px; right: 14px; }
  .site-header { position: relative; }
  .filter-group.grow { flex-basis: 100%; order: -1; }
  :root { --lane-label-w: 132px; }
  .dock-artist { width: 150px; }
  .dock-artist .avatar { display: none; }
}

@media (max-width: 560px) {
  #volume-range { width: 62px; }
  .card-grid { grid-template-columns: 1fr; }
  .dock-embed iframe { height: 80px; }
  .legend { font-size: 11px; }
  .result-count { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .tt-block:hover { transform: none; }
  .mini-btn:hover { transform: none; }
}
