:root {
  --ink: #17202a; --muted: #55606c; --paper: #fbfaf8; --line: #d9d5cc; --focus: #1b5fd1;
  --low: #7fb5a1; --medium: #f0b93b; --high: #e56b2f; --critical: #a3151f;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
#map { position: fixed; inset: 0; background: #f4f1ea; }   /* the basemap's own land colour, so a tile that is late looks like empty land, not a white hole */
#panel {
  position: fixed; z-index: 2; top: 12px; left: 12px; width: 300px; max-height: calc(100% - 24px); overflow: auto;
  padding: 16px 16px 14px; background: var(--paper); border-radius: 8px;
  box-shadow: 0 0 0 1px rgb(23 32 42 / 0.08), 0 1px 2px rgb(23 32 42 / 0.06), 0 8px 24px rgb(23 32 42 / 0.10);
}
h1 { margin: 0 0 4px; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.lede { margin: 0 0 16px; font-size: 0.86rem; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
.toggle { display: none; }
#bands { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.chip {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; font: inherit; font-size: 0.9rem; text-align: left;
  color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; touch-action: manipulation;
}
@media (hover: hover) { .chip:hover { border-color: #b9b4a8; } }
.chip:active { transform: scale(0.98); }
.chip[aria-pressed="false"] { color: var(--muted); background: transparent; }
.chip[aria-pressed="false"] .dot { opacity: 0.35; }
.chip:last-child { grid-column: 1 / -1; }   /* the fifth entry, 'Being rated', takes the full row */
.chip .dot { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--ink); }
.chip .n { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.when { display: block; font-size: 0.86rem; color: var(--muted); }
.when select { display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 6px 8px; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.meta { margin: 12px 0 0; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
#note { position: fixed; z-index: 3; left: 50%; bottom: 28px; transform: translateX(-50%); max-width: calc(100% - 24px); margin: 0; padding: 10px 14px; font-size: 0.9rem; color: #fff; background: var(--ink); border-radius: 4px; }
#note[hidden] { display: none; }
#note button { min-height: 44px; margin-left: 4px; padding: 0 14px; font: inherit; color: #fff; background: transparent; border: 1px solid rgb(255 255 255 / 0.6); border-radius: 6px; cursor: pointer; touch-action: manipulation; }
#note button:focus-visible { outline-color: #fff; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pop .eyebrow { margin: 0 0 2px; font-size: 0.8rem; color: var(--muted); }
.pop h2 { margin: 0 0 6px; font-size: 1rem; line-height: 1.3; text-wrap: balance; }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 0.85rem; }
.pop dt { color: var(--muted); }
.pop dd { margin: 0; }
.pop .stage { max-width: 260px; margin: 8px 0 0; font-size: 0.85rem; line-height: 1.4; color: var(--muted); text-wrap: pretty; }
.photo { position: relative; width: min(240px, 100%); width: min(240px, 100%, 34dvh); aspect-ratio: 1 / 1; margin-top: 8px; border-radius: 3px; background: #e9e6df; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.photo img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.photo::after { content: ""; position: absolute; inset: 0; }   /* the shield: clicks land here, never on the picture */
.maplibregl-popup-close-button { width: 44px; height: 44px; font-size: 22px; }
@media (hover: none) { .maplibregl-ctrl-group button { width: 44px; height: 44px; } }   /* zoom buttons: a thumb-sized target on touch screens */
.maplibregl-popup-content { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 12px 14px; font-family: inherit; color: var(--ink); }
@media (max-width: 760px) {
  .has-popup #panel { display: none; }
  .has-popup .maplibregl-ctrl-top-right { display: none; }   /* reading mode: the zoom buttons would sit on the popup's close button; pinch still zooms */
  /* A bar, not a sheet: title and count on the left, one button on the right. The filters open on request, so the map keeps the screen. */
  #panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 60%; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "title toggle" "meta toggle" "filters filters";
    align-items: center; column-gap: 12px; border-radius: 12px 12px 0 0; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  #panel h1 { grid-area: title; margin: 0; font-size: 1.15rem; }
  #panel .meta { grid-area: meta; margin: 0; }
  #panel #filters { grid-area: filters; display: none; margin-top: 12px; }
  .filters-open #panel #filters { display: block; }
  .toggle { grid-area: toggle; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; font: inherit; font-size: 0.9rem; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; touch-action: manipulation; }
  .toggle::after { content: ""; width: 7px; height: 7px; margin-top: -3px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
  .toggle[aria-expanded="true"]::after { margin-top: 3px; transform: rotate(225deg); }
  .lede { display: none; }
  .meta .upd { display: none; }
  .filters-open .meta .upd { display: inline; }
  #note { bottom: calc(var(--panel-h, 80px) + 12px); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
