/*
 * Minimal photo lightbox.
 *
 * Kept in its own file rather than appended to photo-gallery.css, because that
 * stylesheet is the Photo Showcase plugin's, carried over unchanged so the grid keeps
 * matching the live site pixel for pixel. Mixing new rules into it would make the next
 * comparison against production harder to read.
 *
 * The tiles themselves are already clickable and already have a hover state; nothing
 * here touches the grid.
 */

/* Stop the page behind from scrolling while the lightbox is open. Fixing the body is
   what keeps iOS from scrolling the page under the overlay; the script stores and
   restores the scroll position around it. */
body.dr-lb-open {
	position: fixed;
	width: 100%;
	overflow: hidden;
}

.dr-lb {
	position: fixed;
	inset: 0;
	z-index: 100000; /* Avada's sticky header sits at 99999 */
	display: flex;
	align-items: center;
	justify-content: center;
}

.dr-lb[hidden] {
	display: none;
}

/* Verified with elementFromPoint that this covers the whole viewport, including the
   notification bar and Avada's sticky nav (z-index 99999). 0.94 rather than 0.88 so a
   saturated banner behind it stops competing with the photograph. */
.dr-lb__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.94);
}

.dr-lb__frame {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 3.5rem 4.5rem;
	box-sizing: border-box;
	pointer-events: none; /* clicks fall through to the backdrop... */
}

.dr-lb__frame > * {
	pointer-events: auto; /* ...except on the controls and the picture itself */
}

.dr-lb__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	max-height: 100%;
}

.dr-lb__img {
	display: block;
	max-width: 100%;
	/* leave room for the caption and the counter */
	max-height: calc(100vh - 9rem);
	width: auto;
	height: auto;
	background: #111;
	box-shadow: 0 2px 30px rgba(0, 0, 0, 0.6);
}

.dr-lb__cap {
	margin: 0.85rem 0 0;
	max-width: 60rem;
	color: #f2f2f2;
	font-size: 0.95rem;
	line-height: 1.45;
	text-align: center;
}

.dr-lb__cap[hidden] {
	display: none;
}

.dr-lb__count {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 1rem;
	margin: 0;
	text-align: center;
	color: rgba(255, 255, 255, 0.65);
	font-size: 0.8rem;
	letter-spacing: 0.06em;
}

.dr-lb__btn {
	position: absolute;
	background: none;
	border: 0;
	color: #fff;
	cursor: pointer;
	line-height: 1;
	padding: 0.5rem 0.9rem;
	opacity: 0.75;
	transition: opacity 0.15s ease;
	font-family: inherit;
}

.dr-lb__btn:hover,
.dr-lb__btn:focus {
	opacity: 1;
}

/* A visible focus ring matters here: the whole control set is keyboard-driven. */
.dr-lb__btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.dr-lb__btn[hidden] {
	display: none;
}

.dr-lb__prev,
.dr-lb__next {
	top: 50%;
	transform: translateY(-50%);
	font-size: 3.2rem;
}

.dr-lb__prev {
	left: 0.25rem;
}

.dr-lb__next {
	right: 0.25rem;
}

.dr-lb__close {
	top: 0.5rem;
	right: 0.75rem;
	font-size: 2.4rem;
}

@media only screen and (max-width: 768px) {
	.dr-lb__frame {
		padding: 3rem 0.75rem;
	}

	.dr-lb__img {
		max-height: calc(100vh - 11rem);
	}

	/* On a narrow screen the arrows would sit on top of the photograph, so put them
	   underneath it instead of beside it. */
	.dr-lb__prev,
	.dr-lb__next {
		top: auto;
		bottom: 2.25rem;
		transform: none;
		font-size: 2.6rem;
	}

	.dr-lb__prev {
		left: 1.5rem;
	}

	.dr-lb__next {
		right: 1.5rem;
	}

	.dr-lb__cap {
		font-size: 0.875rem;
	}
}
