/* Activated only by the public-page script; Divi's editing view stays native. */
html.lio-gallery-ready body:not(.et-fb):not(.et-bfb):not(.et-fb-preview) :is(.lio-dv-gallery-image.et_pb_image, .lio-dv-gallery .et_pb_gallery_image) {
	--lio-gallery-thumbnail-height: 180px;
	width: 100% !important;
	max-width: 100% !important;
}

html.lio-gallery-ready body:not(.et-fb):not(.et-bfb):not(.et-fb-preview) :is(.lio-dv-gallery-image.et_pb_image, .lio-dv-gallery .et_pb_gallery_image) a,
html.lio-gallery-ready body:not(.et-fb):not(.et-bfb):not(.et-fb-preview) .lio-dv-gallery-image.et_pb_image .et_pb_image_wrap {
	display: block;
	width: 100% !important;
	max-width: 100% !important;
	height: var(--lio-gallery-thumbnail-height);
	overflow: hidden;
}

html.lio-gallery-ready body:not(.et-fb):not(.et-bfb):not(.et-fb-preview) :is(.lio-dv-gallery-image.et_pb_image, .lio-dv-gallery .et_pb_gallery_image) img {
	display: block;
	width: 100% !important;
	max-width: 100% !important;
	height: var(--lio-gallery-thumbnail-height) !important;
	object-fit: cover;
	object-position: center;
}

html.lio-gallery-ready body:not(.et-fb):not(.et-bfb):not(.et-fb-preview) :is(.lio-dv-gallery-image.et_pb_image, .lio-dv-gallery .et_pb_gallery_image) a[href] {
	cursor: zoom-in;
}

html.lio-gallery-ready body:not(.et-fb):not(.et-bfb):not(.et-fb-preview) :is(.lio-dv-gallery-image.et_pb_image, .lio-dv-gallery .et_pb_gallery_image) a:focus-visible {
	outline: 3px solid #b9530d;
	outline-offset: 4px;
}

/* Native Divi Gallery modules stay fully editable; this is visitor presentation only. */
html.lio-gallery-ready .lio-gallery-group .et_pb_gallery_items {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
}

html.lio-gallery-ready .lio-gallery-group .et_pb_gallery_item {
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 !important;
	float: none;
	clear: none;
}

@media (max-width: 980px) {
	html.lio-gallery-ready .lio-gallery-group .et_pb_gallery_items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	html.lio-gallery-ready .lio-gallery-group .et_pb_gallery_items {
		grid-template-columns: minmax(0, 1fr);
	}
}

html.lio-gallery-lightbox-open,
html.lio-gallery-lightbox-open body {
	overflow: hidden;
}

.lio-gallery-lightbox {
	box-sizing: border-box;
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: max(68px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
	border: 0;
	background: transparent;
	color: #fff;
	overflow: hidden;
}

.lio-gallery-lightbox:not([open]) {
	display: none;
}

.lio-gallery-lightbox[open] {
	display: grid;
	place-items: center;
}

.lio-gallery-lightbox::backdrop {
	background: rgba(17, 16, 15, 0.94);
}

.lio-gallery-lightbox__stage {
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) 48px;
	align-items: center;
	gap: 20px;
	width: min(1480px, 100%);
	height: 100%;
	min-height: 0;
}

.lio-gallery-lightbox__figure {
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
	gap: 14px;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	margin: 0;
}

.lio-gallery-lightbox__image-holder {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
	place-items: center;
	min-width: 0;
	min-height: 0;
}

.lio-gallery-lightbox__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.lio-gallery-lightbox__footer {
	display: grid;
	gap: 6px;
	text-align: center;
}

.lio-gallery-lightbox__counter,
.lio-gallery-lightbox__caption {
	margin: 0;
	padding: 0;
	color: #fff;
	font-size: 14px;
	line-height: 1.5;
}

.lio-gallery-lightbox__counter {
	font-variant-numeric: tabular-nums;
}

.lio-gallery-lightbox__caption {
	max-height: 4.5em;
	overflow: auto;
	overflow-wrap: anywhere;
	color: #e3dfda;
}

.lio-gallery-lightbox__button {
	display: grid;
	place-items: center;
	box-sizing: border-box;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 11px;
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	appearance: none;
}

.lio-gallery-lightbox__button:hover {
	background: rgba(255, 255, 255, 0.24);
}

.lio-gallery-lightbox__button:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 4px;
}

.lio-gallery-lightbox__button:disabled {
	opacity: 0.35;
	cursor: default;
}

.lio-gallery-lightbox__button svg {
	display: block;
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.lio-gallery-lightbox__close {
	position: absolute;
	top: max(12px, env(safe-area-inset-top));
	right: max(24px, env(safe-area-inset-right));
	z-index: 1;
}

.lio-gallery-lightbox__hint {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (max-width: 980px) {
	html.lio-gallery-ready body:not(.et-fb):not(.et-bfb):not(.et-fb-preview) :is(.lio-dv-gallery-image.et_pb_image, .lio-dv-gallery .et_pb_gallery_image) {
		--lio-gallery-thumbnail-height: 160px;
	}
}

@media (max-width: 600px) {
	html.lio-gallery-ready body:not(.et-fb):not(.et-bfb):not(.et-fb-preview) :is(.lio-dv-gallery-image.et_pb_image, .lio-dv-gallery .et_pb_gallery_image) {
		--lio-gallery-thumbnail-height: 140px;
	}
	.lio-gallery-lightbox {
		padding: max(68px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
	}
	.lio-gallery-lightbox__stage {
		grid-template-columns: 44px minmax(0, 1fr) 44px;
		gap: 8px;
	}
	.lio-gallery-lightbox__button {
		width: 44px;
		height: 44px;
		padding: 9px;
	}
	.lio-gallery-lightbox__close {
		right: max(12px, env(safe-area-inset-right));
	}
	.lio-gallery-lightbox__counter,
	.lio-gallery-lightbox__caption {
		font-size: 13px;
	}
}
