/*
 * Cartes
 *
 * Cartes formation et actualite, corps via shortcode, survol commun, cartes services.
 */

/* --- Cartes : image bord à bord en tête, bouton aligné en bas ------------- */
.elementor-widget-loop-grid .e-loop-item > .mlett-card { height: 100%; }
.mlett-card .elementor-widget-image, .mlett-card .elementor-widget-theme-post-featured-image { width: 100%; }
.mlett-card .elementor-widget-image .elementor-widget-container, .mlett-card .elementor-widget-theme-post-featured-image .elementor-widget-container,
.mlett-card .elementor-widget-image a, .mlett-card .elementor-widget-theme-post-featured-image a { display: block; width: 100%; }
.mlett-card .elementor-widget-image img, .mlett-card .elementor-widget-theme-post-featured-image img { display: block; width: 100% !important; height: 220px; object-fit: cover; border-radius: 0 !important; }
.mlett-card .elementor-widget-button { margin-top: auto; }
.mlett-card > .e-con:last-child { flex-grow: 1; }

/* --- Carte formation (corps via [mlett_card_body]) ------------------------ */
.mlett-cb { display: flex; flex-direction: column; gap: 14px; padding: 24px 24px 22px; height: 100%; }
.mlett-cb__title { margin: 0; font-size: 20px; line-height: 1.25; }
.mlett-card .mlett-cb__title a { color: #012853 !important; text-decoration: none; }
.mlett-card .mlett-cb__title a:hover, .mlett-card .mlett-cb__title a:focus-visible { color: #0B63C7 !important; }
/*
 * Chips des cartes formation — meme ecriture que ceux du carrousel (.mlett-hchip),
 * transposee sur fond clair : puce coloree, libelle en gris, valeur en marine.
 * Le balisage reste un <dl> : la pilule est une presentation, la relation
 * libelle/valeur doit rester lisible par un lecteur d'ecran.
 */
.mlett-cb__rows { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.mlett-cchip {
	/* `flex-start` et non `center` : certaines valeurs tiennent sur deux ou trois lignes,
	   la puce et le libelle doivent rester cales sur la premiere. */
	display: inline-flex; align-items: flex-start; gap: 7px;
	align-self: flex-start;
	padding: 6px 12px; border-radius: 14px;
	background: #F1F5F9;
	font: 500 13px/1.35 'Roboto', sans-serif;
}
.mlett-cchip::before {
	content: ""; flex: 0 0 auto;
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--mlett-blue-aa);
	/* centre la puce sur la premiere ligne de texte */
	margin-top: calc((1.35em - 7px) / 2);
}
/* Sans `nowrap`, « Durée » se coupait en « Duré / e » des que la valeur etait longue. */
.mlett-cchip__label { margin: 0; color: #5A6B7D; font-weight: 500; white-space: nowrap; }
.mlett-cchip__value { margin: 0; color: var(--mlett-navy); font-weight: 500; }
/* Statut des inscriptions : seule la puce porte la couleur, comme dans le hero. */
.mlett-cchip--ouvertes::before, .mlett-cchip--continu::before { background: var(--mlett-green-aa); }
.mlett-cchip--bientot::before { background: #C77700; }
.mlett-cchip--cloturees::before { background: #C62828; }
/* Carte entière cliquable */
.mlett-card { position: relative; }

/* ---------------------------------------------------------------------------
 * Cartes : retour au survol, commun aux services, formations et actualites
 * ------------------------------------------------------------------------- */
.mlett-card.e-con { transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.mlett-card.e-con:hover, .mlett-card.e-con:focus-within {
	transform: translateY(-6px);
	border-color: var(--mlett-blue);
	box-shadow: 0 16px 36px rgba(1, 40, 83, .16);
}
@media (prefers-reduced-motion: reduce) {
	.mlett-card.e-con { transition: box-shadow .2s ease, border-color .2s ease; }
	.mlett-card.e-con:hover, .mlett-card.e-con:focus-within { transform: none; }
}

/* --- Cartes services ------------------------------------------------------ */
/* 22 % x 4 + gaps ne faisaient que 1128px sur la grille de 1200 : les cartes
   remplissent la rangee et se replient d'elles-memes quand la place manque. */
/* Elementor pose `--width: 22%` a (0,3,0) depuis le CSS de la page : il faut quatre
   classes pour reprendre la main sur ses variables. */
.elementor-element.mlett-card.mlett-svc.e-con { --width: auto; --flex-grow: 1; --flex-shrink: 1; --flex-basis: 220px; }
/* Tablette : une base de 220px laissait passer 3 cartes puis une seule, etiree sur toute
   la largeur. Deux par ligne, a parts egales (le gap de la rangee vaut 24px). */
@media (max-width: 1024px) { .elementor-element.mlett-card.mlett-svc.e-con { --flex-basis: calc(50% - 12px); } }
@media (max-width: 767px)  { .elementor-element.mlett-card.mlett-svc.e-con { --flex-basis: 100%; } }
/* Toute la carte est cliquable : le lien ne couvrait que l'icone (56x56) et le titre. */
.mlett-svc .elementor-icon-box-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.mlett-svc .elementor-icon-box-title a { color: var(--mlett-navy); text-decoration: none; transition: color .2s ease; }
.mlett-svc:hover .elementor-icon-box-title a, .mlett-svc:focus-within .elementor-icon-box-title a { color: #0B63C7; }
/* Titres sur une ou deux lignes : sans plancher, les descriptions se decalaient de 24px. */
@media (min-width: 768px) {
	.mlett-svc .elementor-icon-box-title {
		min-height: 50px; margin-bottom: 8px;
		/* Centre : sans cela, un titre d'une ligne laissait 25px de vide sous lui. */
		display: flex; align-items: center; justify-content: center;
	}
}
.mlett-svc .elementor-icon { transition: background-color .25s ease, transform .25s ease; }
.mlett-svc:hover .elementor-icon, .mlett-svc:focus-within .elementor-icon { background-color: var(--mlett-navy); transform: scale(1.06); }
@media (prefers-reduced-motion: reduce) { .mlett-svc:hover .elementor-icon { transform: none; } }

.mlett-card .mlett-cb__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.mlett-card .mlett-cb__more { position: relative; z-index: 2; }
.mlett-card .mlett-stamp { position: relative; z-index: 2; }

/* --- Encadre « Infos pratiques » des fiches formation ---------------------- */
/*
 * Le sticky d'Elementor fonctionne en JS avec `position: fixed` : il ne connait pas les
 * limites de sa colonne et continuait de suivre le scroll bien au-dela de sa section
 * (562px de debordement mesures), passant par-dessus le formulaire d'inscription puis
 * « Autres formations ». `position: sticky` s'arrete tout seul au bas de son conteneur.
 */
@media (min-width: 1025px) {
	.mlett-infos { align-self: flex-start; }
	.mlett-infos__panneau.e-con {
		position: sticky;
		/* hauteur du header colle (81px) + une respiration */
		top: 100px;
	}
}
