/* Layout and component styles. All values come from theme.css tokens. */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-height) * 2 + var(--space-4)); }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--font-size);
  line-height: 1.45;
}

h1, h2, h3 { line-height: 1.15; margin: 0; }
h1, h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; }
h1 { font-size: 21px; }
h2 { font-size: var(--font-size-large); }
h3 { font-size: var(--font-size); font-weight: 700; margin: var(--space-4) 0 var(--space-2); }

a { color: var(--accent); }
::selection { background: var(--highlight); color: var(--highlight-text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

button, select, input {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 5px 10px;
  min-height: 34px;
}
button {
  cursor: pointer; border-radius: var(--radius-pill); padding: 5px 14px; font-weight: 550;
  transition: background-color 120ms, transform 120ms;
}
button:hover { background: var(--surface-2); }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
button.primary:hover { background: var(--accent); filter: brightness(1.08); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { border: none; background: none; padding: 0; min-height: 0; color: var(--accent); text-decoration: underline; font-weight: inherit; }
button[aria-pressed="true"], button[aria-selected="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
select { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
input[type="number"] { width: 5.5em; }

.muted { color: var(--muted); }
.small { font-size: var(--font-size-small); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.loading, .notice { padding: var(--space-6) var(--space-4); text-align: center; color: var(--text-2); }
.error { color: var(--danger); }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--content-width); margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-4);
  min-height: var(--bar-height);
}
.topbar .brand { margin-right: auto; display: flex; align-items: center; gap: var(--space-2) var(--space-3); }
.brand-home { display: flex; align-items: center; gap: var(--space-2); color: var(--text); text-decoration: none; border-radius: var(--radius-small); }
.topbar .brand .muted {
  font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--text-2);
  border-radius: var(--radius-pill); padding: 2px 10px;
}

/* Brand mark: four equaliser bars that bounce once when the app loads. */
.eq { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; }
.eq span { width: 5px; border-radius: 2px; background: var(--accent); transform-origin: bottom; }
.eq span:nth-child(1) { height: 45%; }
.eq span:nth-child(2) { height: 75%; }
.eq span:nth-child(3) { height: 100%; background: var(--highlight); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 18%, transparent); }
.eq span:nth-child(4) { height: 60%; }
@media (prefers-reduced-motion: no-preference) {
  .eq span { animation: eq-bounce 900ms cubic-bezier(.3, 1.6, .5, 1) both; }
  .eq span:nth-child(2) { animation-delay: 80ms; }
  .eq span:nth-child(3) { animation-delay: 160ms; }
  .eq span:nth-child(4) { animation-delay: 240ms; }
}
@keyframes eq-bounce {
  0% { transform: scaleY(0.15); }
  35% { transform: scaleY(1.25); }
  60% { transform: scaleY(0.7); }
  100% { transform: scaleY(1); }
}
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.filters label { display: flex; align-items: center; gap: var(--space-1); font-size: var(--font-size-small); color: var(--text-2); }
.filters .custom-range { display: flex; gap: var(--space-1); align-items: center; }
.filters .custom-range[hidden] { display: none; }
.topbar .actions { display: flex; gap: var(--space-2); }
/* Wide screens show the filters inline; phones fold them behind a toggle. */
.topbar-tools { display: contents; }
.tools-toggle { display: none; }

/* Section nav: one scrollable row. When it overflows, the clipped edge fades
   out and (for mouse users) gets a chevron button; the wheel scrolls it too. */
.sectionnav { border-top: 1px solid var(--border); }
.sectionnav-inner {
  position: relative; max-width: var(--content-width); margin: 0 auto;
  padding: 0 calc(var(--space-4) - 8px);
}
.sectionnav ul {
  --fade-l: 0px; --fade-r: 0px;
  list-style: none; margin: 0; padding: 6px 0;
  display: flex; gap: 0; white-space: nowrap;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  mask-image: linear-gradient(to right,
    transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
}
.sectionnav ul::-webkit-scrollbar { display: none; }
.sectionnav.more-left ul { --fade-l: 56px; }
.sectionnav.more-right ul { --fade-r: 56px; }
.sectionnav .nav-scroll {
  position: absolute; top: 50%; z-index: 1;
  display: grid; place-items: center;
  width: 26px; height: 26px; min-height: 0; padding: 0;
  font-size: 16px; line-height: 1; color: var(--text-2);
  border-radius: 50%; border-color: var(--border); background: var(--surface);
  opacity: 0; pointer-events: none;
  transform: translateY(-50%);
  transition: opacity 150ms, background-color 120ms;
}
.sectionnav .nav-scroll:hover { color: var(--text); background: var(--surface-2); }
.sectionnav .nav-scroll.prev { left: calc(var(--space-4) - 8px); }
.sectionnav .nav-scroll.next { right: calc(var(--space-4) - 8px); }
.sectionnav.more-left .nav-scroll.prev,
.sectionnav.more-right .nav-scroll.next { opacity: 1; pointer-events: auto; }
/* Touch screens swipe; the fade alone hints there is more. */
@media (pointer: coarse) { .sectionnav .nav-scroll { display: none; } }
.sectionnav a {
  display: inline-block; padding: 3px 8px; border-radius: var(--radius-pill);
  color: var(--text-2); text-decoration: none; font-size: var(--font-size-small);
  transition: background-color 150ms, color 150ms;
}
.sectionnav a:hover { color: var(--text); background: var(--surface-2); }
.sectionnav a[aria-current="true"] { color: var(--highlight-text); background: var(--highlight); font-weight: 600; }

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

main { max-width: var(--content-width); margin: 0 auto; padding: var(--space-5) var(--space-4); }

.view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  padding: var(--space-5) var(--space-6) var(--space-6);
  margin-bottom: var(--space-5);
  min-height: 120px;
}
.view-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-4); }
.view-head h2 { margin-right: auto; }
.view-note { font-size: var(--font-size-small); color: var(--muted); }
.view-controls { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: var(--space-3); }
.view-controls label { display: flex; align-items: center; gap: var(--space-1); font-size: var(--font-size-small); color: var(--text-2); }
.view-body[aria-busy="true"] { opacity: 0.6; }
/* Segmented control: a pill track with the chosen option raised in ink. */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--radius-pill); }
.segmented button { border: none; background: none; min-height: 28px; padding: 3px 12px; color: var(--text-2); }
.segmented button:hover { background: var(--surface); color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--text); color: var(--surface); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-5) var(--space-4); margin: 0; }
.stat dt { font-size: var(--font-size-small); color: var(--text-2); }
.stat dd {
  margin: 2px 0 0; font-family: var(--font-display); font-size: var(--font-size-hero);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stat dd.smaller { font-size: var(--font-size-large); font-weight: 700; }
/* The overview leads with its headline number. */
.stats.lead .stat:first-child { grid-column: span 2; }
.stats.lead .stat:first-child dd { font-size: var(--font-size-jumbo); color: var(--accent); }

/* tables & ranked lists */
.table-wrap { overflow-x: auto; --fade-l: 0px; --fade-r: 0px; }
/* Fade whichever edge has columns scrolled out of view (classes set in dom.ts). */
.table-wrap:is(.more-left, .more-right) {
  mask-image: linear-gradient(to right,
    transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
}
.table-wrap.more-left { --fade-l: 40px; }
.table-wrap.more-right { --fade-r: 40px; }
.show-more { display: none; }
table { border-collapse: collapse; width: 100%; font-size: var(--font-size-small); }
th, td { padding: 7px var(--space-2); border-bottom: 1px solid var(--grid); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
td.name { min-width: 160px; }
td.name .sub { display: block; color: var(--muted); }
td.rank { color: var(--muted); width: 2.5em; font-family: var(--font-display); font-weight: 700; }
/* Podium: the top three ranks get a highlighter dot. */
tbody tr:nth-child(-n+3) td.rank { color: var(--highlight-text); }
tbody tr:nth-child(-n+3) td.rank > span {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--highlight);
}
td.share { width: 22%; min-width: 80px; }
.share-bar { height: 10px; border-radius: var(--radius-pill); background: var(--series-1); min-width: 4px; }
.entity-link {
  border: none; background: none; padding: 0; min-height: 0; text-align: left;
  color: var(--text); font-weight: 500; cursor: pointer;
}
.entity-link:hover { text-decoration: underline; background: none; }

/* charts */
figure.chart { margin: 0; position: relative; }
.chart-canvas { display: block; width: 100%; height: 260px; touch-action: pan-y; }
.chart-canvas.short { height: 180px; }
.chart-summary { font-size: var(--font-size-small); color: var(--text-2); margin: var(--space-2) 0 0; }
.chart-tools { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-1); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); list-style: none; padding: 0; margin: var(--space-2) 0; font-size: var(--font-size-small); color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: var(--space-1); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.swatch.line { width: 18px; height: 0; border-radius: 0; border-top: 3px solid; }
.swatch.line.dashed { border-top-style: dashed; }
.legend li[tabindex] { cursor: default; border-radius: var(--radius-small); }
.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--tooltip-bg); color: var(--tooltip-text);
  padding: 6px 10px; border-radius: var(--radius-small);
  font-size: var(--font-size-small); line-height: 1.35; max-width: 280px;
}
.tooltip[hidden] { display: none; }
.small-multiples { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: var(--space-2) var(--space-5); }
.small-multiples h3 { margin-top: var(--space-2); }
.multiple-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin: var(--space-2) 0; }
.multiple-head h3 { margin: 0; }
.segmented.small { padding: 2px; }
.segmented.small button { min-height: 0; padding: 1px 9px; font-size: var(--font-size-small); font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-5); }

