/* ==========================================================================
   Achat en une page : bouton « Acheter maintenant », panneau, formulaire.
   ========================================================================== */

/* Le panier reste en secours, sans bouton visible. */
.diwan-achat-une-page .wp-block-woocommerce-mini-cart {
	display: none !important;
}

/* Bouton vert zellige */
.diwan-achat-bouton.wp-element-button,
.diwan-achat-bouton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0.8rem 1.5rem;
	border: 0;
	border-radius: 0;
	background: var(--wp--preset--color--zellige);
	color: var(--wp--preset--color--perle);
	font-family: var(--wp--preset--font-family--ibm-plex-sans);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.2s ease;
}
.diwan-achat-bouton:hover {
	background: color-mix(in srgb, var(--wp--preset--color--zellige) 86%, #000);
	color: var(--wp--preset--color--perle);
}
.diwan-achat-bouton:focus-visible {
	outline: 2px solid var(--wp--preset--color--bronze);
	outline-offset: 3px;
}
.diwan-achat-bouton[hidden] {
	display: none;
}
.diwan-achat-bouton[disabled] {
	opacity: 0.7;
	cursor: progress;
}

/* Sous chaque produit des grilles */
.diwan-achat-grille {
	margin: 0.6rem 0 1.5rem !important;
	text-align: center;
}
.diwan-achat-grille .diwan-achat-bouton {
	box-sizing: border-box;
	width: 100%;
	max-width: 260px;
	min-height: 44px;
	padding: 0.65rem 0.5rem;
	font-size: 0.7rem;
	letter-spacing: 0.08em;
	white-space: nowrap;
}
@media (max-width: 599px) {
	.diwan-achat-grille .diwan-achat-bouton {
		font-size: 0.64rem;
		letter-spacing: 0.04em;
	}
}

/* Fiche produit */
.diwan-achat-fiche {
	margin-top: var(--wp--preset--spacing--40);
}
.diwan-achat-fiche > .diwan-achat-bouton {
	width: 100%;
	max-width: 420px;
}
.diwan-achat-fiche__formulaire {
	max-width: 520px;
}

/* ---------- Panneau ---------- */
html.diwan-achat-ouvert {
	overflow: hidden;
}
.diwan-achat-panneau {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}
.diwan-achat-panneau[hidden] {
	display: none;
}
.diwan-achat-panneau__fond {
	position: absolute;
	inset: 0;
	background: rgba(22, 16, 27, 0.55);
	animation: diwan-achat-fondu 0.2s ease;
}
.diwan-achat-panneau__boite {
	position: relative;
	width: 100%;
	height: 100%;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--wp--preset--color--perle);
	color: var(--wp--preset--color--nuit);
	animation: diwan-achat-monte 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.diwan-achat-panneau__fermer {
	position: sticky;
	top: 0.5rem;
	float: right;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0.5rem 0.5rem -52px 0;
	border: 0;
	border-radius: 50%;
	background: rgba(242, 234, 226, 0.92);
	color: var(--wp--preset--color--nuit);
	cursor: pointer;
}
.diwan-achat-panneau__fermer:focus-visible {
	outline: 2px solid var(--wp--preset--color--zellige);
	outline-offset: 2px;
}
.diwan-achat-panneau__contenu {
	display: grid;
}
.diwan-achat-panneau__infos {
	padding: 1.25rem 1.25rem 2.5rem;
}
.diwan-achat-panneau__nom {
	margin: 0;
	font-size: clamp(1.75rem, 6vw, 2.25rem);
	line-height: 1.15;
}
.diwan-achat-panneau__arabe {
	margin: 0.2rem 0 0;
	font-family: var(--wp--preset--font-family--amiri);
	font-size: 1.25rem;
	color: var(--wp--preset--color--bronze);
	text-align: left !important;
}
.diwan-achat-panneau__prix {
	margin: 0.75rem 0 0;
	font-family: var(--wp--preset--font-family--ibm-plex-sans);
	font-size: 1.15rem;
	font-weight: 600;
}
.diwan-achat-panneau__taille {
	margin: 0.4rem 0 0;
	font-size: 0.9rem;
	color: var(--wp--preset--color--gris-chaud);
}

/* Galerie : défilement horizontal avec aimantation */
.diwan-achat-galerie {
	position: relative;
	background: var(--wp--preset--color--perle-profond);
}
.diwan-achat-galerie__piste {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}
.diwan-achat-galerie__piste::-webkit-scrollbar {
	display: none;
}
.diwan-achat-galerie__piste img {
	flex: 0 0 100%;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	scroll-snap-align: center;
}
.diwan-achat-galerie__points {
	position: absolute;
	bottom: 0.75rem;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: 6px;
}
.diwan-achat-galerie__points span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(242, 234, 226, 0.6);
	transition: background-color 0.2s, transform 0.2s;
}
.diwan-achat-galerie__points span.is-actif {
	background: var(--wp--preset--color--perle);
	transform: scale(1.3);
}

