/* HCH results-page layout (gmaps-kit 1.2). Presentation only.
   Landing-style half-map results (/advanced-search/, city/area archives,
   property_list_half): at most 3 card columns, a capped list pane on very
   wide screens, and a sticky full-height map. Coordinates with cards v2.2.3
   (body.hchc-on, #listing_ajax_container, .listing_wrapper.property_unit_v2,
   #google_map_prop_list_sidebar / _wrapper, .hchc-toolbar, .hchc-nomap,
   .hchc-mapopen) and loads after hch-cards-v2.css so these rules beat the
   cards 55/45 !important split.
   Under 992px this file does not change the existing mobile/tablet behavior
   (listings first, Map toggle / fullscreen map).
   No title, meta, H1, URL, canonical, robots, phone, price or copy changes. */

body.hch-gmaps-layout{
  --hch-gmaps-header:70px;
  --hch-gmaps-gap:14px;
  --hch-gmaps-cardmin:280px;
  --hch-gmaps-cardmax:400px;
  --hch-gmaps-listmax:1240px;
}
body.admin-bar.hch-gmaps-layout{--hch-gmaps-header:102px}

/* =========================================================================
   Desktop (≥992px): card grid, never more than 3 columns.
   992–1599 (list pane is typically <1000px, e.g. 1280 @ 58% ≈ 742px): 2 cols.
   1600+ (1600/1920/2560): 3 cols. Tracks stay ~300–400px and do not grow
   with the viewport; leftover space stays on the right so 1–3 results stay
   left-aligned at normal card size. Non-card chrome (phone bar, H1/copy,
   toolbar, trust strip, pagination) spans the card tracks.
   ========================================================================= */
@media (min-width:992px){
  body.hch-gmaps-layout #listing_ajax_container,
  body.hch-gmaps-layout.hchc-on #listing_ajax_container{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(var(--hch-gmaps-cardmin,280px),var(--hch-gmaps-cardmax,400px)))!important;
    justify-content:start;
    justify-items:stretch;
    gap:var(--hch-gmaps-gap,14px)!important;
    align-items:stretch;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    padding:0 12px 24px;
    overflow-x:hidden;
  }
  body.hch-gmaps-layout #listing_ajax_container>*{min-width:0;max-width:100%}
  body.hch-gmaps-layout #listing_ajax_container>:not(.listing_wrapper),
  body.hch-gmaps-layout.hchc-on #listing_ajax_container>:not(.listing_wrapper){
    grid-column:1 / -1;
    flex:none!important;
    max-width:none!important;
    width:auto!important;
  }
  body.hch-gmaps-layout #listing_ajax_container .listing_wrapper.property_unit_v2,
  body.hch-gmaps-layout.hchc-on #listing_ajax_container .listing_wrapper.property_unit_v2,
  body.hch-gmaps-layout.hchc-on.hchc-nomap #listing_ajax_container .listing_wrapper.property_unit_v2,
  body.hch-gmaps-layout.hchc-on.hchc-ctx-list #listing_ajax_container .listing_wrapper.property_unit_v2{
    flex:none!important;
    flex-basis:auto!important;
    max-width:var(--hch-gmaps-cardmax,400px)!important;
    width:auto!important;
    float:none!important;
    padding-left:0!important;
    padding-right:0!important;
    margin-bottom:0!important;
    margin-top:0!important;
    box-sizing:border-box;
    display:flex;
  }

  /* Neutralize the cards v2 CLS top-margin reservation so the first grid row stays even.
     The toolbar itself occupies a full grid row once JS inserts it. */
  body.hch-gmaps-layout.is_half_map:not(.hchc-ready) #listing_ajax_container>.listing_wrapper:nth-child(-n+2 of .listing_wrapper),
  body.hch-gmaps-layout.hchc-ctx-list:not(.hchc-ready) #listing_ajax_container>.listing_wrapper:nth-child(-n+3 of .listing_wrapper){
    margin-top:0!important;
  }
  body.hch-gmaps-layout #listing_ajax_container>.hchc-toolbar{
    padding-left:0;
    padding-right:0;
  }
}

@media (min-width:1600px){
  body.hch-gmaps-layout #listing_ajax_container,
  body.hch-gmaps-layout.hchc-on #listing_ajax_container{
    grid-template-columns:repeat(3,minmax(var(--hch-gmaps-cardmin,280px),var(--hch-gmaps-cardmax,400px)))!important;
  }
}

