/* Full-site responsive refinement */
img { max-width: 100%; }

.legacy-photo {
  background-image: url('/property-images/legacy-section-enhanced.webp');
  background-position: center;
  background-size: cover;
}

.hero {
  height: clamp(540px, calc(100svh - clamp(104px, 8vw, 116px)), 900px);
  min-height: 0;
}

.hero-copy {
  bottom: clamp(42px, 8svh, 88px);
}

@media (min-width: 901px) and (max-height: 850px) {
  .hero-copy {
    bottom: clamp(30px, 5svh, 44px);
  }

  .hero h1 {
    font-size: clamp(64px, 12svh, 94px);
    margin-top: 18px;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }

  .property-meta {
    margin-bottom: 20px;
  }

  .cta {
    padding: 15px 20px;
  }

  .slide-controls {
    bottom: 4%;
  }
}

@media (min-width: 1600px) {
  .header,
  .intro,
  .featured,
  .map-section,
  .contact,
  footer { padding-left: max(7vw, calc((100vw - 1500px) / 2)); padding-right: max(7vw, calc((100vw - 1500px) / 2)); }
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero-copy {
    left: max(7vw, calc((100vw - 1500px) / 2));
    width: min(760px, 72vw);
    padding-left: 0;
    padding-right: 0;
  }

  .hero h1 {
    font-size: clamp(88px, 6vw, 112px);
    line-height: .82;
  }
}

