/*
 * RIYE Electric — 產品內頁照片輪播（single-riye_products.php + assets/js/product-gallery.js）
 *
 * 只在有 2 張以上產品照片的產品頁載入。顏色、圓角沿用 main.css 的設計 token（var(--color-…)）；
 * 另外寫成獨立檔案，修改時不需要重新編譯 Tailwind。
 */
.riye-gallery {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* 與單張圖時相同的方形淺灰底，去背圖放在中間 */
.riye-gallery__stage {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--radius-lg);
	background: var(--color-surface-200);
	touch-action: pan-y;               /* 手機左右滑動換張，上下仍可捲動頁面 */
}

.riye-gallery__slide {
	position: absolute;
	inset: 0;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	opacity: 0;
	transition: opacity 0.6s var(--ease-out, ease-out);
}
.riye-gallery__slide[data-active] {
	opacity: 1;
}
/* 每張都撐滿同一個方框（object-fit: contain），換張時產品大小不會忽大忽小 */
.riye-gallery__slide img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.riye-gallery__toggle {
	position: absolute;
	right: 12px;
	bottom: 12px;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border: 1px solid var(--color-line);
	border-radius: 9999px;
	background: rgb(255 255 255 / 0.9);
	color: var(--color-ink-900);
	cursor: pointer;
}
.riye-gallery__toggle svg {
	width: 16px;
	height: 16px;
}
.riye-gallery__toggle:hover {
	color: var(--color-brand-600);
}

.riye-gallery__thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.riye-gallery__thumb {
	width: 64px;
	height: 64px;
	padding: 4px;
	border: 2px solid transparent;
	border-radius: var(--radius-md);
	background: var(--color-surface-200);
	cursor: pointer;
	transition: border-color 0.2s;
}
.riye-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.riye-gallery__thumb:hover {
	border-color: var(--color-line);
}
.riye-gallery__thumb[aria-current="true"] {
	border-color: var(--color-brand-600);
}

.riye-gallery__toggle:focus-visible,
.riye-gallery__thumb:focus-visible {
	outline: 2px solid var(--color-brand-700);
	outline-offset: 2px;
}

.riye-gallery [hidden] {
	display: none;
}

@media (min-width: 64rem) {
	.riye-gallery__thumb {
		width: 80px;
		height: 80px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.riye-gallery__slide {
		transition: none;
	}
}
