/**
 * 产品相册轮播：上大图 + 下缩略图
 */

.baijia-pg {
	width: 100%;
}

/* ===== 主图 ===== */
.baijia-pg-main {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: #f5f5f5;
	border-radius: 8px;
	overflow: hidden;
}

.baijia-pg-slides {
	position: absolute;
	inset: 0;
}

.baijia-pg-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease;
	cursor: zoom-in;
}

.baijia-pg-slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 1;
}

.baijia-pg-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* 主图左右箭头 */
.baijia-pg-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.85);
	color: #333;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	z-index: 3;
	opacity: 0;
	transition: opacity 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	-webkit-tap-highlight-color: transparent;
}

.baijia-pg-main:hover .baijia-pg-arrow,
.baijia-pg-arrow:focus-visible {
	opacity: 1;
}

.baijia-pg-arrow:hover {
	background: #fff;
	color: #a6ce39;
}

.baijia-pg-prev { left: 12px; }
.baijia-pg-next { right: 12px; }

.baijia-pg-arrow svg { width: 20px; height: 20px; display: block; }

/* 计数器 */
.baijia-pg-counter {
	position: absolute;
	right: 12px;
	bottom: 12px;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	font-size: 12px;
	z-index: 3;
	pointer-events: none;
}

/* ===== 缩略图 ===== */
.baijia-pg-thumbs {
	--bjpg-thumbs: 5;
	--bjpg-gap: 10px;

	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 12px;
	width: 100%;
}

.baijia-pg-thumbs-viewport {
	flex: 1 1 auto;
	overflow: hidden;
	min-width: 0;
}

.baijia-pg-thumbs-track {
	display: flex;
	gap: var(--bjpg-gap, 10px);
	transition: transform 0.35s ease;
	will-change: transform;
}

.baijia-pg-thumb {
	--bjpg-thumb-border: 2px;

	flex: 0 0 calc(
		(100% - (var(--bjpg-thumbs) - 1) * var(--bjpg-gap, 10px)) / var(--bjpg-thumbs)
	);
	aspect-ratio: 1 / 1;
	padding: 0;
	border: var(--bjpg-thumb-border) solid transparent;
	border-radius: 6px;
	background: #f5f5f5;
	cursor: pointer;
	overflow: hidden;
	box-sizing: border-box;
	transition: border-color 0.2s ease, transform 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.baijia-pg-thumb:hover {
	border-color: rgba(166, 206, 57, 0.5);
}

.baijia-pg-thumb.is-active {
	border-color: #a6ce39;
}

.baijia-pg-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* 缩略图左右翻页按钮 */
.baijia-pg-thumbs-nav {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #f5f5f5;
	color: #666;
	border: 1px solid #e5e5e5;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
	padding: 0;
}

.baijia-pg-thumbs-nav:hover {
	background: #a6ce39;
	color: #fff;
	border-color: #a6ce39;
}

.baijia-pg-thumbs-nav:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.baijia-pg-thumbs-nav svg { width: 16px; height: 16px; display: block; }

/* 键盘聚焦样式 */
.baijia-pg-thumb:focus-visible,
.baijia-pg-arrow:focus-visible,
.baijia-pg-thumbs-nav:focus-visible {
	outline: 2px solid #a6ce39;
	outline-offset: 2px;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
	.baijia-pg-slide,
	.baijia-pg-thumbs-track {
		transition: none !important;
	}
}

/* ===== Lightbox ===== */
.baijia-pg-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.88);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	padding: 32px;
	box-sizing: border-box;
	cursor: zoom-out;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.baijia-pg-lightbox.is-open {
	display: flex;
	opacity: 1;
}

.baijia-pg-lightbox img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
	cursor: default;
}

.baijia-pg-lb-close {
	position: absolute;
	top: 20px;
	right: 24px;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	transition: background-color 0.2s ease;
}

.baijia-pg-lb-close:hover {
	background: rgba(255, 255, 255, 0.3);
}

/* 手机端微调 */
@media (max-width: 767px) {
	.baijia-pg-arrow {
		opacity: 1;
		width: 36px;
		height: 36px;
	}
	.baijia-pg-thumbs-nav {
		width: 28px;
		height: 28px;
	}
	.baijia-pg-lightbox {
		padding: 16px;
	}
}
