/**
 * Property Listing - front end.
 *
 * Everything is namespaced under .plp-listing and uses 3-class selectors so global
 * theme / Elementor kit / Bricks styles for headings, links, buttons and images can't
 * override it. Layout is driven by CSS custom properties set by the shortcode.
 */

.plp-listing {
	--plp-cols: 3;
	--plp-cols-tablet: 2;
	--plp-cols-mobile: 1;
	--plp-gap: 20px;
	--plp-ratio: 1 / 1;
	--plp-bg: #002060;
	--plp-color: #ffffff;
	--plp-location-color: var(--plp-color);
	--plp-arrow-color: #000000;

	display: block;
	clear: both;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

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

/* ---------- Grid (fully responsive) ---------- */

.plp-listing .plp-grid {
	display: grid;
	grid-template-columns: repeat(var(--plp-cols), minmax(0, 1fr));
	gap: var(--plp-gap);
	margin: 0;
	padding: 0;
	width: 100%;
}

/* Matches the default Elementor (tablet 1024 / mobile 767) breakpoints. */
@media (max-width: 1024px) {
	.plp-listing .plp-grid {
		grid-template-columns: repeat(var(--plp-cols-tablet), minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.plp-listing .plp-grid {
		grid-template-columns: repeat(var(--plp-cols-mobile), minmax(0, 1fr));
	}
}

/* ---------- Card ---------- */

.plp-listing .plp-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	overflow: hidden;
	background: var(--plp-bg);
	color: var(--plp-color);
}

/* ---------- Image area ---------- */

.plp-listing .plp-card .plp-card__media {
	position: relative;
	display: block;
	flex: 0 0 auto;
	width: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	aspect-ratio: var(--plp-ratio);
	background: rgba(255, 255, 255, 0.08);
}

.plp-listing .plp-card .plp-card__imglink {
	position: absolute;
	inset: 0;
	display: block;
	color: inherit;
	text-decoration: none;
	border: 0;
	box-shadow: none;
}

.plp-listing .plp-card .plp-card__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.plp-listing .plp-card--linked:hover .plp-card__img,
.plp-listing .plp-card--popup:hover .plp-card__img {
	transform: scale(1.04);
}

/* Cards that open the popup. */
.plp-listing .plp-card--popup {
	cursor: pointer;
}

/* ---------- Carousel (scroll-snap: swipe works natively, arrows are an enhancement) ---------- */

.plp-listing .plp-card .plp-carousel {
	position: absolute;
	inset: 0;
}

.plp-listing .plp-card .plp-carousel__track {
	display: flex;
	height: 100%;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none;
}

.plp-listing .plp-card .plp-carousel__track::-webkit-scrollbar {
	display: none;
}

.plp-listing .plp-card .plp-carousel__slide {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	/* Clip each slide to its own box: the hover zoom on the image must never bleed
	 * into the neighbouring slide. */
	overflow: hidden;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

/* Arrows: hidden until the script adds .plp-js to <html> (no dead buttons without JS). */
.plp-listing .plp-carousel .plp-carousel__btn {
	display: none;
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 40px;
	height: 56px;
	margin: 0;
	padding: 0;
	transform: translateY(-50%);
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
	color: var(--plp-arrow-color);
	font: inherit;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
}

html.plp-js .plp-listing .plp-carousel .plp-carousel__btn {
	display: flex;
}

.plp-listing .plp-carousel .plp-carousel__btn--prev {
	inset-inline-start: 0;
}

.plp-listing .plp-carousel .plp-carousel__btn--next {
	inset-inline-end: 0;
}

/* Keep builder/theme hover + focus colours from changing the arrows. */
.plp-listing .plp-carousel .plp-carousel__btn:hover,
.plp-listing .plp-carousel .plp-carousel__btn:focus,
.plp-listing .plp-carousel .plp-carousel__btn:active {
	background: transparent;
	color: var(--plp-arrow-color);
	border: 0;
	box-shadow: none;
}

.plp-listing .plp-carousel .plp-carousel__btn:focus-visible {
	outline: 2px solid var(--plp-arrow-color);
	outline-offset: -4px;
}

.plp-listing .plp-carousel .plp-carousel__btn svg {
	display: block;
	width: 26px;
	height: 26px;
	fill: none;
	stroke: currentColor;
	stroke-width: 3.2;
	stroke-linecap: square;
	stroke-linejoin: miter;
	/* A soft light halo keeps the arrows visible on dark photos. */
	filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 1px rgba(255, 255, 255, 0.9));
	pointer-events: none;
}

html[dir="rtl"] .plp-listing .plp-carousel .plp-carousel__btn svg {
	transform: scaleX(-1);
}

/* ---------- Text panel ---------- */

.plp-listing .plp-card .plp-card__body {
	position: relative; /* anchor for the stretched title link */
	flex: 1 1 auto;
	margin: 0;
	padding: 20px 20px 30px;
	background: transparent;
	color: var(--plp-color);
	text-align: start;
}

.plp-listing .plp-card .plp-card__title {
	margin: 0 0 10px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--plp-color);
	font-family: inherit;
	font-size: clamp(1.375rem, 1.1rem + 1.2vw, 2rem);
	font-weight: 700;
	font-style: normal;
	line-height: 1.15;
	letter-spacing: normal;
	text-transform: none;
	text-align: start;
	overflow-wrap: break-word;
}

.plp-listing .plp-card .plp-card__location {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--plp-location-color);
	font-family: inherit;
	font-size: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
	font-weight: 400;
	font-style: normal;
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	overflow-wrap: break-word;
}

