/* Easy Photo Album: album grid and lightbox. */

.epa-album {
	display: grid;
	grid-template-columns: repeat(var(--epa-columns, 3), minmax(0, 1fr));
	gap: var(--epa-gap, 1em);
	align-items: start;
	/* !important because themes style lists inside the content area. */
	margin: 0 0 1.5em !important;
	padding: 0 !important;
	list-style: none !important;
}

.epa-album > .epa-image {
	min-width: 0;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
	text-align: center;
}

.epa-album > .epa-image::before {
	content: none;
}

.epa-album .epa-image a {
	display: block;
}

.epa-album .epa-image img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
}

.epa-album .epa-title {
	display: block;
	margin-top: 0.4em;
	overflow: hidden;
	font-size: 0.875em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media (max-width: 600px) {
	.epa-album {
		grid-template-columns: repeat(var(--epa-columns-small, 2), minmax(0, 1fr));
	}
}

/* Lightbox */

.epa-lightbox-open {
	overflow: hidden;
}

.epa-lightbox {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 3.5rem 4rem 1rem;
	overflow: auto;
	border: 0;
	background: transparent;
	color: #fff;
}

.epa-lightbox[open] {
	display: flex;
	flex-direction: column;
}

.epa-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.9);
}

.epa-lightbox__figure {
	margin: auto;
	text-align: center;
}

.epa-lightbox__image {
	display: block;
	max-width: none;
	height: auto;
	margin: 0 auto;
	transition: opacity 0.2s ease;
}

.epa-lightbox--scaled .epa-lightbox__image {
	width: auto;
	max-width: 100%;
	max-height: calc(100vh - 8rem);
	max-height: calc(100dvh - 8rem);
	object-fit: contain;
}

.epa-lightbox.is-loading .epa-lightbox__image {
	opacity: 0.25;
}

.epa-lightbox__caption {
	max-width: 60em;
	margin: 0.75rem auto 0;
	font-size: 0.95rem;
	line-height: 1.4;
}

.epa-lightbox__counter {
	margin: 0.25rem 0 0;
	font-size: 0.85rem;
	text-align: center;
	opacity: 0.75;
}

.epa-lightbox__button {
	position: fixed;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	font: 400 2rem/1 sans-serif;
	cursor: pointer;
}

.epa-lightbox__button:hover,
.epa-lightbox__button:focus-visible {
	background: rgba(255, 255, 255, 0.3);
	color: #fff;
}

.epa-lightbox__button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.epa-lightbox__button[hidden] {
	display: none;
}

.epa-lightbox__close {
	top: 0.75rem;
	right: 0.75rem;
}

.epa-lightbox__prev,
.epa-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
}

.epa-lightbox__prev {
	left: 0.75rem;
}

.epa-lightbox__next {
	right: 0.75rem;
}

@media (max-width: 600px) {
	.epa-lightbox {
		padding: 3.5rem 0.5rem 4.5rem;
	}

	.epa-lightbox--scaled .epa-lightbox__image {
		max-height: calc(100vh - 11rem);
		max-height: calc(100dvh - 11rem);
	}

	.epa-lightbox__prev,
	.epa-lightbox__next {
		top: auto;
		bottom: 0.75rem;
		transform: none;
	}
}

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