/*
 * Agency Core front-end styles. Mobile first, no framework, uses the theme's
 * colours when the theme defines them (theme.json presets), plain fallbacks otherwise.
 * Loaded only on pages that contain one of the blocks.
 */
:where(.agency-search, .agency-results, .agency-facts, .agency-gallery, .agency-contact, .agency-media, .agency-call, .agency-details, .agency-location, .agency-side-card) {
	--agency-brand: var(--wp--preset--color--brand, #00856a);
	--agency-brand-dark: var(--wp--preset--color--brand-dark, #006652);
	--agency-text: var(--wp--preset--color--text, #2c3e50);
	--agency-soft: var(--wp--preset--color--accent-4, #5d6d7e);
	--agency-muted: var(--wp--preset--color--muted, #f4f6f6);
	--agency-line: var(--wp--preset--color--accent-6, #d5dbdf);
	--agency-accent: var(--wp--preset--color--highlight, #8db500);
	--agency-radius: 12px;
	--agency-shadow: 0 1px 2px rgba(16, 40, 34, .06), 0 8px 24px rgba(16, 40, 34, .08);
	box-sizing: border-box;
}
:where(.agency-search, .agency-results, .agency-facts, .agency-gallery, .agency-contact, .agency-details) *,
:where(.agency-search, .agency-results, .agency-facts, .agency-gallery, .agency-contact, .agency-details) *::before,
:where(.agency-search, .agency-results, .agency-facts, .agency-gallery, .agency-contact, .agency-details) *::after { box-sizing: inherit; }
.agency-icon { flex: none; width: 1.15em; height: 1.15em; }

/* ---------- search form ---------- */
.agency-search {
	display: grid;
	grid-template-columns: 1fr;
	gap: .75rem;
	padding: 1rem;
	text-align: left;
	background: var(--wp--preset--color--base, #fff);
	color: var(--agency-text);
	border-radius: var(--agency-radius);
	box-shadow: var(--agency-shadow);
}
.agency-search__field { display: flex; flex-direction: column; gap: .3rem; position: relative; min-width: 0; }
.agency-search label { font-size: .8125rem; font-weight: 600; color: var(--agency-text); }
.agency-search input[type="text"],
.agency-search select {
	width: 100%;
	min-height: 48px;           /* tap target */
	padding: .5rem .75rem;
	font: inherit;
	font-size: 16px;            /* no zoom on iOS focus */
	color: inherit;
	background-color: #fff;
	border: 1px solid #b8c2c8;
	border-radius: 8px;
}
/* same look for selects in every browser (Safari draws its own small grey ones) */
.agency-search select {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 2.25rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6d7e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right .6rem center;
	background-size: 18px;
}
.agency-search input:focus-visible,
.agency-search select:focus-visible { outline: 3px solid var(--agency-brand); outline-offset: 1px; border-color: var(--agency-brand); }
.agency-search__submit { display: flex; align-items: end; }
.agency-search__submit button { width: 100%; min-height: 48px; padding-inline: 1.75rem; cursor: pointer; border-radius: 8px; }
.agency-search__credit { grid-column: 1 / -1; margin: 0; font-size: .75rem; color: var(--agency-soft); }
.agency-search__suggest {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 50;
	margin: 2px 0 0;
	padding: 0;
	list-style: none;
	max-height: 60vh;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #b8c2c8;
	border-radius: 8px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
}
.agency-search__suggest li { padding: .75rem; cursor: pointer; min-height: 44px; }
.agency-search__suggest li.is-active,
.agency-search__suggest li:hover { background: var(--agency-muted); }
@media (min-width: 700px) {
	.agency-search { grid-template-columns: repeat(2, 1fr); padding: 1.25rem; }
	.agency-search__place { grid-column: 1 / -1; }
}
@media (min-width: 1000px) {
	.agency-search { grid-template-columns: 2fr repeat(5, minmax(0, 1fr)) auto; }
	.agency-search__place { grid-column: auto; }
	.agency-search.is-compact { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)) auto; }
}

/* ---------- results grid + cards ---------- */
.agency-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 600px) { .agency-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .agency-grid { grid-template-columns: repeat(3, 1fr); } }
.agency-results__group { margin: 2rem 0 1rem; font-size: 1.25rem; }
.agency-results__count, .agency-results__note { margin: 0 0 1rem; color: var(--agency-soft); }
.agency-results__empty { padding: 2rem; text-align: center; background: var(--agency-muted); border-radius: var(--agency-radius); }
.agency-card {
	background: #fff;
	border: 1px solid var(--agency-line);
	border-radius: var(--agency-radius);
	overflow: hidden;
	transition: box-shadow .2s ease, transform .2s ease;
}
.agency-card:hover { box-shadow: var(--agency-shadow); transform: translateY(-2px); }
.agency-card__link { display: flex; flex-direction: column; color: inherit; text-decoration: none; height: 100%; }
.agency-card__link:focus-visible { outline: 3px solid var(--agency-brand); outline-offset: 2px; }
.agency-card__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--agency-muted); }
.agency-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.agency-card:hover .agency-card__media img { transform: scale(1.04); }
.agency-card__noimg { width: 100%; height: 100%; }
.agency-card__body { display: flex; flex-direction: column; flex: 1; padding: 1rem 1.125rem 1.125rem; }
.agency-card__price { order: 3; margin: auto 0 0; padding-top: .75rem; font-size: 1.25rem; font-weight: 700; color: var(--agency-brand); }
.agency-card__title { margin: 0 0 .35rem; font-size: 1.0625rem; font-weight: 700; line-height: 1.35; color: var(--agency-text); }
.agency-card__where { display: flex; align-items: center; gap: .35rem; margin: 0 0 .75rem; font-size: .875rem; color: var(--agency-soft); }
.agency-card__facts {
	display: flex;
	flex-wrap: wrap;
	gap: .35rem 1.1rem;
	margin: 0;
	padding: .75rem 0 0;
	list-style: none;
	font-size: .875rem;
	border-top: 1px solid var(--agency-line);
}
.agency-card__facts li { display: inline-flex; align-items: center; gap: .4rem; }
.agency-card__facts li::before {
	content: "";
	width: 18px;
	height: 18px;
	background: var(--agency-brand);
	-webkit-mask: var(--agency-i) center / contain no-repeat;
	mask: var(--agency-i) center / contain no-repeat;
}
.agency-card__facts .is-area { --agency-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'/%3E%3C/svg%3E"); }
.agency-card__facts .is-beds { --agency-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 19V6M3 14h18v5M21 14v-1a3 3 0 0 0-3-3h-7v4'/%3E%3Ccircle cx='7' cy='11' r='1.5'/%3E%3C/svg%3E"); }
.agency-card__facts .is-baths { --agency-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16v3a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5zM6 12V6a2 2 0 0 1 4 0M7 20l-1 2M17 20l1 2'/%3E%3C/svg%3E"); }
.agency-badge {
	display: inline-flex;
	align-items: center;
	padding: .25rem .65rem;
	font-size: .75rem;
	font-weight: 700;
	letter-spacing: .02em;
	line-height: 1.3;
	color: #fff;
	background: var(--agency-brand);
	border-radius: 999px;
}
.agency-card .agency-badge { position: absolute; top: .75rem; left: .75rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.agency-badge.is-soft { color: var(--agency-text); background: var(--agency-muted); margin-left: .5rem; }
.agency-pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; padding: 0; margin: 2.5rem 0 0; list-style: none; }
.agency-pagination a, .agency-pagination span { display: inline-block; min-width: 44px; min-height: 44px; padding: .6rem .8rem; text-align: center; border: 1px solid var(--agency-line); border-radius: 8px; text-decoration: none; }
.agency-pagination .current { background: var(--agency-brand); border-color: var(--agency-brand); color: #fff; }

/* ---------- property page: gallery ---------- */
.agency-gallery__stage { position: relative; border-radius: var(--agency-radius); overflow: hidden; background: var(--agency-muted); }
.agency-gallery__track {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;     /* no grey bar under the photo (Safari/Firefox) */
}
.agency-gallery__track::-webkit-scrollbar { display: none; }
.agency-gallery__track:focus-visible { outline: 3px solid var(--agency-brand); outline-offset: -3px; }
.agency-gallery__item { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 4 / 3; }
.agency-gallery__item a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.agency-gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (min-width: 782px) {
	.agency-gallery__item { aspect-ratio: auto; height: min(62vh, 600px); }
}
.agency-gallery__count {
	position: absolute;
	right: .75rem;
	bottom: .75rem;
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .3rem .7rem;
	font-size: .8125rem;
	font-weight: 600;
	color: #fff;
	background: rgba(17, 24, 39, .65);
	border-radius: 999px;
	pointer-events: none;
}
.agency-gallery__nav {
	position: absolute;
	top: 50%;
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	padding: 0;
	color: var(--agency-text);
	background: rgba(255, 255, 255, .92);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
	cursor: pointer;
}
.agency-gallery.is-ready .agency-gallery__nav { display: inline-flex; }
.agency-gallery__nav[hidden] { display: none !important; }
.agency-gallery__nav.is-prev { left: .75rem; }
.agency-gallery__nav.is-next { right: .75rem; }
.agency-gallery__nav:disabled { opacity: 0; pointer-events: none; }
.agency-gallery__nav:focus-visible { outline: 3px solid var(--agency-brand); outline-offset: 2px; }
.agency-gallery__thumbs { display: none; }
@media (min-width: 782px) {
	.agency-gallery__thumbs {
		display: flex;
		gap: .5rem;
		margin: .5rem 0 0;
		padding: 0 0 .25rem;
		list-style: none;
		overflow-x: auto;
		scrollbar-width: thin;
	}
}
.agency-gallery__thumb {
	display: block;
	width: 96px;
	height: 72px;
	padding: 0;
	overflow: hidden;
	background: var(--agency-muted);
	border: 2px solid transparent;
	border-radius: 8px;
	opacity: .7;
	cursor: pointer;
}
.agency-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agency-gallery__thumb:hover, .agency-gallery__thumb[aria-current="true"] { opacity: 1; border-color: var(--agency-brand); }

/* zoom: the photo big on the same page (gallery.js builds the <dialog>) */
.agency-zoom {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(10, 20, 18, .94);
	overflow: hidden;
}
.agency-zoom:not([open]) { display: none; }
.agency-zoom::backdrop { background: rgba(10, 20, 18, .94); }
.agency-zoom__img {
	position: absolute;
	inset: 3.5rem .5rem;
	width: calc(100% - 1rem);
	height: calc(100% - 7rem);
	object-fit: contain;
	pointer-events: none;
}
.agency-zoom__count { position: absolute; left: 0; right: 0; bottom: 1rem; text-align: center; color: #fff; font-size: .9375rem; font-weight: 600; pointer-events: none; }
.agency-zoom__btn {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0 0 4px;
	font: inherit;
	font-size: 2rem;
	line-height: 1;
	color: #fff;
	background: rgba(255, 255, 255, .16);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}
.agency-zoom__btn:hover { background: rgba(255, 255, 255, .3); }
.agency-zoom__btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.agency-zoom__btn.is-close { top: .5rem; right: .5rem; }
.agency-zoom__btn.is-prev { left: .5rem; top: calc(50% - 24px); }
.agency-zoom__btn.is-next { right: .5rem; top: calc(50% - 24px); }

/* ---------- property page: title line, facts card ---------- */
.agency-location { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0; color: var(--agency-soft); font-size: .9375rem; }
.agency-location__where { display: inline-flex; align-items: center; gap: .35rem; color: var(--agency-text); font-weight: 500; }
.agency-location__ref { font-size: .8125rem; }

.agency-side-card {
	padding: 1.25rem;
	background: #fff;
	border: 1px solid var(--agency-line);
	border-radius: var(--agency-radius);
	box-shadow: var(--agency-shadow);
}
@media (min-width: 782px) {
	.agency-side-card { position: sticky; top: 96px; padding: 1.5rem; }
	.admin-bar .agency-side-card { top: 128px; }
}
/* the badge is already under the title */
.agency-side-card .agency-facts__badges > .agency-badge:not(.is-soft) { display: none; }
.agency-side-card .agency-facts__badges:not(:has(.is-soft)) { display: none; }
.agency-side-card .agency-contact { margin-top: 1.25rem; }

.agency-facts__price { margin: 0; font-size: clamp(1.625rem, 3vw, 2rem); font-weight: 700; line-height: 1.2; color: var(--agency-brand); }
.agency-facts__badges { margin: .5rem 0 0; }
.agency-facts__list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; margin: 1rem 0 0; }
.agency-facts__row { padding: .6rem 0; border-top: 1px solid var(--agency-line); min-width: 0; }
.agency-facts__row dt { font-size: .75rem; letter-spacing: .02em; color: var(--agency-soft); }
.agency-facts__row dd { margin: .1rem 0 0; font-weight: 600; overflow-wrap: break-word; }
.agency-facts__subtitle { margin: 1.25rem 0 .5rem; font-size: 1rem; }
.agency-facts__features { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; font-size: .875rem; }
.agency-facts__features li { padding: .25rem .7rem; background: var(--agency-muted); border-radius: 999px; }
.agency-facts__features li::before { content: "✓ "; color: var(--agency-brand); font-weight: 700; }

.agency-single-text { font-size: 1.0625rem; line-height: 1.7; }
.agency-single-text > :first-child { margin-top: 0; }

.agency-tour { margin-top: 1.5rem; }
.agency-tour__frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--agency-radius); }
.agency-video { margin-top: 1.5rem; }
.agency-video iframe { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: var(--agency-radius); }

/* ---------- contact buttons ---------- */
.agency-contact { display: flex; flex-wrap: wrap; gap: .5rem; }
.agency-contact__btn {
	flex: 1 1 8.5rem;          /* wraps to two rows when three do not fit */
	min-width: 0;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .45rem;
	min-height: 48px;
	padding: .5rem .875rem;
	font-weight: 600;
	text-decoration: none;
	color: #fff;
	background: var(--agency-brand);
	border: 2px solid transparent;
	border-radius: 8px;
	transition: background-color .15s ease, color .15s ease;
}
.agency-contact__btn:hover { color: #fff; background: var(--agency-brand-dark); }
.agency-contact__btn.is-wa { background: #1a7f4b; }   /* 4.9:1 with white */
.agency-contact__btn.is-wa:hover { background: #136a3e; }
.agency-contact__btn.is-mail { color: var(--agency-text); background: transparent; border-color: var(--agency-line); }
.agency-contact__btn.is-mail:hover { color: var(--agency-brand); border-color: var(--agency-brand); background: transparent; }
.agency-contact__btn:focus-visible { outline: 3px solid var(--agency-accent); outline-offset: 2px; }
/* in the side card: Call full width on top, WhatsApp + Email below */
.agency-side-card .agency-contact__btn.is-call { flex-basis: 100%; }
@media (max-width: 781px) {
	.agency-contact.is-sticky {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 100;
		flex-wrap: nowrap;
		margin: 0 !important;
		padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom));
		background: #fff;
		border-top: 1px solid var(--agency-line);
		box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
	}
	.agency-contact.is-sticky .agency-contact__btn,
	.agency-side-card .agency-contact.is-sticky .agency-contact__btn.is-call { flex: 1 1 0; }
	.agency-contact.is-sticky .agency-contact__btn { min-height: 46px; padding-inline: .5rem; font-size: .9375rem; }
	body:has(.agency-contact.is-sticky) { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* header call button: number on wide screens, round icon on phones */
.agency-call {
	display: inline-flex;
	align-items: center;
	gap: .45rem;
	min-height: 40px;
	padding: .35rem 1rem;
	font-size: .9375rem;
	font-weight: 600;
	white-space: nowrap;
	text-decoration: none;
	color: #fff;
	background: var(--agency-brand);
	border-radius: 999px;
}
.agency-call:hover { color: #fff; background: var(--agency-brand-dark); }
@media (max-width: 599px) {
	.agency-call { width: 44px; height: 44px; padding: 0; justify-content: center; }
	.agency-call__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* contact details as text (footer) */
.agency-details { font-style: normal; }
.agency-details ul { margin: 0; padding: 0; list-style: none; }
.agency-details li { display: flex; align-items: flex-start; gap: .6rem; margin: 0 0 .6rem; font-size: .9375rem; }
.agency-details .agency-icon { margin-top: .2em; opacity: .8; }

@media (prefers-reduced-motion: no-preference) {
	.agency-gallery__track { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
	.agency-card, .agency-card__media img { transition: none; }
	.agency-card:hover, .agency-card:hover .agency-card__media img { transform: none; }
}

/* property page: on phones the price/facts come right after the title */
@media (max-width: 781px) {
	.agency-single-cols .agency-single-side { order: -1; }
}
