.map-page {
  --map-gap: clamp(14px, 1.8vw, 28px);
  --map-zoom-width: 46px;
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
}

.map-page .site-header { flex: none; }

.rental-map-page {
  position: relative;
  isolation: isolate;
  flex: 1;
  min-height: 0;
}

.rental-map-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-start-start-radius: clamp(24px, 3.2vw, 44px);
  border-start-end-radius: clamp(24px, 3.2vw, 44px);
  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-tools {
  position: absolute;
  z-index: 1000;
  inset-block-start: var(--map-gap);
  inset-inline-end: calc(var(--map-gap) + var(--map-zoom-width) + 8px);
  display: flex;
}

.map-reset {
  min-height: 46px;
  border-color: var(--line);
  background: var(--white);
}

.map-notice {
  position: absolute;
  z-index: 1000;
  inset-block-start: calc(var(--map-gap) + 100px);
  inset-inline-end: var(--map-gap);
  width: max-content;
  max-width: min(330px, calc(100% - 2 * var(--map-gap)));
  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 {
  position: absolute;
  z-index: 1;
  inset-block: var(--map-gap);
  inset-inline-start: var(--map-gap);
  display: flex;
  width: clamp(320px, 31vw, 460px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fffdfa;
  box-shadow: 0 18px 42px -18px rgb(36 34 25 / .34), 0 4px 16px rgb(36 34 25 / .11);
}

.map-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 19px clamp(15px, 2vw, 23px) 14px;
}

.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-toggle > [data-icon] { transform: rotate(180deg); }
.map-results-toggle[aria-expanded=true] > [data-icon] { transform: none; }

.map-results-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  border-top: 1px solid var(--line);
}

.map-results {
  display: grid;
  align-content: start;
  gap: 10px;
  margin: 0;
  padding: 12px clamp(9px, 1.3vw, 17px) 16px;
  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-top.leaflet-right { top: var(--map-gap); right: var(--map-gap); }
#rental-map .leaflet-control-zoom { margin: 0; }

#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: var(--radius-xs);
  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-wrapper { border-radius: var(--radius-md); }

#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-gap) - 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-gap: 12px; --map-zoom-width: 90px; }
  .map-reset { padding-inline: 11px; font-size: .84rem; }
  .map-notice { inset-block-start: calc(var(--map-gap) + 54px); }

  #rental-map .leaflet-control-zoom { display: flex; }

  #rental-map .leaflet-control-zoom a {
    border-radius: 0;
    border-block-end: 0;
  }

  #rental-map .leaflet-control-zoom .leaflet-control-zoom-in {
    border-inline-end: 1px solid var(--line);
  }

  #rental-map .leaflet-popup-content {
    max-width: calc(100vw - 2 * var(--map-gap) - 55px);
    max-height: 175px;
    margin: 12px 35px 12px 13px;
    overflow: auto;
    overscroll-behavior: contain;
  }

  #rental-map .leaflet-popup-close-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--brand);
    font: 22px/1 var(--font);
  }

  #rental-map .leaflet-popup-close-button:focus-visible { outline-offset: -4px; }
  #rental-map .leaflet-control-attribution { margin-bottom: max(4px, env(safe-area-inset-bottom)); }

  .map-results-panel {
    inset-block: auto calc(27px + env(safe-area-inset-bottom));
    inset-inline: var(--map-gap);
    width: auto;
    max-block-size: max(76px, min(44%, 380px));
  }

  .map-results-header { padding: 12px 13px; }
  .map-results-header h2 { font-size: clamp(1.06rem, 5.1vw, 1.32rem); }
  .map-results-header p { margin-top: 3px; }
  .map-results-toggle { flex: none; padding-inline: 10px; font-size: .84rem; }
  .map-results-toggle > [data-icon] { width: 15px; height: 15px; }
  .map-listing-link { grid-template-columns: clamp(82px, 31%, 150px) minmax(0, 1fr); }
  .map-listing-info { padding: 12px 11px; }
  .map-listing-area, .map-listing-availability { font-size: .79rem; }
  .map-listing-price { font-size: 1rem; }
  .map-listing-locate > [data-icon] { width: 36px; height: 36px; }
}
