.map-page {
  --map-gutter: clamp(48px, 7.8vw, 132px);
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
}

.map-page::before {
  position: absolute;
  z-index: -1;
  inset: auto 0 0;
  height: clamp(290px, 36vw, 540px);
  background: url("/media/editorial/vancouver-footer-skyline.webp") center bottom / cover no-repeat;
  mask-image: linear-gradient(to bottom, transparent, #000 50%, #000 84%, transparent);
  opacity: .66;
  pointer-events: none;
  content: "";
}

.map-page .site-footer { background: transparent; }
.map-page .site-footer::before { content: none; }
.map-page .footer-inner { min-height: 0; padding-block: 8px 28px; }

.rental-map-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: calc(100% - 2 * var(--map-gutter));
  padding-block: clamp(16px, 2vw, 28px) clamp(12px, 1.7vw, 24px);
}

.rental-map-layout {
  display: grid;
  flex: 1;
  min-height: clamp(440px, 56vh, 520px);
  grid-template-areas: "results map";
  grid-template-columns: clamp(250px, 31vw, 520px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.rental-map-stage {
  position: relative;
  grid-area: map;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--soft);
}

#rental-map {
  position: absolute;
  inset: 0;
  background: var(--soft);
  font-family: var(--font);
}

#rental-map:focus-visible {
  outline-offset: -3px;
}

#rental-map .leaflet-tile-pane {
  filter: saturate(.72) sepia(.09);
}

.map-reset {
  position: absolute;
  z-index: 1000;
  top: 12px;
  right: 12px;
  min-height: 44px;
  border-color: var(--line);
  background: var(--white);
}

.map-notice {
  position: absolute;
  z-index: 1000;
  bottom: 35px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 30px);
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 15px;
  background: var(--white);
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}

.map-results-panel {
  grid-area: results;
  display: flex;
  min-width: 0;
  min-height: 0;
  contain: size;
  flex-direction: column;
  overflow: hidden;
  border-inline-end: 1px solid var(--line);
  background: var(--canvas);
}

.map-results-header {
  flex: none;
  padding: 19px clamp(15px, 2vw, 23px) 14px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.map-results-header h2 {
  font: 580 clamp(1.32rem, 2.2vw, 1.58rem)/1.12 var(--font-display);
  letter-spacing: -.04em;
}

.map-results-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: .9rem;
}

.map-results {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  margin: 0;
  padding: 12px clamp(9px, 1.3vw, 17px) 16px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  list-style: none;
}

.map-listing {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: background-color var(--motion), border-color var(--motion);
}

.map-listing.is-active {
  border-color: var(--brand-hover);
  background: var(--brand-soft);
}

.map-listing-link {
  display: grid;
  grid-template-columns: clamp(72px, 35%, 170px) minmax(0, 1fr);
  min-width: 0;
  min-height: 118px;
  border-radius: inherit;
}

.map-listing-photo {
  position: relative;
  display: grid;
  min-width: 0;
  overflow: hidden;
  background: var(--soft);
}

.map-listing-link > .map-listing-photo {
  border-start-start-radius: calc(var(--radius-md) - 1px);
  border-end-start-radius: calc(var(--radius-md) - 1px);
}

.map-listing-photo img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-photo-placeholder {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 5px;
  padding: 6px;
  background: radial-gradient(ellipse at 26% 4%, var(--white), var(--soft) 89%);
  color: var(--muted);
  font-size: .68rem;
  text-align: center;
}

.map-photo-placeholder [data-icon] {
  width: 21px;
  height: 21px;
  color: var(--accent);
}

.map-listing-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 11px clamp(9px, 1.1vw, 15px) 12px;
}

.map-listing-link:focus-visible .map-listing-title {
  text-decoration: underline;
}

.map-listing-link:focus-visible {
  outline-offset: -2px;
}

.map-listing-title {
  margin-top: 3px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 680;
  line-height: 1.22;
  letter-spacing: -.016em;
  overflow-wrap: anywhere;
  text-underline-offset: .14em;
}

.map-listing-area {
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.3;
}

.map-listing-meta {
  margin-top: 7px;
  line-height: 1.35;
}

.map-listing-price {
  color: var(--ink);
  font-size: .94rem;
  font-weight: 700;
}

.map-rent-period {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
}

.map-listing-availability {
  margin-top: 2px;
  color: var(--brand-hover);
  font-size: .75rem;
  font-weight: 620;
}

.map-listing:has(.map-listing-locate) .map-listing-meta {
  padding-inline-end: 40px;
}

