/*
 * MK Estate property styles. Loaded only on property archives, property
 * taxonomies and single properties. Tokens come from theme.json.
 */

/* ---------- Breadcrumb ---------- */

.breadcrumb {
	padding-block: var(--wp--preset--spacing--30) 0;
}

.breadcrumb__list {
	display: flex;
	/* Always one line; the last crumb truncates when the trail overflows. */
	flex-wrap: nowrap;
	overflow: hidden;
	white-space: nowrap;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.breadcrumb__list li {
	display: flex;
	align-items: center;
	flex: none;
}

/* Separator drawn as a small chevron so it never depends on the font. */
.breadcrumb__list li + li::before {
	content: "";
	display: block;
	flex: none;
	width: 0.4rem;
	height: 0.4rem;
	margin-inline: 0.45rem 0.5rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
}

.breadcrumb__list a {
	color: inherit;
	text-decoration: none;
}

/* Sit the home glyph a touch lower so it lines up with the crumb text. */
.breadcrumb__list a .mkestate-icon {
	margin-block-start: 0.2rem;
}

.breadcrumb__list a:hover,
.breadcrumb__list a:focus-visible {
	color: var(--wp--preset--color--primary);
}

.breadcrumb__list [aria-current] {
	color: var(--wp--preset--color--contrast);
}

.breadcrumb__list li:last-child {
	flex: 0 1 auto;
	min-width: 0;
}

.breadcrumb__list li:last-child span {
	flex: 0 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- Status badge ---------- */

/* Solid primary fill so For Rent / For Sale reads at a glance. */
.property-badge {
	display: inline-block;
	margin: 0;
	padding: 0.4rem 1rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--base);
	background: var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--radius--small);
}

.card .property-badge {
	position: absolute;
	inset-block-start: 0.75rem;
	inset-inline-start: 0.75rem;
	padding: 0.25rem 0.6rem;
	font-size: 0.75rem;
	color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--base);
	box-shadow: 0 2px 8px rgb(0 0 0 / 12%);
}

.card__media {
	position: relative;
}

/* ---------- Hero band ---------- */

.property-hero {
	background: var(--wp--preset--color--surface);
	padding-bottom: var(--wp--preset--spacing--40);
}

.property-hero__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50);
	margin-top: var(--wp--preset--spacing--30);
}

.property-hero__intro {
	flex: 1 1 24rem;
}

/* Price with the status badge stacked beneath it. Right-aligned while the
 * row sits beside the title, left-aligned when it wraps under on phones. */
.property-hero__pricing {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--20);
}

@media (min-width: 720px) {

	.property-hero__pricing {
		align-items: flex-end;
	}
}

.property-hero .entry-title {
	margin-block: var(--wp--preset--spacing--20) 0;
}

.property-hero__location {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin: var(--wp--preset--spacing--20) 0 0;
	color: var(--wp--preset--color--muted);
}

.property-hero__location .mkestate-icon {
	color: var(--wp--preset--color--primary);
}

/* Quotable reference ID, e.g. "ID: MK-1024" — buyers quote it to the
 * agent, and typing it into search jumps to the property. */
.property-id {
	margin: var(--wp--preset--spacing--20) 0 0;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--wp--preset--color--muted);
	font-variant-numeric: tabular-nums;
}

/* Price as a white "tag" chip so it reads as the key fact of the listing. */
.property-price {
	margin: 0;
	padding: 0.5rem 1.25rem;
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--subtle);
	border-radius: var(--wp--custom--radius--medium);
	box-shadow: 0 4px 12px rgb(0 0 0 / 6%);
	white-space: nowrap;
}

/* ---------- Gallery ---------- */

.property-gallery {
	margin-block: var(--wp--preset--spacing--40) 0;
}

.property-gallery__main img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--wp--custom--radius--medium);
	background: var(--wp--preset--color--surface);
}

/* Laptops / short viewports: cap the photo height to what fits on screen
 * (shrinking the width and centering instead of cropping), so the whole
 * photo is visible without scrolling. On tall screens the cap sits above
 * the natural 4:3 height and never applies — those keep the full-width
 * photo exactly as before. */
@media (min-width: 720px) {

	.property-gallery__main img {
		width: min(100%, calc((100vh - 150px) * 4 / 3));
		margin-inline: auto;
	}
}

/* Short screens (laptops): the hero band (breadcrumb, badge, title,
 * price, location) sits above the photo, so on a low viewport it pushes
 * the gallery below the fold and the photo can never fit. Compact the
 * band and deepen the photo cap's headroom so photo + hero share one
 * screen. Tall screens keep the roomy layout untouched. */
@media (min-width: 720px) and (max-height: 900px) {

	.breadcrumb {
		padding-block-start: var(--wp--preset--spacing--20);
	}

	.property-hero {
		padding-bottom: var(--wp--preset--spacing--20);
	}

	.property-hero__row {
		margin-top: var(--wp--preset--spacing--20);
	}

	.property-hero .entry-title {
		font-size: var(--wp--preset--font-size--x-large);
	}

	.property-badge {
		padding: 0.25rem 0.75rem;
	}

	.property-price {
		padding: 0.35rem 1rem;
		font-size: var(--wp--preset--font-size--large);
	}

	.property-gallery {
		margin-block: var(--wp--preset--spacing--20) 0;
	}

	.property-gallery__main img {
		width: min(100%, calc((100vh - 210px) * 4 / 3));
	}
}

