:root {
  --map-ink: #172033;
  --map-muted: #748096;
  --map-line: #e2e7ef;
  --map-soft: #f5f7fb;
  --map-blue: #2858d8;
  --map-shadow: 0 1.25rem 3rem rgba(36, 50, 81, .12);
}

body { background: #edf1f7; color: var(--map-ink); }
.map-page { min-height: 100vh; padding: clamp(1.25rem, 3vw, 3rem); }
.map-header, .map-layout, .results-section { width: min(100%, 112rem); margin-inline: auto; }
.map-header { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding: .25rem 0 1.5rem; }
.back-link { display: inline-flex; margin-bottom: 1.2rem; color: var(--map-muted); font-size: .82rem; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--map-blue); }
.title-row { display: flex; align-items: center; gap: 1rem; }
.map-header h1 { max-width: none; margin: 0; color: var(--map-ink); font-size: clamp(2.35rem, 5vw, 4.8rem); letter-spacing: -.065em; }
.map-header .eyebrow { margin: 0 0 .35rem; color: var(--map-blue); }
.map-header .lede { max-width: 46rem; margin: .8rem 0 0; color: var(--map-muted); font-size: 1.05rem; }
.live-badge { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .7rem; border: 1px solid #c9d5fa; border-radius: 999px; background: #f1f4ff; color: var(--map-blue); font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.live-badge span { width: .45rem; height: .45rem; border-radius: 50%; background: #47b978; box-shadow: 0 0 0 .2rem #47b9782b; }
.download-links { display: flex; flex-wrap: wrap; justify-content: end; gap: .55rem; }
.download-link, .map-actions button { border: 0; border-radius: .7rem; padding: .75rem 1rem; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.download-link { background: var(--map-blue); color: white; box-shadow: 0 .45rem 1rem #2858d82e; }
.download-link.secondary { background: white; color: var(--map-blue); box-shadow: 0 .35rem 1rem #24325112; }
.download-link:hover, .map-actions button:hover { transform: translateY(-1px); }
.download-link span { margin-right: .3rem; font-size: 1.05rem; }
.map-layout { display: grid; grid-template-columns: minmax(18rem, 24rem) minmax(0, 1fr); gap: 1rem; }
.map-panel { display: flex; min-height: 70vh; max-height: 76vh; flex-direction: column; overflow: hidden; border: 1px solid var(--map-line); border-radius: 1.2rem; background: white; box-shadow: var(--map-shadow); }
.panel-topline { display: flex; align-items: start; justify-content: space-between; padding: 1.35rem 1.35rem .85rem; }
.panel-topline h2, .results-heading h2 { margin: .2rem 0 0; font-size: 1.3rem; letter-spacing: -.03em; }
.panel-kicker { margin: 0; color: var(--map-blue); font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.icon-button { width: 2rem; height: 2rem; border: 1px solid var(--map-line); border-radius: .55rem; background: white; color: var(--map-muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.search-label { display: block; padding: 0 1.35rem .4rem; color: var(--map-muted); font-size: .73rem; font-weight: 800; }
.search-wrap { display: flex; align-items: center; gap: .55rem; margin: 0 1.35rem; padding: .1rem .7rem; border: 1px solid var(--map-line); border-radius: .7rem; background: var(--map-soft); color: var(--map-muted); }
.search-wrap:focus-within { border-color: #9bb0f4; background: white; box-shadow: 0 0 0 .2rem #2858d814; }
.search-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--map-ink); font: inherit; font-size: .88rem; }
.search-wrap input::placeholder { color: #9aa5b7; }
.search-wrap button { border: 0; background: none; color: var(--map-muted); font-size: 1.1rem; cursor: pointer; }
.map-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; padding: .8rem 1.35rem .7rem; }
.map-actions button { padding: .65rem .7rem; font-size: .77rem; }
.primary-action { background: var(--map-blue); color: white; }
.quiet-action { background: #edf2ff; color: var(--map-blue); }
.map-summary { display: flex; align-items: baseline; gap: .35rem; padding: .15rem 1.35rem 1rem; color: var(--map-muted); font-size: .73rem; }
.map-summary strong { color: var(--map-ink); font-size: 1.15rem; }
.summary-dot { padding: 0 .1rem; color: #c3cad5; }
.layer-list { display: grid; gap: .15rem; overflow-y: auto; padding: 0 .65rem .9rem; scrollbar-color: #cdd5e1 transparent; }
.layer-row { display: flex; align-items: center; gap: .55rem; padding: .56rem .7rem; border-radius: .55rem; color: var(--map-ink); font-size: .76rem; cursor: pointer; transition: background .15s; }
.layer-row:hover { background: var(--map-soft); }
.layer-row input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--map-blue); }
.layer-swatch { width: .62rem; height: .62rem; flex: 0 0 auto; border-radius: 50%; box-shadow: 0 0 0 3px #ffffff, 0 0 0 4px #dbe2eb; }
.layer-count { margin-left: auto; color: #a1acbc; font-size: .7rem; }
.panel-footnote { margin-top: auto; padding: .85rem 1.35rem 1rem; border-top: 1px solid var(--map-line); color: var(--map-muted); font-size: .7rem; line-height: 1.45; }
.panel-footnote a { color: var(--map-blue); font-weight: 800; text-decoration: none; }
.map-panel.is-collapsed { min-height: auto; }
.map-panel.is-collapsed > :not(.panel-topline) { display: none; }
.map-stage { position: relative; min-width: 0; height: clamp(34rem, 76svh, 56rem); overflow: hidden; border-radius: 1.2rem; box-shadow: var(--map-shadow); }
#map { width: 100%; height: 100%; min-height: 0; background: #dce6ef; }
.map-overlay { position: absolute; z-index: 500; left: 1rem; right: 1rem; display: flex; justify-content: space-between; pointer-events: none; }
.map-overlay-top { top: 1rem; justify-content: end; }
.map-overlay-bottom { bottom: .8rem; align-items: center; }
.map-control { pointer-events: auto; border: 0; border-radius: .65rem; padding: .55rem .7rem; background: rgba(255,255,255,.95); color: var(--map-ink); box-shadow: 0 .35rem 1rem #24325126; font: inherit; font-size: .75rem; font-weight: 800; cursor: pointer; }
.map-control:hover { color: var(--map-blue); }
.map-status, .map-attribution { padding: .38rem .6rem; border-radius: .5rem; background: rgba(255,255,255,.92); color: var(--map-muted); box-shadow: 0 .25rem .7rem #2432511c; font-size: .69rem; }
.map-attribution a { color: var(--map-blue); text-decoration: none; }
.map-detail { position: absolute; z-index: 700; top: .75rem; right: .75rem; bottom: .75rem; display: flex; width: min(34%, 29rem); min-width: 19rem; flex-direction: column; overflow: hidden; border: 1px solid #dbe3ef; border-radius: 1rem; background: rgba(255,255,255,.98); box-shadow: 0 .8rem 2.5rem rgba(23,32,51,.2); }
.map-detail[hidden] { display: none; }
.map-detail-header { display: flex; align-items: start; justify-content: space-between; gap: .8rem; padding: 1rem 1rem .8rem; border-bottom: 1px solid var(--map-line); }
.map-detail-title { margin: .25rem 0 0; color: var(--map-ink); font-size: 1.12rem; line-height: 1.12; letter-spacing: -.025em; }
.map-detail-close { flex: 0 0 auto; width: 2rem; height: 2rem; border: 1px solid var(--map-line); border-radius: .55rem; background: white; color: var(--map-muted); font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.map-detail-close:hover, .map-detail-close:focus-visible { border-color: #9bb0f4; color: var(--map-blue); }
.map-detail-content { overflow-y: auto; padding: .9rem 1rem 1.1rem; scrollbar-color: #cdd5e1 transparent; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 .35rem 1rem #24325126 !important; }
.leaflet-control-zoom a { color: var(--map-ink) !important; }
.leaflet-popup-content-wrapper { border-radius: .85rem; }
.custom-pin { display: grid; place-items: center; border: 0; background: transparent; }
.custom-pin span { display: block; width: 1rem; height: 1rem; border: 2px solid white; border-radius: 50%; background: var(--pin-color); box-shadow: 0 1px 4px #17203366; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: #2858d82b; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: var(--map-blue); color: white; font: 800 .72rem/2rem system-ui, sans-serif; }
.leaflet-popup-content { min-width: 16rem; margin: 1rem; }
.popup-category { color: var(--map-blue); font-size: .65rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.popup-name { margin: .3rem 0 .55rem; color: var(--map-ink); font-size: 1.05rem; letter-spacing: -.02em; }
.popup-description { max-height: 13rem; overflow: auto; color: #566278; font-size: .77rem; line-height: 1.5; }
.popup-description p { margin: .45rem 0; }
.popup-description a { color: var(--map-blue); font-weight: 700; }
.popup-links { margin: .7rem 0 0; font-size: .75rem; }
.popup-links a, .popup-related a { color: var(--map-blue); font-weight: 800; }
.popup-related { max-height: 15rem; overflow: auto; margin-top: .85rem; padding-top: .7rem; border-top: 1px solid #dbe3ef; color: #566278; font-size: .75rem; line-height: 1.45; }
.popup-related > strong { display: block; color: var(--map-ink); font-size: .72rem; }
.popup-related-item { margin-top: .75rem; padding-top: .65rem; border-top: 1px solid #edf1f6; }
.popup-related-item h4 { margin: 0 0 .25rem; color: var(--map-ink); font-size: .78rem; }
.popup-related-item p { margin: .3rem 0; }
.results-section { margin-top: 1.7rem; }
.results-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: .8rem; }
.results-heading > span { color: var(--map-muted); font-size: .76rem; }
.result-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; }
.result-card { display: flex; min-height: 7rem; flex-direction: column; justify-content: space-between; padding: .9rem; border: 1px solid var(--map-line); border-radius: .8rem; background: white; color: inherit; text-align: left; cursor: pointer; box-shadow: 0 .35rem .9rem #24325109; transition: border-color .15s, transform .15s; }
.result-card:hover, .result-card:focus-visible { border-color: #9bb0f4; transform: translateY(-1px); }
.result-card-category { display: flex; align-items: center; gap: .45rem; color: var(--map-muted); font-size: .65rem; font-weight: 800; }
.result-card-category span { width: .48rem; height: .48rem; border-radius: 50%; }
.result-card h3 { margin: .5rem 0 0; color: var(--map-ink); font-size: .83rem; line-height: 1.2; }
.empty-state { grid-column: 1 / -1; padding: 2rem; border: 1px dashed #cbd4e1; border-radius: .8rem; color: var(--map-muted); text-align: center; }
@media (max-width: 1000px) { .result-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .map-page { padding: 1rem; }
  .map-header { align-items: start; flex-direction: column; gap: 1rem; }
  .download-links { justify-content: start; }
  .map-layout { display: flex; flex-direction: column; }
  .map-stage { order: 1; height: clamp(30rem, 70svh, 44rem); }
  .map-detail { top: auto; right: .65rem; bottom: .65rem; left: .65rem; width: auto; min-width: 0; max-height: 68%; border-radius: 1rem; }
  .map-detail-content { padding-bottom: 1.25rem; }
  .map-panel { order: 2; min-height: auto; max-height: none; }
  .layer-list { max-height: 20rem; }
  .results-section { display: none; }
  .title-row { align-items: start; flex-direction: column; gap: .6rem; }
  .live-badge { align-self: start; }
}
@media (max-width: 480px) {
  .map-header h1 { font-size: 2.7rem; }
  .download-links { width: 100%; }
  .download-link { flex: 1; text-align: center; }
  .map-overlay-bottom { align-items: end; flex-direction: column; gap: .35rem; }
  .map-attribution { align-self: end; }
  .map-detail { max-height: 72%; }
}
