/* Static-site gallery lightbox (replaces WordPress AJAX + iLightBox init for exported HTML) */

/*
 * Theme default: .cmsmasters_gallery_item { opacity: 0 } until JS adds .shortcode_animated.
 * Exported static pages never run that animation → thumbnails stay invisible. Force visible.
 */
.cmsmasters_gallery .cmsmasters_gallery_item {
	opacity: 1 !important;
}

.cmsmasters_gallery::after {
	content: "";
	display: table;
	clear: both;
}

html.hwm-lightbox-active,
body.hwm-lightbox-active {
	overflow: hidden;
}

#hwm-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 48px 56px;
	box-sizing: border-box;
	background: rgba(10, 12, 16, 0.92);
}

#hwm-lightbox.hwm-lightbox--open {
	display: flex;
}

#hwm-lightbox-backdrop {
	position: absolute;
	inset: 0;
	cursor: pointer;
}

#hwm-lightbox-figure {
	position: relative;
	z-index: 1;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	pointer-events: none;
}

#hwm-lightbox-figure img {
	max-width: 100%;
	max-height: calc(100vh - 120px);
	width: auto;
	height: auto;
	object-fit: contain;
	pointer-events: auto;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
}

#hwm-lightbox-caption {
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
	max-width: min(720px, 100%);
	pointer-events: none;
}

#hwm-lightbox-close,
#hwm-lightbox-prev,
#hwm-lightbox-next {
	position: absolute;
	z-index: 2;
	border: 0;
	margin: 0;
	padding: 0;
	width: 44px;
	height: 44px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 28px;
	line-height: 1;
	color: #fff;
	background: rgba(255, 255, 255, 0.12);
	transition: background 0.15s ease;
	pointer-events: auto;
}

#hwm-lightbox-close:hover,
#hwm-lightbox-prev:hover,
#hwm-lightbox-next:hover {
	background: rgba(255, 255, 255, 0.22);
}

#hwm-lightbox-close {
	top: 12px;
	right: 12px;
}

#hwm-lightbox-prev {
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
}

#hwm-lightbox-next {
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
}

#hwm-lightbox-counter {
	position: absolute;
	z-index: 2;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, 0.65);
	font-size: 13px;
	pointer-events: none;
}

@media (max-width: 600px) {
	#hwm-lightbox {
		padding: 44px 12px 56px;
	}

	#hwm-lightbox-figure img {
		max-height: calc(100vh - 100px);
	}

	#hwm-lightbox-prev,
	#hwm-lightbox-next {
		width: 40px;
		height: 40px;
		font-size: 24px;
	}
}