.heatmap svg { display: block; width: 100%; height: auto; }
.heatmap .cell:hover, .heatmap .cell:focus { stroke: var(--text); stroke-width: 1.5; outline: none; }
.heat-legend .ramp span:first-child { border-radius: 3px 0 0 3px; }
.heat-legend .ramp span:last-child { border-radius: 0 3px 3px 0; }
.heatmap text { fill: var(--muted); font-size: 10px; font-family: var(--font-sans); }
.heat-legend { display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-small); color: var(--text-2); margin-top: var(--space-2); }
.heat-legend .ramp { display: flex; }
.heat-legend .ramp span { width: 18px; height: 10px; }

.hbars { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: var(--space-2); align-items: center; font-size: var(--font-size-small); }
.hbars .bar { height: 12px; background: var(--series-1); border-radius: var(--radius-pill); min-width: 4px; }

.sparkline { display: block; width: 100%; height: 60px; }
.sparkline path { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.timetravel { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.tt-year { background: var(--surface-2); border-radius: var(--radius); padding: var(--space-4); }
.tt-year h3 { margin: 0 0 var(--space-1); font-family: var(--font-display); font-size: var(--font-size-large); font-weight: 800; letter-spacing: -0.02em; }
.tt-year ol { margin: var(--space-2) 0 0; padding-left: 1.4em; font-size: var(--font-size-small); }
.tt-year li { margin-bottom: 2px; }

details > summary { cursor: pointer; color: var(--accent); font-size: var(--font-size-small); margin: var(--space-2) 0; }

/* ---------------------------------------------------------------- dialogs */

dialog {
  border: 1px solid var(--border); border-radius: var(--radius-large);
  background: var(--surface); color: var(--text);
  padding: 0; width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 48px);
}
dialog::backdrop { background: color-mix(in srgb, #1a1726 55%, transparent); backdrop-filter: blur(2px); }
.dialog-head {
  position: sticky; top: 0; background: var(--surface); z-index: 1;
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
}
.dialog-head h2 { margin-right: auto; }
.dialog-body { padding: var(--space-4) var(--space-5) var(--space-5); }
.dialog-body section + section { margin-top: var(--space-5); }

/* ---------------------------------------------------------------- import */

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3);
  border: 2px dashed var(--axis); border-radius: var(--radius-large);
  padding: var(--space-6) var(--space-4); text-align: center;
  background: var(--surface);
  transition: border-color 150ms, background-color 150ms;
}
.dropzone.big { min-height: 340px; }
.dropzone.dragover { border-color: var(--accent); border-style: solid; background: var(--drop-bg); }
.dropzone p { margin: 0; max-width: 560px; color: var(--text-2); }
.dropzone p strong { color: var(--text); font-size: 17px; }

/* A record drawn in CSS; it spins while a file is held over the drop zone. */
.record {
  width: 88px; height: 88px; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle, var(--surface) 0 4px, var(--highlight) 5px 17px, var(--text) 18px 100%);
  box-shadow: inset 0 0 0 9px var(--text), inset 0 0 0 10px color-mix(in srgb, var(--surface) 20%, var(--text)),
    inset 0 0 0 19px var(--text), inset 0 0 0 20px color-mix(in srgb, var(--surface) 20%, var(--text));
  position: relative;
}
.record::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 4px; height: 12px; border-radius: 2px;
  background: var(--accent); transform: translate(-50%, -26px);
}
.dropzone:not(.big) .record { width: 64px; height: 64px; }
.dropzone:not(.big) .record::after { transform: translate(-50%, -20px) scale(0.8); }
@media (prefers-reduced-motion: no-preference) {
  .record { transition: transform 300ms; }
  .dropzone.dragover .record { animation: spin 1.8s linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.steps {
  list-style: none; padding: 0; margin: 0 0 var(--space-5);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4);
  counter-reset: step;
}
.steps li { counter-increment: step; color: var(--text-2); padding-top: var(--space-2); border-top: 2px solid var(--text); }
.steps li::before {
  content: counter(step); display: block; margin-bottom: var(--space-1);
  font-family: var(--font-display); font-weight: 800; font-size: var(--font-size-large); color: var(--accent);
}

.progress { margin: var(--space-3) 0; }
.progress-bar { height: 10px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.progress-bar > div { height: 100%; width: 0; background: var(--accent); }
.progress-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); font-size: var(--font-size-small); color: var(--text-2); margin-top: var(--space-1); }
tr.skipped td { color: var(--muted); }
tr.failed td { color: var(--danger); }
.totals { display: flex; flex-wrap: wrap; gap: var(--space-5); margin: var(--space-3) 0; }
.totals div { font-size: var(--font-size-small); color: var(--text-2); }
.totals strong { display: block; font-family: var(--font-display); font-weight: 800; font-size: var(--font-size-large); color: var(--text); }