@media (max-width: 1200px) {
  .header { padding-left: 4vw; padding-right: 4vw; }
  .hero h1 { font-size: clamp(58px, 8.5vw, 94px); }
  .hero-copy { width: min(580px, 68vw); }
  .searchbar { padding-left: 4vw; padding-right: 4vw; }
  .intro, .featured, .map-section { padding-left: 5vw; padding-right: 5vw; }
  .map-shell { grid-template-columns: 290px minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legacy { grid-template-columns: 1fr 1fr; }
  .service-copy { padding: 85px 6vw; }
}

@media (max-width: 900px) {
  .hero { height: clamp(580px, calc(100svh - 100px), 760px); min-height: 0; }
  .hero-copy { bottom: 15%; width: min(620px, 86vw); }
  .hero h1 { font-size: clamp(54px, 12vw, 82px); }
  .hero-copy .property-meta { flex-wrap: wrap; }
  .slide-controls { right: 7vw; bottom: 5%; }
  .searchbar { padding: 20px 7vw; }
  .intro { padding-top: 82px; padding-bottom: 82px; gap: 36px; }
  .featured, .map-section { padding-top: 80px; padding-bottom: 80px; }
  .section-head { align-items: flex-start; gap: 24px; }
  .cards { grid-template-columns: 1fr; gap: 20px; }
  .card-image { height: min(58vw, 470px); }
  .map-shell { grid-template-columns: 1fr; }
  .map-list { max-height: none; }
  #propertyMap { min-height: 500px; }
  .legacy { grid-template-columns: 1fr; }
  .legacy-photo { min-height: min(72vw, 620px); }
  .service-copy { padding: 78px 8vw; }
}

@media (max-width: 640px) {
  .header { height: 112px; padding-bottom: 15px; }
  /* The shared header stylesheet uses this pseudo-element as the mobile
     contact rail. Keep it as tall as the phone link so the numerals cannot
     spill into the cream logo area. */
  .header:after { height: 29px; background-size: auto; }
  .hero {
    /* Let the listing copy determine the final height. This keeps short names
       compact and guarantees that longer names cannot clip the CTA. */
    height: auto;
    min-height: 560px;
    max-height: none;
    padding-top: clamp(265px, 69vw, 400px);
    padding-bottom: 34px;
    background: #191a16;
  }
  .hero .slide {
    background-color: #191a16;
    background-position: center top;
    background-size: 100% auto;
  }
  .hero .slide::after {
    background:
      linear-gradient(180deg, rgba(15,15,12,.02) 0%, rgba(15,15,12,.03) 50%, rgba(25,26,22,.18) 55%, rgba(25,26,22,.72) 62%, #191a16 68%, #191a16 100%),
      linear-gradient(90deg, rgba(15,15,12,.18), transparent 34%, transparent 66%, rgba(15,15,12,.18));
  }
  .hero-copy {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
    width: auto;
    margin: 0 6vw;
  }
  .hero-copy .overline { font-size: 8px; letter-spacing: .18em; }
  .hero-copy .overline:before { width: 32px; }
  .hero h1 { font-size: clamp(47px, 14.5vw, 68px); line-height: .84; margin: 19px 0 16px; }
  .property-meta { gap: 14px 20px; font-size: 10px; margin-bottom: 23px; }
  .cta { padding: 15px 16px; gap: 14px; font-size: 9px; }
  .slide-controls { left: 6vw; right: auto; bottom: 18px; gap: 10px; }
  .arrow { width: 39px; height: 39px; }
  .progress { width: 72px; }
  .searchbar { padding: 17px 6vw 22px; }
  .field { padding: 12px 0; }
  .field input, .field select { font-size: 18px; }
  .searchbar button { width: 100%; margin-top: 8px; }
  .intro, .featured, .map-section { padding: 64px 6vw; }
  .intro h2, .section-head h2, .service-copy h2, .map-intro h2 { font-size: clamp(41px, 13vw, 58px); }
  .intro p, .service-copy p, .map-intro p { font-size: 18px; }
  .section-head { flex-direction: column; align-items: flex-start; margin-bottom: 30px; }
  .card-image { height: 62vw; min-height: 230px; }
  .card-body { padding: 21px; }
  .card-body h3 { font-size: 27px; }
  .numbers { gap: 16px; flex-wrap: wrap; }
  .map-intro { margin-bottom: 28px; gap: 18px; }
  .map-list { display: block; padding: 12px; }
  .map-list h3 { margin-bottom: 12px; }
  .map-property { grid-template-columns: 64px 1fr; }
  .map-property img { width: 64px; height: 54px; }
  #propertyMap { min-height: 430px; }
  .leaflet-control-zoom { margin-top: 12px !important; margin-left: 12px !important; }
  .legacy-photo { min-height: 86vw; }
  .service-copy { padding: 64px 7vw; }
  .contact { padding: 62px 7vw; }
  .contact h2 { font-size: clamp(42px, 12vw, 58px); }
  footer { padding: 34px 7vw; }
}

@media (max-width: 380px) {
  .hero { padding-top: clamp(245px, 67vw, 270px); }
  .hero h1 { font-size: 44px; }
  .slide-controls .progress { display: none; }
  .map-popup img { height: 105px; }
  .leaflet-popup-content { width: 220px !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slide, .card, .quality-meter i { transition: none !important; }
}

/* Owner review: give the property map a true full-screen canvas. */
body .map-section {
  padding: 88px 0 0;
}

body .map-intro {
  padding-inline: 7vw;
}

body .map-shell {
  width: 100%;
  height: calc(100svh - 24px);
  min-height: 680px;
  border-left: 0;
  border-right: 0;
}

body .map-notice {
  margin: 20px 7vw 88px;
}

@media (max-width: 900px) {
  body .map-section { padding-top: 64px; }
  body .map-intro { padding-inline: 6vw; }
  body .map-shell { height: auto; min-height: 0; }
  body .map-stage,
  body #propertyMap { height: 72svh; min-height: 500px; }
  body .map-notice { margin: 20px 6vw 64px; }
}

@media (max-width: 520px) {
  body .map-stage,
  body #propertyMap { height: 68svh; min-height: 430px; }
}

/* Mobile map: a fixed vertical listing rail with an always-visible progress cue. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

.map-shell,
.map-list-panel,
.map-list,
.map-property,
.map-property > span,
.map-stage {
  min-width: 0;
  max-width: 100%;
}

.map-list-panel {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--cream);
}

.map-list {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.map-property {
  overflow: hidden;
}

.map-property strong {
  overflow-wrap: anywhere;
}

.map-scroll-rail {
  display: none;
}

@media (max-width: 900px) {
  body .map-shell {
    gap: 0;
    overflow: hidden;
  }

  .map-list-panel {
    height: 232px;
    border-bottom: 1px solid #cfc5b4;
  }

  .map-list {
    height: 232px;
    max-height: 232px;
    padding-right: 28px;
    scrollbar-width: none;
  }

  .map-list::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .map-scroll-rail {
    display: block;
    position: absolute;
    z-index: 5;
    top: 14px;
    right: 8px;
    bottom: 14px;
    width: 5px;
    border-radius: 999px;
    background: rgba(152, 45, 37, .14);
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .map-scroll-rail.is-hidden {
    opacity: 0;
  }

  .map-scroll-thumb {
    display: block;
    width: 100%;
    min-height: 32px;
    border-radius: 999px;
    background: var(--red);
    box-shadow: 0 0 0 1px rgba(255,255,255,.55);
    will-change: transform;
  }

  body .map-stage {
    margin: 0;
  }

  .map-style-switcher {
    top: 0;
    margin: 0;
  }
}

/* Keep the homepage hero controls on the photograph on phones. The previous
   bottom-aligned control row could collide with the price and CTA as the hero
   copy reflowed on shorter screens. */
@media (max-width: 640px) {
  .hero > .slide-controls {
    inset: 0;
    display: block;
    width: auto;
    height: 0;
    pointer-events: none;
  }

  .hero > .slide-controls .arrow {
    position: absolute;
    top: clamp(118px, 32vw, 185px);
    margin: 0;
    transform: translateY(-50%);
    pointer-events: auto;
  }

  .hero > .slide-controls .arrow:first-child {
    left: 12px;
  }

  .hero > .slide-controls .arrow:last-child {
    right: 12px;
  }

  .hero > .slide-controls .counter,
  .hero > .slide-controls .progress {
    display: none;
  }
}

@media (max-width: 520px) {
  .map-list-panel,
  .map-list {
    height: 226px;
    max-height: 226px;
  }

  .map-style-switcher {
    top: 0;
    right: 0;
    left: 0;
    border-right: 0;
    border-left: 0;
  }
}
