/* ==========================================================================
   Sélection du moment — Max de Génie

   Bloc [mdg_selection] : slider produit (Swiper, effet fade) + bloc statique
   "Comment ça marche ?". Chargé uniquement quand le shortcode est présent
   (voir functions.php).
   ========================================================================== */

.mdg-sel {
	--mdg-max: 1300px;
	position: relative;
	max-width: var(--mdg-max);
	margin: 0 auto;
	padding: 3rem 0;
}

.mdg-sel *,
.mdg-sel *::before,
.mdg-sel *::after {
	box-sizing: border-box;
}

/* --- Titre ----------------------------------------------------------------- */

.mdg-sel__heading {
	margin: 0 0 2.5rem;
	text-align: center;
	font-family: "laca", Sans-serif;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .02em;
	font-size: 48px;
	color: #C38841;
}

/* --- Structure générale ------------------------------------------------------ */

.mdg-sel__layout {
	position: relative;
	display: grid;
	grid-template-columns: 62px minmax(0, 1fr) 230px;
	align-items: center;
	gap: .5rem;
	padding: 0 40px
}

/* --- Puces (bullets) --------------------------------------------------------- */

.mdg-sel__bullets {
	display: flex;
	flex-direction: column;
	gap: 41px;
	align-items: center;
}

/*
 * Préfixe `button` pour gagner en spécificité sur Elementor, mais ça ne
 * suffit pas partout : le style bouton par défaut d'Elementor (le fond
 * rose) passe par une règle plus spécifique que `button.mdg-sel__bullet`
 * sur :hover. Donc !important sur les seules propriétés visuelles où
 * Elementor s'impose (background, border, outline, box-shadow), plutôt
 * que de partir dans une course à la spécificité. Toutes les
 * pseudo-classes (hover, focus, focus-visible, active) sont réaffirmées
 * pour que le bouton reste identique à son état normal / .is-active.
 */
button.mdg-sel__bullet,
button.mdg-sel__bullet:hover,
button.mdg-sel__bullet:focus,
button.mdg-sel__bullet:focus-visible,
button.mdg-sel__bullet:active {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 2px solid #B98B54 !important;
	border-radius: 50%;
	background: var(--mdg-bullet) !important;
	cursor: pointer;
	outline: none !important;
	box-shadow: none !important;
	transform: none;
	transition: transform .3s ease, box-shadow .3s ease;
}

button.mdg-sel__bullet.is-active,
button.mdg-sel__bullet.is-active:hover,
button.mdg-sel__bullet.is-active:focus,
button.mdg-sel__bullet.is-active:focus-visible,
button.mdg-sel__bullet.is-active:active {
	width: 61px;
	height: 61px;
	border-width: 5px !important;
}

/* --- Slider produit ----------------------------------------------------------- */

.mdg-sel__swiper {
	position: relative;
	width: 100%;
	min-width: 0;
	overflow: hidden;
}

/*
 * Filet de sécurité : si le CSS vendor de Swiper ne se charge pas (ou pas
 * encore) sur une page donnée, .swiper-wrapper / .swiper-slide n'ont plus
 * ni "display: flex" ni largeur définie, et le contenu (titre, texte…)
 * peut alors forcer une largeur énorme sur .mdg-sel__content. On fige donc
 * ici explicitement la largeur à chaque étage, indépendamment du CSS vendor.
 */
.mdg-sel__swiper .swiper-wrapper {
	width: 100%;
	min-width: 0;
}

.mdg-sel__swiper .swiper-slide {
	width: 100%;
	min-width: 0;
	max-width: 100%;
	flex-shrink: 0;
}

.mdg-sel__slide {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	max-width: 100%;
}

.mdg-sel__media {
	flex: 0 0 auto;
	width: min(320px, 35%);
	display: flex;
	align-items: center;
	justify-content: center;
}

.mdg-sel__media img {
	display: block;
	width: auto;
	max-width: 100%;
	max-height: 420px;
	height: auto;
	margin: 0 auto;
}

/* --- Contenu produit ----------------------------------------------------------- */

.mdg-sel__content {
	flex: 1 1 auto;
	min-width: 0;
	padding-right: 15px;
}

.mdg-sel__content hr{
	margin: 10px 0;
}

.mdg-sel__cat {
	margin: 0 0 .25rem;
	font-family: "finlay", cursive;
	font-size: 22px;
	color: var(--mdg-cat);
}

.mdg-sel__title {
	margin: 0 0 .75rem;
	font-family: "laca", Sans-serif;
	font-weight: 700;
	text-transform: uppercase;
	line-height: 27px;
	font-size: 24px;
	color: var(--mdg-title);
	overflow-wrap: break-word;
}

.mdg-sel__price {
	margin: 0 0 1rem;
	font-size: 20px;
	font-weight: 600;
	color: #000000;
	font-family: "laca", Sans-serif;
}

.mdg-sel__excerpt {
	font-size: 16px;
	font-weight: 400;
	color: #000000;
	font-family: "laca", Sans-serif;
	line-height: 18px;
	overflow-wrap: break-word;
	margin-bottom: 30px;
}

.mdg-sel__excerpt p {
	margin: 0 0 .75rem;
}

.mdg-sel__excerpt p:last-child {
	margin-bottom: 0;
}

/* --- Pictogrammes --------------------------------------------------------------- */

.mdg-sel__pictos {
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
	margin: 0 0 40px;
	row-gap: 10px;
}

.mdg-sel__picto {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .5rem;
	width: 92px;
	text-align: center;
}

