/*
 * Accueil (bloc jmb/home). Chargé uniquement sur la page d'accueil.
 * Tailles ramenées à l'échelle réelle (la maquette est dessinée ~×1,4).
 */

.jmb-main.jmb-main--home {
	margin-block-start: 0;
	padding-block: 0;
}

.jmb-home {
	--jmb-home-gutter: clamp(1rem, 4vw, 2rem);
	--jmb-home-container: min(100% - 2 * var(--jmb-home-gutter), 1300px);

	/* Carte « guide » et pastille avis, côte à côte à cheval sur le bas du bandeau (ordinateur). */
	--jmb-home-overlap: 3rem;
	--jmb-home-card-height: 14rem;
}

.jmb-home-container {
	width: var(--jmb-home-container);
	margin-inline: auto;
}

.jmb-home-section + .jmb-home-section {
	margin-top: var(--wp--preset--spacing--60);
}

/* ─── Bandeau principal ──────────────────────────────────────────────────── */

/*
 * Aplat bleu coupé en biais, la photo apparaît dessous. La pente est celle de la maquette et du haut du
 * drapeau (0,2745), identique à toutes les largeurs : la hauteur du biais dépend donc de la largeur.
 * La hauteur de l'aplat suit le texte : quel que soit le texte saisi, il reste sur le bleu.
 * La photo occupe toujours le même cadre en bas du bandeau (biais + bande sous le texte).
 */
.jmb-home-hero {
	--jmb-hero-width: min(100vw, 1920px);
	--jmb-hero-drop: calc(var(--jmb-hero-width) * 0.2745);
	--jmb-hero-fill: 0.55; /* bleu ajouté sous le texte, en part du biais */
	--jmb-hero-photo: 0.165; /* bande de photo sous le point bas du biais, en part de la largeur */
	--jmb-hero-flag-x: 0.68; /* position du drapeau le long du biais (0 = gauche, 1 = droite) */

	position: relative;
	padding-bottom: calc(var(--jmb-hero-width) * var(--jmb-hero-photo));
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

.jmb-home-hero__media {
	position: absolute;
	inset: auto 0 0;
	height: calc(var(--jmb-hero-drop) + var(--jmb-hero-width) * var(--jmb-hero-photo) + 2px);
}

.jmb-home-hero__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 40%;
}

.jmb-home-hero__top {
	position: relative;
	padding-block: clamp(1.75rem, 4vw, 3.5rem) calc(var(--jmb-hero-drop) * var(--jmb-hero-fill));
}

.jmb-home-hero__top::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--wp--preset--color--primary);
	clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--jmb-hero-drop)), 0 100%);
}

.jmb-home-hero__content {
	position: relative;
}

.jmb-home-hero__content > * {
	max-width: 40rem;
}

.jmb-home-hero__title {
	margin: 0;
	color: var(--wp--preset--color--white);
	font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.5rem);
	font-weight: 600;
	line-height: 1.1;
}

.jmb-home-hero__subtitle {
	margin: 0.4rem 0 0;
	color: var(--wp--preset--color--accent);
	font-family: var(--wp--preset--font-family--heading);
	font-size: clamp(1.375rem, 1rem + 1.2vw, 2rem);
	font-weight: 600;
	line-height: 1.1;
	text-transform: uppercase;
}

.jmb-home-hero__buttons {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.75rem;
	margin-top: 1.5rem;
}

.jmb-home-hero__buttons .jmb-button {
	padding: 1em 1.6em;
	font-size: var(--wp--preset--font-size--x-small);
}

/* Drapeau à cheval sur le biais : son centre suit la ligne, à toutes les largeurs. */
.jmb-home-hero__flag {
	position: absolute;
	bottom: calc(var(--jmb-hero-flag-x) * var(--jmb-hero-drop));
	left: calc(var(--jmb-hero-flag-x) * 100%);
	width: clamp(40px, var(--jmb-hero-width) * 0.044, 84px);
	height: auto;
	transform: translate(-50%, 50%);
}

/* Pastille « avis clients », à cheval sur le bas du bandeau. */
.jmb-home-hero__badge {
	position: absolute;
	right: max(var(--jmb-home-gutter), (100% - 1300px) / 2);
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.15rem;
	box-sizing: border-box;
	width: 12.5rem;
	padding: 1rem 0.75rem;
	transform: translateY(25%);
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--primary);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	text-align: center;
}

.jmb-home-hero__stars {
	display: flex;
	gap: 0.2rem;
	color: #fbd400;
	font-size: 1.1rem;
}

.jmb-home-hero__badge-label {
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
}

.jmb-home-hero__rating {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 2.25rem;
	font-weight: 600;
	line-height: 1.1;
}

.jmb-home-hero__badge-text {
	font-size: 0.6875rem;
	line-height: 1.35;
	text-transform: uppercase;
}

/* ─── Univers (grille de catégories, mobile par défaut) ──────────────────── */
.jmb-home-univers .jmb-section-title {
	margin-bottom: 0.25rem;
}

