/* Listing cards: [listings] shortcode, listing archive, Featured Listings widget. */

.gp-listing-grid {
	--gp-bar-bg: #222;
	--gp-bar-text: #fff;
	--gp-accent: #3e88c7;
	--gp-text: #555;
	--gp-muted: #888;
	--gp-border: #ddd;
	--gp-number-bg: #2f74b5;
	--gp-number-text: #fff;
	--gp-gap: 36px;

	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: var(--gp-gap);
	align-items: start;
	margin: 0 0 var(--gp-gap);
	padding: 0;
	box-sizing: border-box;
}

.gp-listing-grid *,
.gp-listing-grid *::before,
.gp-listing-grid *::after {
	box-sizing: border-box;
}

.gp-listing-grid.gp-cols-1 { grid-template-columns: minmax(0, 1fr); }
.gp-listing-grid.gp-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gp-listing-grid.gp-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gp-listing-grid.gp-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gp-listing-grid.gp-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gp-listing-grid.gp-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1024px) {
	.gp-listing-grid.gp-cols-3,
	.gp-listing-grid.gp-cols-4,
	.gp-listing-grid.gp-cols-5,
	.gp-listing-grid.gp-cols-6 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 680px) {
	.gp-listing-grid[class*="gp-cols-"] {
		grid-template-columns: minmax(0, 1fr);
		--gp-gap: 24px;
	}
}

/* Card */

.gp-listing-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	padding: 0;
	background: #fff;
	border: 1px solid var(--gp-border);
	color: var(--gp-text);
	font-weight: 300;
	line-height: 1.4;
	container: gp-card / inline-size;
}

.gp-card-price {
	display: flex;
	align-items: stretch;
	margin: -1px -1px 0;
	padding: 0;
	background: var(--gp-bar-bg);
	color: var(--gp-bar-text);
	font-size: 24px;
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.01em;
}

.gp-card-price-amount {
	flex: 1 1 auto;
	min-width: 0;
	padding: 12px 14px;
}

.gp-card-number {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	min-width: 52px;
	padding: 0 12px;
	background: var(--gp-number-bg);
	color: var(--gp-number-text);
	font-size: 20px;
	font-weight: 600;
	letter-spacing: 0;
	font-variant-numeric: tabular-nums;
}

.gp-listing-card .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.gp-card-body {
	display: flex;
	flex-direction: column;
	padding: 28px 24px 24px;
}

/* Address */

.gp-card-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin: 0 0 30px;
}

.gp-listing-card a.gp-card-address {
	display: block;
	min-width: 0;
	color: var(--gp-accent);
	font-size: 18px;
	font-weight: 300;
	line-height: 1.4;
	text-transform: uppercase;
	text-decoration: none;
	border: 0;
	box-shadow: none;
}

.gp-listing-card a.gp-card-address:hover,
.gp-listing-card a.gp-card-address:focus {
	text-decoration: underline;
}

.gp-card-street,
.gp-card-locality {
	display: block;
	overflow-wrap: anywhere;
}

/* Photo */

.gp-listing-card a.gp-card-image {
	display: block;
	margin: 0;
	padding: 0;
	line-height: 0;
	border: 0;
	box-shadow: none;
	overflow: hidden;
}

.gp-listing-card .gp-card-image img,
.gp-card-image-placeholder {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	margin: 0;
	padding: 0;
	border: 0;
	object-fit: cover;
	max-width: none;
}

.gp-card-image-placeholder {
	background: #eee;
}

/* "Images coming soon" on listings without photos (cards and the detail gallery). */
.gp-no-photos {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.gp-no-photos__text {
	padding: 0 12px;
	color: #6b7280;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.3;
}

/* Beds / baths / sqft */

.gp-card-stats {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin: 26px 0 0;
}

/*
 * Each item draws its divider on its left edge and is pulled 1px left, and the
 * list clips its overflow. Whichever item starts a line (the first one, or one
 * that wrapped) has its divider clipped away and no leading indent, so the row
 * wraps cleanly at any card width.
 */
.gp-listing-card ul.gp-card-facts {
	--gp-facts-indent: 16px;
	--gp-fact-pad: 16px;

	display: flex;
	flex-wrap: wrap;
	align-items: center;
	flex: 1 1 auto;
	min-width: 0;
	margin: 0 0 0 calc(var(--gp-facts-indent) - var(--gp-fact-pad));
	padding: 0;
	overflow: hidden;
	list-style: none;
	font-size: 18px;
	color: var(--gp-text);
}

.gp-listing-card ul.gp-card-facts li {
	margin: 0 0 0 -1px;
	padding: 2px var(--gp-fact-pad);
	list-style: none;
	font-size: inherit;
	white-space: nowrap;
	line-height: 1.5;
	border-left: 1px solid var(--gp-border);
}

.gp-card-media {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	flex: none;
	padding-top: 3px;
	font-size: 14px;
	line-height: 1.3;
}

.gp-listing-card .gp-card-media a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--gp-muted);
	text-decoration: none;
	border: 0;
	box-shadow: none;
	white-space: nowrap;
}

