/**
 * FG Project Card — orientation-aware grid
 * Adapts layout to hero image orientation; minimizes ugly cropping.
 */

/* ─── ELEMENTOR LIGHTBOX FIX (global) ──────────────────────────────
   Default Elementor lightbox lets portrait images overflow viewport
   so caption + bottom of image get cut off. This forces images to
   fit within (viewport - header - caption) bounds. */
.elementor-lightbox .swiper-zoom-container,
.elementor-lightbox .swiper-slide {
	max-width: 100vw;
	max-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.elementor-lightbox .elementor-lightbox-image,
.elementor-lightbox .swiper-zoom-container > img,
.elementor-lightbox .swiper-slide > img {
	max-width: 92vw !important;
	max-height: calc(100vh - 130px) !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain !important;
	margin: 0 auto !important;
}

/* Title/caption stretches full width at bottom */
.elementor-lightbox .elementor-slideshow__title,
.elementor-lightbox .elementor-slideshow__description,
.elementor-lightbox-image-title,
.elementor-lightbox .elementor-slideshow__footer {
	position: absolute !important;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	margin: 0;
	padding: 18px 24px;
	background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .55) 60%, rgba(0, 0, 0, .75) 100%);
	color: #fff;
	text-align: center;
	z-index: 5;
	border-radius: 0;
	font-size: 15px;
	letter-spacing: .02em;
}

@media (max-width: 640px) {
	.elementor-lightbox .elementor-lightbox-image,
	.elementor-lightbox .swiper-zoom-container > img,
	.elementor-lightbox .swiper-slide > img {
		max-width: 96vw !important;
		max-height: calc(100vh - 110px) !important;
	}
}


.fg-project-card {
	--fg-grid-max-h: 620px;
	--fg-radius: 4px;
	--fg-gap: 8px;
	margin: 0 0 60px;
}

.fg-project-card *,
.fg-project-card *::before,
.fg-project-card *::after {
	box-sizing: border-box;
}

/* ─── GRID BASE ──────────────────────────────────────────────────── */
.fg-project-grid {
	display: grid;
	gap: var(--fg-gap);
	width: 100%;
	max-height: var(--fg-grid-max-h);
}

.fg-project-cell {
	display: block;
	overflow: hidden;
	position: relative;
	background: #f0ede8;
	transition: transform .5s ease, box-shadow .5s ease;
	will-change: transform;
	min-height: 0; /* allow flex/grid children to shrink */
	min-width: 0;
}

.fg-project-cell img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center center;
	display: block;
	transition: transform .8s cubic-bezier(.2,.8,.2,1), filter .5s ease;
}

.fg-project-cell:hover img {
	transform: scale(1.04);
	filter: brightness(1.03);
}

.fg-project-cell::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.18));
	opacity: 0;
	transition: opacity .4s ease;
	pointer-events: none;
}

.fg-project-cell:hover::after { opacity: 1; }

/* ─── LAYOUT: SINGLE (1 image) ───────────────────────────────────── */
/* Aspect ratio comes from the image's own ratio — no crop. */
.fg-project-grid--single {
	grid-template-columns: 1fr;
}
.fg-project-grid--single .fg-project-cell {
	aspect-ratio: var(--fg-img-ratio, 1.5);
	max-height: var(--fg-grid-max-h);
	width: auto;
	max-width: 100%;
	margin: 0 auto;
}

/* ─── LAYOUT: MOSAIC (2 images, same orientation) ────────────────── */
.fg-project-grid--mosaic {
	grid-template-columns: 1.6fr 1fr;
	aspect-ratio: 16 / 9;
}
.fg-project-card--hero-portrait .fg-project-grid--mosaic {
	grid-template-columns: 1fr 1.4fr;
	aspect-ratio: 4 / 5;
}

/* ─── LAYOUT: MOSAIC EQUAL (2 images, mixed orientation) ─────────── */
.fg-project-grid--mosaic-equal {
	grid-template-columns: 1fr 1fr;
	aspect-ratio: 16 / 8;
}
.fg-project-card--hero-portrait .fg-project-grid--mosaic-equal {
	aspect-ratio: 5 / 4;
}

/* ─── LAYOUT: HERO + SIDE (3 images, landscape hero) ─────────────── */
.fg-project-grid--hero-side {
	grid-template-columns: 1.6fr 1fr;
	grid-template-rows: 1fr 1fr;
	aspect-ratio: 16 / 9;
}
.fg-project-grid--hero-side .fg-project-cell--hero {
	grid-row: 1 / 3;
}

/* ─── LAYOUT: HERO PORTRAIT + 2 LANDSCAPE STACKED ────────────────── */
/* Hero is portrait → narrower hero column, taller overall grid. */
.fg-project-grid--hero-side-portrait {
	grid-template-columns: 1fr 1.5fr;
	grid-template-rows: 1fr 1fr;
	aspect-ratio: 5 / 4;
}
.fg-project-grid--hero-side-portrait .fg-project-cell--hero {
	grid-row: 1 / 3;
}

