
/* ZMA Block Product Gallery — v1.2 */

body.zma-block-gallery-ready .zma-native-product-gallery {
	display: none !important;
}

.zma-block-product-gallery {
	width: 100%;
	margin: 0;
	padding: 0;
}

.zma-block-product-gallery-track,
.zma-block-product-gallery-slide {
	margin: 0;
	padding: 0;
}

.zma-block-product-gallery-slide,
.zma-block-product-gallery-slide a,
.zma-block-product-gallery-slide img {
	display: block;
	width: 100%;
}

.zma-block-product-gallery-slide img {
	height: auto;
	object-fit: cover;
}

/* DESKTOP */
@media (min-width: 992px) {
	.zma-block-product-gallery-track {
		display: flex;
		flex-direction: column;
		gap: clamp(10px, 1.2vw, 18px);
	}

	.zma-block-product-gallery-dots {
		display: none;
	}

	.single-product .wp-block-columns:has(.zma-block-product-gallery) {
		align-items: flex-start !important;
	}

	.single-product .wp-block-columns:has(.zma-block-product-gallery) > .wp-block-column:last-child {
		position: sticky;
		top: 120px;
		align-self: flex-start;
	}
}

/* MOBILE : galerie en haut, résumé produit en dessous */
@media (max-width: 991px) {
	.single-product .wp-block-columns:has(.zma-block-product-gallery) {
		display: flex !important;
		flex-direction: column !important;
		gap: 24px !important;
		align-items: stretch !important;
	}

	.single-product .wp-block-columns:has(.zma-block-product-gallery) > .wp-block-column {
		width: 100% !important;
		flex-basis: 100% !important;
		max-width: 100% !important;
	}

	/* Colonne galerie toujours en premier */
	.single-product .wp-block-columns:has(.zma-block-product-gallery) > .wp-block-column:has(.zma-block-product-gallery) {
		order: 1 !important;
		position: relative !important;
		z-index: 1 !important;
	}

	/* Colonne prix / titre / panier toujours en dessous */
	.single-product .wp-block-columns:has(.zma-block-product-gallery) > .wp-block-column:not(:has(.zma-block-product-gallery)) {
		order: 2 !important;
		position: static !important;
		top: auto !important;
		inset: auto !important;
		transform: none !important;
		z-index: auto !important;
		margin-top: 0 !important;
	}

	.zma-block-product-gallery {
		width: 100vw;
		max-width: 100vw;
		margin-left: calc(50% - 50vw);
		overflow: hidden;
		position: relative;
		z-index: 1;
	}

	.zma-block-product-gallery-track {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		touch-action: pan-x;
		scrollbar-width: none;
	}

	.zma-block-product-gallery-track::-webkit-scrollbar {
		display: none;
	}

	.zma-block-product-gallery-slide {
		flex: 0 0 100%;
		width: 100%;
		min-width: 100%;
		scroll-snap-align: start;
		scroll-snap-stop: always;
	}

	.zma-block-product-gallery-dots {
		display: flex;
		justify-content: center;
		align-items: center;
		gap: 7px;
		padding: 12px 0 6px;
		background: transparent;
	}

	.zma-block-product-gallery-dot {
		width: 6px;
		height: 6px;
		padding: 0;
		border: 0;
		border-radius: 999px;
		background: rgba(0,0,0,.22);
		transition: width .2s ease, background-color .2s ease;
	}

	.zma-block-product-gallery-dot.is-active {
		width: 18px;
		background: rgba(0,0,0,.72);
	}
}

/* BOUTON PRODUIT */
.single-product .single_add_to_cart_button,
.single-product .wp-block-button__link,
.single-product button[type="submit"] {
	background: #111 !important;
	color: #fff !important;
	border: 1px solid #111 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	font: inherit !important;
	font-weight: 400 !important;
	letter-spacing: .02em;
	text-transform: none !important;
	padding: 14px 28px !important;
	min-height: 48px;
	transition: background-color .25s ease, color .25s ease, border-color .25s ease, opacity .25s ease;
}

.single-product .single_add_to_cart_button:hover,
.single-product .single_add_to_cart_button:focus,
.single-product .wp-block-button__link:hover,
.single-product .wp-block-button__link:focus,
.single-product button[type="submit"]:hover,
.single-product button[type="submit"]:focus {
	background: transparent !important;
	color: #111 !important;
	border-color: #111 !important;
	outline: none !important;
}

.single-product .single_add_to_cart_button.disabled,
.single-product .single_add_to_cart_button:disabled,
.single-product button[type="submit"]:disabled {
	opacity: .42 !important;
	cursor: not-allowed !important;
}

@media (max-width: 767px) {
	.single-product .single_add_to_cart_button,
	.single-product .wp-block-button__link,
	.single-product button[type="submit"] {
		width: 100%;
		justify-content: center;
		text-align: center;
		padding: 14px 20px !important;
	}
}


/* =========================
   v1.3 — PROPORTIONS MOBILE
   ========================= */
@media (max-width: 991px) {
	/* La galerie reste dans la largeur réelle du contenu :
	   plus de débordement 100vw qui donnait un effet surdimensionné. */
	.zma-block-product-gallery {
		width: 100% !important;
		max-width: 100% !important;
		margin-left: 0 !important;
		overflow: hidden !important;
	}

	/* Hauteur visuelle maîtrisée pour garder les infos produit proches. */
	.zma-block-product-gallery-slide {
		height: min(68vh, 620px);
		background: transparent;
	}

	.zma-block-product-gallery-slide a {
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.zma-block-product-gallery-slide img {
		width: 100% !important;
		height: 100% !important;
		max-height: min(68vh, 620px) !important;
		object-fit: contain !important;
		object-position: center center;
	}

	/* Rapproche titre/prix/bouton de la galerie. */
	.single-product .wp-block-columns:has(.zma-block-product-gallery) {
		gap: 14px !important;
	}

	.zma-block-product-gallery-dots {
		padding: 9px 0 2px !important;
	}
}

@media (max-width: 600px) {
	.zma-block-product-gallery-slide {
		height: min(62vh, 540px);
	}

	.zma-block-product-gallery-slide img {
		max-height: min(62vh, 540px) !important;
	}
}