.gp-listing-card .gp-card-media a.gp-card-tour {
	color: var(--gp-accent);
}

.gp-tour-label-short {
	display: none;
}

.gp-listing-card .gp-card-media a:hover,
.gp-listing-card .gp-card-media a:focus {
	text-decoration: underline;
}

.gp-icon {
	display: inline-block;
	width: 15px;
	height: 15px;
	background-color: var(--gp-accent);
	-webkit-mask: var(--gp-icon) center / contain no-repeat;
	mask: var(--gp-icon) center / contain no-repeat;
}

.gp-icon-camera {
	--gp-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M9 3 7.2 5H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-3.2L15 3H9zm3 5a5 5 0 1 1 0 10 5 5 0 0 1 0-10zm0 2.2a2.8 2.8 0 1 0 0 5.6 2.8 2.8 0 0 0 0-5.6z'/%3E%3C/svg%3E");
}

.gp-icon-play {
	--gp-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm-2 4 6 4-6 4z'/%3E%3C/svg%3E");
}

/* MLS + brokerage */

.gp-listing-card p.gp-card-mls {
	margin: 44px 0 0;
	padding: 0;
	color: var(--gp-muted);
	font-size: 17px;
	text-align: center;
}

.gp-card-mls-part {
	white-space: nowrap;
}

.gp-listing-card .gp-sep {
	margin: 0 8px;
	color: var(--gp-border);
}

.gp-listing-card p.gp-card-brokerage {
	margin: 44px 0 0;
	padding: 0;
	color: var(--gp-muted);
	font-size: 13px;
}

/* Tighter gaps for dense grids and sidebars */

.widget .gp-listing-grid,
.gp-listing-grid.gp-cols-4,
.gp-listing-grid.gp-cols-5,
.gp-listing-grid.gp-cols-6 {
	--gp-gap: 20px;
}

/*
 * Compact card. Keyed to the card's own width rather than the column count,
 * because the same column count gives very different card widths depending on
 * the page, theme row width and sidebars.
 */

@container gp-card (max-width: 400px) {
	.gp-card-price {
		font-size: 20px;
	}

	.gp-card-price-amount {
		padding: 10px 14px;
	}

	.gp-card-number {
		min-width: 44px;
		padding: 0 10px;
		font-size: 17px;
	}

	.gp-card-body {
		padding: 20px 18px 18px;
	}

	.gp-card-header {
		gap: 12px;
		margin-bottom: 20px;
	}

	.gp-listing-card a.gp-card-address {
		font-size: 16px;
	}

	.gp-card-stats {
		flex-direction: column;
		gap: 8px;
		margin-top: 18px;
	}

	.gp-listing-card ul.gp-card-facts {
		--gp-facts-indent: 0px;
		--gp-fact-pad: 10px;
		font-size: 15px;
	}

	.gp-card-media {
		gap: 4px;
		padding-top: 2px;
		font-size: 13px;
	}

	.gp-listing-card p.gp-card-mls {
		margin-top: 22px;
		font-size: 15px;
	}

	.gp-listing-card p.gp-card-brokerage {
		margin-top: 16px;
		font-size: 12px;
	}
}

