/**
 * [homewood_properties] — the property grids, one per area.
 *
 * A card is a photograph and an address. Properties have no page of their own,
 * so nothing here is a link and nothing responds to a hover.
 *
 * @package homewood_theme
 */

.hw-properties {
	--hw-property-min: clamp(11rem, 17vw, 15rem);
	--hw-property-aspect: 7 / 9;
	--hw-property-radius: 5px;
	--hw-property-gap: 2em;
	--hw-property-bleed: 5em;

	--hw-property-border: var(--wp--preset--color--wheat, #c3a87f);
	--hw-property-rule: var(--wp--preset--color--bronze, #896d44);
	--hw-property-ground: var(--wp--preset--color--sand, #e9e4d4);
	--hw-property-text: var(--wp--preset--color--ink, #252b23);
	--hw-property-house: var(--wp--preset--color--bronze, #896d44);
}

.hw-properties__area + .hw-properties__area {
	margin-top: clamp(2.5rem, 5vw, 4.5rem);
}

.hw-properties__title {
	margin: 0 0 var(--hw-property-gap);
	padding-bottom: clamp(0.5rem, 1.2vw, 1rem);
	border-bottom: 1px solid var(--hw-property-rule);
	color: var(--hw-property-text);
}

/*
 * The grid runs wider than the heading above it, pushing out into the padding
 * of the group it sits in. The area name and the rule under it stay on the
 * measure the rest of the page's text is set to, so the cards read as a band
 * of their own rather than a column of body copy.
 *
 * --hw-property-bleed is how far out, per side. It has to stay smaller than
 * that padding: bleed further than there is room for and the page scrolls
 * sideways.
 */
.hw-properties__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--hw-property-min)), 1fr));
	gap: var(--hw-property-gap);
	margin: 0 calc(var(--hw-property-bleed) * -0.7);
	padding: 0;
	list-style: none;
}
@media (max-width: 1300px) {
	.hw-properties__grid {
		margin: 0;
	}

	/*
	 * Half the space under the area name. Taken from the gap the grid is set
	 * with rather than written out again, and only here: the grid itself keeps
	 * the full gap between its cards.
	 */
	.hw-properties__title {
		margin-bottom: calc(var(--hw-property-gap) / 2);
	}
}

.hw-properties__card {
	margin: 0;
}

/*
 * Border-box, or the 2px border is added on top of the full width and the
 * photo spills past its card (and past the lease card's hover wash).
 */
.hw-properties__photo {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--hw-property-aspect);
	object-fit: cover;
	border: 2px solid var(--hw-property-border);
	border-radius: var(--hw-property-radius);
	background: var(--hw-property-ground);
}

/*
 * No photograph, and no view of the address from the street either. The dashed
 * edge says the picture is missing rather than plain; the house inside says
 * what is missing is a house.
 */
.hw-properties__photo--none {
	display: flex;
	align-items: center;
	justify-content: center;
	border-style: dashed;
	color: var(--hw-property-house);
}

/*
 * Shared with the preview row, which draws the same house: both stylesheets
 * load site wide, and each sets its own --hw-*-house colour for the card it
 * sits in.
 */
.hw-property-house {
	width: 42%;
	height: auto;
	opacity: 0.4;
}

/*
 * The address runs on as one line — street, city, and the note after them —
 * wrapping onto as many lines as it needs. The separators are written into the
 * markup, so there is nothing to set here beyond the type itself.
 */
.hw-properties__address {
	margin-top: 0.75em;
	color: var(--hw-property-text);
	line-height: 1.3;
	text-wrap: pretty;
}

/* -- Narrow --------------------------------------------------------------- */

/*
 * Past the widest sizes the grid stops counting for itself. auto-fill packs in
 * whatever its track minimum allows, which at these widths lands on counts the
 * design does not ask for, so the counts are named.
 *
 * minmax(0, 1fr) rather than the track minimum: a named count has to be free to
 * shrink, or three columns each insisting on their minimum width overflow a
 * screen with no room for them.
 *
 * Widest first, so each narrower one overrides the last.
 */
@media (max-width: 1040px) {
	.hw-properties__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 740px) {
	.hw-properties__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	.hw-properties__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}
