/*
 * Product Image Carousel (Swiper.js)
 * Loaded on: single vigilis_product pages
 */

/* =====================
   SWIPER OVERRIDES
===================== */

/*
 * .product-carousel sets the intrinsic size via aspect-ratio.
 * .product-carousel__swiper is absolutely positioned to fill it — this
 * breaks the height:100% circular reference that swiper-wrapper creates
 * when the swiper has no explicit pixel height.
 */
.product-carousel {
	position: relative;
	width: 100%;
	aspect-ratio: 5 / 6;
	border-radius: 24px;
	overflow: hidden;
	background: #f9f8f6;
	margin-bottom: 24px;
}

.product-carousel__swiper {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.product-carousel__slide {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f9f8f6;
}

.product-carousel__slide img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* Swiper pagination (dots) */
.swiper-pagination {
	position: absolute;
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	justify-content: center;
	gap: 4px;
	z-index: 10;
}

/* Bullet padding gives a 24x24 hit area while keeping the visible dot at 8px */
.swiper-pagination-bullet {
	width: 24px;
	height: 24px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease;
}

.swiper-pagination-bullet::before {
	content: '';
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.4);
	transition: background 0.2s ease;
}

.swiper-pagination-bullet:hover::before {
	background: rgba(255, 255, 255, 0.7);
}

.swiper-pagination-bullet-active::before {
	background: #ffffff;
}

.swiper-pagination-bullet-active {
	transform: scale(1.2);
}

/* Navigation buttons */
.swiper-button-prev,
.swiper-button-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 11;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(6, 55, 21, 0.6);
	border: none;
	border-radius: 50%;
	color: #ffffff;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
	font-size: 20px;
	font-weight: bold;
	padding: 0;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
	background: rgba(6, 55, 21, 0.85);
	transform: translateY(-50%) scale(1.1);
}

.swiper-button-prev {
	left: 12px;
}

.swiper-button-next {
	right: 12px;
}

.swiper-button-prev::after,
.swiper-button-next::after {
	content: '';
}

/* Image counter / slide info */
.product-carousel__counter {
	position: absolute;
	top: 12px;
	right: 12px;
	background: rgba(6, 55, 21, 0.7);
	color: #ffffff;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 500;
	z-index: 10;
	pointer-events: none;
}

/* Image caption */
.product-carousel__caption {
	position: absolute;
	bottom: 48px;
	left: 0;
	right: 0;
	background: rgba(6, 55, 21, 0.7);
	color: #ffffff;
	padding: 8px 16px;
	text-align: center;
	font-size: 13px;
	font-weight: 500;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.product-carousel__slide.swiper-slide-active .product-carousel__caption {
	opacity: 1;
}

/* Accessibility: Ensure keyboard nav is visible */
.swiper-button-prev:focus-visible,
.swiper-button-next:focus-visible {
	outline: 3px solid var(--color-primary-800, #08471B);
	outline-offset: 2px;
}

/* =====================
   RESPONSIVE
===================== */

@media (max-width: 960px) {
	.product-carousel {
		aspect-ratio: 4 / 3;
		border-radius: 20px;
	}

	.swiper-button-prev,
	.swiper-button-next {
		width: 40px;
		height: 40px;
		font-size: 18px;
	}

	.swiper-pagination {
		bottom: 4px;
	}

	.swiper-pagination-bullet::before {
		width: 6px;
		height: 6px;
	}
}

@media (max-width: 480px) {
	.product-carousel {
		aspect-ratio: 3 / 4;
		border-radius: 16px;
	}

	.swiper-button-prev,
	.swiper-button-next {
		width: 36px;
		height: 36px;
		font-size: 16px;
	}

	.product-carousel__counter {
		top: 8px;
		right: 8px;
		font-size: 11px;
		padding: 3px 6px;
	}
}