/* Popup mode: the title is a real <button> (keyboard + screen reader friendly) that is
 * styled to look like plain heading text. Every state is reset so global theme /
 * Elementor / Bricks button styles can't leak in. */
.plp-listing .plp-card .plp-card__open,
.plp-listing .plp-card .plp-card__open:hover,
.plp-listing .plp-card .plp-card__open:focus,
.plp-listing .plp-card .plp-card__open:active {
	display: inline;
	width: auto;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-align: inherit;
	text-transform: none;
	text-decoration: none;
	overflow-wrap: break-word;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.plp-listing .plp-card .plp-card__open:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 4px;
}

/* Title link covers the whole text panel (no nested interactive elements). */
.plp-listing .plp-card .plp-card__title a,
.plp-listing .plp-card .plp-card__title a:hover,
.plp-listing .plp-card .plp-card__title a:focus,
.plp-listing .plp-card .plp-card__title a:visited,
.plp-listing .plp-card .plp-card__title a:active {
	color: inherit;
	font: inherit;
	text-decoration: none;
	border: 0;
	box-shadow: none;
	background: none;
}

.plp-listing .plp-card .plp-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.plp-listing .plp-card .plp-card__title a:focus-visible {
	outline: none;
}

.plp-listing .plp-card .plp-card__title a:focus-visible::after {
	outline: 3px solid currentColor;
	outline-offset: -3px;
}

/* ---------- Text scales with the CARD width, not the screen ----------
 * A card in a narrow column (sidebar, 4-up grid, small Elementor container) gets
 * smaller text instead of words breaking mid-word. Browsers without container query
 * units simply keep the viewport based sizes above. */
@supports (container-type: inline-size) {
	.plp-listing .plp-card {
		container-type: inline-size;
	}

	.plp-listing .plp-card .plp-card__body {
		padding: clamp(14px, 5.7cqi, 20px) clamp(14px, 5.7cqi, 20px) clamp(20px, 8.5cqi, 30px);
	}

	.plp-listing .plp-card .plp-card__title {
		font-size: clamp(1.2rem, 8.6cqi, 2rem);
	}

	.plp-listing .plp-card .plp-card__location {
		font-size: clamp(0.9rem, 5.1cqi, 1.2rem);
	}
}

/* ---------- Editor hint ---------- */

.plp-empty {
	padding: 12px 16px;
	border: 1px dashed #c3c4c7;
	color: #50575e;
	font-size: 14px;
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
	.plp-listing .plp-card .plp-card__img {
		transition: none;
	}

	.plp-listing .plp-card--linked:hover .plp-card__img,
	.plp-listing .plp-card--popup:hover .plp-card__img {
		transform: none;
	}
}

