/* =====================================================================
   Product photo gallery (front end)
   Drop-in styles for the markup produced by includes/gallery.php.
   Everything is namespaced under .fav-gallery so it won't collide with
   your existing front-end CSS.
   ===================================================================== */

.fav-gallery {
	--fav-accent: #E84E17;
	--fav-border: #333;
	--fav-surface: #151515;
	max-width: 500px;
}

/* --- Main image stage --- */
.fav-gallery-stage {
	position: relative;
	background: var(--fav-surface);
	border: 1px solid var(--fav-border);
	border-radius: 6px;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fav-gallery-main {
	max-width: 100%;
	max-height: 100%;
	width: 400px;
	height: auto;
	object-fit: contain;
	display: inline-block;
	cursor: zoom-in;
	transition: opacity 0.18s ease;
}

.fav-gallery-main.is-swapping {
	opacity: 0;
}

/* Single photo: nothing to click through, so no zoom affordance either */
.fav-gallery.is-single .fav-gallery-main {
	cursor: default;
}

/* --- Prev / next arrows --- */
.fav-gallery-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border: 1px solid var(--fav-border);
	border-radius: 50%;
	background: rgba(10, 10, 10, 0.72);
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s ease, border-color 0.2s ease;
	z-index: 2;
}

.fav-gallery-nav:hover,
.fav-gallery-nav:focus-visible {
	background: var(--fav-accent);
	border-color: var(--fav-accent);
}

.fav-gallery-prev { left: 10px; }
.fav-gallery-next { right: 10px; }

/* --- Counter --- */
.fav-gallery-counter {
	position: absolute;
	bottom: 10px;
	right: 12px;
	background: rgba(10, 10, 10, 0.72);
	border: 1px solid var(--fav-border);
	border-radius: 20px;
	color: #ccc;
	font-size: 11px;
	padding: 3px 10px;
	z-index: 2;
}

/* --- Thumbnail strip --- */
.fav-gallery-thumbs {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.fav-gallery-thumb {
	width: 68px;
	height: 68px;
	padding: 0;
	border: 1px solid var(--fav-border);
	border-radius: 4px;
	background: var(--fav-surface);
	cursor: pointer;
	overflow: hidden;
	display: block;
	transition: border-color 0.2s ease, opacity 0.2s ease;
	opacity: 0.65;
}

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

.fav-gallery-thumb:hover,
.fav-gallery-thumb:focus-visible {
	opacity: 1;
	border-color: #666;
}

.fav-gallery-thumb.is-active {
	opacity: 1;
	border-color: var(--fav-accent);
}

/* --- Empty state (product has no photos yet) --- */
.fav-gallery-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	background: var(--fav-surface);
	border: 1px dashed var(--fav-border);
	border-radius: 6px;
	color: #666;
	font-size: 13px;
}

/* =====================================================================
   Lightbox
   ===================================================================== */

.fav-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	z-index: 9999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
}

.fav-lightbox.is-open {
	display: flex;
}

.fav-lightbox-img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
}

.fav-lightbox-close,
.fav-lightbox-nav {
	position: absolute;
	border: 1px solid #444;
	border-radius: 50%;
	background: rgba(20, 20, 20, 0.8);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.fav-lightbox-close:hover,
.fav-lightbox-close:focus-visible,
.fav-lightbox-nav:hover,
.fav-lightbox-nav:focus-visible {
	background: #E84E17;
	border-color: #E84E17;
}

.fav-lightbox-close {
	top: 20px;
	right: 20px;
	width: 42px;
	height: 42px;
	font-size: 22px;
}

.fav-lightbox-nav {
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	font-size: 22px;
}

.fav-lightbox-prev { left: 20px; }
.fav-lightbox-next { right: 20px; }

.fav-lightbox-counter {
	position: absolute;
	bottom: 22px;
	left: 50%;
	transform: translateX(-50%);
	color: #aaa;
	font-size: 12px;
}

/* Stops the page behind the lightbox scrolling while it's open */
body.fav-lightbox-open {
	overflow: hidden;
}

/* --- Small screens --- */
@media screen and (max-width: 600px) {
	.fav-gallery-thumb {
		width: 54px;
		height: 54px;
	}
	.fav-gallery-nav {
		width: 34px;
		height: 34px;
		font-size: 15px;
	}
	.fav-lightbox-nav {
		width: 40px;
		height: 40px;
	}
	.fav-lightbox-prev { left: 8px; }
	.fav-lightbox-next { right: 8px; }
}

/* --- Respect reduced-motion preferences --- */
@media (prefers-reduced-motion: reduce) {
	.fav-gallery-main,
	.fav-gallery-nav,
	.fav-gallery-thumb,
	.fav-lightbox-close,
	.fav-lightbox-nav {
		transition: none;
	}
}
