:root {
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #6b7076;
  --line: #e7e7e4;
  --hover: #f6f6f3;
  --active: #f1f0eb;
  --map-h: 40vh;
}

@supports (height: 1svh) {
  :root { --map-h: 40svh; }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

/* ---------- Layout ---------- */

/* Phone: intro, then the map pinned to the top, then the list scrolling under it. */
.layout { display: block; }

.intro { padding: 24px 16px 16px; }

.intro h1 {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.intro p {
  margin: 0;
  color: var(--muted);
  max-width: 34em;
}

.map-col {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--map-h);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #eef0f0;
}

#map { width: 100%; height: 100%; }

.list { padding: 0 16px 48px; }

/* Desktop: list on the left, map on the right, always in view. */
@media (min-width: 900px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(360px, 2fr) 3fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "intro map"
      "list  map";
  }

  .intro { grid-area: intro; padding: 40px 40px 8px; }
  .list  { grid-area: list;  padding: 0 40px 64px; }

  .map-col {
    grid-area: map;
    align-self: start;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-left: 1px solid var(--line);
  }
}

/* ---------- Groups ---------- */

.group { margin-top: 28px; }

.group h2 { margin: 0; }

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 2px solid var(--text);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}

.group-head:hover { background: var(--hover); }

.group h3 { margin: 0; }

.subgroup-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 16px 10px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.subgroup-head:hover { color: var(--text); background: var(--hover); }

.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}

.count {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}

/* ---------- Places ---------- */

.places {
  list-style: none;
  margin: 0;
  padding: 0;
}

.place {
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--map-h) + 12px);
  scroll-margin-bottom: 12px;
}

@media (min-width: 900px) {
  .place { scroll-margin-top: 16px; }
}

.place:hover { background: var(--hover); }

.place.is-active {
  background: var(--active);
  box-shadow: inset 3px 0 0 var(--c);
}

.place-main {
  display: block;
  width: 100%;
  padding: 12px 10px 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.place-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
}

.place-name { font-weight: 600; }

.tag {
  align-self: center;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-upscale {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.place-area {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.place-note {
  display: block;
  margin-top: 2px;
  color: #444a50;
  font-size: 15px;
}

.place-links {
  display: flex;
  gap: 14px;
  padding: 0 10px 12px;
  font-size: 13px;
}

.place-links a { color: var(--muted); }
.place-links a:hover { color: var(--text); }

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

/* ---------- Map popups ---------- */

.leaflet-container { font: inherit; }
.leaflet-container .leaflet-control-attribution { font-size: 11px; }

/* Mute the busy OSM colors into a flat light grey. */
.leaflet-tile-pane { filter: grayscale(1) contrast(0.85) brightness(1.08); }

.leaflet-popup-content-wrapper {
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.leaflet-popup-content {
  margin: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
}

.popup-name { display: block; font-weight: 600; font-size: 15px; }
.popup-area { display: block; color: var(--muted); font-size: 12px; }
.leaflet-popup-content .popup-note { margin: 6px 0 0; }

.popup-links {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 13px;
}

.leaflet-container .popup-links a { color: var(--text); }
