/**
 * Qing 产品画廊小部件样式（对齐设计稿）。
 *
 * 结构：
 *   .qing-pg
 *     .qing-pg__main（主图容器，相对定位承载放大镜按钮）
 *       .qing-pg__main-swiper（.swiper） > .swiper-wrapper > .qing-pg__main-slide
 *       .qing-pg__zoom（右下角放大镜，点击开灯箱）
 *     .qing-pg__thumbs-row（flex：prev 箭头 + 缩略图 swiper + next 箭头）
 *       .qing-pg__nav（左右导航按钮，内含自定义 SVG / 图标）
 *       .qing-pg__thumbs（.swiper） > .swiper-wrapper > .swiper-slide > .qing-pg__thumb
 *   灯箱 .qing-pg-lightbox 由 JS 动态构建并追加到 body。
 *
 * 依赖 Elementor 自带 swiper 基础样式；具体配色/尺寸由控件通过内联 selectors 覆盖。
 */

.qing-pg {
	--pg-lb-backdrop: rgba(15, 18, 24, 0.92);
	--pg-lb-ctrl: #ffffff;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
}

/* -------- 主图区 -------- */
.qing-pg__main {
	position: relative;
	overflow: hidden;
	background-color: #ffffff;
	border-radius: 8px;
}

.qing-pg__main-swiper {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
}

.qing-pg__main-swiper .swiper-wrapper {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.qing-pg__main-slide {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 480px;
	box-sizing: border-box;
	/* 兜底：约束单张主图 slide 宽度，避免 Swiper 偶发算出异常巨大宽度导致图片消失。 */
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

.qing-pg__main-slide img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: 100%;
	object-fit: contain;
}

/* 开启灯箱时主图可点击。 */
.qing-pg__main-slide img[role='button'] {
	cursor: zoom-in;
}

/* 右下角放大镜按钮。 */
.qing-pg__zoom {
	position: absolute;
	right: 14px;
	bottom: 14px;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	color: #ffffff;
	background-color: rgba(0, 0, 0, 0.45);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.25s ease, transform 0.25s ease;
}

.qing-pg__zoom:hover {
	transform: scale(1.08);
}

.qing-pg__zoom svg {
	width: 20px;
	height: 20px;
}

/* -------- 缩略图行 -------- */
.qing-pg__thumbs-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 16px;
}

.qing-pg__thumbs {
	flex: 1 1 0;
	min-width: 0;
	width: 100%;
	overflow: hidden;
}

.qing-pg__thumbs .swiper-wrapper {
	min-width: 0;
}

.qing-pg__thumbs .swiper-slide {
	box-sizing: border-box;
	cursor: pointer;
	min-width: 0;
	flex-shrink: 0;
}

.qing-pg__thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 84px;
	overflow: hidden;
	background-color: #ffffff;
	border: 2px solid rgba(0, 0, 0, 0.08);
	border-radius: 6px;
	opacity: 0.55;
	box-sizing: border-box;
	transition: border-color 0.25s ease, opacity 0.25s ease;
}

.qing-pg__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 选中缩略图：高亮边框 + 完全不透明。 */
.qing-pg__thumbs .swiper-slide-thumb-active .qing-pg__thumb {
	border-color: #2563eb;
	opacity: 1;
}

.qing-pg__thumbs .swiper-slide:hover .qing-pg__thumb {
	opacity: 1;
}

/* -------- 左右导航箭头 -------- */
.qing-pg__nav {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	color: #333333;
	background-color: transparent;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: color 0.25s ease, background-color 0.25s ease, opacity 0.25s ease;
}

.qing-pg__nav svg {
	width: 18px;
	height: 18px;
}

.qing-pg__nav i {
	font-size: 18px;
	line-height: 1;
}

.qing-pg__nav:hover {
	color: #2563eb;
}

/* Swiper 判定到达边界时禁用箭头（非 loop 场景）。 */
.qing-pg__nav.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
}

/* -------- 灯箱（JS 动态注入 body） -------- */
.qing-pg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px;
	background-color: var(--pg-lb-backdrop, rgba(15, 18, 24, 0.92));
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	box-sizing: border-box;
}

.qing-pg-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.qing-pg-lightbox__stage {
	position: relative;
	max-width: 90vw;
	max-height: 86vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.qing-pg-lightbox__img {
	display: block;
	max-width: 90vw;
	max-height: 86vh;
	object-fit: contain;
	border-radius: 4px;
	transform: scale(0.96);
	transition: transform 0.3s ease;
}

.qing-pg-lightbox.is-open .qing-pg-lightbox__img {
	transform: scale(1);
}

.qing-pg-lightbox__ctrl {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--pg-lb-ctrl, #ffffff);
	background-color: rgba(255, 255, 255, 0.12);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.25s ease, transform 0.25s ease;
}

.qing-pg-lightbox__ctrl:hover {
	background-color: rgba(255, 255, 255, 0.25);
}

.qing-pg-lightbox__ctrl svg {
	width: 24px;
	height: 24px;
}

.qing-pg-lightbox__close {
	top: 24px;
	right: 24px;
	width: 44px;
	height: 44px;
}

.qing-pg-lightbox__nav {
	top: 50%;
	width: 52px;
	height: 52px;
	transform: translateY(-50%);
}

.qing-pg-lightbox__nav:hover {
	transform: translateY(-50%) scale(1.08);
}

.qing-pg-lightbox__nav--prev {
	left: 24px;
}

.qing-pg-lightbox__nav--next {
	right: 24px;
}

.qing-pg-lightbox__counter {
	position: absolute;
	left: 50%;
	bottom: 22px;
	transform: translateX(-50%);
	color: var(--pg-lb-ctrl, #ffffff);
	font-size: 14px;
	letter-spacing: 0.5px;
	opacity: 0.85;
}

/* body 打开灯箱时禁止背景滚动。 */
body.qing-pg-lightbox-open {
	overflow: hidden;
}

/* -------- 移动端适配 -------- */
@media (max-width: 767px) {
	.qing-pg__main-slide {
		height: 320px;
	}

	.qing-pg__thumb {
		height: 64px;
	}

	.qing-pg__nav {
		width: 34px;
		height: 34px;
	}

	.qing-pg-lightbox {
		padding: 16px;
	}

	.qing-pg-lightbox__nav {
		width: 42px;
		height: 42px;
	}

	.qing-pg-lightbox__nav--prev {
		left: 10px;
	}

	.qing-pg-lightbox__nav--next {
		right: 10px;
	}
}

/* 尊重「减少动态效果」偏好。 */
@media (prefers-reduced-motion: reduce) {
	.qing-pg__zoom,
	.qing-pg__nav,
	.qing-pg__thumb,
	.qing-pg-lightbox,
	.qing-pg-lightbox__img,
	.qing-pg-lightbox__ctrl {
		transition: none;
	}
}

