/* ----------------------------- */
/* Jagoe Communities – Frontend */
/* ----------------------------- */

.comm-section H2 {
  text-transform: uppercase;
	margin: 0 0 10px 0 !important;
}
.comm-section H3{
	margin: 0 0 10px 0 !important;
}
.comm-section p{
	margin: 0 0 10px 0 !important;
}

/* section box + variables */
.comm-section {
  /* padding/margin/vars are applied via a per-instance <style> from PHP */
  --btn-bg: #244a77;
  --btn-text: #fff;
  --btn-radius: 999px; /* default; overridden inline */
  --slider-track: #bed0e1;
  --slider-fill: #244a77;
  --slider-thumb: #244a77;
  --loadmore-bg: #ffffff;
  --loadmore-text: #244a77;
  --loadmore-border: #244a77;
  --loadmore-radius: 999px;
  --loadmore-border-width: 2px;
}
.comm-intro { margin-bottom: 16px; }

.comm-section > .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Search bar – desktop/tablet ABOVE the grid by default */
.comm-search {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
  order: 1;
}
.comm-field label {
  display: block;
  font-size: .85rem;
  color: #555;
  margin-bottom: 6px;
}
.comm-field select,
.comm-field input[type=number] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
}
/* Custom city multiselect --------------------------------------- */
.comm-field-city {
  position: relative;
}

.comm-city-select-native {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* Trigger that looks like a nice select */
.comm-city-multiselect {
  position: relative;
}
.comm-city-trigger {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 14px;
}
.comm-city-placeholder {
  color: #888;
  flex: 1;
}
.comm-city-selected {
	color: #244a77;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comm-city-arrow {
  margin-left: auto;
  font-size: 11px;
}

/* Dropdown panel */
.comm-city-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ddd;
  box-shadow: 0 4px 10px rgba(0,0,0,.08);
  padding: 8px;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  display: none;
}
.comm-city-multiselect.is-open .comm-city-dropdown {
  display: block;
}

/* Dropdown items (clickable) */
.comm-city-item {
  color: #244a77;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.comm-city-item:last-child {
  margin-bottom: 0;
}
.comm-city-item:hover {
  background: #f3f3f3;
}

/* Checkbox box */
.comm-city-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid #bbb;
  background: #fff;
  flex-shrink: 0;
  position: relative;
}

/* Label */
.comm-city-label {
  flex: 1;
  text-align: left;
}

/* Active (selected) city */
.comm-city-item.is-active {
  background: #244a77;
  color: #fff;
}
.comm-city-item.is-active:hover {
  background: #1b3858;
}

/* When active, show check mark inside the box */
.comm-city-item.is-active .comm-city-checkbox {
  background: #244a77;
  border-color: #244a77;
}
.comm-city-item.is-active .comm-city-checkbox::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}


.comm-actions .btn { white-space: nowrap; }

.btn.btn--primary{
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: var(--btn-radius);
  padding: 10px 16px;
  font-weight: 600;
}

/* Base grid container */
.comm-grid{
  display: grid;
  grid-template-columns: minmax(360px,1fr) minmax(0,1fr);
  gap: 24px;
  align-items: start;
  order: 2;
}

/* Layout modifiers -------------------------------------- */
/* side layout (default): existing behavior */
.comm-layout-side .comm-grid{
  grid-template-columns: minmax(360px,1fr) minmax(0,1fr);
}

/* map full width, tiles below */
.comm-layout-map-top .comm-grid{
  grid-template-columns: 1fr;
}

/* no map layout: hide map and let tiles span full width */
.comm-layout-no-map .comm-map{
  display: none;
}
.comm-layout-no-map .comm-grid{
  grid-template-columns: 1fr;
}

/* Map */
.comm-map{
  width: 100%;
  height: clamp(495px, 40vh, 520px);
  background: #eef0ee;
  border-radius: 12px;
  overflow: hidden;
}

