/* ==========================================================
   Nearby locations: city list + Leaflet map (widget/nearbyMap)
   Same design as the San Francisco / Los Angeles pages.
   ========================================================== */

/* accent colour (bar, buttons, links, active pin); a page can pass its own via 'accent' */
.nm-section { --nm-accent: var(--primary-color); }

/* scrollable list card with the map overlapping it */
.nm-cities {
  max-height: 588px;
  overflow-y: auto;
  border-radius: 10px;
  background: #f2f2f2;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.34) !important;
}

/* city rows: selectable; the active one lifts onto a white card with a blue accent bar */
.nm-city {
  position: relative;
  gap: 12px !important;
  padding: 10px 12px 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.nm-city::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--nm-accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nm-city:hover { background: rgba(255, 255, 255, 0.6); }

.nm-city.is-active {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nm-city.is-active::before { opacity: 1; }

.nm-city p { color: #4a4a4a; }

/* city photo, or the city's initial when there is no photo */
.nm-city-pin {
  width: 40px;
  height: 40px;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
}

.nm-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: var(--nm-accent);
}

.nm-city-pin.nm-initial { font-size: 17px; }

/* round map-pin button; filled when its city is on the map */
.nm-city-btn {
  --bs-btn-padding-y: 0;
  --bs-btn-padding-x: 0;
  --bs-btn-color: var(--nm-accent);
  --bs-btn-bg: #fff;
  --bs-btn-border-color: #cfe0ee;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--nm-accent);
  --bs-btn-hover-border-color: var(--nm-accent);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--nm-accent);
  --bs-btn-active-border-color: var(--nm-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  font-size: 15px;
}

/* cities with their own page get one blue, descriptive link under the text.
   inline-block so a wrapped link keeps its arrow right after the last word */
.nm-city-more {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--nm-accent);
  text-decoration: none;
}

.nm-city-more i {
  display: inline-block;
  margin-left: 2px;
  vertical-align: -1px;
  transition: transform 0.2s ease;
}

.nm-city-more:hover {
  color: var(--nm-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nm-city-more:hover i { transform: translateX(3px); }

.nm-map {
  height: 420px;
  z-index: 0;
}

/* Leaflet pins: round city photo (or initial) in a white ring with a pointer below */
.nm-pin {
  display: flex;
  justify-content: center;
}

.nm-pin img,
.nm-pin .nm-initial {
  width: 42px;
  height: 42px;
  border: 3px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
  transform-origin: 50% 100%;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.nm-pin .nm-initial { font-size: 16px; }

.nm-pin::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  border: 6px solid transparent;
  border-top: 9px solid #fff;
  border-bottom: 0;
  transform: translateX(-50%);
  transition: border-top-color 0.2s ease;
}

.nm-pin.is-active img,
.nm-pin.is-active .nm-initial {
  border-color: var(--nm-accent);
  transform: scale(1.2);
}

.nm-pin.is-active::after { border-top-color: var(--nm-accent); }

@media (min-width: 1200px) {
  /* keep the pin buttons clear of the overlapping map */
  .nm-cities { padding-right: 64px !important; }

  .nm-map {
    position: relative;
    z-index: 1;
    height: 440px;
    margin-left: -56px;
  }
}

@media (max-width: 1199.98px) {
  .nm-cities {
    max-height: none;
    overflow: visible;
  }
}

/* phones: map on top, cities become a swipeable row of cards right under it,
   so the map and the selected city are always on screen together */
@media (max-width: 767.98px) {
  .nm-map { height: 300px; }

  .nm-cities {
    position: relative;
    display: flex;
    gap: 12px;
    margin: 0 -12px;
    padding: 14px 12px 10px !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 12px;
    overscroll-behavior-x: contain;
    border-radius: 0;
    background: none;
    box-shadow: none !important;
    scrollbar-width: none;
  }

  .nm-cities::-webkit-scrollbar { display: none; }

  .nm-city {
    flex: 0 0 84%;
    margin-bottom: 0 !important;
    padding: 14px 14px 14px 16px;
    border: 1px solid #e3e8ee;
    background: #fff;
    scroll-snap-align: center;
  }

  .nm-city:hover { background: #fff; }

  .nm-city.is-active {
    border-color: #bcd8ee;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .nm-city::before {
    top: 14px;
    bottom: 14px;
  }

  /* the card itself selects the city; the pin button is only needed on larger screens */
  .nm-city-btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .nm-cities *,
  .nm-pin * {
    transition: none !important;
  }
}
