.world-map-header {
  max-width: 760px;
  margin-bottom: 1.5rem;
}

.world-map-header h1 {
  margin-top: 0;
}

.world-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}

.world-map-toolbar button {
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.world-map-toolbar button:hover:not(:disabled) {
  background: var(--surface-hover);
}

.world-map-toolbar button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.world-map-toolbar button:focus-visible,
.world-map-locations summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

#world-map-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.world-map-canvas {
  height: clamp(360px, 65vh, 760px);
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 0.8rem;
  background: #dce4df;
  overflow: hidden;
  isolation: isolate;
}

.world-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  margin: 1.25rem 0 2rem;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.world-map-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.legend-dot {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
  border: 2px solid white;
  border-radius: 50%;
}

.legend-dot-post {
  background: #c93636;
}

.legend-dot-photo {
  background: #246ac3;
}

.legend-dot-group {
  background: #23834b;
}

/* The letters and counts distinguish pins without relying on colour. */

.mgs-map-marker {
  background: transparent;
  border: 0;
}

.mgs-map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 3px solid white;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.35);
  color: white;
}

.mgs-map-pin span {
  transform: rotate(45deg);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.mgs-map-pin-post {
  background: #c93636;
}

.mgs-map-pin-photo {
  background: #246ac3;
}

.mgs-map-pin-group {
  background: #23834b;
}

.mgs-map-marker:focus-visible .mgs-map-pin {
  outline: 3px solid #060a07;
  outline-offset: 3px;
}

/* Leaflet's controls and popups have their own light surface. */

.world-map-canvas .leaflet-control,
.world-map-canvas .leaflet-popup-content-wrapper {
  color: #1f1f1f;
}

.world-map-canvas .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.94);
  color: #333;
}

.world-map-canvas .leaflet-control-attribution a,
.world-map-canvas .leaflet-popup-content a {
  color: #155b91;
}

.world-map-canvas .leaflet-popup-content a:hover {
  text-decoration: none;
}

.world-map-canvas .leaflet-popup-content a:focus-visible {
  outline: 2px solid #155b91;
  outline-offset: 3px;
}

.world-map-canvas .leaflet-popup-content {
  margin: 1rem;
  line-height: 1.5;
}

.mgs-map-popup {
  max-height: min(360px, 45vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mgs-map-popup-heading {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.mgs-map-popup-item {
  padding: 0.8rem 0;
  border-top: 1px solid #d9e1dc;
}

.mgs-map-popup-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.mgs-map-popup-item.is-selected {
  padding: 0.8rem;
  border-radius: 0.35rem;
  background: #eaf3ec;
}

.mgs-map-popup-item h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.mgs-map-popup-item p {
  margin: 0.35rem 0;
  font-size: 0.85rem;
}

.mgs-map-popup-type {
  color: #526258;
  font-weight: 700;
}

.world-map-locations {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.world-map-locations summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 600;
}

.world-map-location-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
  padding: 0;
  margin: 1.25rem 0;
  list-style: none;
}

.world-map-location-list > li {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface);
}

.world-map-location-list h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.world-map-location-list p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.world-map-location-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

@media (max-width: 600px) {
  .world-map-canvas {
    height: 60vh;
    min-height: 340px;
  }

  .world-map-legend {
    gap: 0.75rem 1rem;
    font-size: 0.85rem;
  }

  .world-map-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
