/* ==========================================================================
   Photo gallery + lightbox
   Used on: Home, Photos & Videos.
   ========================================================================== */

/* ---------- Gallery + lightbox ---------- */

/* Mosaic grid: every 5th photo is large, every 3rd is tall — dense packing fills the gaps. */
.gallery__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-auto-rows: 150px;
	grid-auto-flow: dense;
	gap: 12px;
}

@media (min-width: 700px) {
	.gallery__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		grid-auto-rows: 190px;
	}
}

@media (min-width: 1040px) {
	.gallery__grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		grid-auto-rows: 210px;
		gap: 16px;
	}
}

.gallery__item {
	position: relative;
	margin: 0;
	border-radius: var(--radius);
	overflow: hidden;
}

.gallery__item:nth-child(5n + 1) {
	grid-column: span 2;
	grid-row: span 2;
}

.gallery__item:nth-child(5n + 3),
.gallery__item:nth-child(5n + 4) {
	grid-row: span 2;
}

.gallery__item.is-hidden {
	display: none;
}

.gallery__item a {
	display: block;
	position: relative;
	height: 100%;
}

.gallery__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 1s var(--ease), filter 0.6s;
}

.gallery__item a::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, transparent 40%, rgba(15, 36, 29, 0.6));
	opacity: 0;
	transition: opacity 0.5s var(--ease);
}

.gallery__item:hover img {
	transform: scale(1.06);
}

.gallery__item:hover a::after {
	opacity: 1;
}

.gallery__zoom {
	position: absolute;
	right: 14px;
	bottom: 14px;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	color: var(--ink);
	opacity: 0;
	transform: translateY(10px) scale(0.8);
	transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.gallery__item:hover .gallery__zoom,
.gallery__item a:focus-visible .gallery__zoom {
	opacity: 1;
	transform: none;
}

.lightbox {
	position: fixed;
	inset: 0;
	z-index: 500;
	display: grid;
	place-items: center;
	padding: 60px 16px;
	background: rgba(10, 24, 19, 0.94);
	opacity: 0;
	transition: opacity 0.35s var(--ease);
}

.lightbox.is-open {
	opacity: 1;
}

.lightbox[hidden] {
	display: none;
}

.lightbox__figure {
	margin: 0;
	text-align: center;
}

.lightbox__figure img {
	max-width: min(1200px, 100%);
	max-height: 78vh;
	margin: 0 auto;
	border-radius: 14px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
	animation: zoomIn 0.45s var(--ease);
}

.lightbox__figure figcaption {
	margin-top: 14px;
	color: rgba(255, 255, 255, 0.8);
	font-size: var(--fs-sm);
}

@keyframes zoomIn {
	from { opacity: 0; transform: scale(0.94); }
	to { opacity: 1; transform: none; }
}

.lightbox__close,
.lightbox__nav {
	position: absolute;
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	transition: background-color 0.3s;
}

.lightbox__close:hover,
.lightbox__nav:hover {
	background: rgba(255, 255, 255, 0.2);
}

.lightbox__close {
	top: 16px;
	right: 16px;
}

.lightbox__nav--prev {
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
}

.lightbox__nav--next {
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 640px) {
	.lightbox__nav {
		top: auto;
		bottom: 16px;
		transform: none;
	}
}
