/**
 * Accessible gallery lightbox for legacy [data-clearing] galleries.
 *
 * Styles the vanilla-JS modal that replaces Foundation 5 "Clearing" on the
 * legacy Spotlight stories (Priceless / art buying, IPLACe, WakeDowntown).
 * All rules are namespaced under `.wfu-lightbox` to avoid colliding with the
 * per-story `.clearing-*` styles that remain in the theme.
 */

/* Lock background scrolling while the modal is open. */
html.wfu-lightbox-open,
html.wfu-lightbox-open body {
	overflow: hidden;
}

.wfu-lightbox {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 3.5rem 1rem 4rem;
	background: rgba( 0, 0, 0, 0.9 );
}

/* Native [hidden] must win over the flex display above. */
.wfu-lightbox[hidden] {
	display: none;
}

.wfu-lightbox * {
	box-sizing: border-box;
}

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

.wfu-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: 78vh;
	width: auto;
	height: auto;
	object-fit: contain;
}

.wfu-lightbox__caption {
	max-width: 60rem;
	margin-top: 1rem;
	color: #f5f5f5;
	font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 0.95rem;
	line-height: 1.5;
	text-align: center;
}

.wfu-lightbox__caption[hidden] {
	display: none;
}

.wfu-lightbox__counter {
	position: absolute;
	bottom: 1.25rem;
	left: 50%;
	transform: translateX( -50% );
	color: #ddd;
	font-family: "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 0.85rem;
	letter-spacing: 0.05em;
}

/* Shared control button styling. */
.wfu-lightbox__nav,
.wfu-lightbox__close {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba( 0, 0, 0, 0.35 );
	color: #fff;
	cursor: pointer;
	line-height: 1;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.wfu-lightbox__nav[hidden],
.wfu-lightbox__close[hidden] {
	display: none;
}

.wfu-lightbox__nav:hover,
.wfu-lightbox__close:hover,
.wfu-lightbox__nav:focus-visible,
.wfu-lightbox__close:focus-visible {
	background: rgba( 255, 255, 255, 0.18 );
}

/* Visible keyboard focus ring per WFU accessibility policy. */
.wfu-lightbox__nav:focus-visible,
.wfu-lightbox__close:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.wfu-lightbox__nav {
	top: 50%;
	width: 3.25rem;
	height: 3.25rem;
	transform: translateY( -50% );
	border-radius: 50%;
	font-size: 2.25rem;
}

.wfu-lightbox__nav--prev {
	left: 1rem;
}

.wfu-lightbox__nav--next {
	right: 1rem;
}

.wfu-lightbox__close {
	top: 1rem;
	right: 1rem;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 50%;
	font-size: 1.9rem;
}

/* Visually hidden live region for screen-reader announcements. */
.wfu-lightbox__live {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

@media only screen and ( max-width: 640px ) {
	.wfu-lightbox {
		padding: 3rem 0.5rem 3.5rem;
	}

	.wfu-lightbox__image {
		max-height: 68vh;
	}

	.wfu-lightbox__nav {
		width: 2.75rem;
		height: 2.75rem;
		font-size: 1.9rem;
	}

	.wfu-lightbox__nav--prev {
		left: 0.35rem;
	}

	.wfu-lightbox__nav--next {
		right: 0.35rem;
	}

	.wfu-lightbox__caption {
		font-size: 0.85rem;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.wfu-lightbox__nav,
	.wfu-lightbox__close {
		transition: none;
	}
}
