/* ============================================================
 * Projects Grid for Elementor — Frontend Styles
 *
 * Architecture:
 *   - Square cards in a clean grid. Each card shows the project
 *     image (slideshow) + always-visible title and location at
 *     the bottom over a gradient.
 *   - No hover behavior on the card body.
 *   - Click the "Explore" button → opens a popup modal with
 *     image (slideshow) on the left and full details on the right.
 * ============================================================ */

.pge-wrap {
	width: 100%;
}

.pge-heading {
	letter-spacing: 0.18em;
	text-transform: uppercase;
	margin: 0 0 48px;
}

/* ---------- Grid ---------- */
.pge-grid {
	--pge-img-split: 50%;
	--pge-accent: #c9b48b;

	display: grid;
	grid-template-columns: repeat(var(--pge-cols, 3), minmax(0, 1fr));
	gap: 24px;
	align-items: start;
}

.pge-empty {
	grid-column: 1 / -1;
	padding: 48px;
	text-align: center;
	border: 1px dashed rgba(0, 0, 0, 0.15);
	border-radius: 8px;
	color: #6b6157;
}

/* ---------- Card ---------- */
.pge-card {
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	background: #fff;
	aspect-ratio: 1 / 1;
	outline: none;
}

/* ---------- Slideshow ---------- */
.pge-slides {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.pge-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity var(--pge-fade, 600ms) ease;
	will-change: opacity;
}

.pge-slide.is-active { opacity: 1; }

.pge-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pge-slide-placeholder {
	background: linear-gradient(135deg, #ece6dc, #d8cfc1);
	display: grid;
	place-items: center;
	color: #8a7e6f;
	font-size: 13px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

/* Ken Burns subtle zoom on the active slide */
.pge-grid[data-kenburns="1"] .pge-slide.is-active img {
	animation: pge-kenburns 8s ease-in-out infinite alternate;
}

@keyframes pge-kenburns {
	from { transform: scale(1.02) translate(0, 0); }
	to   { transform: scale(1.10) translate(-2%, -1%); }
}

/* ---------- Idle overlay (gradient at bottom for legibility) ---------- */
.pge-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.55) 25%, rgba(0, 0, 0, 0.15) 50%, rgba(0, 0, 0, 0) 70%);
	pointer-events: none;
	z-index: 1;
}

/* ---------- Idle title + location (ALWAYS visible, sits above the button) ---------- */
.pge-idle {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 70px; /* leaves room for the Explore link below */
	padding: 0 26px;
	z-index: 2;
	color: #fff;
	pointer-events: none;
}

.pge-idle-sub {
	font-size: 11px;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	opacity: 0.85;
	margin-bottom: 8px;
	font-weight: 500;
}

.pge-idle-title {
	font-size: 22px;
	line-height: 1.18;
	font-weight: 600;
	margin: 0;
	letter-spacing: -0.005em;
}

.pge-idle-location {
	margin-top: 8px;
	font-size: 13px;
	opacity: 0.92;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	letter-spacing: 0.02em;
}

.pge-pin {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--pge-accent);
	display: inline-block;
	flex-shrink: 0;
}

/* ---------- Explore button (text-only link, no background, no shadow) ----------
 * Hardened against theme button styles. Themes commonly set
 *   body button { background: #fff; padding: 10px 20px; box-shadow: ...; ... }
 * so we use !important on the critical visual properties.
 */
.pge-card .pge-explore,
.pge-card .pge-explore[type="button"] {
	position: absolute;
	left: 26px;
	bottom: 26px;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
	height: auto !important;
	min-height: 0 !important;
	padding: 4px 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	color: #fff;
	font-size: 15px;
	font-weight: 400;
	letter-spacing: 0.01em;
	text-transform: none;
	text-decoration: none;
	cursor: pointer;
	font-family: inherit;
	box-shadow: none !important;
	text-shadow: none !important;
	transition: opacity 220ms ease, transform 280ms cubic-bezier(.22, 1, .36, 1);
	-webkit-tap-highlight-color: transparent;
	white-space: nowrap;
	line-height: 1.3;
}

.pge-card .pge-explore .pge-explore-text {
	border-bottom: 1px solid currentColor;
	padding-bottom: 2px;
	transition: border-color 220ms ease;
}

