/*
 * FlexMLS "Property Search" results grid (/idx/search/, the special page
 * rendered by flexmlsConnectPageSearchResults — NOT the /listings page).
 * Scoped to body.flexmls_connect__search_results_page because /listings and
 * this page share the exact same .flexmls_connect__search_results_v2 /
 * .flexmls-listings-list-wrapper / .flexmls-listing markup (both render
 * through views/v2/fmcSearchResults.php), so the body class added by
 * flexmlsConnectPage::custom_body_class is the only server-side way to tell
 * them apart.
 *
 * Columns use minmax(0, 1fr), not plain 1fr — a plain 1fr track's minimum
 * size is "auto" (its content's intrinsic width), so it can refuse to shrink
 * to its column share; minmax(0, 1fr) removes that floor and guarantees an
 * even N-column split. See listings-grid.css for the matching /listings page
 * implementation using the same technique.
 *
 * .flexmls-image-wrapper is a CSS background-image div, not an <img> tag, so
 * object-fit doesn't apply to it — background-size: cover is the equivalent
 * for this markup.
 */

body.flexmls_connect__search_results_page .flexmls-listings-list-wrapper {
	display: grid !important;
	grid-template-columns: minmax( 0, 1fr );
	gap: 1.5rem;
}

body.flexmls_connect__search_results_page .flexmls-listing {
	width: auto !important;
	max-width: none !important;
	min-width: 0 !important;
	margin: 0 !important;
	box-sizing: border-box;
}

body.flexmls_connect__search_results_page .flexmls-listing .flexmls-image-wrapper {
	height: 200px !important;
	padding-top: 0 !important;
	background-size: cover !important;
	background-position: center !important;
	background-repeat: no-repeat !important;
}

/*
 * Last Modified + Listing Office are hidden on this page only (not on
 * /listings, which shares this exact markup via the same v2 template) — see
 * .flexmls-last-modified-and-label-wrapper / .flexmls-office-name in
 * views/v2/fmcSearchResults/_listings_list.php.
 */
body.flexmls_connect__search_results_page .flexmls-last-modified-and-label-wrapper,
body.flexmls_connect__search_results_page .flexmls-office-name {
	display: none !important;
}

/* Mobile: under 768px -> 1 column (base rule above) */

/* Tablet: 768px - 1199px */
@media (min-width: 768px) {
	body.flexmls_connect__search_results_page .flexmls-listings-list-wrapper {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

/* Desktop: 1200px+ */
@media (min-width: 1200px) {
	body.flexmls_connect__search_results_page .flexmls-listings-list-wrapper {
		grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	}
}