@container gp-card (max-width: 260px) {
	.gp-card-body {
		padding: 16px 14px 14px;
	}

	.gp-listing-card a.gp-card-address {
		font-size: 15px;
	}

	.gp-listing-card ul.gp-card-facts {
		--gp-fact-pad: 8px;
		font-size: 14px;
	}

	.gp-card-header {
		gap: 8px;
	}

	.gp-card-media {
		gap: 3px;
		font-size: 12px;
	}

	.gp-card-media .gp-icon {
		width: 13px;
		height: 13px;
	}

	.gp-tour-label-full {
		display: none;
	}

	.gp-tour-label-short {
		display: inline;
	}

	.gp-card-price {
		font-size: 17px;
	}

	.gp-card-price-amount {
		padding: 10px 12px;
	}

	.gp-card-number {
		min-width: 38px;
		padding: 0 8px;
		font-size: 15px;
	}

	.gp-card-mls-part {
		display: block;
	}

	.gp-listing-card .gp-sep {
		display: none;
	}
}

/* Only truly tiny cards move the photo/tour links below the address. */
@container gp-card (max-width: 200px) {
	.gp-card-header {
		flex-direction: column;
	}

	.gp-card-media {
		flex-direction: row;
		align-items: center;
		gap: 12px;
		padding-top: 0;
	}

	/* Below the address there is room for the full label again. */
	.gp-tour-label-full {
		display: inline;
	}

	.gp-tour-label-short {
		display: none;
	}

	.gp-card-price {
		font-size: 15px;
	}
}

/* Photo-first listing card: IDX results, Featured Listings, local listing grids
   and similar listings. The whole card is
   clickable through the address link. */
.gp-photo-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	background: #fff;
	color: #1f2937;
	border: 1px solid #e5e7eb;
	border-radius: 0.75rem;
	box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
	transition: box-shadow 0.15s ease;
}

.gp-photo-card:hover,
.gp-photo-card:focus-within {
	box-shadow: 0 10px 28px rgb(0 0 0 / 0.12);
}

.gp-photo-card__image {
	position: relative;
	display: block;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	background: #e5e7eb;
}

.gp-photo-card__image img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.gp-photo-card:hover .gp-photo-card__image img {
	transform: scale(1.03);
}

.gp-photo-card__placeholder {
	display: flex; /* centres "Images coming soon" (.gp-no-photos) */
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
}

.gp-photo-card__status,
.gp-photo-card__count {
	position: absolute;
	inset-block-start: 0.75rem;
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	padding: 0.25rem 0.625rem;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
}

.gp-photo-card__status {
	inset-inline-start: 0.75rem;
	background: #fff;
	color: #111;
}

.gp-photo-card__count {
	inset-inline-end: 0.75rem;
	background: rgb(0 0 0 / 0.6);
	color: #fff;
}

.gp-photo-card__count .gp-icon {
	width: 13px;
	height: 13px;
	background-color: currentColor;
}

.gp-photo-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0.875rem 1rem 1rem;
}

.gp-photo-card p.gp-photo-card__price {
	margin: 0;
	padding: 0;
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.2;
	color: #111;
}

.gp-photo-card p.gp-photo-card__facts {
	display: flex;
	flex-wrap: wrap;
	margin: 0;
	padding: 0;
	font-size: 0.9375rem;
	line-height: 1.4;
}

.gp-photo-card__facts span + span::before {
	content: "·";
	margin: 0 0.4em;
	color: #9ca3af;
}

.gp-photo-card h3.gp-photo-card__address {
	margin: 0;
	padding: 0;
	font-size: 0.9375rem;
	font-weight: 400;
	line-height: 1.4;
	color: inherit;
}

.gp-photo-card__address a {
	color: inherit;
	text-decoration: none;
}

.gp-photo-card__address a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.gp-photo-card p.gp-photo-card__mls,
.gp-photo-card p.gp-photo-card__brokerage {
	margin: 0;
	padding: 0;
	font-size: 0.75rem;
	line-height: 1.4;
	color: #6b7280;
}

.gp-photo-card p.gp-photo-card__brokerage {
	margin-block-start: 0.375rem;
}

.gp-photo-card a:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #1d4ed8);
	outline-offset: 2px;
}

/* Above the card-wide address link, so it opens the tour, not the listing. */
.gp-photo-card p.gp-photo-card__tour {
	position: relative;
	z-index: 1;
	margin: 0 0 0.375rem;
	padding: 0;
	font-size: 0.8125rem;
	line-height: 1.4;
}

.gp-photo-card__tour a {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	text-decoration: none;
}

.gp-photo-card__tour a:hover {
	text-decoration: underline;
}
