.discovery-view-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
}

.discovery-view-button {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.discovery-view-button:hover {
  border-color: transparent;
  background: var(--surface);
  color: var(--text);
}

.discovery-view-button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.discovery-view-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.discovery-map-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.discovery-map-panel[hidden] {
  display: none;
}

.discovery-map {
  position: relative;
  width: 100%;
  min-height: 480px;
  height: min(68vh, 680px);
  background: var(--surface-raised);
}

.discovery-map.is-loading::after {
  position: absolute;
  z-index: 1000;
  top: 50%;
  left: 50%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 20px rgb(0 0 0 / 12%);
  color: var(--text);
  content: "Loading map…";
  font-size: 13px;
  font-weight: 800;
  transform: translate(-50%, -50%);
}

.discovery-map:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.discovery-map-note {
  margin: 0;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.discovery-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  list-style: none;
}

.discovery-map-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.discovery-map-legend-marker {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 1.5px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  background: #66716b;
  box-shadow: 0 0 0 1px rgb(23 33 28 / 16%);
  transform: rotate(-45deg);
}

.discovery-map-legend-marker.is-food {
  background: #c75b39;
}

.discovery-map-legend-marker.is-fitness {
  background: #19764a;
}

.discovery-map-legend-marker.is-martial-arts {
  background: #8f2f32;
}

.discovery-map-legend-marker.is-wellness {
  background: #287aa1;
}

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

.discovery-map-popup {
  min-width: 170px;
  display: grid;
  gap: 4px;
  color: var(--text);
}

.discovery-map-popup-kind {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.discovery-map-popup-title {
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.discovery-map-popup-title:hover {
  text-decoration: underline;
}

.discovery-map-popup-location,
.discovery-map-popup-events {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.gm-style .discovery-map-popup {
  color: #17211c;
}

.gm-style .discovery-map-popup-kind,
.gm-style .discovery-map-popup-location,
.gm-style .discovery-map-popup-events {
  color: #506158;
}

.gm-style .discovery-map-popup-title {
  color: #0d6840;
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}

.leaflet-control-attribution {
  color: #333333;
}

@media (max-width: 920px) {
  .events-toolbar .sort-control {
    grid-column: 1;
    justify-self: start;
  }

  .events-toolbar .discovery-view-toggle {
    grid-column: 2;
    justify-self: end;
  }
}

@media (max-width: 760px) {
  .discovery-map {
    min-height: 430px;
    height: min(66vh, 620px);
  }
}