/* Horizontal rail / default scroll ---------------------- */
.entry-content ul {
    margin-bottom: 0 !important;
    padding-left: 0 !important;
}
.comm-rail-wrap{
  --cards: 2;
  --gap: 24px;
  position: relative;
  overflow: hidden; /* keep arrows inside */
}
.comm-rail{
  display: flex;
  gap: var(--gap);
  overflow-x: hidden; /* will be relaxed in some modes/media */
  -webkit-overflow-scrolling: touch;
/*  padding: 4px 8px 16px;*/
  margin: 0;
  list-style: none;
  scroll-snap-type: x proximity;
}
.comm-rail > li.community-li{
  width: auto !important;
  flex: 0 0 calc((100% - (var(--gap) * (var(--cards) - 1))) / var(--cards));
  max-width: calc((100% - (var(--gap) * (var(--cards) - 1))) / var(--cards)) !important;
  box-sizing: border-box;
  scroll-snap-align: start;
	background: white;
}
.comm-rail img{ max-width:100%; height:auto; display:block; }
.comm-rail > li.community-li .sub-community-banner{
  position: absolute; top: 0; left: 0; width: 100%;
  padding: 10px 5px 10px 10px; font-weight: 700;
}

/* Nav arrows */
.comm-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid #dcdcdc; background: white;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
  display: flex; align-items: center; justify-content: center;
}
.comm-nav.prev{ left:0; }
.comm-nav.next{ right:0; }
.comm-nav .fa-regular{
	font-size: 42px;
	color: #244a77;
}
.comm-nav .fa-regular:hover{
	opacity: .7;
}

/* Scroll-mode modifiers ---------------------------------- */
/* Vertical infinite scroll: no horizontal overflow, use CSS grid */
/* Scroll-mode modifiers ---------------------------------- */
/* Vertical infinite scroll / button / load-all: grid layout */
.comm-scroll-infinite .comm-rail-wrap,
.comm-scroll-button  .comm-rail-wrap,
.comm-scroll-all     .comm-rail-wrap{
  overflow: visible;
}

.comm-scroll-infinite .comm-rail,
.comm-scroll-button  .comm-rail,
.comm-scroll-all     .comm-rail{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  overflow: visible;
  scroll-snap-type: none;
  padding: 4px 0 0;
}

.comm-scroll-infinite .comm-rail > li.community-li,
.comm-scroll-button  .comm-rail > li.community-li,
.comm-scroll-all     .comm-rail > li.community-li{
  flex: 0 0 auto;
  max-width: 100% !important;
}

.comm-scroll-infinite .comm-nav,
.comm-scroll-button  .comm-nav,
.comm-scroll-all     .comm-nav{
  display: none;
}
.comm-no-results{
	text-align: center;
  margin-top: 12px;
  font-size: 0.95rem;
  color: #555;
  font-style: italic;
}

/* "View More" button */
.comm-load-more-wrap{
  margin-top: 16px;
  display: none;
  justify-content: center;
}
.comm-load-more-wrap.is-visible{
  display: flex;
}
.comm-layout-side .comm-load-more-wrap{
  display: none !important;
}
.comm-load-more{
  background: var(--loadmore-bg);
  color: var(--loadmore-text);
  border-radius: var(--loadmore-radius);
  border: var(--loadmore-border-width) solid var(--loadmore-border);
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
}

/* Multi-select city */
.comm-city-multi{
  min-height: 44px;
}

/* ------------------------ */
/* Dual slider (Price/SqFt) */
/* ------------------------ */

.dual-slider{
  --track-h: 8px;        /* track height */
  --thumb-d: 26px;       /* thumb diameter */
  --thumb-ring: 2px;     /* white ring around thumb */
  position: relative;
  height: calc(var(--thumb-d) + 14px); /* room for thumbs + track */
  margin-top: 6px;
  overflow: visible;     /* allow thumbs to touch edges */
}

/* Reset UA/theme styles on inputs; overlay both inputs in the same spot */
.dual-slider input[type="range"]{
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  inset: 0;               /* left:0; right:0; top:0; bottom:0 */
  width: 100%;
  margin: 0;
  padding: 0 !important;
  background: transparent;
  border: 0;
  outline: 0;
  pointer-events: none;   /* thumbs handle the dragging */
}

/* Ensure consistent stacking; top input above bottom input */
.dual-slider input[type="range"]:nth-of-type(1){ z-index: 2; }
.dual-slider input[type="range"]:nth-of-type(2){ z-index: 3; }

/* Custom track sits behind both inputs */
.dual-slider .track{
  position: absolute; left: 0; right: 0; top: 50%;
  height: var(--track-h); transform: translateY(-50%);
  border-radius: calc(var(--track-h) / 2);
  background: var(--slider-track);
  z-index: 1;
}

