/*
	Image gallery + lightbox (replaces Unite Gallery)
	Each item carries its image size as --w / --h so rows can be justified with plain CSS.
*/
.image-gallery {
	--gallery-row-height: 110px;
	--gallery-gap: 6px;
	display: flex;
	flex-wrap: wrap;
	gap: var(--gallery-gap);
}

/* stops the last row from stretching to full width */
.image-gallery::after {
	content: "";
	flex-grow: 999999;
}

.image-gallery__item {
	--w: 4;
	--h: 3;
	position: relative;
	display: block;
	flex-grow: calc(var(--w) / var(--h) * 100);
	flex-basis: calc(var(--w) / var(--h) * var(--gallery-row-height));
	aspect-ratio: var(--w) / var(--h);
	overflow: hidden;
	border-radius: 10px;
	background: #e9e9e9;
}

.image-gallery__item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .4s ease;
}

.image-gallery__item::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--color-primary, #FFC412);
	opacity: 0;
	transition: opacity .3s ease;
}

.image-gallery__item:hover img,
.image-gallery__item:focus-visible img {
	transform: scale(1.06);
}
.image-gallery__item:hover::after,
.image-gallery__item:focus-visible::after {
	opacity: .35;
}
.image-gallery__item:focus-visible {
	outline: 3px solid var(--color-primary-2, #535353);
	outline-offset: 2px;
}

@media (max-width: 575.98px) {
	.image-gallery {
		--gallery-row-height: 90px;
		--gallery-gap: 5px;
	}
}

/* Lightbox */
.image-lightbox-open,
.image-lightbox-open body {
	overflow: hidden;
}

.image-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .88);
	touch-action: pan-y;
}
.image-lightbox[hidden] {
	display: none;
}

.image-lightbox__figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 56px 64px 48px;
}

.image-lightbox__img {
	max-width: 100%;
	max-height: 100%;
	min-height: 0;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
	transition: opacity .2s ease;
}
.image-lightbox.is-loading .image-lightbox__img {
	opacity: .3;
}

.image-lightbox__caption {
	margin-top: 12px;
	color: #f1f1f1;
	font-size: 15px;
	text-align: center;
}

.image-lightbox__counter {
	position: absolute;
	top: 16px;
	left: 20px;
	color: #ddd;
	font-size: 14px;
}

.image-lightbox__btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	cursor: pointer;
	transition: background-color .2s ease;
}
.image-lightbox__btn svg {
	width: 28px;
	height: 28px;
	fill: currentColor;
}
.image-lightbox__btn:hover {
	background: rgba(255, 255, 255, .25);
}
.image-lightbox__btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}
.image-lightbox__btn[hidden] {
	display: none;
}
.image-lightbox__close {
	top: 10px;
	right: 12px;
}
.image-lightbox__prev,
.image-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
}
.image-lightbox__prev { left: 10px; }
.image-lightbox__next { right: 10px; }

@media (max-width: 575.98px) {
	.image-lightbox__figure {
		padding: 56px 8px 72px;
	}
	.image-lightbox__prev,
	.image-lightbox__next {
		top: auto;
		bottom: 12px;
		transform: none;
	}
}
