/*--------------------------------------------------------------
# Post image lightbox — behaviour in js/tw-lightbox.js
--------------------------------------------------------------*/

/* Images that open in the lightbox */
.tw-lb-trigger {
	cursor: zoom-in !important;
	transition: opacity 0.25s ease;
}

.tw-lb-trigger:hover {
	opacity: 0.9;
}

.tw-lb-trigger:focus-visible,
a:focus-visible > .tw-lb-trigger {
	outline: 3px solid var(--tw-focus-ring, #000F43);
	outline-offset: 3px;
	box-shadow: 0 0 0 3px var(--tw-focus-halo, #fff);
}

/* Lock page scroll while open */
html.tw-lb-open,
html.tw-lb-open body {
	overflow: hidden;
}

html.tw-lb-open body {
	padding-right: var(--tw-lb-scrollbar, 0px);
}

/* ---------- Viewer ---------- */

.tw-lb {
	position: fixed;
	inset: 0;
	z-index: 100000; /* above the header and WP admin bar */
	display: flex;
	flex-direction: column;
	background: rgba(0, 15, 67, 0.96);
	opacity: 0;
	transition: opacity 0.25s ease;
	-webkit-tap-highlight-color: transparent;
}

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

.tw-lb.is-open {
	opacity: 1;
}

.tw-lb__stage {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 70px 90px 10px;
}

.tw-lb__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	margin: 0;
	object-fit: contain;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
	opacity: 0;
	transform: scale(0.98);
	transition: opacity 0.3s ease, transform 0.3s ease;
	user-select: none;
	-webkit-user-drag: none;
}

.tw-lb.is-loaded .tw-lb__img {
	opacity: 1;
	transform: none;
}

/* Spinner */
.tw-lb__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 38px;
	height: 38px;
	margin: -19px 0 0 -19px;
	border: 2px solid rgba(255, 255, 255, 0.2);
	border-top-color: var(--tw-gold);
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.2s ease;
	animation: tw-lb-spin 0.8s linear infinite;
	pointer-events: none;
}

.tw-lb.is-loading .tw-lb__spinner {
	opacity: 1;
}

@keyframes tw-lb-spin {
	to { transform: rotate(360deg); }
}

/* Caption bar */
.tw-lb__bar {
	flex: 0 0 auto;
	padding: 16px 90px calc(26px + env(safe-area-inset-bottom, 0px));
	text-align: center;
}

.tw-lb__counter {
	display: block;
	color: var(--tw-gold);
	font-family: Open Sans, sans-serif;
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0.12em;
	line-height: 1.4;
}

.tw-lb__caption {
	max-width: 800px;
	margin: 6px auto 0;
	color: rgba(255, 255, 255, 0.9);
	font-family: Open Sans, sans-serif;
	font-size: 16px;
	font-style: italic;
	font-weight: 300;
	line-height: 1.5;
}

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

/* Buttons */
.tw-lb .tw-lb__btn {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	color: #fff;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.tw-lb .tw-lb__btn:hover {
	color: var(--tw-gold);
}

.tw-lb .tw-lb__btn:focus-visible {
	outline: 2px solid var(--tw-gold);
	outline-offset: 2px;
}

.tw-lb .tw-lb__btn svg {
	display: block;
	pointer-events: none;
}

.tw-lb__close {
	top: 14px;
	right: 16px;
}

.tw-lb__prev,
.tw-lb__next {
	top: 50%;
	margin-top: -26px !important;
	border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

.tw-lb__prev { left: 20px; }
.tw-lb__next { right: 20px; }

.tw-lb .tw-lb__prev:hover,
.tw-lb .tw-lb__next:hover {
	border-color: var(--tw-gold) !important;
}

.tw-lb.is-single .tw-lb__prev,
.tw-lb.is-single .tw-lb__next {
	display: none;
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
	.tw-lb__stage {
		padding: 64px 0 0;
	}

	.tw-lb__img {
		box-shadow: none;
	}

	.tw-lb__bar {
		padding-left: 70px;
		padding-right: 70px;
	}

	.tw-lb__caption {
		font-size: 14px;
	}

	/* Arrows move down beside the caption so they don't cover the photo */
	.tw-lb__prev,
	.tw-lb__next {
		top: auto;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
		margin-top: 0 !important;
		width: 46px;
		height: 46px;
	}

	.tw-lb__prev { left: 12px; }
	.tw-lb__next { right: 12px; }

	.tw-lb__close {
		top: 8px;
		right: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tw-lb,
	.tw-lb__img,
	.tw-lb-trigger {
		transition: none;
	}
}