.settings-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-2) 0; }
.meter { height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; max-width: 360px; }
.meter > div { height: 100%; width: 0; background: var(--accent); }

/* ---------------------------------------------------------------- landing */

.landing { padding-top: var(--space-6); padding-bottom: var(--space-6); overflow-x: clip; /* tilted cards and the sticker never cause sideways scroll */ }
.landing code {
  font-family: var(--font-mono); font-size: 0.9em; overflow-wrap: anywhere;
  background: var(--surface-2); border-radius: 5px; padding: 1px 5px;
}

/* Hero: the pitch (or "welcome back") beside the preview poster. */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--space-6); align-items: center; }
.hero-copy { min-height: 380px; display: flex; flex-direction: column; justify-content: center; }
.hero-skeleton { min-height: 300px; }
.hero-title { font-size: 60px; line-height: 0.98; letter-spacing: -0.04em; max-width: 12ch; margin-bottom: var(--space-4); }
.hero-title .ink { color: var(--accent); }
.hero-lede { font-size: 18px; color: var(--text-2); max-width: 50ch; margin: 0 0 var(--space-5); }
.hero-lede strong { color: var(--text); }
.kicker {
  margin: 0 0 var(--space-2); color: var(--accent); font-weight: 800; font-size: var(--font-size-small);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.hero-summary { font-size: 19px; color: var(--text-2); max-width: 46ch; margin: 0 0 var(--space-5); }
.hero-summary mark {
  color: var(--text); font-family: var(--font-display); font-weight: 800; font-size: 1.15em;
  background: linear-gradient(transparent 58%, var(--highlight) 58%); padding: 0 2px;
}
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.cta-note { margin: var(--space-2) 0 var(--space-4); }
button.big {
  font-size: 17px; font-weight: 700; min-height: 50px; padding: 10px 26px;
  box-shadow: 4px 4px 0 var(--text);
}
button.big:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--text); }
button.big:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--text); }
.cta-row button.link { font-weight: 600; }
.chips { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chips li {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-pill);
  padding: 3px 12px; font-size: var(--font-size-small); font-weight: 600; color: var(--text-2);
}
.chips li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.nudge {
  margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); max-width: 52ch;
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--highlight);
  border-radius: var(--radius);
}
.nudge p { margin: 0 0 var(--space-1); color: var(--text-2); }
.nudge strong { color: var(--text); }
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: rise 420ms cubic-bezier(.2, .8, .3, 1) both; }
  .hero-copy > :nth-child(2) { animation-delay: 50ms; }
  .hero-copy > :nth-child(3) { animation-delay: 100ms; }
  .hero-copy > :nth-child(n+4) { animation-delay: 150ms; }
}
@keyframes rise { from { opacity: 0; translate: 0 10px; } }