.pge-card .pge-explore:hover,
.pge-card .pge-explore:focus-visible {
	color: #fff;
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	transform: translateX(4px);
	outline: none;
}

.pge-card .pge-explore:hover .pge-explore-text,
.pge-card .pge-explore:focus-visible .pge-explore-text {
	border-bottom-color: var(--pge-accent);
}

.pge-card .pge-explore .pge-arrow {
	width: 8px;
	height: 8px;
	display: inline-block;
	border-right: 1.2px solid currentColor;
	border-top: 1.2px solid currentColor;
	transform: rotate(45deg);
	margin-left: 2px;
	flex-shrink: 0;
}

/* ============================================================
 * Modal Popup
 *
 * IMPORTANT: The modal is appended to <body>, so it lives OUTSIDE
 * the Elementor widget wrapper. Theme CSS targeting `body button`
 * or generic `.elementor button` rules can apply here. We use
 * extra specificity + `all: revert` resets on buttons inside the
 * modal to neutralize theme styles.
 * ============================================================ */

.pge-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(15, 18, 22, 0);
	visibility: hidden;
	pointer-events: none;
	transition:
		background 320ms ease,
		visibility 0s linear 320ms;
}

/* Neutralize theme button styles for ALL buttons inside the modal.
 * Using `:where()` keeps specificity at 0 so our targeted rules below
 * still win, but the reset itself is enough to undo most theme CSS. */
.pge-modal :where(button) {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	font-family: inherit;
	-webkit-tap-highlight-color: transparent;
}

.pge-modal.is-open {
	background: rgba(15, 18, 22, 0.78);
	visibility: visible;
	pointer-events: auto;
	transition:
		background 320ms ease,
		visibility 0s linear 0s;
}

.pge-modal-dialog {
	position: relative;
	width: 100%;
	max-width: 1100px;
	max-height: calc(100vh - 48px);
	background: #f6f3ee;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
	transform: scale(0.94) translateY(20px);
	opacity: 0;
	transition:
		transform 380ms cubic-bezier(.22, 1, .36, 1),
		opacity 280ms ease;
	display: flex;
	flex-direction: column;
}

.pge-modal.is-open .pge-modal-dialog {
	transform: scale(1) translateY(0);
	opacity: 1;
}

.pge-modal-inner {
	display: grid;
	grid-template-columns: var(--pge-img-split, 50%) 1fr;
	min-height: 520px;
	flex: 1 1 auto;
	min-height: 0;
}

.pge-modal[data-image-position="right"] .pge-modal-inner {
	grid-template-columns: 1fr var(--pge-img-split, 50%);
}

/* ---------- Modal: image side ---------- */
.pge-modal .pge-m-image {
	position: relative;
	overflow: hidden;
	background: #1a1a1a;
	min-height: 520px;
}

.pge-modal[data-image-position="right"] .pge-m-image {
	order: 2;
}

.pge-modal .pge-m-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	transition: opacity var(--pge-fade, 600ms) ease;
}
.pge-modal .pge-m-slide.is-active { opacity: 1; }
.pge-modal .pge-m-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	max-width: none;  /* override theme img max-width if any */
}

/* Ken Burns on modal active slide */
.pge-modal[data-kenburns="1"] .pge-m-slide.is-active img {
	animation: pge-kenburns 10s ease-in-out infinite alternate;
}

/* Slide indicator dots — hardened against theme button styles */
.pge-modal .pge-m-dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 20px;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	z-index: 5;
	pointer-events: none; /* container itself shouldn't catch clicks */
}

.pge-modal .pge-m-dot {
	display: inline-block;
	width: 8px;
	min-width: 8px;
	max-width: 8px;
	height: 8px;
	min-height: 8px;
	max-height: 8px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.45);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	pointer-events: auto;
	transition: background 220ms ease, transform 220ms ease;
	flex: 0 0 8px; /* prevent flex stretching */
	font-size: 0; /* nullify any inherited line-height */
	line-height: 0;
}

.pge-modal .pge-m-dot:hover {
	background: rgba(255, 255, 255, 0.75);
}