.jmb-home-univers .is-style-souligne::after {
	width: 110px;
}

.jmb-home-univers__subtitle {
	margin: 0 0 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
}

.jmb-home-univers__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1rem 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.jmb-home-univers__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	color: inherit;
	text-decoration: none;
}

.jmb-home-univers__icon {
	display: block;
	width: 100%;
	max-width: 4.5rem;
	aspect-ratio: 1;
	border-radius: 50%;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary);
}

.jmb-home-univers__name {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	text-transform: uppercase;
}

.jmb-home-univers__item:hover .jmb-home-univers__icon {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--white);
}

/* ─── Guide d'aide au choix ──────────────────────────────────────────────── */
.jmb-home-guide__card {
	display: grid;
	grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
	gap: clamp(1rem, 3vw, 2rem);
	overflow: hidden;
	padding-right: clamp(1rem, 3vw, 2rem);
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--surface);
}

/* L'image remplit sa colonne sans jamais fixer la hauteur de la carte, quelles que soient ses dimensions. */
.jmb-home-guide__media {
	position: relative;
	min-height: 9rem;
}

.jmb-home-guide__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Image détourée : entière, posée sur le bas de la carte, avec un peu d'air en haut et à gauche. */
.jmb-home-guide__media--cutout .jmb-home-guide__image {
	inset: 0.75rem 0 0 1rem;
	width: calc(100% - 1rem);
	height: calc(100% - 0.75rem);
	object-fit: contain;
	object-position: 50% 100%;
}

.jmb-home-guide__body {
	align-self: center;
	padding-block: 1.25rem;
}

.jmb-home-guide__title {
	margin: 0;
	font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
}

.jmb-home-guide__subtitle {
	margin: 0.2rem 0 0.5rem;
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
}

.jmb-home-guide__text {
	max-width: 26rem;
	margin: 0 0 0.9rem;
	font-size: var(--wp--preset--font-size--x-small);
	line-height: 1.5;
}

/*
 * Ordinateur, quand la carte « guide » suit le bandeau : carte et pastille avis sur une même ligne
 * (même haut, même hauteur), à cheval sur le bas du bandeau. Sinon la pastille reste seule sur le bord.
 */
@media (min-width: 1024px) {
	.jmb-home-hero + .jmb-home-guide,
	.jmb-home-hero + .jmb-home-univers.is-hidden-desktop + .jmb-home-guide {
		position: relative;
		margin-top: calc(-1 * var(--jmb-home-overlap));
	}

	.jmb-home-guide__card {
		width: 66%;
		min-height: var(--jmb-home-card-height);
	}

	.jmb-home-hero:has(+ .jmb-home-guide) .jmb-home-hero__badge,
	.jmb-home-hero:has(+ .jmb-home-univers.is-hidden-desktop + .jmb-home-guide) .jmb-home-hero__badge {
		top: calc(100% - var(--jmb-home-overlap));
		bottom: auto;
		z-index: 1;
		width: calc(var(--jmb-home-container) * 0.213);
		height: var(--jmb-home-card-height);
		transform: none;
	}

	.jmb-home-hero__stars {
		font-size: 1.375rem;
	}

	.jmb-home-hero__badge-label {
		font-size: var(--wp--preset--font-size--medium);
	}

	.jmb-home-hero__rating {
		font-size: 2.75rem;
	}

	.jmb-home-hero__badge-text {
		margin-top: 0.5rem;
		font-size: var(--wp--preset--font-size--x-small);
	}
}