/* Preview poster: tilted "riso print" cards drawn from made-up data. */
.poster { position: relative; }
.poster-cards { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--space-4); }
.poster-card {
  margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-large);
  padding: var(--space-3) var(--space-4) var(--space-4);
  box-shadow: 6px 6px 0 var(--accent-soft);
}
.poster-card figcaption { font-family: var(--font-display); font-weight: 800; font-size: var(--font-size-small); margin-bottom: var(--space-2); }
.pc-artists { grid-column: 1 / -1; rotate: -1.5deg; }
.pc-heat { rotate: 1.2deg; translate: 0 4px; }
.pc-gap { rotate: -1deg; display: flex; flex-direction: column; gap: var(--space-1); }
.poster-svg { display: block; width: 100%; height: auto; overflow: visible; }
.poster-svg .grid { stroke: var(--grid); stroke-width: 1; }
.poster-svg .tick { fill: var(--muted); font-size: 9px; font-family: var(--font-sans); }
.poster-svg .label { fill: var(--text); font-size: 9.5px; font-weight: 700; font-family: var(--font-sans); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.poster-svg .line { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.poster-svg .dot { stroke: var(--surface); stroke-width: 1.5; }
.poster-svg .gap { stroke: var(--axis); stroke-width: 1.5; stroke-dasharray: 3 4; }
.poster-svg .play { fill: var(--muted); }
.poster-svg .play.back { fill: var(--accent); }
.s1 { stroke: var(--series-1); } .dot.s1 { fill: var(--series-1); }
.s2 { stroke: var(--series-2); } .dot.s2 { fill: var(--series-2); }
.s3 { stroke: var(--series-3); } .dot.s3 { fill: var(--series-3); }
.s4 { stroke: var(--series-4); } .dot.s4 { fill: var(--series-4); }
.s5 { stroke: var(--series-5); } .dot.s5 { fill: var(--series-5); }
.q1 { fill: var(--seq-1); } .q2 { fill: var(--seq-2); } .q3 { fill: var(--seq-3); } .q4 { fill: var(--seq-4); }
.q5 { fill: var(--seq-5); } .q6 { fill: var(--seq-6); } .q7 { fill: var(--seq-7); } .q8 { fill: var(--seq-8); }
.gap-title { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 19px; line-height: 1.15; }
.gap-title span { display: block; font-family: var(--font-sans); font-weight: 500; font-size: var(--font-size-small); color: var(--muted); }
.gap-note { margin: 0; font-size: var(--font-size-small); color: var(--text-2); }
.gap-note strong { color: var(--text); background: linear-gradient(transparent 55%, var(--highlight) 55%); }
.poster-sticker {
  position: absolute; top: -26px; right: -8px; width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: var(--highlight); color: var(--highlight-text);
  font-family: var(--font-display); font-weight: 800; font-size: 12px; line-height: 1.1; text-transform: uppercase; letter-spacing: 0.04em;
  box-shadow: inset 0 0 0 3px var(--highlight), inset 0 0 0 4.5px var(--highlight-text);
  rotate: 12deg;
}
@media (prefers-reduced-motion: no-preference) {
  .poster-card { animation: settle 650ms cubic-bezier(.2, .9, .3, 1.15) both; }
  .pc-heat { animation-delay: 120ms; }
  .pc-gap { animation-delay: 240ms; }
  .poster-sticker { animation: stamp 500ms cubic-bezier(.3, 1.6, .5, 1) 520ms both; }
}
@keyframes settle { from { opacity: 0; translate: 0 28px; } }
@keyframes stamp { from { opacity: 0; scale: 1.3; } }

/* Sections below the hero. */
.land-section { margin-top: 88px; }
.land-section > h2, .get-details h2 { font-size: 36px; letter-spacing: -0.03em; }
.section-lede { font-size: 17px; color: var(--text-2); max-width: 62ch; margin: var(--space-2) 0 var(--space-5); }

.feature-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--space-4);
}
.feature-grid li { display: flex; }
.feature-card {
  flex: 1; display: block; text-align: left; font: inherit; font-weight: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-large);
  padding: var(--space-5);
}
button.feature-card { cursor: pointer; transition: transform 150ms, box-shadow 150ms; }
button.feature-card:hover { background: var(--surface); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--accent); }
button.feature-card h3::after { content: " →"; color: var(--accent); }
.feature-card h3 { font-family: var(--font-display); font-size: 18px; font-weight: 800; margin: var(--space-3) 0 var(--space-1); }
.feature-card p { margin: 0; color: var(--text-2); font-size: var(--font-size-small); }
.glyph svg { display: block; width: 40px; height: 40px; }
.g-ink { fill: var(--text); }
.g-accent { fill: var(--accent); }
.g-hi { fill: var(--highlight); }
.g-soft { fill: var(--seq-3); }
.g-line { fill: none; stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.g-ring { fill: none; stroke: var(--text); stroke-width: 3; }

.steps.howto { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--space-5) var(--space-4); }
.steps.howto h3 { margin: 0 0 var(--space-1); font-size: 17px; color: var(--text); }
.steps.howto p { margin: 0; }
.steps.howto strong { color: var(--text); }
.steps li.wait { background: var(--highlight); color: var(--highlight-text); padding: var(--space-2) var(--space-3) var(--space-3); border-radius: 0 0 var(--radius) var(--radius); }
.steps li.wait h3, .steps li.wait strong { color: var(--highlight-text); }
.steps li.wait::before { color: var(--highlight-text); }
.callout {
  display: block; margin-top: var(--space-2); padding-left: var(--space-2);
  border-left: 3px solid var(--accent); font-size: var(--font-size-small);
}
.import-zone { margin-top: var(--space-6); }
.get-details > summary { color: var(--text); font-size: inherit; margin: 0; }
.get-details > summary h2 { display: inline; }
.get-details[open] > summary { margin-bottom: var(--space-3); }

