/*
 * /listings results grid (post ID 47, [dmg_listings_filtered]).
 * Scoped to .dmg-listings-results so it only affects the listings page, not
 * any other use of the FlexMLS results widget elsewhere on the site.
 *
 * The plugin renders cards into .flexmls-listings-list-wrapper > a.flexmls-listing
 * as a flex row by default. We override the wrapper to CSS grid. Columns are
 * defined with 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 regardless of card content length.
 *
 * .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.
 */

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

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

.dmg-listings-results .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 — see the
 * matching rule scoped to body.flexmls_connect__search_results_page in
 * search-results-grid.css for the Property Search results page.
 */
.dmg-listings-results .flexmls-last-modified-and-label-wrapper,
.dmg-listings-results .flexmls-office-name {
	display: none !important;
}

/* Small mobile: under 480px -> 1 column (base rule above) */

/* Mobile: 480px - 767px */
@media (min-width: 480px) {
	.dmg-listings-results .flexmls-listings-list-wrapper {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

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

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