/* elmur Gallery — frontend styles */

.elmur-gallery {
	margin: 0 0 1.5rem;
}

.elmur-gallery__item {
	margin: 0;
	position: relative;
}

.elmur-gallery__trigger {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: zoom-in;
	position: relative;
	line-height: 0;
}

.elmur-gallery__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 6px;
}

/* ---------------------------------------------------------------------------
   Captions
   --------------------------------------------------------------------------- */

.elmur-gallery__caption {
	font-size: 0.95rem;
	line-height: 1.4;
}

.elmur-gallery__caption--overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 0.5rem 0.75rem;
	background: rgba(26, 26, 26, 0.65);
	color: #ffffff;
	text-align: left;
	border-radius: 0 0 6px 6px;
}

.elmur-gallery__caption--below {
	display: block;
	padding: 0.5rem 0.75rem;
	background: var(--color-primary, #2d2d2d);
	color: var(--color-on-primary, #ffffff);
	border-radius: 0 0 6px 6px;
}

.elmur-gallery--caption-below .elmur-gallery__img {
	border-radius: 6px 6px 0 0;
}

/* ---------------------------------------------------------------------------
   Grid layout
   --------------------------------------------------------------------------- */

.elmur-gallery__grid {
	display: grid;
	gap: 1rem;
}

.elmur-gallery--cols-2 .elmur-gallery__grid {
	grid-template-columns: repeat(2, 1fr);
}

.elmur-gallery--cols-3 .elmur-gallery__grid {
	grid-template-columns: repeat(3, 1fr);
}

.elmur-gallery--cols-4 .elmur-gallery__grid {
	grid-template-columns: repeat(4, 1fr);
}

.elmur-gallery--grid .elmur-gallery__img {
	aspect-ratio: 4 / 3;
}

@media (max-width: 48.875rem) {
	.elmur-gallery--cols-3 .elmur-gallery__grid,
	.elmur-gallery--cols-4 .elmur-gallery__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 30rem) {
	.elmur-gallery__grid {
		grid-template-columns: 1fr !important;
	}
}

/* ---------------------------------------------------------------------------
   Slider layout
   --------------------------------------------------------------------------- */

.elmur-gallery__stage {
	position: relative;
}

.elmur-gallery--slider .elmur-gallery__item {
	display: none;
}

.elmur-gallery--slider .elmur-gallery__item.is-current {
	display: block;
}

.elmur-gallery--slider .elmur-gallery__img {
	aspect-ratio: 3 / 2;
}

.elmur-gallery__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	border-radius: 50%;
	background: rgba(26, 26, 26, 0.55);
	color: #ffffff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.elmur-gallery__nav:hover {
	background: var(--color-accent);
}

.elmur-gallery__nav--prev {
	left: 0.75rem;
}

.elmur-gallery__nav--next {
	right: 0.75rem;
}

.elmur-gallery__thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

.elmur-gallery__thumb {
	padding: 0;
	border: 2px solid transparent;
	border-radius: 4px;
	background: none;
	cursor: pointer;
	line-height: 0;
	overflow: hidden;
}

.elmur-gallery__thumb img {
	width: 4rem;
	height: 3rem;
	object-fit: cover;
	display: block;
	border-radius: 2px;
	opacity: 0.7;
	transition: opacity 0.2s ease;
}

.elmur-gallery__thumb:hover img {
	opacity: 1;
}

.elmur-gallery__thumb.is-current {
	border-color: var(--color-accent);
}

.elmur-gallery__thumb.is-current img {
	opacity: 1;
}

/* ---------------------------------------------------------------------------
   Lightbox
   --------------------------------------------------------------------------- */

.elmur-gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.elmur-gallery-lightbox[hidden] {
	display: none;
}

.elmur-gallery-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.9);
}

.elmur-gallery-lightbox__figure {
	position: relative;
	z-index: 1;
	margin: 0;
	max-width: 90vw;
	max-height: 90vh;
	text-align: center;
}

.elmur-gallery-lightbox__img {
	max-width: 90vw;
	max-height: 82vh;
	display: block;
	margin: 0 auto;
	border-radius: 4px;
}

.elmur-gallery-lightbox__caption {
	color: #ffffff;
	padding: 0.75rem 0.5rem 0;
	font-size: 1rem;
}

.elmur-gallery-lightbox__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	z-index: 2;
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #ffffff;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.elmur-gallery-lightbox__close:hover {
	background: var(--color-accent);
}

.elmur-gallery-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #ffffff;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.elmur-gallery-lightbox__nav:hover {
	background: var(--color-accent);
}

.elmur-gallery-lightbox__nav--prev {
	left: 1rem;
}

.elmur-gallery-lightbox__nav--next {
	right: 1rem;
}

body.elmur-gallery-lightbox-open {
	overflow: hidden;
}