.map-listing-locate {
  position: absolute;
  z-index: 2;
  inset-inline-end: 3px;
  inset-block-end: 4px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--brand);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  transition: color var(--motion), background-color var(--motion);
}

.map-listing-locate > [data-icon] {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: inherit;
  background: var(--white);
  transition: inherit;
}

.map-listing-locate svg { width: 16px; height: 16px; }
.map-listing-locate:focus-visible { outline-offset: -2px; }

.map-listing-locate:hover > [data-icon] {
  background: var(--brand-soft);
}

.map-listing-locate[aria-pressed="true"] > [data-icon] {
  color: var(--white);
  border-color: var(--brand);
  background: var(--brand);
}

.map-empty {
  margin: 0;
  padding: 21px clamp(15px, 2vw, 23px);
  color: var(--muted);
}

.map-empty h3 {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 650;
  line-height: 1.28;
}

.map-empty p {
  margin-top: 5px;
}

.map-empty .button {
  margin-top: 14px;
}

#rental-map .leaflet-bar {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px #1929231b;
}

#rental-map .leaflet-bar a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  color: var(--brand);
  background: var(--white);
  border-color: var(--line);
}

#rental-map .leaflet-bar a:hover {
  background: var(--brand-soft);
}

#rental-map .leaflet-bar a:focus-visible {
  position: relative;
  z-index: 1;
  outline-offset: -3px;
}

#rental-map .leaflet-bar a.leaflet-disabled {
  color: var(--muted);
  background: var(--canvas);
}

#rental-map .leaflet-control-attribution {
  margin-right: 6px;
  margin-bottom: 4px;
  color: var(--ink);
  background: var(--white);
  border-radius: 4px;
  font-size: .75rem;
}

#rental-map .leaflet-control-attribution a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.map-marker-wrap {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.map-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  padding-inline: 8px;
  color: var(--white);
  background: var(--brand);
  border: 2px solid var(--white);
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px #132d2650;
  font: 680 .9rem/1 var(--font);
  white-space: nowrap;
}

.map-marker-wrap:hover .map-marker,
.map-marker-wrap.is-preview .map-marker,
.map-marker-wrap.is-active .map-marker,
.map-marker-wrap:focus-visible .map-marker {
  color: var(--brand);
  background: var(--white);
  border-color: var(--brand);
}

.map-marker-wrap:focus-visible {
  outline-offset: 0;
  border-radius: var(--radius-pill);
}

.map-marker-count {
  font-variant-numeric: tabular-nums;
}

#rental-map .leaflet-popup-content-wrapper,
#rental-map .leaflet-popup-tip {
  color: var(--ink);
  background: var(--white);
}

#rental-map .leaflet-popup-content {
  margin: 14px 23px 13px 14px;
  font-family: var(--font);
}

.map-popup {
  min-width: min(219px, calc(100vw - 2 * var(--map-gutter) - 58px));
}

#rental-map .map-popup-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

#rental-map .map-popup-link {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 62px;
  border-radius: var(--radius-sm);
  color: var(--ink);
}

.map-popup-link + .map-popup-link {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.map-popup-link .map-listing-photo {
  align-self: stretch;
  min-height: 62px;
  border-radius: var(--radius-sm);
}

.map-popup-details { display: grid; min-width: 0; line-height: 1.28; }
.map-popup-heading { font-size: .85rem; font-weight: 680; overflow-wrap: anywhere; }
.map-popup-rent { margin-top: 4px; font-size: .81rem; font-weight: 680; }
.map-popup-link > [data-icon] { width: 14px; height: 14px; color: var(--brand); }

.map-popup-link:focus-visible .map-popup-heading {
  text-decoration: underline;
  text-underline-offset: .15em;
}

@media (max-width: 760px) {
  .map-page { --map-gutter: clamp(16px, 2.6vw, 44px); }

  .map-page::before {
    height: clamp(224px, 45vw, 340px);
    background-position: 82% bottom;
  }

  .rental-map-layout {
    min-height: 0;
    grid-template-areas: "map" "results";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .rental-map-stage {
    min-height: clamp(320px, 55vh, 540px);
    min-height: clamp(320px, 55svh, 540px);
  }

  #rental-map .leaflet-popup-content {
    max-width: calc(100vw - 2 * var(--map-gutter) - 58px);
  }

  .map-results-panel {
    contain: none;
    border-inline-end: 0;
    border-block-start: 1px solid var(--line);
  }

  .map-results {
    overflow: visible;
    overscroll-behavior-y: auto;
  }
}