.trust {
  background: var(--accent-soft); border-radius: var(--radius-large);
  padding: var(--space-6);
}
/* Flex rather than grid, so a short last row stretches instead of leaving a hole. */
.trust-grid { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-4); }
.trust-tile { flex: 1 1 280px; background: var(--surface); border-radius: var(--radius-large); padding: var(--space-5); }
.trust-tile h3 { font-family: var(--font-display); font-size: 18px; font-weight: 800; margin: var(--space-3) 0 var(--space-1); }
.trust-tile p { margin: 0; color: var(--text-2); font-size: var(--font-size-small); }
.stamp {
  display: inline-block; rotate: -2deg;
  font-family: var(--font-display); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent); border: 2.5px solid var(--accent); border-radius: var(--radius-small); padding: 2px 10px;
}
.trust-tile:nth-child(even) .stamp { rotate: 1.5deg; }

.faq { max-width: 780px; }
.faq > h2 { margin-bottom: var(--space-3); }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item > summary { color: var(--text); font-size: 17px; font-weight: 650; margin: 0; padding: var(--space-3) 0; }
.faq-item > summary::marker { color: var(--accent); }
.faq-item p { margin: 0 0 var(--space-4); color: var(--text-2); max-width: 66ch; }

.feedback {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4) var(--space-6);
  border: 2px solid var(--text); border-radius: var(--radius-large); padding: var(--space-5) var(--space-6);
  box-shadow: 6px 6px 0 var(--highlight);
}
.feedback h2 { font-size: 28px; letter-spacing: -0.02em; }
.feedback p { margin: var(--space-2) 0 0; color: var(--text-2); max-width: 56ch; }
/* A link styled as the big primary button. */
a.button-link {
  display: inline-flex; align-items: center; min-height: 48px; padding: 10px 26px;
  border-radius: var(--radius-pill); font-weight: 700; font-size: 17px; text-decoration: none;
  box-shadow: 4px 4px 0 var(--text); transition: transform 120ms, box-shadow 120ms;
}
a.button-link.primary { background: var(--accent); color: var(--accent-text); }
a.button-link:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--text); }
a.button-link.support { background: var(--highlight); color: var(--highlight-text); border: 2px solid var(--highlight-text); }
.feedback-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* The quiet line under the last chart in the app. */
.app-foot { max-width: var(--content-width); margin: 0 auto; padding: 0 var(--space-4) var(--space-6); text-align: center; }
.app-foot p { margin: 0; }