/* ─── LAYOUT: TRIPTYCH (3 portraits in a row) ────────────────────── */
.fg-project-grid--triptych {
	grid-template-columns: 1fr 1fr 1fr;
	aspect-ratio: 9 / 6;
}
.fg-project-grid--triptych .fg-project-cell {
	aspect-ratio: 3 / 4;
}

/* ─── LAYOUT: MASONRY (4+ images) ────────────────────────────────── */
.fg-project-grid--masonry {
	grid-template-columns: 2fr 1fr 1fr;
	grid-template-rows: 1fr 1fr;
	aspect-ratio: 16 / 9;
}
.fg-project-grid--masonry .fg-project-cell--hero {
	grid-column: 1 / 2;
	grid-row: 1 / 3;
}
.fg-project-card--hero-portrait .fg-project-grid--masonry {
	aspect-ratio: 4 / 3;
}

/* ─── PER-CELL ORIENTATION HINTS ─────────────────────────────────── */
/* Portrait images placed in any cell get a slight downward bias on
   focus point (sky/horizons usually at top, not bottom). */
.fg-project-cell--portrait img { object-position: center 35%; }
.fg-project-cell--landscape img { object-position: center center; }
.fg-project-cell--square img { object-position: center center; }

/* ─── CONTAIN MODE: full image visible ───────────────────────────── */
.fg-project-cell img[style*="object-fit: contain"],
.fg-project-cell--contain img {
	object-fit: contain;
}

/* ─── META (title + description) ─────────────────────────────────── */
.fg-project-meta {
	margin-top: 28px;
	max-width: 720px;
}
.fg-project-card--text-above .fg-project-meta {
	margin-top: 0;
	margin-bottom: 28px;
}

.fg-project-title {
	margin: 0 0 14px;
	font-size: 36px;
	font-weight: 500;
	letter-spacing: -.01em;
	line-height: 1.15;
	position: relative;
	padding-bottom: 14px;
}
.fg-project-title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 36px;
	height: 2px;
	background: currentColor;
	opacity: .6;
}

.fg-project-desc {
	margin: 0;
	font-size: 16px;
	line-height: 1.65;
	font-weight: 400;
}

/* ─── SPLIT (text right of grid) ─────────────────────────────────── */
.fg-project-split {
	display: grid;
	grid-template-columns: 1.4fr 1fr;
	gap: 48px;
	align-items: center;
}
.fg-project-card--text-right .fg-project-meta {
	margin-top: 0;
	max-width: none;
}

/* ─── EMPTY STATE ────────────────────────────────────────────────── */
.fg-project-empty {
	padding: 40px;
	border: 2px dashed #cfd6d3;
	background: #f8faf7;
	color: #7e8a85;
	text-align: center;
	border-radius: 4px;
	font-size: 14px;
}

/* ─── RESPONSIVE: TABLET ─────────────────────────────────────────── */
@media (max-width: 1024px) {
	.fg-project-card { --fg-grid-max-h: 480px; }

	.fg-project-grid--masonry {
		grid-template-columns: 1.6fr 1fr;
		grid-template-rows: 1fr 1fr;
	}
	.fg-project-grid--masonry .fg-project-cell:nth-child(n+4) { display: none; }

	.fg-project-split {
		grid-template-columns: 1fr;
		gap: 28px;
	}

	.fg-project-title { font-size: 30px; }
}

/* ─── RESPONSIVE: MOBILE ─────────────────────────────────────────── */
@media (max-width: 640px) {
	.fg-project-card {
		--fg-grid-max-h: none;
		--fg-gap: 6px;
		margin-bottom: 44px;
	}

	/* Reset all complex grids on mobile to a 2-col with hero spanning. */
	.fg-project-grid {
		max-height: none;
		aspect-ratio: auto !important;
		grid-template-columns: 1fr 1fr !important;
		grid-template-rows: auto !important;
		grid-auto-rows: 1fr;
	}

	.fg-project-grid .fg-project-cell {
		grid-column: auto !important;
		grid-row: auto !important;
		aspect-ratio: 4 / 3;
	}

	.fg-project-grid--single .fg-project-cell {
		grid-column: 1 / -1 !important;
		aspect-ratio: var(--fg-img-ratio, 1.5);
	}

	.fg-project-grid--triptych {
		grid-template-columns: 1fr 1fr 1fr !important;
	}
	.fg-project-grid--triptych .fg-project-cell { aspect-ratio: 3 / 4; }

	/* Hero spans full width when portrait — preserves vertical composition. */
	.fg-project-card--hero-portrait .fg-project-grid:not(.fg-project-grid--triptych) .fg-project-cell--hero {
		grid-column: 1 / -1 !important;
		aspect-ratio: 4 / 5;
	}
	/* Landscape hero spans full width too on narrow screens. */
	.fg-project-card--hero-landscape .fg-project-grid:not(.fg-project-grid--triptych) .fg-project-cell--hero {
		grid-column: 1 / -1 !important;
		aspect-ratio: 16 / 11;
	}

	.fg-project-meta { margin-top: 22px; max-width: none; }
	.fg-project-title { font-size: 26px; padding-bottom: 12px; margin-bottom: 12px; }
	.fg-project-desc { font-size: 15px; }
}