/**
 * YWX 全站图片灯箱（幻灯片缩放效果）
 * 用于关于页、产品详情等；点击后在当前页放大，支持左右切换与缩略图导航。
 */

body.ywx-lightbox-open {
	overflow: hidden;
}

.ywx-lightbox {
	position: fixed;
	inset: 0;
	z-index: 10050;
	display: block;
	visibility: hidden;
	pointer-events: none;
}

.ywx-lightbox.is-open {
	visibility: visible;
	pointer-events: auto;
}

.ywx-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.86);
	opacity: 0;
	transition: opacity 0.32s ease;
}

.ywx-lightbox.is-open.is-ready .ywx-lightbox__backdrop {
	opacity: 1;
}

.ywx-lightbox__panel {
	position: absolute;
	top: 50%;
	left: 50%;
	width: min(92vw, 1100px);
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 48px 56px 24px;
	box-sizing: border-box;
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.9);
	transition: opacity 0.34s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.ywx-lightbox.is-open.is-ready .ywx-lightbox__panel {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

.ywx-lightbox__stage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-height: calc(92vh - 140px);
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.38);
	overflow: hidden;
}

.ywx-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: calc(92vh - 140px);
	width: auto;
	height: auto;
	object-fit: contain;
	transform: scale(1);
	opacity: 1;
	transition: opacity 0.28s ease, transform 0.28s ease;
}

.ywx-lightbox__img.is-changing {
	opacity: 0;
	transform: scale(0.96);
}

.ywx-lightbox__img.is-entering {
	animation: ywx-lightbox-zoom-in 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ywx-lightbox-zoom-in {
	from {
		opacity: 0;
		transform: scale(0.88);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

.ywx-lightbox__close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	color: #333;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	transition: background 0.2s ease, transform 0.2s ease;
}

.ywx-lightbox__close:hover {
	background: #fff;
	color: #000;
	transform: scale(1.05);
}

.ywx-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #333;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	transition: background 0.2s ease, transform 0.2s ease;
}

.ywx-lightbox__prev {
	left: 8px;
}

.ywx-lightbox__next {
	right: 8px;
}

.ywx-lightbox__nav:hover {
	background: #fff;
	transform: translateY(-50%) scale(1.06);
}

.ywx-lightbox__meta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 14px;
	color: #fff;
	font-size: 14px;
	line-height: 1.4;
}

.ywx-lightbox__counter {
	opacity: 0.85;
}

.ywx-lightbox__title {
	font-weight: 600;
	max-width: min(70vw, 520px);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ywx-lightbox__thumbs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
	max-width: 100%;
}

.ywx-lightbox__thumb {
	border: 2px solid transparent;
	border-radius: 4px;
	padding: 0;
	background: transparent;
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.2s ease, transform 0.2s ease;
}

.ywx-lightbox__thumb:hover {
	transform: translateY(-2px);
}

.ywx-lightbox__thumb.is-active {
	border-color: #fff;
}

.ywx-lightbox__thumb img {
	display: block;
	width: 52px;
	height: 52px;
	object-fit: cover;
}

@media (max-width: 767px) {
	.ywx-lightbox__panel {
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		transform: none;
		width: 100%;
		max-height: 100%;
		height: 100%;
		padding:
			calc(3rem + env(safe-area-inset-top, 0px))
			calc(0.75rem + env(safe-area-inset-right, 0px))
			calc(0.75rem + env(safe-area-inset-bottom, 0px))
			calc(0.75rem + env(safe-area-inset-left, 0px));
	}

	.ywx-lightbox.is-open.is-ready .ywx-lightbox__panel {
		transform: none;
	}

	.ywx-lightbox__stage {
		flex: 1 1 auto;
		min-height: 0;
		width: 100%;
		max-height: none;
		border-radius: 0.5rem;
		background: transparent;
		box-shadow: none;
	}

	.ywx-lightbox__img {
		max-width: 100%;
		max-height: 100%;
		border-radius: 0.5rem;
		box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
	}

	.ywx-lightbox__close {
		position: fixed;
		top: calc(0.75rem + env(safe-area-inset-top, 0px));
		right: calc(0.75rem + env(safe-area-inset-right, 0px));
		width: 2.25rem;
		height: 2.25rem;
		font-size: 1.5rem;
		z-index: 10052;
	}

	.ywx-lightbox__nav {
		width: 2.375rem;
		height: 2.375rem;
		font-size: 1.375rem;
		background: rgba(255, 255, 255, 0.16);
		color: #fff;
		border: 1px solid rgba(255, 255, 255, 0.28);
		box-shadow: none;
	}

	.ywx-lightbox__nav:hover {
		transform: translateY(-50%);
	}

	.ywx-lightbox__prev {
		left: calc(0.5rem + env(safe-area-inset-left, 0px));
	}

	.ywx-lightbox__next {
		right: calc(0.5rem + env(safe-area-inset-right, 0px));
	}

	.ywx-lightbox__meta {
		flex-direction: column;
		gap: 4px;
		margin-top: 10px;
		font-size: 13px;
		text-align: center;
	}

	.ywx-lightbox__title {
		max-width: 100%;
		white-space: normal;
	}

	.ywx-lightbox__thumbs {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		width: 100%;
		margin-top: 10px;
		padding-bottom: 2px;
	}

	.ywx-lightbox__thumbs::-webkit-scrollbar {
		display: none;
	}

	.ywx-lightbox__thumb {
		flex: 0 0 auto;
	}

	.ywx-lightbox__thumb img {
		width: 48px;
		height: 48px;
	}
}
