:root{
  --ink:#1f2a24; --muted:#5f6b63; --paper:#fbf8f2; --line:#e6e0d4;
  --moss:#2f4a37; --moss-2:#3f6b46; --accent:#c2603a;
  --shadow:0 10px 30px rgba(31,42,36,.18), 0 2px 6px rgba(31,42,36,.08);
  --top:64px;
  --serif:'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;font-family:var(--sans);color:var(--ink);background:var(--paper);-webkit-font-smoothing:antialiased}
body{display:flex;flex-direction:column;height:100dvh;overflow:hidden}

/* ---- top bar ---- */
.topbar{height:var(--top);flex:0 0 var(--top);display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:0 18px;background:var(--moss);color:#f4efe4;position:relative;z-index:5;box-shadow:0 2px 10px rgba(0,0,0,.15)}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.brand-mark{width:34px;height:34px;color:#cfe0b4;flex:0 0 auto}
.brand h1{font-family:var(--serif);font-weight:650;font-size:22px;margin:0;letter-spacing:-.01em;white-space:nowrap}
.brand h1 em{font-style:italic;font-weight:500;color:#e8d7b0}
.tagline{margin:1px 0 0;font-size:12.5px;color:#c9d3c3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cta{display:inline-flex;align-items:center;gap:8px;background:#f1c76b;color:#2a2410;text-decoration:none;font-weight:600;
  font-size:14px;padding:9px 14px;border-radius:999px;white-space:nowrap;transition:transform .15s, box-shadow .15s}
.cta:hover{transform:translateY(-1px);box-shadow:0 4px 12px rgba(0,0,0,.2)}
.cta[hidden]{display:none}
.cta-short{display:none}

/* ---- map stage ---- */
.stage{position:relative;flex:1 1 auto;min-height:0}
#map{position:absolute;inset:0}

/* ---- legend ---- */
.legend{position:absolute;top:16px;left:16px;width:300px;max-height:calc(100% - 32px);overflow:auto;
  background:rgba(251,248,242,.97);backdrop-filter:blur(6px);border:1px solid var(--line);border-radius:16px;
  box-shadow:var(--shadow);padding:14px 14px 12px;z-index:3;display:none}
.legend.open{display:block}
.lg-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:6px}
.lg-head h2{font-family:var(--serif);font-size:18px;font-weight:650;margin:0}
.lg-total{font-size:12px;color:var(--muted)}
.icon-btn{border:0;background:transparent;color:var(--muted);padding:6px;border-radius:8px;cursor:pointer;display:none}
.icon-btn:hover{background:#eee8dc}
.lg-list,.lg-sub{list-style:none;margin:0;padding:0}
.lg-row{border-top:1px solid var(--line);padding:6px 0}
.lg-row:first-child{border-top:0}
.lg-list label{display:flex;align-items:center;gap:10px;padding:5px 4px;border-radius:8px;cursor:pointer;font-size:14.5px;font-weight:500}
.lg-list label:hover{background:#f1ece2}
.lg-list input{width:16px;height:16px;accent-color:var(--moss-2);margin:0;flex:0 0 auto}
.lg-icon{width:26px;height:26px;border-radius:50%;background:var(--c);color:#fff;display:grid;place-items:center;flex:0 0 auto;
  box-shadow:0 0 0 2px #fff, 0 1px 3px rgba(0,0,0,.25)}
.lg-name{flex:1 1 auto}
.lg-count{font-size:12px;font-weight:600;color:var(--muted);background:#efe9dd;border-radius:999px;padding:2px 8px}
.lg-sub{margin:0 0 2px 26px}
.lg-sub label{font-size:13px;font-weight:400;padding:3px 4px;color:#3a463e}
.lg-sub input{width:14px;height:14px}
.lg-dot{width:11px;height:11px;border-radius:50%;flex:0 0 auto;box-shadow:0 0 0 2px #fff,0 0 0 3px rgba(0,0,0,.08)}
.lg-row.soon label{cursor:default;color:#9aa198}
.lg-row.soon label:hover{background:none}
.lg-row.soon .lg-icon{filter:grayscale(1);opacity:.45}
.lg-soon{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;color:#a39a87;border:1px dashed #cfc6b3;border-radius:999px;padding:2px 7px}

.bm{display:flex;align-items:center;justify-content:space-between;margin:10px 0 12px;padding-top:10px;border-top:1px solid var(--line)}
.bm-label{font-size:13px;color:var(--muted);font-weight:500}
.bm-switch{display:inline-flex;background:#ece5d8;border-radius:999px;padding:3px}
.bm-btn{border:0;background:transparent;font:600 13px var(--sans);color:var(--muted);padding:6px 14px;border-radius:999px;cursor:pointer}
.bm-btn.on{background:#fff;color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.15)}

.lg-cta{display:block;text-decoration:none;color:#2a2410;background:linear-gradient(135deg,#f6dc9c,#f1c76b);border-radius:12px;padding:10px 12px;font-size:13px;line-height:1.35}
.lg-cta[hidden]{display:none}
.lg-cta strong{display:block;font-family:var(--serif);font-size:15px;margin-bottom:2px}
.lg-foot{font-size:11.5px;color:var(--muted);margin:10px 2px 0;line-height:1.4}
.lg-tell{font-size:12px;margin:8px 2px 0;line-height:1.4}
.lg-tell a{color:var(--moss-2);font-weight:600}
.lg-sources{margin:8px 2px 0;font-size:11px;color:var(--muted)}
.lg-sources summary{cursor:pointer;font-weight:600;color:var(--moss-2);display:inline}
.lg-sources summary::-webkit-details-marker{color:var(--moss-2)}
.lg-sources p{margin:6px 0 0;line-height:1.45}

.legend-fab{position:absolute;left:14px;bottom:28px;z-index:3;display:none;align-items:center;gap:8px;border:0;cursor:pointer;
  background:var(--moss);color:#f4efe4;font:600 15px var(--sans);padding:12px 18px;border-radius:999px;box-shadow:var(--shadow)}

/* ---- pins ---- */
.pin{border:0;padding:0;background:transparent;cursor:pointer;width:32px;height:40px;display:block}
.pin-body{display:grid;place-items:center;width:30px;height:30px;margin:0 auto;border-radius:50% 50% 50% 0;transform:rotate(-45deg);
  background:var(--c);border:2.5px solid #fff;box-shadow:0 3px 8px rgba(0,0,0,.35);transition:transform .15s}
.pin-body svg{transform:rotate(45deg);color:#fff}
.pin:hover .pin-body,.pin.active .pin-body{transform:rotate(-45deg) scale(1.18)}
.pin.active{z-index:2}
/* smaller pin variant (e.g. small car parks) */
.pin.pin-sm{width:26px;height:32px}
.pin.pin-sm .pin-body{width:22px;height:22px;border-width:2px}
.lg-dot.lg-dot-lg{width:13px;height:13px}
.lg-dot.lg-dot-sm{width:9px;height:9px;margin:0 2px}
/* grouped pins: count bubble with a ring of the member colours, and fan-out legs */
.cluster{border:0;padding:3px;cursor:pointer;width:40px;height:40px;border-radius:50%;background:var(--ring,#3f6b46);
  box-shadow:0 3px 8px rgba(0,0,0,.35);display:block;transition:transform .15s}
.cluster span{display:grid;place-items:center;width:100%;height:100%;border-radius:50%;background:#2f3b2f;color:#fff;
  font:700 14px var(--sans);border:2px solid #fff;box-sizing:border-box}
.cluster:hover{transform:scale(1.1)}
.spider{pointer-events:none}
.spider line{stroke:#2f3b2f;stroke-width:1.5;stroke-opacity:.7}
.spider circle{fill:#2f3b2f;stroke:#fff;stroke-width:1.5}
.maplibregl-popup,.mapboxgl-popup{z-index:5}

/* ---- popups ---- */
.maplibregl-popup-content,.mapboxgl-popup-content{border-radius:14px;padding:14px 16px 14px;box-shadow:var(--shadow);font-family:var(--sans)}
.maplibregl-popup-close-button,.mapboxgl-popup-close-button{font-size:20px;width:30px;height:30px;color:var(--muted);border-radius:0 14px 0 8px}
.pop{max-height:min(52vh,420px);overflow:auto;padding-right:2px}
.pop-cat{font-size:11px;text-transform:uppercase;letter-spacing:.08em;font-weight:700;display:flex;align-items:center;gap:6px}
.pop-dot{width:8px;height:8px;border-radius:50%}
.pop h3{font-family:var(--serif);font-weight:650;font-size:19px;line-height:1.2;margin:4px 24px 6px 0;color:var(--ink)}
.pop-desc{font-size:13.5px;line-height:1.5;margin:0 0 8px;color:#2d3831}
.pop-meta{font-size:12.5px;line-height:1.45;margin:0 0 6px;color:#46524a}
.pop-meta strong{display:block;font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.pop-more{margin:4px 0 8px;font-size:12.5px;line-height:1.5;color:#3a463e}
.pop-more summary{cursor:pointer;color:var(--moss-2);font-weight:600;font-size:13px}
.pop-more p{margin:6px 0 0}
.pop-addr{font-size:12px;color:var(--muted);margin:6px 0 0}
.pop-approx{font-size:11.5px;color:#9a6a1f;margin:4px 0 0}
.pop-approx::before{content:'⌖ '}
.pop-actions{display:flex;gap:8px;margin-top:12px;flex-wrap:nowrap}
.btn{display:inline-flex;align-items:center;font-size:13px;font-weight:600;text-decoration:none;padding:7px 12px;border-radius:999px;
  border:1px solid var(--line);color:var(--ink);background:#fff;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.btn-primary{background:var(--moss);border-color:var(--moss);color:#fff}

/* ---- mobile ---- */
@media (max-width:759px){
  :root{--top:56px}
  .topbar{padding:0 12px}
  .brand-mark{width:28px;height:28px}
  .brand h1{font-size:18px}
  .tagline{display:none}
  .cta{padding:8px 12px;font-size:13px}
  .cta-long{display:none}.cta-short{display:inline}
  .legend{top:auto;left:0;right:0;bottom:0;width:auto;max-height:72%;border-radius:18px 18px 0 0;padding:12px 16px calc(16px + env(safe-area-inset-bottom))}
  .legend::before{content:'';display:block;width:40px;height:4px;border-radius:4px;background:#d8d0c0;margin:0 auto 10px}
  .icon-btn{display:block}
  .legend-fab{display:inline-flex}
  body.legend-open .legend-fab{display:none}
  .maplibregl-ctrl-bottom-right{margin-bottom:6px}
}

/* keep Directions / Website always visible at the foot of long pop-ups */
.pop-actions{position:sticky;bottom:-1px;background:#fff;padding:10px 0 2px;margin-top:6px;box-shadow:0 -8px 10px -6px rgba(255,255,255,.95)}
@media (max-width:759px){
  .brand{gap:8px}
  .brand-mark{width:24px;height:24px}
  .brand h1{font-size:16.5px}
  .cta svg{display:none}
  .cta{padding:7px 11px}
  .pop{max-height:44vh}
  .pop h3{font-size:17px}
}
@media (max-width:360px){ .brand-mark{display:none} }
