/* Search results review (Nov 25, 2026): sort above the list, filter buttons that say what is picked, photo slider and
   New / Price cut badges on cards, loading and empty states, no inner scrollbars, back to the same spot.
   Loaded by the map search page only; colors come from each site's theme file, so NWRS, PVH and TDH keep their own look. */

/* Page widths (y4 layout review, approved Nov 25, 2026): the list grows with the screen and the map never gets
   narrower than about 600px beside it. 24 homes a page gives full rows at 1, 2 and 3 across.
     1680 and up: list 860px, 3 cards across     1280 to 1679: list 560 to 720px, 2 across
     1024 to 1279: list 400px, 1 across          761 to 1023 (tablets): no split, List / Map switch, 2 across */
@media (min-width: 1024px) { .search-layout { grid-template-columns: minmax(0, 1fr) 400px; } .page-search .cards { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1280px) { .search-layout { grid-template-columns: minmax(0, 1fr) clamp(560px, 44vw, 720px); } .page-search .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1680px) { .search-layout { grid-template-columns: minmax(0, 1fr) 860px; } .page-search .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 761px) and (max-width: 1023px) {
  .search-layout { grid-template-columns: minmax(0, 1fr); }
  .page-search .results-pane { border-left: 0; padding-bottom: 84px; }
  .page-search .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-switch:not([hidden]) { display: inline-flex; position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 900;
    background: var(--brand); border-radius: 999px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
  .view-switch button { border: 0; background: none; color: #fff; font: 700 15px/1 var(--font-head, inherit); padding: 12px 24px; border-radius: 999px; cursor: pointer; min-width: 90px; }
  .view-switch button.is-on { background: #fff; color: var(--brand); }
  body.v-list .map-pane { display: none; }
  body.v-map .results-pane { display: none; }
}
/* The big photo view (drawn area) always shows the homes, whichever switch was last used */
body.v-gallery .view-switch { display: none !important; }
body.v-gallery.v-map .results-pane { display: block; }

/* Photo grid ("See homes in this area"): 4 across on big screens, 3, 2, then 1 on phones (24 a page = full rows) */
body.v-gallery .results-pane .results-head, body.v-gallery #results { max-width: 1440px; }
body.v-gallery #results { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (min-width: 1440px) { body.v-gallery #results { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1023px) { body.v-gallery #results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (max-width: 639px) { body.v-gallery #results { grid-template-columns: minmax(0, 1fr); padding: 8px 14px 24px; } }

/* No inner scrollbars (Troy): the list and the More panel still scroll with the wheel, trackpad, touch and keys */
.page-search .results-pane, #pop-more { scrollbar-width: none; -ms-overflow-style: none; }
.page-search .results-pane::-webkit-scrollbar, #pop-more::-webkit-scrollbar { display: none; width: 0; height: 0; }
@media (min-width: 861px) { #pop-more { min-width: 420px; } }

/* Results header: count on the left, sort and layout on the right; it stays in view while the list scrolls */
.page-search .results-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-bottom: 8px; }
.rh-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.rh-count { min-width: 0; }
.rh-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rh-sort { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.rh-sort select { font: 600 14px/1.2 var(--font); color: var(--ink, inherit); border: 1px solid var(--line); border-radius: 999px; padding: 8px 30px 8px 12px; min-height: 38px; background-color: var(--surface); cursor: pointer; }
.rh-layout { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.rh-layout button { border: 0; background: none; padding: 8px 14px; min-height: 36px; font: 700 14px/1 var(--font); color: var(--brand); cursor: pointer; }
.rh-layout button.is-on { background: var(--brand); color: var(--brand-ink, #fff); }
.rh-range { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.rh-range:empty { display: none; }
.rh-clear { margin: 6px 0 0; font-size: 14px; }
.rh-clear[hidden] { display: none; }
@media (max-width: 760px) {
  .rh-layout { display: none; }   /* phones keep the List / Map switch at the bottom */
  .page-search .results-head { position: static; }
  .rh-top { align-items: center; }
}

/* Filter buttons that carry a value read a little stronger */
.chip.has-value { font-weight: 700; }

/* Cards: status, New and Price cut badges in one row; the courtesy line keeps its RMLS logo beside the words */
.card-photo .badge-row { position: absolute; top: 8px; left: 8px; right: 52px; display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none; }
.card-photo .badge-row .badge { position: static; }
.badge.b-new { background: var(--accent, var(--brand)); color: #fff; }
.badge.b-cut { background: #fff; color: #9A3412; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.badge[hidden] { display: none; }
.page-search .card .courtesy .rmls-mark { display: inline-block; height: 20px; margin: 0 6px 0 0; vertical-align: -5px; }
.card-link:focus-visible { outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px; border-radius: var(--radius); }

/* Photo slider on cards: arrows show on hover with a mouse, always on touch screens */
.ph-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.92); color: #1b2733; font: 700 24px/30px var(--font); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.25);
  opacity: 0; transition: opacity .15s; display: grid; place-items: center; padding: 0 0 3px; }
.ph-prev { left: 8px; } .ph-next { right: 8px; }
.ph-nav[hidden], .ph-count[hidden] { display: none; }
.card:hover .ph-nav, .ph-nav:focus-visible { opacity: 1; }
.ph-count { position: absolute; right: 8px; bottom: 8px; background: rgba(15, 23, 32, .72); color: #fff; border-radius: 6px; padding: 1px 7px; font: 600 12px/18px var(--font); opacity: 0; transition: opacity .15s; }
.card:hover .ph-count { opacity: 1; }
@media (hover: none) { .ph-nav { opacity: .9; width: 40px; height: 40px; } .ph-count { opacity: 1; } }

/* Searching: the list dims a touch and a thin bar runs along the top of the map */
#results { transition: opacity .15s; }
body.is-searching #results { opacity: .55; }
.load-bar { position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 850; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .15s; }
.load-bar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; left: -35%; background: var(--accent, var(--brand)); animation: loadSlide 1s ease-in-out infinite; }
body.is-searching .load-bar { opacity: 1; }
@keyframes loadSlide { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .load-bar::after { animation: none; left: 0; width: 100%; opacity: .6; } }

/* Search this area (shown when "Search as I move the map" is off and the map has moved) */
.search-here { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); z-index: 820; border-radius: 999px; padding: 10px 18px; min-height: 40px;
  background: var(--brand); color: var(--brand-ink, #fff); border: 0; font-weight: 700; box-shadow: var(--shadow-lg); cursor: pointer; }
.search-here[hidden] { display: none; }

/* Map bubbles: bigger when they hold more homes, so the busy areas read at a glance */
.cluster.cl-lg { width: 46px; height: 46px; font-size: 14px; }
.cluster.cl-xl { width: 54px; height: 54px; font-size: 15px; }

/* No match: a short line and one tap fixes */
.results .empty, #results .empty { grid-column: 1 / -1; line-height: 1.5; }
.empty-fixes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.empty-fixes .btn { margin-top: 0; }

/* Back to top, once the list has been scrolled a long way */
.to-top { position: sticky; bottom: 16px; display: block; margin: 0 16px 0 auto; z-index: 6; border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; min-height: 44px;
  background: var(--surface); color: var(--brand); font-weight: 700; box-shadow: var(--shadow-lg); cursor: pointer; }
.to-top[hidden] { display: none; }
@media (max-width: 760px) { .to-top { position: fixed; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); margin: 0; } }

/* Tablets and small laptops (narrow list pane): count on top, then sort and layout side by side on one line;
   the map buttons wrap instead of running under Draw tools */
.rh-tools { flex-wrap: nowrap; }
@media (min-width: 761px) and (max-width: 1100px) {
  .rh-top { display: block; }
  .rh-tools { margin-top: 8px; justify-content: space-between; }
  .rh-sort span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* the select says "Newest" etc. */
  .rh-sort select { max-width: 190px; }
  .map-controls { flex-wrap: wrap; }
}
/* List layout: the BAH and assumable bars line up with the cards instead of running edge to edge */
body.v-gallery .results-pane > .bah-bar, body.v-gallery .results-pane > .asm-alert-bar { max-width: 1392px; margin-left: auto; margin-right: auto; }
/* Tablets: the floating List / Map switch does the Map / List job (kept last so it wins over the results header rules) */
@media (min-width: 761px) and (max-width: 1023px) { .rh-layout { display: none; } }
/* Photo grid: the "Pick up where you left off" bar lines up with the cards */
body.v-gallery .results-pane > .nw-resume { max-width: 1392px; margin: 12px auto; }
