:root {
  color-scheme: light;
  --canvas: #f6f6f2;
  --panel: rgb(255 255 252 / 95%);
  --ink: #23231f;
  --line: #c8c7bd;
  --focus: #005fcc;
  --node: #687169;
  --edge: #9ca39b;
  font-family: ui-sans-serif, system-ui, sans-serif;
  background: var(--canvas);
  color: var(--ink);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #171917;
  --panel: rgb(35 39 35 / 96%);
  --ink: #f2f2eb;
  --line: #555a52;
  --focus: #80baff;
  --node: #94ab92;
  --edge: #758074;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --canvas: #171917;
    --panel: rgb(35 39 35 / 96%);
    --ink: #f2f2eb;
    --line: #555a52;
    --focus: #80baff;
    --node: #94ab92;
    --edge: #758074;
  }
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button, input { font: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#map { position: fixed; inset: 0; background: var(--canvas); }
#semantic-map { display: block; width: 100%; height: 100%; background: var(--canvas); touch-action: none; cursor: grab; }
#semantic-map:active { cursor: grabbing; }
#semantic-map:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

#map-controls, #search, #map-detail {
  position: fixed;
  z-index: 4;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

#map-controls { right: 14px; bottom: 14px; display: flex; gap: 4px; padding: 4px; }
#map-controls button { min-width: 32px; min-height: 32px; border: 0; border-radius: 4px; color: var(--ink); background: transparent; cursor: pointer; }
#map-controls button:hover, #map-controls button:focus-visible { background: color-mix(in srgb, var(--line) 35%, transparent); outline: 2px solid var(--focus); }

#search { top: 14px; left: 14px; width: min(360px, calc(100vw - 28px)); padding: 0; }
#query { width: 100%; height: 42px; padding: 0 12px; border: 0; border-radius: 7px; outline: none; color: var(--ink); background: transparent; }
#query:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

#map-detail { top: 70px; right: 14px; width: min(310px, calc(100vw - 28px)); max-height: min(60vh, 520px); padding: 14px; overflow: auto; }
#map-detail h2 { margin: 0; font-size: 18px; }
#map-detail h3 { margin: 14px 0 5px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
#map-detail ul { display: grid; gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; }
#map-detail a { color: var(--ink); }
#map-detail .artist-link { display: inline-block; margin-top: 12px; font-size: 13px; }

.map-error { position: fixed; top: 74px; left: 14px; z-index: 5; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }

@media (max-width: 600px) {
  #search { top: 10px; left: 10px; width: calc(100vw - 20px); }
  #map-controls { right: 10px; bottom: 10px; }
  #map-detail { top: auto; right: 10px; bottom: 54px; left: 10px; width: auto; max-height: 38vh; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; } }