.mdg-sel__picto-icon {
	display: grid;
	place-items: center;
	width: 35px;
	height: 35px;
}

.mdg-sel__picto-icon img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.mdg-sel__picto-label {
		font-size: 12px;
	font-weight: 500;
	color: #000000;
	font-family: "laca", Sans-serif;
	line-height: 13px;
	letter-spacing: 0.36px;
	text-transform: uppercase;
}

/* --- Bouton CTA -------------------------------------------------------------- */

.mdg-sel__cta {
	display: inline-block;
	padding: 10px 25px;
	font-family: "laca", Sans-serif;
	border-radius:59px;
	background: var(--mdg-title);
	color: #fff;
	font-weight: 700;
	font-size: 16px;
	line-height: 18px;
	text-transform: uppercase;
	text-decoration: none;
	transition: filter .2s ease, transform .2s ease;
}

.mdg-sel__cta:hover,
.mdg-sel__cta:focus-visible {
	filter: brightness(1.08);
	transform: translateY(-1px);
	color: #fff;
}

/* --- Bloc "Comment ça marche ?" -------------------------------------------------- */

.mdg-sel__howto {
	align-self: flex-start;
	display: flex;
	flex-direction: column;
	padding: 20px 16px;
	border-radius: 11px;
	background: #FEEFE3;
	z-index: 1;
}

.mdg-sel__howto-title {
	color: #C38841;
	text-align: center;
	font-family: "laca", Sans-serif;
	font-size: 17px;
	font-style: normal;
	font-weight: 700;
	line-height: 18px;
	text-transform: uppercase;
	padding-bottom: 20px;
}

.mdg-sel__howto-steps {
	display: flex;
	flex-direction: column;
	gap: 1.75rem;
}

.mdg-sel__howto-step {
	text-align: center;
}

.mdg-sel__howto-icon {
	width: 52px;
	height: auto ;
	margin: 0 auto .75rem;
	color: #c98a2e;
}

.mdg-sel__howto-icon svg {
	width: 55px;
	height: 100%;
}

.mdg-sel__howto-text {
	color: #000;
	text-align: center;
	font-family: "laca", Sans-serif;
	font-size: 16px;
	font-style: normal;
	font-weight: 400;
	line-height: 18px;
}

/* --- Flèches de navigation ------------------------------------------------------ */

/*
 * Même logique que .mdg-sel__bullet : préfixe `button` + !important sur
 * les propriétés visuelles où Elementor s'impose (voir le commentaire
 * détaillé sur .mdg-sel__bullet plus haut), sur tous les états.
 *
 * Le slider boucle (voir `loop` dans selection-du-moment.js) : ces
 * boutons ne passent donc jamais en .swiper-button-disabled, pas
 * besoin de style pour cet état.
 */
button.mdg-sel__nav,
button.mdg-sel__nav:hover,
button.mdg-sel__nav:focus,
button.mdg-sel__nav:focus-visible,
button.mdg-sel__nav:active {
	position: absolute;
	top: 50%;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 0 !important;
	background: none !important;
	cursor: pointer;
	outline: none !important;
	box-shadow: none !important;
	transform: translateY(-50%);
}

.mdg-sel__nav::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: .9rem;
	height: .9rem;
	border-right: 3px solid #c9a06b;
	border-top: 3px solid #c9a06b;
}

.mdg-sel__nav--prev {
	left: 0;
}

.mdg-sel__nav--prev::before {
	transform: translate(-50%, -50%) rotate(-135deg);
}

.mdg-sel__nav--next {
	right: 0;
}

.mdg-sel__nav--next::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

/* --- Responsive ----------------------------------------------------------------- */

@media (max-width: 960px) {
	.mdg-sel__layout {
		grid-template-columns: 1fr;
		padding: 0 1rem;
	}

	.mdg-sel__bullets {
		order: 3;
		flex-direction: row;
		justify-content: center;
	}

	.mdg-sel__swiper {
		order: 1;
	}

	.mdg-sel__howto {
		order: 2;
		align-self: center;
	}

	.mdg-sel__slide {
		flex-direction: column;
		text-align: center;
	}

	.mdg-sel__excerpt {
		max-width: none;
	}

	.mdg-sel__pictos {
		justify-content: center;
	}

	.mdg-sel__nav {
		display: none;
	}
	
	.mdg-sel__content {
		padding-right: 0px;
	}
	
	/* Ordre : slider, puces, puis "Comment ça marche ?" */
    .mdg-sel__swiper  { order: 1; width: 100%; }
    .mdg-sel__bullets { order: 2; }
    .mdg-sel__layout > :not(.mdg-sel__swiper):not(.mdg-sel__bullets):not(.mdg-sel__nav) { order: 3; }

    .mdg-sel__bullets {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 12px;
        margin: 20px 0 30px;
    }
}

@media (max-width: 767px) {
	.mdg-sel__heading {
		font-size: 36px;
		margin-bottom: 1.5rem;
	}
	
	.mdg-sel__layout {
        position: relative;
        display: flex;
        flex-direction: column;
    }

    .mdg-sel__bullets {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;   /* le gros rond actif reste centré avec les petits */
        gap: 16px;
        margin: 20px 0 30px;
    }

    /* Flèches en ronds blancs, sur les côtés de l'image */
    .mdg-sel__nav {
        position: absolute;
        top: 160px;
        z-index: 10;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background-color: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .mdg-sel__nav--prev { left: 0; }
    .mdg-sel__nav--next { right: 0; }
}
