/* Project Gallery — frontend styles */

.cpg-gallery-wrap {
	--cpg-accent: #c8703f;
	--cpg-dark: #1a1a1a;
	--cpg-muted: #8a8a8a;
	--cpg-pill-bg: #f2f1ec;
	box-sizing: border-box;
	font-family: 'Mulish', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.cpg-gallery-wrap *,
.cpg-gallery-wrap *::before,
.cpg-gallery-wrap *::after {
	box-sizing: border-box;
}

/* Header */
.cpg-gallery-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 32px;
}

.cpg-eyebrow {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.12em;
	color: var(--cpg-accent);
}

.cpg-heading {
	margin: 0;
	font-family: 'Libre Baskerville', Georgia, "Times New Roman", serif;
	font-size: clamp(28px, 4vw, 40px);
	font-weight: 700;
	color: var(--cpg-dark);
	line-height: 1.15;
}

.cpg-heading-accent {
	color: var(--cpg-accent);
}

/* Filters */
.cpg-filters {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	background: var(--cpg-pill-bg);
	padding: 6px;
	border-radius: 999px;
}

.cpg-filter-btn {
	appearance: none;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 10px 20px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: #444;
	border-radius: 999px;
	transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
	white-space: nowrap;
}

.cpg-filter-btn:hover {
	color: var(--cpg-dark);
}

.cpg-filter-btn.is-active {
	background: #fff;
	color: var(--cpg-accent);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Bento-style grid: fixed row height, 6-column base track.
   JS assigns each item a span-4 (hero) or span-2 (standard) in a repeating
   4,2,2,2 pattern, and grid-auto-flow: dense backfills any gaps so items
   never leave an empty hole. */
.cpg-grid {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	grid-auto-rows: 500px;
	grid-auto-flow: row dense;
	gap: 16px;
}


@media (max-width: 900px) {
	.cpg-grid {
		grid-template-columns: repeat(4, 1fr);
		grid-auto-rows: 220px;
	}
	.cpg-item {
		grid-column: span 2 !important;
	}
}

@media (max-width: 560px) {
	.cpg-grid {
		grid-template-columns: 1fr;
		grid-auto-rows: 260px;
	}
	.cpg-item {
		grid-column: span 1 !important;
	}
}

.cpg-item {
	grid-column: span 2; /* default/fallback; JS assigns the real 4 vs 2 pattern */
	height: 100%;
	opacity: 1;
	transform: scale(1);
	transition: opacity 0.28s ease, transform 0.28s ease;
}

/* Step 1: fade + shrink out (still in the flow, so nothing jumps yet) */
.cpg-item.cpg-item-fading-out {
	opacity: 0;
	transform: scale(0.96);
	pointer-events: none;
}

/* Step 2: fully removed from layout once the fade-out finishes */
.cpg-item.cpg-item-hidden {
	display: none;
}

/* Step 3: items entering start invisible, then transition to visible on the next frame */
.cpg-item.cpg-item-fading-in {
	opacity: 0;
	transform: scale(0.96);
}

@media (prefers-reduced-motion: reduce) {
	.cpg-item {
		transition: none;
	}
}

.cpg-item-inner {
	position: relative;
	height: 100%;
	overflow: hidden;
	border-radius: 10px;
	background: #eee;
}

.cpg-item-img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.cpg-item-inner:hover .cpg-item-img {
	transform: scale(1.04);
}

.cpg-item-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 40px 20px 20px;
    background: linear-gradient(to top, rgb(0 0 0), rgba(0, 0, 0, 0));
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 2px;
    backdrop-filter: blur(1px);
}

.cpg-item-inner:hover .cpg-item-overlay {
	opacity: 1;
	transform: translateY(0);
}

.cpg-item-title {
	font-size: 14px;
	font-weight: 700;
}

.cpg-item-cat {
	font-size: 14px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #fff;
	font-weight: 600;
}

.cpg-empty {
	color: var(--cpg-muted);
	font-style: italic;
}

/* Lightbox trigger button (wraps each grid image) */
.cpg-lightbox-trigger {
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	border: none;
	background: none;
	cursor: zoom-in;
	appearance: none;
	position: relative;
}

/* Lightbox overlay */
.cpg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cpg-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.cpg-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 10, 0.88);
}

.cpg-lightbox-content {
	position: relative;
	z-index: 1;
	max-width: min(92vw, 1100px);
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.cpg-lightbox-img {
	max-width: 100%;
	max-height: 78vh;
	width: auto;
	height: auto;
	border-radius: 4px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	opacity: 0;
	transform: scale(0.97);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.cpg-lightbox.is-open .cpg-lightbox-img.is-loaded {
	opacity: 1;
	transform: scale(1);
}

.cpg-lightbox-caption {
	margin-top: 14px;
	text-align: center;
	color: #fff;
}

.cpg-lightbox-title {
	display: block;
	font-size: 15px;
	font-weight: 700;
}

.cpg-lightbox-cat {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--cpg-accent);
	font-weight: 600;
}

.cpg-lightbox-close,
.cpg-lightbox-prev,
.cpg-lightbox-next {
	appearance: none;
	border: none;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease;
}

.cpg-lightbox-close:hover,
.cpg-lightbox-prev:hover,
.cpg-lightbox-next:hover {
	background: rgba(255, 255, 255, 0.24);
}

.cpg-lightbox-close {
	position: absolute;
	top: -46px;
	right: 0;
	width: 36px;
	height: 36px;
	font-size: 24px;
	line-height: 1;
}

.cpg-lightbox-prev,
.cpg-lightbox-next {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	width: 46px;
	height: 46px;
	font-size: 26px;
}

.cpg-lightbox-prev {
	left: 24px;
}

.cpg-lightbox-next {
	right: 24px;
}

@media (max-width: 640px) {
	.cpg-lightbox-prev {
		left: 8px;
	}
	.cpg-lightbox-next {
		right: 8px;
	}
	.cpg-lightbox-close {
		top: -40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cpg-lightbox,
	.cpg-lightbox-img {
		transition: none;
	}
}