.landing-foot { border-top: 1px solid var(--border); }
.landing-foot-inner {
  max-width: var(--content-width); margin: 0 auto; padding: var(--space-5) var(--space-4);
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4);
}
.landing-foot-inner p { margin: 0; }
.foot-brand { font-family: var(--font-display); font-weight: 800; font-size: 20px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .hero-copy { min-height: 0; }
  .hero-skeleton { min-height: 320px; }
  .poster { max-width: 560px; width: 100%; margin: 0 auto; }
}

@media (max-width: 640px) {
  .topbar-inner { padding: var(--space-2) var(--space-3); min-height: 0; }
  .tools-toggle {
    display: inline-flex; align-items: center; gap: var(--space-1);
    min-height: 30px; padding: 3px 12px; max-width: 55%;
    font-size: var(--font-size-small);
  }
  .tools-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tools-toggle .chev { transition: transform 150ms; }
  .tools-toggle[aria-expanded="true"] { background: var(--surface-2); }
  .tools-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
  .topbar-tools { display: none; }
  .topbar.tools-open .topbar-tools {
    display: flex; flex-direction: column; align-items: stretch; gap: var(--space-3);
    flex-basis: 100%; padding: var(--space-2) 0 var(--space-1);
  }
  .topbar-tools .filters { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-3); }
  .topbar-tools .filters .custom-range { grid-column: 1 / -1; }
  .topbar-tools .filters .custom-range input { flex: 1; min-width: 0; }
  .topbar-tools .actions button { flex: 1; }
  .sectionnav-inner { padding: 0 calc(var(--space-3) - 8px); }
  .sectionnav .nav-scroll.prev { left: calc(var(--space-3) - 8px); }
  .sectionnav .nav-scroll.next { right: calc(var(--space-3) - 8px); }
  main { padding: var(--space-3) var(--space-2); }
  .view { padding: var(--space-4) var(--space-3); border-radius: var(--radius); margin-bottom: var(--space-3); }
  .dialog-body, .dialog-head { padding-left: var(--space-3); padding-right: var(--space-3); }
  .stat dd { font-size: var(--font-size-large); }
  .stats.lead .stat:first-child dd { font-size: 40px; }
  .hide-narrow { display: none; }
  .landing { padding-top: var(--space-5); padding-left: var(--space-3); padding-right: var(--space-3); }
  .hero-title { font-size: 42px; }
  .hero-lede, .hero-summary { font-size: 17px; }
  .poster-cards { grid-template-columns: minmax(0, 1fr); }
  .poster-sticker { width: 76px; height: 76px; font-size: 10px; top: -20px; right: -4px; }
  .land-section { margin-top: 56px; }
  .land-section > h2, .get-details h2 { font-size: 28px; }
  .feedback { padding: var(--space-5) var(--space-4); }
  .trust { padding: var(--space-5) var(--space-3); margin-left: calc(-1 * var(--space-1)); margin-right: calc(-1 * var(--space-1)); }
  th, td { padding: 7px 6px; }
  /* Long lists show their first 10 rows; "Show all" reveals the rest. */
  .clamp-rows tbody tr:nth-child(n+11) { display: none; }
  .show-more { display: block; width: 100%; margin-top: var(--space-2); }
  .heatmap svg { max-width: 420px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
