/**
 * Galerie produit : une image à la fois + miniatures en bas + lightbox.
 * Child theme Unita.
 */

.single-product.unita-child-gallery-enabled div.product .woocommerce-product-gallery.unita-child-product-gallery {
	opacity: 1 !important;
	float: none;
	width: 100%;
	overflow: visible;
	position: relative;
}

.unita-child-gallery {
	position: relative;
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Rapport d'image fixe : la scène garde exactement la même taille quelle que
   soit l'orientation de la photo, donc la page ne saute plus d'une image à
   l'autre. Une seule variable à changer pour adopter un autre format. */
.unita-child-gallery__main {
	position: relative;
	width: 100%;
	aspect-ratio: var(--unita-child-gallery-ratio, 1 / 1);
	background: #f5f5f5;
	overflow: hidden;
}

.unita-child-gallery__main .swiper-wrapper {
	display: flex;
	align-items: stretch;
	height: 100%;
}

/*
 * Reprise obligatoire du thème parent : woocommerce.css impose
 * « display: block » à .woocommerce-product-gallery__wrapper avec une
 * spécificité supérieure. Swiper empile alors les slides les unes sous les
 * autres et, une fois le conteneur décalé, seule la première image reste
 * visible. Les sélecteurs ci-dessous sont volontairement longs pour repasser
 * devant celui du parent.
 */
.single-product div.product .woocommerce-product-gallery.unita-child-product-gallery .unita-child-gallery__main .swiper-wrapper {
	position: relative;
	display: flex;
	align-items: stretch;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.single-product div.product .woocommerce-product-gallery.unita-child-product-gallery .unita-child-gallery__main .swiper-slide {
	width: 100%;
	height: 100%;
	flex-shrink: 0;
}

.single-product div.product .woocommerce-product-gallery.unita-child-product-gallery .unita-child-gallery__main .swiper-slide img {
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.unita-child-gallery__main .swiper-slide {
	width: 100%;
	height: 100%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f5f5f5;
}

.unita-child-gallery .unita-child-gallery__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	line-height: 0;
	/* Hérite du curseur de préhension du slider : la photo se fait glisser,
	   elle ne s'agrandit plus au clic. */
	cursor: inherit;
}

/* Sélecteurs volontairement spécifiques : le thème parent impose sinon ses
   propres dimensions aux images de la fiche produit. */
.single-product .unita-child-gallery__main .woocommerce-product-gallery__image img,
.single-product .unita-child-gallery__main .swiper-slide img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	margin: 0;
	background: transparent;
}

/* Les boutons de la galerie sont des <button> : sans ces remises à zéro
   explicites, le style de bouton du thème (fond doré, angles droits) les
   emporte et les repères deviennent illisibles. */
.unita-child-gallery .unita-child-gallery__nav,
.unita-child-gallery .unita-child-gallery__zoom {
	position: absolute;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	min-height: 0;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background-color: rgba(255, 255, 255, 0.92) !important;
	background-image: none !important;
	color: #1a1a1a !important;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
	line-height: 1;
	text-transform: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.unita-child-gallery .unita-child-gallery__nav:hover,
.unita-child-gallery .unita-child-gallery__nav:focus,
.unita-child-gallery .unita-child-gallery__zoom:hover,
.unita-child-gallery .unita-child-gallery__zoom:focus {
	background-color: var(--e-global-color-secondary, #1a1a1a) !important;
	color: #fff !important;
	outline: none;
}

.unita-child-gallery .unita-child-gallery__nav {
	top: 50%;
	width: 48px !important;
	height: 48px !important;
	transform: translateY(-50%);
}

.unita-child-gallery .unita-child-gallery__nav.is-disabled {
	opacity: 0.35;
	pointer-events: none;
}

.unita-child-gallery .unita-child-gallery__nav--prev {
	left: 16px;
}

.unita-child-gallery .unita-child-gallery__nav--next {
	right: 16px;
}

.unita-child-gallery .unita-child-gallery__zoom {
	top: 16px;
	right: 16px;
	width: 44px !important;
	height: 44px !important;
}

/* Pictogrammes en masque SVG : taille et centrage garantis, quelles que soient
   les marges internes héritées du thème. */
.unita-child-gallery__nav-icon,
.unita-child-gallery__zoom-icon {
	display: block;
	flex: none;
	background-color: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.unita-child-gallery__nav-icon {
	width: 14px;
	height: 14px;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.6 3.4 7.2 4.8 14.4 12l-7.2 7.2 1.4 1.4L17.4 12z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.6 3.4 7.2 4.8 14.4 12l-7.2 7.2 1.4 1.4L17.4 12z'/%3E%3C/svg%3E");
}

.unita-child-gallery__nav--prev .unita-child-gallery__nav-icon {
	transform: rotate(180deg);
}

.unita-child-gallery__zoom-icon {
	width: 20px;
	height: 20px;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2a8 8 0 1 0 4.9 14.3l5.4 5.4 1.4-1.4-5.4-5.4A8 8 0 0 0 10 2zm0 2a6 6 0 1 1 0 12 6 6 0 0 1 0-12z'/%3E%3Cpath d='M9 6h2v3h3v2h-3v3H9v-3H6V9h3z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2a8 8 0 1 0 4.9 14.3l5.4 5.4 1.4-1.4-5.4-5.4A8 8 0 0 0 10 2zm0 2a6 6 0 1 1 0 12 6 6 0 0 1 0-12z'/%3E%3Cpath d='M9 6h2v3h3v2h-3v3H9v-3H6V9h3z'/%3E%3C/svg%3E");
}

/* Miniatures sous l'image principale. */
.unita-child-gallery__thumbs {
	width: 100%;
	padding: 0 2px;
	overflow: hidden;
}

.unita-child-gallery__thumbs .swiper-wrapper {
	display: flex;
	align-items: stretch;
}

.unita-child-gallery__thumb {
	width: 84px;
	height: 84px;
	flex-shrink: 0;
	margin: 0;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 2px;
	overflow: hidden;
	cursor: pointer;
	opacity: 0.65;
	background: #f0f0f0;
	transition: opacity 0.2s ease, border-color 0.2s ease;
	box-sizing: border-box;
}

.unita-child-gallery__thumb:hover,
.unita-child-gallery__thumb:focus {
	opacity: 1;
	outline: none;
}

.unita-child-gallery__thumb.is-active {
	opacity: 1;
	border-color: var(--e-global-color-secondary, #1a1a1a);
}

.unita-child-gallery__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Lightbox Magnific — mode plein écran. */
.mfp-unita-child-gallery.mfp-bg {
	background: rgba(0, 0, 0, 0.92);
	opacity: 1;
}

.mfp-unita-child-gallery .mfp-content {
	max-width: 100%;
}

.mfp-unita-child-gallery .mfp-figure {
	max-height: 100vh;
}

.mfp-unita-child-gallery .mfp-img {
	max-height: 92vh !important;
	padding: 0;
	box-shadow: none;
}

.mfp-unita-child-gallery .mfp-close {
	width: 48px;
	height: 48px;
	line-height: 48px;
	right: 16px;
	top: 16px;
	opacity: 1;
	color: #fff;
	font-size: 32px;
}

.mfp-unita-child-gallery .mfp-arrow {
	opacity: 1;
}

.mfp-unita-child-gallery .mfp-bottom-bar {
	margin-top: -20px;
}

.mfp-unita-child-gallery .mfp-counter {
	color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 767px) {
	.unita-child-gallery .unita-child-gallery__nav {
		width: 40px !important;
		height: 40px !important;
	}

	.unita-child-gallery .unita-child-gallery__nav--prev {
		left: 8px;
	}

	.unita-child-gallery .unita-child-gallery__nav--next {
		right: 8px;
	}

	.unita-child-gallery__thumb {
		width: 64px;
		height: 64px;
	}

	.unita-child-gallery .unita-child-gallery__zoom {
		top: 10px;
		right: 10px;
		width: 40px !important;
		height: 40px !important;
	}

	.unita-child-gallery__zoom-icon {
		width: 18px;
		height: 18px;
	}
}