/* ====================================================================
 * Popup (native <dialog>, appended to <body> by the script)
 * ================================================================== */

.plp-modal {
	--plp-bg: #002060;
	--plp-color: #ffffff;
	--plp-location-color: var(--plp-color);

	box-sizing: border-box;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--plp-color);
	overflow: hidden;
}

.plp-modal *,
.plp-modal *::before,
.plp-modal *::after {
	box-sizing: border-box;
}

/* display:flex ONLY while open, otherwise it would override the closed state. */
.plp-modal[open] {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(8px, 2vw, 24px);
	animation: plp-modal-in 0.2s ease;
}

.plp-modal::backdrop {
	background: rgba(0, 10, 30, 0.82);
}

@keyframes plp-modal-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

.plp-modal .plp-modal__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(100%, 1180px);
	max-height: 100%;
	overflow-x: hidden;
	overflow-y: auto;
	background: var(--plp-bg);
	color: var(--plp-color);
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.plp-modal .plp-modal__panel:focus {
	outline: none;
}

.plp-modal svg {
	display: block;
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.6;
	stroke-linecap: round;
	stroke-linejoin: round;
	pointer-events: none;
}

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

.plp-modal .plp-modal__media {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: #0b0b0b;
}

.plp-modal .plp-modal__stage {
	position: relative;
	flex: 0 0 auto;
	height: 52vh;
	min-height: 240px;
	overflow: hidden;
}

.plp-modal .plp-modal__track {
	display: flex;
	height: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.plp-modal .plp-modal__track::-webkit-scrollbar {
	display: none;
}

.plp-modal .plp-modal__slide {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

/* Spinner until the picture has arrived (slides are filled in by frontend.js). */
.plp-modal .plp-modal__slide:not([data-plp-state="loaded"]):not([data-plp-state="error"])::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: plp-spin 0.8s linear infinite;
	pointer-events: none;
}

@keyframes plp-spin {
	to {
		transform: rotate(360deg);
	}
}

.plp-modal .plp-modal__fail {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 24px;
	color: #fff;
	font-size: 15px;
	line-height: 1.4;
	text-align: center;
	opacity: 0.85;
}

.plp-modal .plp-modal__slide .plp-modal__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: contain; /* show the WHOLE picture in the popup */
}

/* Buttons: every state is reset so theme / builder button styles can't leak in. */
.plp-modal .plp-modal__close,
.plp-modal .plp-modal__nav,
.plp-modal .plp-modal__thumb {
	margin: 0;
	font: inherit;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	box-shadow: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
}

.plp-modal .plp-modal__close,
.plp-modal .plp-modal__close:hover,
.plp-modal .plp-modal__close:focus,
.plp-modal .plp-modal__close:active,
.plp-modal .plp-modal__nav,
.plp-modal .plp-modal__nav:hover,
.plp-modal .plp-modal__nav:focus,
.plp-modal .plp-modal__nav:active {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #ffffff;
}

.plp-modal .plp-modal__close:hover,
.plp-modal .plp-modal__nav:hover {
	background: rgba(0, 0, 0, 0.82);
}

.plp-modal .plp-modal__close:focus-visible,
.plp-modal .plp-modal__nav:focus-visible,
.plp-modal .plp-modal__thumb:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.plp-modal .plp-modal__close {
	position: absolute;
	top: 10px;
	inset-inline-end: 10px;
	z-index: 6;
	width: 44px;
	height: 44px;
}

.plp-modal .plp-modal__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 46px;
	height: 46px;
	transform: translateY(-50%);
}

.plp-modal .plp-modal__nav--prev {
	inset-inline-start: 12px;
}

.plp-modal .plp-modal__nav--next {
	inset-inline-end: 12px;
}

html[dir="rtl"] .plp-modal .plp-modal__nav svg {
	transform: scaleX(-1);
}

.plp-modal .plp-modal__count {
	position: absolute;
	bottom: 12px;
	inset-inline-start: 12px;
	z-index: 3;
	padding: 4px 11px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.62);
	color: #ffffff;
	font-size: 0.8rem;
	line-height: 1.4;
}