.pge-modal .pge-m-dot.is-active {
	background: #fff;
	transform: scale(1.4);
}

/* ---------- Modal: details side ---------- */
.pge-m-details {
	position: relative;
	padding: 56px 64px 56px 56px;
	overflow-y: auto;
	color: #3d3a36;
	max-height: calc(100vh - 48px);
}

.pge-modal[data-image-position="right"] .pge-m-details {
	order: 1;
	padding: 56px 56px 56px 64px;
}

.pge-m-details::-webkit-scrollbar { width: 6px; }
.pge-m-details::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.18);
	border-radius: 6px;
}

/* Close button (top-right of dialog) — hardened against theme styles */
.pge-modal .pge-m-close {
	position: absolute;
	top: 20px;
	right: 20px;
	display: grid;
	place-items: center;
	width: 40px;
	min-width: 40px;
	max-width: 40px;
	height: 40px;
	min-height: 40px;
	max-height: 40px;
	padding: 0;
	margin: 0;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.65);
	cursor: pointer;
	z-index: 10;
	color: #1a1a1a;
	font-size: 0;
	line-height: 0;
	transition: background 200ms ease, transform 200ms ease;
}

.pge-modal .pge-m-close:hover {
	background: #fff;
	transform: rotate(90deg);
}

.pge-modal .pge-m-close::before,
.pge-modal .pge-m-close::after {
	content: "";
	position: absolute;
	width: 16px;
	height: 1.5px;
	background: currentColor;
	display: block;
}
.pge-modal .pge-m-close::before { transform: rotate(45deg);  }
.pge-modal .pge-m-close::after  { transform: rotate(-45deg); }

.pge-m-sub {
	font-size: 11px;
	letter-spacing: 0.26em;
	text-transform: uppercase;
	color: var(--pge-accent);
	margin-bottom: 6px;
	font-weight: 600;
}

.pge-m-title {
	font-size: 34px;
	line-height: 1.1;
	margin: 0 0 10px;
	color: #1a1a1a;
	font-weight: 600;
	padding-right: 50px;
	letter-spacing: -0.01em;
}

.pge-m-meta {
	font-size: 13px;
	color: #6b6157;
}

.pge-m-location {
	margin-bottom: 28px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.pge-m-location::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--pge-accent);
	display: inline-block;
}

.pge-m-block + .pge-m-block { margin-top: 24px; }

.pge-m-label {
	font-size: 11px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--pge-accent);
	margin-bottom: 10px;
	position: relative;
	padding-left: 26px;
	font-weight: 600;
}
.pge-m-label::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 18px;
	height: 1px;
	background: var(--pge-accent);
}

.pge-m-body {
	font-size: 15px;
	line-height: 1.75;
	color: #3d3a36;
}

.pge-m-body p { margin: 0 0 0.8em; }
.pge-m-body p:last-child { margin-bottom: 0; }

/* Scroll lock helper applied to <body> when modal is open */
body.pge-modal-open {
	overflow: hidden;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
	.pge-modal { padding: 0; }

	.pge-modal-dialog {
		max-width: 100%;
		max-height: 100vh;
		height: 100vh;
		border-radius: 0;
	}

	.pge-modal-inner {
		grid-template-columns: 1fr !important;
		grid-template-rows: 38vh 1fr;
		min-height: 100vh;
		max-height: 100vh;
	}

	.pge-m-image {
		min-height: 0;
		grid-row: 1;
	}
	.pge-modal[data-image-position="right"] .pge-m-image { order: 1; grid-row: 1; }

	.pge-m-details {
		padding: 32px 24px;
		grid-row: 2;
		max-height: 62vh;
	}
	.pge-modal[data-image-position="right"] .pge-m-details { order: 2; padding: 32px 24px; }

	.pge-m-title { font-size: 26px; padding-right: 50px; }
	.pge-m-close {
		top: 12px;
		right: 12px;
		background: rgba(255, 255, 255, 0.94);
	}
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.pge-card,
	.pge-slide,
	.pge-overlay,
	.pge-explore,
	.pge-modal,
	.pge-modal-dialog,
	.pge-m-slide {
		transition-duration: 0ms !important;
		animation: none !important;
	}
}
