/**
 * Baijia Product Gallery Styles
 *
 * 布局：第一张大图全宽，后续小图一排两个，视频全宽
 */

.baijia-product-gallery {
	width: 100%;
	max-width: 100%;
}

.baijia-gallery-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

/* 全宽项（第一张大图 & 视频） */
.baijia-gallery-item.baijia-gallery-full {
	flex: 0 0 100%;
	width: 100%;
}

/* 半宽项（小图两列） */
.baijia-gallery-item.baijia-gallery-half {
	flex: 0 0 calc(50% - 2px);
	width: calc(50% - 2px);
}

/* 图片通用样式 */
.baijia-gallery-item img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
	cursor: pointer;
	transition: opacity 0.3s ease;
}

.baijia-gallery-item img:hover {
	opacity: 0.9;
}

/* Lightbox 链接去除默认样式 */
.baijia-lightbox-trigger {
	display: block;
	line-height: 0;
	text-decoration: none;
}

/* 视频容器 */
.baijia-gallery-video {
	position: relative;
	overflow: hidden;
	background: #000;
}

.baijia-video-wrapper {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 默认 16:9 */
	height: 0;
	overflow: hidden;
}

.baijia-video-wrapper video,
.baijia-video-wrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* 视频封面图（poster 模式） */
.baijia-video-poster {
	cursor: pointer;
}

.baijia-video-cover {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	z-index: 1;
}

.baijia-video-cover-native {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	z-index: 1;
	pointer-events: none;
}

/* 播放按钮 */
.baijia-play-btn {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 2;
	pointer-events: none;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.baijia-video-poster:hover .baijia-play-btn {
	transform: translate(-50%, -50%) scale(1.1);
}

.baijia-play-btn svg {
	display: block;
	filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

/* 播放后隐藏封面和按钮 */
.baijia-video-poster.is-playing .baijia-video-cover,
.baijia-video-poster.is-playing .baijia-video-cover-native,
.baijia-video-poster.is-playing .baijia-play-btn {
	display: none;
}

/* === 简易 Lightbox === */
.baijia-lightbox-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.92);
	z-index: 999999;
	justify-content: center;
	align-items: center;
	cursor: zoom-out;
}

.baijia-lightbox-overlay.active {
	display: flex;
}

.baijia-lightbox-overlay .baijia-lightbox-img {
	max-width: 90%;
	max-height: 90vh;
	object-fit: contain;
	cursor: default;
	user-select: none;
}

.baijia-lightbox-close {
	position: absolute;
	top: 16px;
	right: 24px;
	font-size: 36px;
	color: #fff;
	cursor: pointer;
	z-index: 10;
	line-height: 1;
	font-weight: 300;
	transition: opacity 0.2s;
}

.baijia-lightbox-close:hover {
	opacity: 0.7;
}

/* 响应式 - 移动端小图也两列 */
@media (max-width: 480px) {
	.baijia-gallery-item.baijia-gallery-half {
		flex: 0 0 calc(50% - 2px);
		width: calc(50% - 2px);
	}
}