.plp-modal .plp-modal__thumbs {
	position: relative; /* offsetParent for centring the active thumbnail */
	display: flex;
	gap: 8px;
	padding: 10px;
	overflow-x: auto;
	overflow-y: hidden;
	background: #000000;
	scrollbar-width: thin;
}

.plp-modal .plp-modal__thumb,
.plp-modal .plp-modal__thumb:hover,
.plp-modal .plp-modal__thumb:focus,
.plp-modal .plp-modal__thumb:active {
	flex: 0 0 auto;
	display: block;
	width: 72px;
	height: 54px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 0;
	background: #222222;
	color: #ffffff;
	opacity: 0.6;
	overflow: hidden;
}

.plp-modal .plp-modal__thumb:hover {
	opacity: 0.9;
}

.plp-modal .plp-modal__thumb.is-active {
	border-color: #ffffff;
	opacity: 1;
}

.plp-modal .plp-modal__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
}

/* ---- Details ---- */

.plp-modal .plp-modal__body {
	flex: 1 1 auto;
	min-width: 0;
	padding: 24px 24px 32px;
	color: var(--plp-color);
	text-align: start;
}

.plp-modal .plp-modal__title {
	margin: 0 0 10px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--plp-color);
	font-family: inherit;
	font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
	font-weight: 700;
	font-style: normal;
	line-height: 1.15;
	letter-spacing: normal;
	text-transform: none;
	overflow-wrap: break-word;
}

.plp-modal .plp-modal__location {
	margin: 0;
	padding: 0;
	color: var(--plp-location-color);
	font-size: 1.15rem;
	line-height: 1.4;
}

.plp-modal .plp-modal__desc {
	margin: 18px 0 0;
	color: var(--plp-color);
	font-size: 1rem;
	line-height: 1.65;
	overflow-wrap: break-word;
}

.plp-modal .plp-modal__desc p {
	margin: 0 0 1em;
	color: inherit;
}

.plp-modal .plp-modal__desc p:last-child {
	margin-bottom: 0;
}

.plp-modal .plp-modal__cta,
.plp-modal .plp-modal__cta:hover,
.plp-modal .plp-modal__cta:focus,
.plp-modal .plp-modal__cta:visited,
.plp-modal .plp-modal__cta:active {
	display: inline-block;
	margin: 24px 0 0;
	padding: 12px 24px;
	border: 0;
	border-radius: 0;
	background: var(--plp-color);
	color: var(--plp-bg);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	box-shadow: none;
}

.plp-modal .plp-modal__cta:hover {
	opacity: 0.88;
}

.plp-modal .plp-modal__cta:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

/* ---- Variants ---- */

.plp-modal.plp-modal--single .plp-modal__nav,
.plp-modal.plp-modal--single .plp-modal__thumbs,
.plp-modal.plp-modal--single .plp-modal__count,
.plp-modal.plp-modal--noimg .plp-modal__media {
	display: none;
}

.plp-modal.plp-modal--noimg .plp-modal__panel {
	width: min(100%, 560px);
}

/* ---- Desktop: image left, details right ---- */

@media (min-width: 900px) {
	.plp-modal .plp-modal__panel {
		flex-direction: row;
		max-height: min(100%, 860px);
		overflow: hidden;
	}

	.plp-modal .plp-modal__media {
		flex: 1 1 62%;
	}

	.plp-modal .plp-modal__stage {
		height: min(72vh, 700px);
	}

	.plp-modal .plp-modal__body {
		flex: 0 0 38%;
		max-width: 38%;
		padding: 64px 28px 32px;
		overflow-y: auto;
	}

	.plp-modal.plp-modal--noimg .plp-modal__body {
		flex: 1 1 auto;
		max-width: none;
	}
}

/* Placed last so it wins over the popup's own animation rule. */
@media (prefers-reduced-motion: reduce) {
	.plp-modal[open] {
		animation: none;
	}

	.plp-modal .plp-modal__slide::after {
		animation: none;
	}
}