/* =========================================================================
   Half-map split. Theme default is listings 45% / map 55% (and my_media.css
   shifts those at ≤1600/1450/1350). Cards v2.2.3 forces 55/45 at ≥992px.
   Chosen split (room for 2 then 3 comfortable card columns):
     992–1199:  55 / 45
     1200–1599: 58 / 42
     1600+:     60 / 40, until the list pane hits --hch-gmaps-listmax (1240px).
   On very wide screens (1920–2560+) the list is capped at 1240px and the
   map receives the rest, so cards never shrink into 4+ columns and never
   stretch past ~400px.
   The theme takes both panes out of document flow (position:fixed). We keep
   that model — it is the half-map equivalent of Landing's sticky full-height
   map — and pin each pane under the header with height: calc(100vh - header).
   JS may update --hch-gmaps-header from the visible header's bottom edge.
   ========================================================================= */
@media (min-width:992px){
  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) .full_map_container,
  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) .full_map_container>.row{
    width:100%;
    max-width:none;
    margin-left:0;
    margin-right:0;
  }

  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) #google_map_prop_list_sidebar,
  body.hch-gmaps-layout.hchc-on.is_half_map:not(.hchc-nomap) #google_map_prop_list_sidebar{
    position:fixed!important;
    left:0!important;
    right:auto!important;
    top:var(--hch-gmaps-header,70px)!important;
    bottom:0!important;
    height:calc(100vh - var(--hch-gmaps-header,70px))!important;
    width:min(55%,var(--hch-gmaps-listmax,1240px))!important;
    max-width:var(--hch-gmaps-listmax,1240px)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    box-sizing:border-box!important;
    min-width:0!important;
    z-index:2;
  }

  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) #google_map_prop_list_wrapper,
  body.hch-gmaps-layout.hchc-on.is_half_map:not(.hchc-nomap) #google_map_prop_list_wrapper{
    position:sticky; /* requested pin; next declaration is what the theme panes need */
    position:fixed!important;
    right:0!important;
    left:auto!important;
    top:var(--hch-gmaps-header,70px)!important;
    bottom:0!important;
    height:calc(100vh - var(--hch-gmaps-header,70px))!important;
    width:calc(100% - min(55%,var(--hch-gmaps-listmax,1240px)))!important;
    max-width:none!important;
    box-sizing:border-box;
    z-index:1;
    margin:0!important;
  }

  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) #google_map_prop_list,
  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) #google_map_prop_list.leaflet-container{
    width:100%!important;
    height:100%!important;
    min-height:0;
  }
}

@media (min-width:1200px){
  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) #google_map_prop_list_sidebar,
  body.hch-gmaps-layout.hchc-on.is_half_map:not(.hchc-nomap) #google_map_prop_list_sidebar{
    width:min(58%,var(--hch-gmaps-listmax,1240px))!important;
    max-width:var(--hch-gmaps-listmax,1240px)!important;
  }
  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) #google_map_prop_list_wrapper,
  body.hch-gmaps-layout.hchc-on.is_half_map:not(.hchc-nomap) #google_map_prop_list_wrapper{
    width:calc(100% - min(58%,var(--hch-gmaps-listmax,1240px)))!important;
    max-width:none!important;
  }
}

@media (min-width:1600px){
  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) #google_map_prop_list_sidebar,
  body.hch-gmaps-layout.hchc-on.is_half_map:not(.hchc-nomap) #google_map_prop_list_sidebar{
    width:min(60%,var(--hch-gmaps-listmax,1240px))!important;
    max-width:var(--hch-gmaps-listmax,1240px)!important;
  }
  body.hch-gmaps-layout.is_half_map:not(.hchc-nomap) #google_map_prop_list_wrapper,
  body.hch-gmaps-layout.hchc-on.is_half_map:not(.hchc-nomap) #google_map_prop_list_wrapper{
    width:calc(100% - min(60%,var(--hch-gmaps-listmax,1240px)))!important;
    max-width:none!important;
  }
}

/* Map off (cards v2 .hchc-nomap): listings use the full viewport width, but
   the grid still caps at 3 columns of ≤400px, left-aligned. */
@media (min-width:992px){
  body.hch-gmaps-layout.is_half_map.hchc-nomap #google_map_prop_list_sidebar,
  body.hch-gmaps-layout.hchc-on.is_half_map.hchc-nomap #google_map_prop_list_sidebar{
    width:100%!important;
    max-width:100%!important;
    position:relative!important;
    top:auto!important;
    left:auto!important;
    right:auto!important;
    bottom:auto!important;
    height:auto!important;
    overflow:visible!important;
  }
  body.hch-gmaps-layout.is_half_map.hchc-nomap #google_map_prop_list_wrapper,
  body.hch-gmaps-layout.hchc-on.is_half_map.hchc-nomap #google_map_prop_list_wrapper{
    display:none!important;
    width:0!important;
    max-width:0!important;
    visibility:hidden;
    pointer-events:none;
  }
}

/* Reduced motion: keep the layout, drop movement. */
@media (prefers-reduced-motion:reduce){
  body.hch-gmaps-layout #listing_ajax_container .listing_wrapper.property_unit_v2 .property_listing{
    transition:none!important;
  }
}
