/* Compact logo stacks keep neighbourhoods readable without losing identities. */
.map-logo-group-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.map-group-anchor { display:block; width:44px; height:44px; padding:0; border:0; background:transparent; cursor:pointer; }
.map-pin-icon { transition:none; user-select:none; -webkit-user-select:none; }
/* Artwork shares the pin's click/drag target instead of becoming a native
   draggable image. Pointer events continue through the pin to map controls. */
.map-pin-icon img { pointer-events:none; -webkit-user-drag:none; }
/* One short centre-out reveal, timed to the map's opening wave. The outer
   marker keeps its position and full-sized tap target throughout. */
.city-scene-markers[data-pin-reveal] .map-logo-icon > .map-logo-tile.organisation-avatar,
.city-scene-markers[data-pin-reveal] .map-pin-leader { opacity:0; transition:none; }
.city-scene-markers[data-pin-reveal] [data-pin-arriving] > .map-logo-tile,
.city-scene-markers[data-pin-reveal] [data-pin-arriving] > .map-pin-leader {
  animation:city-pin-arrive var(--city-pin-arrival-duration,450ms) cubic-bezier(.33,0,.67,1) var(--city-pin-arrival-delay,0ms) both;
}
@keyframes city-pin-arrive {
  from { opacity:0; scale:.65; }
  to { opacity:var(--map-category-opacity,1); scale:1; }
}
@media (prefers-reduced-motion: reduce) {
  .city-scene-markers .map-logo-icon > .map-logo-tile.organisation-avatar,
  .city-scene-markers .map-pin-leader { transition:none; animation:none; }
}
.map-pin-leader { position:absolute; left:0; top:0; width:44px; height:44px; overflow:visible; pointer-events:none; color:var(--blue,#005293); opacity:var(--map-category-opacity,1); }
.leaflet-container .map-pin-icon { translate:var(--map-pin-offset-x,0px) var(--map-pin-offset-y,0px); }
.leaflet-zoom-anim .leaflet-zoom-animated.map-pin-icon { transition-property:transform,translate; }
.map-pin-leader line { stroke:currentColor; stroke-width:1; stroke-opacity:.18; }
.map-pin-leader circle { fill:currentColor; fill-opacity:.75; }
.map-pin-leader + .map-logo-tile { position:relative; z-index:1; }
html[data-theme="dark"] .map-pin-leader { color:#b7d7eb; }
.map-group-anchor .map-logo-group { transition:opacity .2s ease; }
.map-logo-icon { display:grid; place-items:center; }
.map-logo-icon>.map-logo-tile.organisation-avatar { width:calc(24px + var(--map-category-size,0px)); height:calc(24px + var(--map-category-size,0px)); border-width:1px; border-radius:4px; font-size:12px; box-shadow:0 1px 4px #173b5133; opacity:var(--map-category-opacity,1); filter:grayscale(var(--map-category-grayscale,0)); transition:opacity .18s ease; }
.map-category-context { --map-category-size:-8px; --map-category-opacity:.16; --map-category-grayscale:1; }
.map-logo-icon.map-category-context>.map-logo-tile.organisation-avatar { box-shadow:none; }
.map-category-context:hover,.map-category-context:focus-visible { --map-category-opacity:1; --map-category-grayscale:0; }
.map-logo-icon:hover>.map-logo-tile,.map-logo-icon>.map-logo-tile.selected { transform:none; }
.map-logo-icon>.map-logo-tile.selected { box-shadow:0 0 0 3px #00529326,0 2px 6px #173b5126; }
.map-logo-icon>.map-logo-tile img { padding:2px; }

.map-logo-group-icon .map-logo-group {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.map-logo-group .map-logo-tile.organisation-avatar {
  position: absolute;
  width: 26px;
  height: 26px;
  border-width: 1px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 2px 5px #173b5130;
  font-size: 11px;
  transition: box-shadow .15s, border-color .15s;
}

.map-logo-group .map-logo-tile:nth-child(1) { left: 0; top: 15px; z-index: 3; }
.map-logo-group .map-logo-tile:nth-child(2) { left: 8px; top: 8px; z-index: 2; }
.map-logo-group .map-logo-tile:nth-child(3) { left: 16px; top: 1px; z-index: 1; }
.map-logo-group.logo-stack-2 .map-logo-tile:nth-child(1) { left: 2px; top: 12px; }
.map-logo-group.logo-stack-2 .map-logo-tile:nth-child(2) { left: 14px; top: 2px; }

.map-logo-group .map-group-count {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 1px solid #fff;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 1px 4px #173b5130;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

.map-logo-group-icon:hover .map-logo-group {
  border: 0;
  box-shadow: none;
}

.map-group-anchor:hover .map-logo-tile {
  border-color: var(--blue);
  box-shadow: 0 3px 8px #173b5145;
}

.map-group-anchor:focus-visible { outline:3px solid #62a5d8; outline-offset:4px; border-radius:10px; }

/* Shared locations use the existing directory rather than covering the map. */
.directory-panel.nearby-active .directory-intro > :not(.map-group-intro):not(.directory-controls) { display:none!important; }
.directory-panel.nearby-active #clear-filters { display:none; }
.map-group-intro h2 { margin:14px 0 2px; font-size:20px; line-height:1.25; }
.map-group-intro .text-button { min-height:44px; }
.map-group-intro h2:focus { outline:none; }
.directory-panel.nearby-active .organisation-card { padding-top:12px; padding-bottom:12px; }
.directory-panel.nearby-active .organisation-card-description,
.directory-panel.nearby-active .organisation-meta .tag:not(:first-child) { display:none; }
.directory-panel.nearby-active .organisation-card h3 { margin-bottom:6px; }

@media(pointer:coarse) {
  #ecosystem-map .leaflet-control-zoom a { width:44px!important; height:44px!important; line-height:44px!important; }
}
@media(max-width:650px) {
  #ecosystem-map .leaflet-control-zoom a { width:44px!important; height:44px!important; line-height:44px!important; }
}

.map-logo-icon:focus-visible,
.map-logo-group-icon:focus-visible {
  outline: 3px solid #62a5d8;
  outline-offset: 4px;
}

html[data-theme="dark"] .map-logo-group-icon .map-logo-group {
  background: transparent;
  border: 0;
}

html[data-theme="dark"] .map-logo-group .map-logo-tile {
  box-shadow: 0 2px 7px #0007;
}

html[data-theme="dark"] .map-logo-group .map-group-count {
  border-color: #183248;
  background: #8acbff;
  color: #102739;
}

/* A steady ring ties the nearby list to its original map location(s). */
.map-pin-icon.map-group-selected {
  outline: 3px solid #005293;
  outline-offset: 4px;
  border-radius: 10px;
  box-shadow: 0 0 0 7px #fff, 0 3px 12px #173b5140;
  z-index: 1500!important;
}
.map-group-selected .map-group-count { background: #fecc00; color: #005293; }
html[data-theme="dark"] .map-pin-icon.map-group-selected {
  outline-color: #8acbff;
  box-shadow: 0 0 0 7px #102739, 0 3px 12px #0007;
}
html[data-theme="dark"] .map-group-selected .map-group-count { background: #fecc00; color: #102739; }

@media (prefers-reduced-motion: reduce) {
  .map-pin-icon,.map-group-anchor .map-logo-group { transition:none; }
  .map-logo-icon>.map-logo-tile.organisation-avatar { transition:none; }
}
