/* Search results map: shared by geolocation and manual place searches. */

body.has-results .bg-emoji {
  display: none;
}

body.has-results .hero-wrap {
  width: 100%;
  max-width: 1180px;
  padding-right: 0;
  padding-left: 0;
  align-items: stretch;
}

body.has-results #title {
  padding-inline: 1.25rem;
  text-align: center;
}

#results {
  position: relative;
  padding-top: 1rem;
  text-align: left;
}

.results-map-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  height: clamp(320px, 46svh, 440px);
  min-height: 320px;
  overflow: hidden;
  background: #d8e6d5;
  border-block: 3px solid var(--ink);
  isolation: isolate;
}

#resultsMap {
  width: 100%;
  height: 100%;
  background: #d8e6d5;
}

.results-map-caption {
  position: absolute;
  z-index: 700;
  top: 0.8rem;
  left: 3.75rem;
  display: inline-flex;
  max-width: calc(100% - 8rem);
  min-height: 40px;
  align-items: center;
  gap: 0.38rem;
  margin: 0;
  padding: 0.42rem 0.66rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15;
  backdrop-filter: blur(10px);
}

.results-map-caption i {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 1rem;
}

.results-map-recenter {
  position: absolute;
  z-index: 700;
  top: 0.8rem;
  right: 0.8rem;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--ink);
  font: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}

.results-map-recenter:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.results-sheet {
  position: relative;
  z-index: 3;
  width: min(100%, 680px);
  margin: -24px auto 0;
  padding: 0.62rem 1.25rem 1.3rem;
  background: var(--bg);
  border-top: 3px solid var(--ink);
  border-radius: 25px 25px 0 0;
  animation: results-sheet-rise 0.58s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes results-sheet-rise {
  from { transform: translateY(58px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.results-handle {
  width: 44px;
  height: 5px;
  margin: 0.04rem auto 0.82rem;
  background: var(--ink);
  border-radius: 999px;
  opacity: 0.24;
}

.results-heading {
  padding-inline: 0.1rem;
}

.results-map-wrap .leaflet-control-attribution {
  border-radius: 9px 0 0;
  font-size: 9px !important;
}

.results-map-wrap .leaflet-control-zoom {
  margin-top: 0.8rem;
  margin-left: 0.8rem;
  border: 0;
  box-shadow: 3px 3px 0 var(--ink);
}

.results-map-wrap .leaflet-control-zoom a {
  color: var(--ink) !important;
  border: 2px solid var(--ink) !important;
  font-weight: 900;
}

.results-map-wrap .leaflet-control-zoom-in {
  border-radius: 12px 12px 0 0 !important;
}

.results-map-wrap .leaflet-control-zoom-out {
  border-radius: 0 0 12px 12px !important;
}

.results-marker-shell {
  position: relative;
  display: block;
  width: 38px;
  height: 42px;
  color: var(--accent);
  filter: drop-shadow(0 3px 0 rgba(26, 26, 26, 0.92));
  transform-origin: 50% 100%;
  animation: results-marker-bloom 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.results-marker-shell i {
  display: block;
  font-size: 38px;
  line-height: 1;
  -webkit-text-stroke: 1.4px var(--ink);
}

.results-marker-number {
  position: absolute;
  top: 6px;
  left: 50%;
  min-width: 18px;
  color: #fff;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
}

.results-marker-shell.is-selected {
  color: #ffd84d;
  transform: scale(1.14);
  z-index: 2;
}

.results-marker-shell.is-selected .results-marker-number {
  color: var(--ink);
  text-shadow: none;
}

.results-origin-marker {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: #176b9b;
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--ink), 0 4px 0 rgba(26, 26, 26, 0.45);
  font-size: 17px;
}

@keyframes results-marker-bloom {
  from { transform: translateY(12px) scale(0.2); opacity: 0; }
  72% { transform: translateY(-2px) scale(1.06); opacity: 1; }
  to { transform: none; opacity: 1; }
}

.results-map-popup {
  min-width: 170px;
  color: var(--ink);
  font-family: inherit;
}

.results-map-popup strong,
.results-map-popup span {
  display: block;
}

.results-map-popup strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.results-map-popup span {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.68;
}

.results-map-popup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
  margin-top: 0.55rem;
}

.results-map-popup-actions a,
.results-map-popup-actions button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.38rem 0.65rem;
  color: #fff;
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 9px;
  box-shadow: none;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
}

.results-map-popup-actions span {
  display: inline;
  margin: 0;
  opacity: 1;
}

.results-map-popup-actions button {
  color: var(--ink);
  background: var(--yellow, #ffd84d);
  cursor: pointer;
}

.results-map-popup-actions button[aria-pressed="true"] {
  color: #fff;
  background: #24795a;
}

.results-map-popup-actions a:focus-visible,
.results-map-popup-actions button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#list .card[data-map-active="true"] {
  border-color: var(--accent);
  box-shadow: 6px 6px 0 var(--accent);
}

#list .card {
  scroll-margin-top: 1rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

#list .card:hover {
  cursor: pointer;
}

.card-statuses {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.accessible-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: #24795a;
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 1.45rem;
}

#againBtn {
  display: block;
  margin: 1.8rem auto 0;
}

@media (min-width: 820px) {
  body.has-results .hero-wrap {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  #results {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
    gap: 1.1rem;
    align-items: start;
  }

  .results-map-wrap {
    position: sticky;
    top: calc(0.8rem + env(safe-area-inset-top));
    height: calc(100svh - 1.6rem - env(safe-area-inset-top));
    min-height: 520px;
    max-height: 820px;
    border: 3px solid var(--ink);
    border-radius: 24px;
    box-shadow: 7px 7px 0 var(--ink);
  }

  .results-sheet {
    width: 100%;
    margin: 0;
    padding: 1rem 0.25rem 1.5rem 0.35rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    animation: none;
  }

  .results-handle {
    display: none;
  }

  .results-heading {
    padding-inline: 0;
  }
}

@media (max-width: 520px) {
  .results-map-caption {
    left: 3.45rem;
    max-width: calc(100% - 7.4rem);
    min-height: 38px;
    padding-inline: 0.55rem;
    font-size: 0.67rem;
  }

  .results-map-recenter {
    width: 42px;
    height: 42px;
    right: 0.62rem;
  }

  .results-map-wrap .leaflet-control-zoom {
    margin-left: 0.62rem;
  }

  .results-sheet {
    padding-inline: 0.9rem;
  }

  .card-statuses {
    gap: 0.42rem;
  }

  .accessible-icon {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .results-sheet,
  .results-marker-shell {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .results-map-caption {
    background: #fff;
    backdrop-filter: none;
  }
}
