/* YooAI — Lightbox Gallery — сетка превью и оверлей */

.yooai-lightbox-wrap {
	position: relative;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin-top: var(--yooai-margin-gallery, 0);
	margin-bottom: var(--yooai-margin-gallery, 0);
}

.yooai-lightbox-wrap--pos-center .yooai-lightbox-heading,
.yooai-lightbox-wrap--pos-center .yooai-lightbox-description {
	text-align: center;
}

.yooai-lightbox-wrap--pos-left .yooai-lightbox-heading,
.yooai-lightbox-wrap--pos-left .yooai-lightbox-description {
	text-align: left;
}

.yooai-lightbox-heading {
	margin: 0 0 8px;	
	font-weight: 600;
}

.yooai-lightbox-description {
	margin: 0 0 12px;
	line-height: 1.5;
}

.yooai-lightbox-grid {
	display: grid;
	width: 100%;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--yooai-thumb-width, 140px)), var(--yooai-thumb-width, 140px)));
	gap: var(--yooai-margin-item, 10px);
	justify-content: start;
}

.yooai-lightbox-wrap--pos-center .yooai-lightbox-grid {
	justify-content: center;
}

.yooai-lightbox-grid--scroll {
	padding-bottom: 18px;
}

.yooai-lightbox-item {
	display: block;
	width: 100%;
	max-width: var(--yooai-thumb-width, 140px);
	line-height: 0;
	overflow: hidden;
	border-radius: var(--yooai-border-radius, 10px);
}

.yooai-lightbox-item img {
	display: block;
	width: 100%;
	max-width: var(--yooai-thumb-width, 140px);
	max-height: var(--yooai-thumb-height, 140px);
	height: auto;
	aspect-ratio: var(--yooai-thumb-w, 140) / var(--yooai-thumb-h, 140);
	object-fit: cover;
	border-radius: inherit;
	transition: opacity 0.2s ease;
}

.yooai-lightbox-wrap--original .yooai-lightbox-item img {
	width: auto;
	max-width: 100%;
	object-fit: contain;
}

.yooai-lightbox-item:hover img {
	opacity: 0.92;
}

/* Оверлей */
.yooai-lightbox-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px 56px;
	background: rgba(0, 0, 0, 0.88);
	box-sizing: border-box;
	touch-action: none;
}

.yooai-lightbox-overlay.is-open {
	display: flex;
}

html.yooai-lightbox-open {
	overflow: hidden;
}

.yooai-lightbox-stage {
	max-width: 100%;
	max-height: 100%;
	text-align: center;
}

.yooai-lightbox-image {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 120px);
	width: auto;
	height: auto;
	margin: 0 auto;
	transition: opacity 0.2s ease;
	user-select: none;
	-webkit-user-drag: none;
}

.yooai-lightbox-caption {
	display: none;
}

.yooai-lightbox-close,
.yooai-lightbox-nav {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	line-height: 1;
	font-family: Arial, Helvetica, sans-serif;
	transition: background 0.15s ease;
}

.yooai-lightbox-close:hover,
.yooai-lightbox-nav:hover {
	background: rgba(255, 255, 255, 0.24);
}

.yooai-lightbox-close {
	top: 12px;
	right: 12px;
	width: 40px;
	height: 40px;
	border-radius: 4px;
	font-size: 26px;
}

.yooai-lightbox-nav {
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 64px;
	border-radius: 4px;
	font-size: 32px;
}

.yooai-lightbox-prev {
	left: 12px;
}

.yooai-lightbox-next {
	right: 12px;
}

@media (max-width: 767px) {
	.yooai-lightbox-overlay {
		padding: 16px 12px;
	}

	.yooai-lightbox-nav {
		width: 36px;
		height: 48px;
		font-size: 26px;
	}
}
