/**
 * Image lightbox - see js/lightbox.js and inc/lightbox.php.
 *
 * Deliberately plain: a dark surface, the image, and the controls. The point
 * of the overlay is to keep the reader on the post, not to decorate.
 */

.et-lb-open {
	overflow: hidden;
}

.et-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 24px;

	/* Near-solid on purpose. At 0.94 the page's floating toolbar icons showed
	   through in the top-right corner, right where the close button sits, and
	   read as part of the lightbox rather than as the page behind it. */
	background: rgba(3, 6, 26, 0.985);
}

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

/* Keep flex-shrink at its default 1. The arrows are `flex: 0 0 auto`, so the
   frame is the item that yields and the space for them is reserved by their
   refusal to shrink - not by anything here. `max-width: 100%` is only an
   upper bound. Setting `flex-shrink: 0` or `flex: 0 0 auto` on this rule
   would push the arrows off-screen on any image wider than the viewport,
   which measures as prev.left going negative. Verified the current
   behaviour with a 4000px source from 601px to 1440px: the frame lands on
   viewport - 48 padding - 88 arrows - 16 gaps every time. */
.et-lb__frame {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
}

.et-lb__img {
	display: block;
	max-width: 100%;

	/* Leave room for the caption and the counter underneath. */
	max-height: calc(100vh - 140px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.04);
}

.et-lb.is-loading .et-lb__img {
	opacity: 0.35;
	transition: opacity 0.15s ease-out;
}

.et-lb__caption {
	max-width: 70ch;
	margin: 0;
	font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	color: #d9dee8;
}

.et-lb__caption[hidden] {
	display: none;
}

.et-lb__count {
	position: absolute;
	right: 24px;
	bottom: 18px;
	margin: 0;
	font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
	color: #8f95c0;
}

.et-lb__count[hidden] {
	display: none;
}

/* ---------------------------------------------------------------------------
 * Controls
 * ------------------------------------------------------------------------ */

.et-lb__close,
.et-lb__nav {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease-out;
}

.et-lb__close:hover,
.et-lb__nav:hover,
.et-lb__close:focus-visible,
.et-lb__nav:focus-visible {
	background: rgba(255, 255, 255, 0.2);
}

.et-lb__close:focus-visible,
.et-lb__nav:focus-visible {
	outline: 2px solid #d6ff00;
	outline-offset: 2px;
}

.et-lb__close {
	position: absolute;
	top: 18px;
	right: 18px;
	font-size: 32px;
}

.et-lb__nav[hidden] {
	display: none;
}

@media (max-width: 600px) {

	.et-lb {
		padding: 12px;
		gap: 4px;
	}

	.et-lb__img {
		max-height: calc(100vh - 160px);
	}

	.et-lb__close,
	.et-lb__nav {
		width: 38px;
		height: 38px;
		font-size: 24px;
	}

	/* On a phone the side arrows would eat the image, so sit them at the
	   bottom where thumbs already are. */
	.et-lb__nav {
		position: absolute;
		bottom: 14px;
	}

	.et-lb__nav--prev {
		left: 16px;
	}

	.et-lb__nav--next {
		left: 64px;
	}

	.et-lb__count {
		right: 16px;
		bottom: 24px;
	}
}

@media (prefers-reduced-motion: reduce) {

	.et-lb__close,
	.et-lb__nav,
	.et-lb.is-loading .et-lb__img {
		transition: none;
	}
}

/* A linked image should look clickable before it is clicked.
   Kept as its own rule so it survives in a browser without :is() support. */
.gallery-item a img {
	cursor: zoom-in;
}

/* .elementor-widget-container is where this site's post bodies actually live;
   .entry-content is here for any classic template that still renders one. */
:is(.entry-content, .elementor-widget-container)
a:is([href$=".jpg"], [href$=".jpeg"], [href$=".png"], [href$=".gif"], [href$=".webp"]) img {
	cursor: zoom-in;
}