.property-gallery__thumbs {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.5rem;
	padding-bottom: 0.25rem;
	padding-top: 0.25rem;
	padding-left: 0.25rem;
	overflow-x: auto;
}

.property-gallery__thumb {
	flex: 0 0 72px;
	border-radius: var(--wp--custom--radius--small);
	opacity: 0.75;
}

.property-gallery__thumb img {
	display: block;
	width: 72px;
	height: 54px;
	object-fit: cover;
	border-radius: var(--wp--custom--radius--small);
}

.property-gallery__thumb:hover,
.property-gallery__thumb:focus-visible {
	opacity: 1;
}

.property-gallery__thumb.is-active {
	opacity: 1;
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 1px;
}

/* ---------- Facts grid ---------- */

/* One card per fact: 2-up on phones, 3-up on tablets, and as many equal
 * columns as fit on desktop so any number of facts fills the row. */
.property-facts {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding: 0;
}

.property-facts__item {
	display: grid;
	grid-template-columns: auto 1fr;
	grid-template-rows: auto auto;
	column-gap: 0.6rem;
	align-items: center;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--medium);
}

@media (min-width: 600px) {

	.property-facts {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 960px) {

	.property-facts {
		grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	}
}

.property-facts__icon {
	grid-row: 1 / span 2;
	align-self: center;
	color: var(--wp--preset--color--primary);
}

.property-facts__icon .mkestate-icon {
	width: 1.5rem;
	height: 1.5rem;
}

.property-facts dt {
	grid-column: 2;
	grid-row: 2;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.property-facts dd {
	grid-column: 2;
	grid-row: 1;
	margin: 0;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

/* ---------- Two-column body (description | contact + location) ---------- */

.property-layout {
	margin-block: var(--wp--preset--spacing--40) 0;
}

@media (min-width: 960px) {

	.property-layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 340px;
		gap: var(--wp--preset--spacing--50);
		align-items: start;
	}

	.property-layout__aside .property-section {
		margin-block: 0 var(--wp--preset--spacing--40);
	}

	/* The contact card follows the reader while the rail is on screen. */
	.property-layout__aside .property-contact {
		position: sticky;
		top: 1rem;
	}

	.property-contact__actions {
		flex-direction: column;
	}

	.property-contact__actions .button {
		width: 100%;
		justify-content: center;
		text-align: center;
	}
}

/* ---------- Sections ---------- */

.property-section {
	margin-block: var(--wp--preset--spacing--40) 0;
}

/* ---------- Features ---------- */

.property-features {
	display: grid;
	gap: 0.375rem 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {

	.property-features {
		grid-template-columns: repeat(2, 1fr);
	}
}

.property-features li::before {
	content: "✓";
	margin-inline-end: 0.5rem;
	color: var(--wp--preset--color--primary);
	font-weight: 700;
}

/* ---------- Contact ---------- */

.property-contact {
	padding: var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--medium);
}

.property-contact__name {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0 0 var(--wp--preset--spacing--20);
	font-weight: 600;
}

.property-contact__name .mkestate-icon {
	color: var(--wp--preset--color--primary);
}

.property-contact__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* Below the aside rail breakpoint the actions stack full-width, so the
 * four buttons (Call / WhatsApp / Email / Quick Inquiry) read as a tidy
 * list instead of an uneven wrap. Desktop keeps its own rules in the
 * 960px block. */
@media (max-width: 959px) {

	.property-contact__actions {
		flex-direction: column;
	}

	.property-contact__actions .button {
		width: 100%;
		justify-content: center;
		text-align: center;
	}
}

/* ---------- Location card ---------- */

.property-location {
	display: flex;
	gap: 0.75rem;
	padding: var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--medium);
}

.property-location__icon {
	flex: none;
	padding-top: 0.15rem;
	color: var(--wp--preset--color--primary);
}

.property-location__icon .mkestate-icon {
	width: 1.25rem;
	height: 1.25rem;
}

.property-location p {
	margin: 0;
}

.property-location p + p {
	margin-top: var(--wp--preset--spacing--20);
}

/* ---------- Property search form ---------- */

.property-search {
	display: grid;
	gap: 0.5rem;
	margin-bottom: var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--medium);
}

.property-search input,
.property-search select {
	width: 100%;
	background-color: var(--wp--preset--color--base);
	/* Reset the color inherited from dark contexts (e.g. the home hero),
	 * otherwise white text sits on this white background. */
	color: var(--wp--preset--color--contrast);
}

.property-search__field--wide {
	grid-column: 1 / -1;
}

@media (min-width: 600px) {

	.property-search {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 960px) {

	.property-search {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* ---------- Icons ---------- */

.mkestate-icon {
	width: 1rem;
	height: 1rem;
	flex: none;
}

/* ---------- Property card bits ---------- */

.property-card__placeholder {
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--wp--preset--color--surface);
}

.property-card__price {
	margin: 0;
	font-weight: 700;
	color: var(--wp--preset--color--primary);
}

.property-card__stats {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.property-card__stats li {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

.property-card__stats li + li {
	border-inline-start: 1px solid var(--wp--preset--color--subtle);
	padding-inline-start: 0.75rem;
}

.property-card__location {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.property-card__location .mkestate-icon {
	color: var(--wp--preset--color--primary);
}

.property-card__id {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.04em;
	color: var(--wp--preset--color--muted);
	font-variant-numeric: tabular-nums;
}