.diwan-achat-galerie__fleche {
	position: absolute;
	top: 50%;
	display: none;
	place-items: center;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	border: 0;
	border-radius: 50%;
	background: rgba(242, 234, 226, 0.88);
	color: var(--wp--preset--color--nuit);
	cursor: pointer;
}
.diwan-achat-galerie__fleche--prec {
	left: 0.75rem;
}
.diwan-achat-galerie__fleche--suiv {
	right: 0.75rem;
}
.diwan-achat-galerie__fleche:focus-visible {
	outline: 2px solid var(--wp--preset--color--zellige);
	outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
	.diwan-achat-galerie__fleche {
		display: grid;
	}
}

/* ---------- Formulaire ---------- */
.diwan-achat-form {
	margin-top: 1.25rem;
	padding-top: 1.25rem;
	border-top: 1px solid rgba(22, 16, 27, 0.14);
}
.diwan-achat-champ {
	display: grid;
	gap: 0.3rem;
	margin: 0 0 0.9rem;
}
.diwan-achat-champ label {
	font-family: var(--wp--preset--font-family--ibm-plex-sans);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.04em;
}
.diwan-achat-champ input,
.diwan-achat-champ textarea {
	width: 100%;
	box-sizing: border-box;
	min-height: 48px;
	padding: 0.7rem 0.85rem;
	border: 1px solid rgba(22, 16, 27, 0.25);
	border-radius: 0;
	background: #fff;
	color: var(--wp--preset--color--nuit);
	font: inherit;
	font-size: 16px; /* évite le zoom automatique sur iPhone */
}
.diwan-achat-champ textarea {
	resize: vertical;
}
.diwan-achat-champ input:focus-visible,
.diwan-achat-champ textarea:focus-visible {
	outline: 2px solid var(--wp--preset--color--zellige);
	outline-offset: 0;
	border-color: var(--wp--preset--color--zellige);
}
.diwan-achat-champ [aria-invalid="true"] {
	border-color: #a3341f;
}
.diwan-achat-champ__err {
	font-size: 0.82rem;
	color: #a3341f;
}
.diwan-achat-champ__err:empty {
	display: none;
}
.diwan-achat-piege {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.diwan-achat-form__erreur {
	margin: 0 0 0.75rem;
	padding: 0.6rem 0.8rem;
	border-left: 3px solid #a3341f;
	background: rgba(163, 52, 31, 0.07);
	font-size: 0.9rem;
	color: #7d2717;
}
.diwan-achat-form__envoyer {
	box-sizing: border-box;
	width: 100%;
	margin-top: 0.4rem;
	font-size: 0.78rem;
}
.diwan-achat-form__note {
	margin: 0.6rem 0 0;
	text-align: center;
	font-size: 0.85rem;
	color: var(--wp--preset--color--gris-chaud);
}

/* Confirmation */
.diwan-achat-merci {
	margin-top: 1.25rem;
	padding: 1.25rem;
	border: 1px solid var(--wp--preset--color--champagne);
	background: rgba(255, 255, 255, 0.5);
}
.diwan-achat-merci__titre {
	margin: 0 0 0.5rem;
	font-size: 1.4rem;
	line-height: 1.25;
}
.diwan-achat-merci__titre:focus {
	outline: none;
}
.diwan-achat-merci__whatsapp {
	box-sizing: border-box;
	width: 100%;
}

/* Chargement */
.diwan-achat-chargement {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	min-height: 60vh;
	color: var(--wp--preset--color--gris-chaud);
	font-size: 0.9rem;
}
.diwan-achat-chargement span {
	width: 28px;
	height: 28px;
	border: 2px solid rgba(22, 16, 27, 0.15);
	border-top-color: var(--wp--preset--color--zellige);
	border-radius: 50%;
	animation: diwan-achat-tourne 0.8s linear infinite;
}

/* Ordinateur : fenêtre centrée, photos à gauche */
@media (min-width: 782px) {
	.diwan-achat-panneau {
		padding: 2rem;
	}
	.diwan-achat-panneau__boite {
		width: min(980px, 100%);
		height: auto;
		max-height: min(90vh, 860px);
		box-shadow: 0 30px 80px rgba(22, 16, 27, 0.3);
	}
	.diwan-achat-panneau__contenu {
		grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
		align-items: start;
	}
	.diwan-achat-galerie {
		position: sticky;
		top: 0;
	}
	.diwan-achat-panneau__infos {
		padding: 2.25rem 2.25rem 2rem;
	}
}

@keyframes diwan-achat-fondu {
	from { opacity: 0; }
}
@keyframes diwan-achat-monte {
	from { opacity: 0; transform: translateY(24px); }
}
@keyframes diwan-achat-tourne {
	to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
	.diwan-achat-panneau__fond,
	.diwan-achat-panneau__boite,
	.diwan-achat-chargement span {
		animation: none;
	}
	.diwan-achat-bouton {
		transition: none;
	}
}
