[data-places-map] {
  position: relative;
  isolation: isolate;
  height: clamp(300px, 43svh, 450px);
  touch-action: none;
  background-color: var(--wash);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
}

.places-map-marker {
  fill: #20252d;
  stroke: #fff;
  stroke-width: 2;
}

.places-map-marker.is-forced { fill: #802c13; }
.places-map-marker.is-selected { stroke-width: 2.5; }
.places-map-marker.is-active, .places-map-marker:hover { stroke-width: 3; }
.places-map-marker:focus-visible { stroke-width: 3; }

.places-leaflet-marker {
  width: var(--leaflet-circle-size);
  height: var(--leaflet-circle-size);
  margin: calc(var(--leaflet-circle-size) / -2) 0 0 calc(var(--leaflet-circle-size) / -2);
}

.places-leaflet-marker svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.places-leaflet-marker:focus-visible { border-radius: 50%; }

.places-map-cluster {
  display: grid;
  place-items: center;
  width: var(--cluster-badge-size);
  height: var(--cluster-badge-size);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #20252d;
  background: #20252d;
  color: #fff;
  font: 700 13px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.places-amap-cluster-button {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.leaflet-marker-icon:focus-visible:has(.places-map-cluster) { border-radius: 50%; }

.places-map-location {
  fill: var(--ink);
  fill-opacity: 1;
  stroke: var(--paper);
  stroke-width: 3;
}

.places-map-route { stroke: var(--ink); stroke-opacity: .85; }
.places-map-route-casing { stroke: var(--paper); stroke-opacity: .94; }

[data-places-map] .leaflet-tile-pane { filter: saturate(.48) sepia(.1); }

[data-places-map] .leaflet-bar {
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: none;
}

[data-places-map] .leaflet-control-zoom a {
  width: 40px;
  height: 40px;
  line-height: 40px;
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
  font-family: var(--mono);
}

[data-places-map] .leaflet-control-zoom a:hover,
[data-places-map] .leaflet-control-zoom a:focus-visible { background: var(--project-band); }
[data-places-map] .leaflet-control-zoom a.leaflet-disabled { color: var(--secondary); }

.places-amap-zoom {
  position: absolute;
  z-index: 700;
  top: 10px;
  right: 10px;
}

.places-amap-zoom button {
  display: block;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font: 700 22px/1 var(--mono);
  cursor: pointer;
}

.places-amap-zoom button + button { border-top: 1px solid var(--line); }
.places-amap-zoom button:not(:disabled):is(:hover, :focus-visible) { background: var(--project-band); }
.places-amap-zoom button:disabled { color: var(--secondary); cursor: default; }

.places-amap-marker,
.places-amap-location {
  position: relative;
  display: block;
  width: var(--amap-circle-size, 16px);
  height: var(--amap-circle-size, 16px);
}

.places-amap-marker {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
}

.places-amap-marker svg,
.places-amap-location svg { width: 100%; height: 100%; overflow: visible; }
.places-amap-marker:focus-visible circle { stroke-width: 3; }
.places-amap-location { width: 16px; height: 16px; pointer-events: none; }

.places-amap-location span {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  padding: 3px 6px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 12px;
}

[data-places-map] .leaflet-control-attribution {
  background: var(--paper);
  color: var(--muted);
  padding-inline: 4px;
}

[data-places-map] .leaflet-control-attribution a { color: inherit; text-decoration: underline; }

[data-places-map] .leaflet-tooltip {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: none;
  width: max-content;
  max-width: min(220px, 70vw);
  white-space: normal;
  overflow-wrap: anywhere;
}

[data-places-map] .leaflet-tooltip-top::before { border-top-color: var(--line); }
[data-places-map] .leaflet-tooltip-bottom::before { border-bottom-color: var(--line); }

@media (prefers-color-scheme: dark) {
  [data-places-map] .leaflet-tile-pane { filter: invert(.93) hue-rotate(180deg) saturate(.48) brightness(.82); }
}
