/*
 * Mark Alberts R2 Gallery
 * Full-width justified gallery with custom lightbox.
 */

/* Gallery layout */

.map-r2-gallery {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	width: 100%;
	margin: 0;
	padding: 0;
	gap: 0;
	line-height: 0;
	overflow: hidden;
}

.map-r2-gallery__item {
	position: relative;
	display: block;
	flex-grow: 1;
	flex-shrink: 1;
	margin: 0;
	padding: 0;
	border: 0;
	overflow: hidden;
	text-decoration: none;
	background: #111;
}

.map-r2-gallery__item img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	object-fit: cover;
	transition:
		transform 250ms ease,
		opacity 200ms ease;
}

.map-r2-gallery__item:hover img {
	transform: scale(1.012);
}

.map-r2-gallery--calculating {
	visibility: hidden;
}

/* Gallery error message */

.map-r2-gallery-error {
	padding: 1rem;
	background: #f5f5f5;
	line-height: 1.5;
}

/* Custom R2 gallery lightbox */

html.map-r2-lightbox-open {
	overflow: hidden;
}

.map-r2-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.88);
	line-height: normal;
}

.map-r2-lightbox__image-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 24px 80px;
	cursor: zoom-out;
}

.map-r2-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 48px);
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
	opacity: 1;
	transition: opacity 150ms ease;
	cursor: default;
}

.map-r2-lightbox__image--loading {
	opacity: 0;
}

.map-r2-lightbox__close,
.map-r2-lightbox__arrow {
	position: fixed;
	z-index: 2;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #fff;
	font-family: Arial, sans-serif;
	cursor: pointer;
	opacity: 0.8;
	transition: opacity 150ms ease;
}

.map-r2-lightbox__close:hover,
.map-r2-lightbox__arrow:hover {
	opacity: 1;
}

.map-r2-lightbox__close {
	top: 10px;
	right: 18px;
	width: 44px;
	height: 44px;
	font-size: 40px;
	font-weight: 300;
	line-height: 40px;
}

.map-r2-lightbox__arrow {
	top: 50%;
	width: 64px;
	height: 90px;
	font-size: 48px;
	line-height: 90px;
	transform: translateY(-50%);
}

.map-r2-lightbox__arrow--previous {
	left: 6px;
}

.map-r2-lightbox__arrow--next {
	right: 6px;
}

.map-r2-lightbox__counter {
	position: fixed;
	right: 18px;
	bottom: 12px;
	z-index: 2;
	color: #fff;
	font-size: 12px;
	opacity: 0.8;
}

/* Mobile lightbox adjustments */

@media (max-width: 549px) {
	.map-r2-lightbox__image-wrapper {
		padding: 48px 42px;
	}

	.map-r2-lightbox__arrow {
		width: 42px;
		font-size: 34px;
	}

	.map-r2-lightbox__arrow--previous {
		left: 0;
	}

	.map-r2-lightbox__arrow--next {
		right: 0;
	}
}