/* ─── Nos engagements ────────────────────────────────────────────────────── */
.jmb-home-engagements__box {
	padding: clamp(1.75rem, 4vw, 3rem) 1rem;
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

.jmb-home-engagements .jmb-section-title {
	color: var(--wp--preset--color--white);
}

.jmb-home-engagements__list {
	display: flex;
	justify-content: center;
	gap: clamp(1.5rem, 8vw, 7rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.jmb-home-engagements__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	max-width: 9rem;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.3;
	text-align: center;
	text-transform: uppercase;
}

.jmb-home-engagements__item .jmb-icon {
	width: clamp(2.25rem, 3vw, 2.75rem);
	height: clamp(2.25rem, 3vw, 2.75rem);
}

/* ─── Conseils & actualités ──────────────────────────────────────────────── */
.jmb-home-blog__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
}

.jmb-home-blog .jmb-post-card--featured {
	grid-column: 1 / -1;
	grid-template-columns: minmax(0, 18%) minmax(0, 1fr);
}

/* Article sans image : le texte prend toute la largeur. */
.jmb-home-blog .jmb-post-card:not(:has(.jmb-post-card__media)) {
	grid-template-columns: minmax(0, 1fr);
}

/* ─── Avis clients ───────────────────────────────────────────────────────── */
/* Avis Google : note globale à gauche, avis à droite dans une bande à faire défiler. */
.jmb-reviews {
	display: grid;
	grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
	gap: clamp(1rem, 3vw, 2rem);
	align-items: stretch;
}

.jmb-reviews p {
	margin: 0;
}

.jmb-reviews__summary {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	padding: 1.5rem 1rem;
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	text-align: center;
}

.jmb-reviews__source {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	text-transform: uppercase;
}

.jmb-reviews__rating {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 3rem;
	font-weight: 700;
	line-height: 1;
}

.jmb-reviews__rating span {
	font-size: 1.5rem;
}

.jmb-reviews__stars {
	display: inline-flex;
	gap: 0.15em;
	color: #f5b400;
	font-size: 1.1rem;
	line-height: 1;
}

.jmb-reviews__stars-off {
	display: inline-flex;
	gap: 0.15em;
	color: #c9cddd;
}

.jmb-reviews__count {
	font-size: var(--wp--preset--font-size--small);
}

.jmb-reviews__all {
	margin-top: 0.35rem;
	color: inherit;
	font-size: var(--wp--preset--font-size--x-small);
}

.jmb-reviews__all:hover,
.jmb-reviews__all:focus {
	color: inherit;
	text-decoration: none;
}

.jmb-reviews__list {
	display: grid;
	grid-auto-columns: minmax(17rem, 1fr);
	grid-auto-flow: column;
	gap: 1rem;
	margin: 0;
	padding: 0 0 0.75rem;
	overflow-x: auto;
	list-style: none;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
	overscroll-behavior-x: contain;
}

.jmb-reviews__item {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: 1.25rem;
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--surface);
	scroll-snap-align: start;
}

.jmb-reviews__head {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: 0.75rem;
	align-items: center;
}

.jmb-reviews__avatar {
	display: flex;
	grid-row: span 2;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
	font-weight: 700;
}

.jmb-reviews__author {
	overflow: hidden;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--wp--preset--color--primary);
}

.jmb-reviews__date {
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--slate);
}

.jmb-reviews__text {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.55;
}

.jmb-reviews__more {
	margin-top: auto;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
}

@media (max-width: 781.98px) {
	.jmb-reviews {
		grid-template-columns: minmax(0, 1fr);
	}

	.jmb-reviews__summary {
		flex-flow: row wrap;
		gap: 0.25rem 0.75rem;
		padding: 1rem;
	}

	.jmb-reviews__rating {
		font-size: 2rem;
	}

	.jmb-reviews__rating span {
		font-size: 1.125rem;
	}

	.jmb-reviews__all {
		flex-basis: 100%;
	}

	.jmb-reviews__list {
		grid-auto-columns: 82%;
	}
}

.jmb-home-avis [data-jmb-elfsight] {
	min-height: 12rem;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 781.98px) {
	.jmb-home-section + .jmb-home-section {
		margin-top: var(--wp--preset--spacing--50);
	}

	.jmb-home-hero {
		--jmb-hero-fill: 0.4;
		--jmb-hero-photo: 0.31;
		--jmb-hero-flag-x: 0.885;
	}

	/* Deuxième ligne du titre de la maquette sur une seule ligne dès 360 px de large. */
	.jmb-home-hero__title {
		font-size: clamp(1.125rem, 5.3vw, 1.625rem);
	}

	.jmb-home-hero__badge {
		width: 9.5rem;
		padding: 0.75rem 0.5rem;
	}

	.jmb-home-hero__rating {
		font-size: 1.75rem;
	}

	/* Maquette mobile : la note avant « Avis clients ». */
	.jmb-home-hero__badge-label {
		order: 1;
	}

	.jmb-home-hero__badge-text {
		order: 2;
	}

	.jmb-home-hero + .jmb-home-section {
		margin-top: var(--wp--preset--spacing--60);
	}

	.jmb-home-guide__card {
		grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
	}

	.jmb-home-engagements .jmb-home-container {
		width: 100%;
	}

	.jmb-home-engagements__box {
		border-radius: 0;
	}

	.jmb-home-engagements__item {
		font-size: var(--wp--preset--font-size--x-small);
	}

	/* Produits : 3 colonnes compactes comme la maquette mobile. */
	.jmb-home-produits .jmb-product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 0.5rem;
	}

	.jmb-home-produits .jmb-product-card {
		padding: 0.75rem 0.4rem;
	}

	.jmb-home-produits .jmb-product-card__title,
	.jmb-home-produits .jmb-product-card__price {
		font-size: var(--wp--preset--font-size--x-small);
	}

	.jmb-home-produits .jmb-product-card__subtitle {
		font-size: 0.6875rem;
	}

	.jmb-home-produits .jmb-product-card__button {
		padding: 0.5em 0.4em;
		font-size: 0.625rem;
	}

	.jmb-home-blog .jmb-post-card {
		grid-template-columns: minmax(0, 1fr);
		gap: 0.6rem;
		padding: 0.6rem;
	}

	.jmb-home-blog .jmb-post-card--featured {
		grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
	}
}