/* Fill between thumbs */
.dual-slider .track .range-fill{
  position: absolute; top: 0; bottom: 0;
  left: 0;
  right: 100%;
  border-radius: inherit;
  background: var(--slider-fill);
  transition: left .15s ease, right .15s ease, background-color .2s;
  pointer-events: none;
}

/* WebKit/Blink thumb */
.dual-slider input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: var(--thumb-d);
  height: var(--thumb-d);
  border-radius: 50%;
  background: var(--slider-thumb);
  border: var(--thumb-ring) solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
  cursor: pointer;
  pointer-events: auto;
  margin-top: calc((var(--track-h) - var(--thumb-d)) / 2);
}

/* Firefox thumb */
.dual-slider input[type="range"]::-moz-range-thumb{
  width: var(--thumb-d);
  height: var(--thumb-d);
  border-radius: 50%;
  background: var(--slider-thumb);
  border: var(--thumb-ring) solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
  cursor: pointer;
  pointer-events: auto;
}

/* Hide UA tracks */
.dual-slider input[type="range"]::-webkit-slider-runnable-track{
  height: var(--track-h);
  background: transparent;
  border: 0;
}
.dual-slider input[type="range"]::-moz-range-track{
  height: var(--track-h);
  background: transparent;
  border: 0;
}

/* Readouts under the track */
.dual-slider .thumb-readouts{
  position: absolute; left: 0; right: 0; bottom: -22px;
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 13px; color: #556;
}
.comm-filter-reset-row{
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.comm-reset-filters{
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9rem;
  color: #244a77;
  text-decoration: underline;
  cursor: pointer;
}

.comm-reset-filters:hover{
  opacity: 0.8;
}

/* InfoWindow bits */
.comm-iw { max-width: 240px; }
.comm-iw .iw-img img { width: 100%; height: auto; display: block; border-radius: 6px; }
.comm-iw .iw-loc   { margin-top: 6px; font-weight: 600; color: #222; }
.comm-iw .iw-price { color: #444; font-size: 13px; }

/* Overflow guards */
.comm-section,
.comm-section .container,
.comm-grid,
.comm-map,
.comm-rail-wrap,
.comm-rail,
.comm-search { min-width: 0; max-width: 100%; }

/* Font Awesome-based map markers */
.comm-fa-marker{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #244a77;
  color: #fff;
  box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(0,0,0,.3);
  font-size: 16px;
}
.comm-fa-marker i{
  line-height: 1;
}
/* Hide tiles filtered out by live filters */
.community-li.is-hidden-by-filter{
  display: none !important;
}


/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1200px){
  .comm-scroll-infinite .comm-rail,
  .comm-scroll-button  .comm-rail{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px){
  .comm-scroll-infinite .comm-rail,
  .comm-scroll-button  .comm-rail{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px){
  .comm-scroll-infinite .comm-rail,
  .comm-scroll-button  .comm-rail,
  .comm-scroll-all     .comm-rail{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1000px){
  .comm-grid { grid-template-columns: 1fr; }
  .comm-map { min-height: 360px; }
}
/* Hide search button on desktop/tablet; keep on mobile */
@media (min-width: 701px){
  .comm-search .comm-actions{
    display: none;
  }
}
/* Mobile: order becomes intro (1), map (2), tiles (3), search (4) */
@media (max-width: 700px){
  H2 { font-size: 3em !important; line-height: 1em !important; }
  .comm-section p { text-align: justify !important; }
  .comm-section .container{ gap: 0; }
  .comm-intro{ order:1; margin-bottom: 0 !important; }
  .comm-grid { order:2; }
  .comm-search{ order:4; grid-template-columns: 1fr; }
  .comm-actions .btn { width: 100%; }
  .comm-rail{ margin-bottom: 0 !important; }
  .comm-range{ margin-bottom: 15px; }

  /* ✅ For side layout on mobile: always stack map then tiles, no side-by-side overflow */
  .comm-layout-side .comm-grid{
    grid-template-columns: 1fr !important;
  }

  /* ✅ In horizontal mode, allow touch scrolling of the rail on mobile */
  .comm-scroll-horizontal .comm-rail{
    overflow-x: auto;
  }

  /* Show one card per view on mobile for horizontal mode */
  .comm-scroll-horizontal .comm-rail-wrap{ --cards: 1 !important; }

  /* Final guard */
  .comm-section { overflow-x: clip; }
  .comm-section * { box-sizing: border-box; }
	
  .dual-slider{
    --thumb-d: 32px;       /* thumb diameter */
  }
}
