﻿/*------------------------------------------------------------
	Lightbox (inside Strata modal: .st-modal__overlay > .st-modal > .st-modal__content)

	Markup:
	.st-lightbox >
	  .st-lightbox__view >
	    .st-lightbox__stage (.st-lightbox__main > .st-lightbox__image, .st-lightbox__caption) +
	    .st-lightbox__foot (.st-lightbox__counter + .st-lightbox__thumbs)
------------------------------------------------------------*/

.st-modal__overlay--with-lightbox .st-modal__content {
	overflow: hidden;
	min-height: 0;
	align-items: stretch;
	justify-content: center;
}

.st-lightbox {
	display: flex;
	flex-direction: column;
	width: 100%;
	min-height: 0;
	max-height: min(85vh, 100%);
	height: 100%;
	box-sizing: border-box;
}

.st-lightbox__view {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	width: 100%;
	max-width: min(90vw, 100%);
	margin: 0 auto;
}

/* Main image area: use all space above the thumb strip; no scroll */
.st-lightbox__stage {
	position: relative;
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
}

.st-lightbox__main {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	min-height: 0;
	overflow: hidden;
	width: 100%;
}

/* Scale up to fill available height (and width); never upscale beyond intrinsic size */
.st-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 0.25rem;
}

.st-lightbox__caption {
	flex-shrink: 0;
	padding: 0.5rem 1rem 0;
	text-align: center;
	color: var(--wp--preset--color--white, #fff);
	font-size: 1rem;
	line-height: 1.4;
}

.st-lightbox__caption:empty {
	display: none;
}

/* Footer: counter + thumbnail strip */
.st-lightbox__foot {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	max-width: 100%;
	padding-top: 0.75rem;
	box-sizing: border-box;
}

.st-lightbox__counter {
	background: rgba(0, 0, 0, 0.7);
	color: var(--wp--preset--color--white, #fff);
	padding: 0.5rem 1rem;
	border-radius: 0.25rem;
	font-size: 0.875rem;
	backdrop-filter: blur(0.5rem);
}

.st-lightbox__thumbs {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	gap: 0.5rem;
	justify-content: center;
	max-width: 100%;
	margin: 0;
	padding: 0.25rem 0;
	list-style: none;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.st-lightbox__thumbs-item {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
}

.st-lightbox__thumb {
	flex: 0 0 auto;
	position: relative;
	width: 3.5rem;
	height: 3.5rem;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 0.25rem;
	overflow: hidden;
	cursor: pointer;
	background: rgba(0, 0, 0, 0.35);
	filter: grayscale(1);
	transition: filter 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.st-lightbox__thumb:hover {
	filter: grayscale(1);
	opacity: 0.95;
}

.st-lightbox__thumb--current,
.st-lightbox__thumb[aria-current="true"] {
	filter: none;
	border-color: rgba(255, 255, 255, 0.95);
	opacity: 1;
}

.st-lightbox__thumb--current:hover {
	filter: none;
	opacity: 1;
}

.st-lightbox__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.st-lightbox__thumb:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Close control (modal shell) */
.st-modal__overlay--with-lightbox .st-modal__close .button-link,
.st-modal__overlay--with-lightbox .st-modal__close button {
	color: #fff;
}

.st-modal__overlay--with-lightbox .st-modal__close .button-link:hover,
.st-modal__overlay--with-lightbox .st-modal__close button:hover {
	color: rgba(255, 255, 255, 0.85);
}

.st-lightbox__prev,
.st-lightbox__next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 1;
	width: 3.75rem;
	height: 5rem;
	border-radius: 0.25rem;
	font-size: 1.75rem;
	background: rgba(255, 255, 255, 0.1);
	border: none;
	color: #fff;
	cursor: pointer;
	transition: all 0.3s ease;
	backdrop-filter: blur(0.5rem);
	display: flex;
	align-items: center;
	justify-content: center;
}

.st-lightbox__prev {
	left: 1.5rem;
}

.st-lightbox__next {
	right: 1.5rem;
}

.st-lightbox__prev:hover,
.st-lightbox__next:hover {
	background: rgba(255, 255, 255, 0.2);
}

.st-lightbox__prev:focus-visible,
.st-lightbox__next:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

@media (max-width: 48rem) {
	.st-lightbox__prev {
		left: 0.5rem;
	}

	.st-lightbox__next {
		right: 0.625rem;
	}
}

@media (max-width: 30rem) {
	.st-lightbox__prev,
	.st-lightbox__next {
		width: 3.125rem;
		height: 3.75rem;
		font-size: 1.5rem;
	}

	.st-lightbox__thumb {
		width: 3rem;
		height: 3rem;
	}
}

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

	.st-lightbox__prev,
	.st-lightbox__next {
		transition: none;
	}
}
