/*
 * JMB — composants réutilisables : boutons, titres de section, cartes produit et article.
 */

/* ─── Boutons ────────────────────────────────────────────────────────────── */
.jmb-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.jmb-button--outline {
	background: transparent;
	color: var(--wp--preset--color--white);
	box-shadow: inset 0 0 0 2px currentColor;
}

.jmb-button--outline:hover,
.jmb-button--outline:focus {
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
}

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

/* ─── Titres et liens de section ─────────────────────────────────────────── */
.jmb-section-title {
	margin: 0 0 var(--wp--preset--spacing--40);
}

.jmb-section-more {
	margin: var(--wp--preset--spacing--40) 0 0;
	text-align: center;
}

.jmb-section-more a {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	text-transform: uppercase;
	text-decoration: none;
	letter-spacing: 0.02em;
}

.jmb-section-more a:hover {
	text-decoration: underline;
}

/* ─── Grille et carte produit ────────────────────────────────────────────── */
.jmb-product-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 19rem));
	justify-content: center;
	gap: clamp(0.75rem, 2vw, 1.5rem);
}

/* Vente croisée du mini-panier : lignes compactes (image | nom, prix | bouton) sous les articles. */
.jmb-mini-cross-sells {
	margin-top: 1.25rem;
	padding-top: 1rem;
	border-top: 1px solid var(--wp--preset--color--surface);
}

.jmb-mini-cross-sells__title {
	margin: 0 0 0.5rem;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	text-transform: uppercase;
}

.jmb-mini-cross-sells ul {
	display: grid;
	gap: 0.6rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.jmb-mini-cross-sells li {
	display: grid;
	grid-template-columns: 3.5rem minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.75rem;
}

.jmb-mini-cross-sells img {
	width: 3.5rem;
	height: 3.5rem;
	object-fit: contain;
}

.jmb-mini-cross-sells__text {
	display: grid;
	gap: 0.1rem;
	font-size: var(--wp--preset--font-size--x-small);
	line-height: 1.3;
}

.jmb-mini-cross-sells__name {
	color: inherit;
	font-weight: 700;
	text-decoration: none;
}

.jmb-mini-cross-sells__button {
	min-height: 2.75rem;
	padding: 0.5em 0.9em;
	font-size: var(--wp--preset--font-size--x-small);
	cursor: pointer;
}

.jmb-mini-cross-sells__button[aria-busy="true"] {
	opacity: 0.6;
	pointer-events: none;
}

/* Vente croisée (fiche produit, panier) : cartes alignées à gauche, sous un titre de section. */
.jmb-cross-sells {
	margin-top: var(--wp--preset--spacing--60);
}

.jmb-cross-sells__title {
	margin: 0 0 1rem;
	font-size: var(--wp--preset--font-size--large);
}

.jmb-cross-sells__grid {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));
	justify-content: start;
	gap: clamp(0.5rem, 2vw, 1rem);
}

.jmb-cross-sells .jmb-product-card {
	padding: 0.75rem;
}

.jmb-cross-sells .jmb-product-card__image {
	max-width: 9rem;
}

.jmb-cart .jmb-cross-sells {
	margin-top: var(--wp--preset--spacing--50);
}

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

.jmb-product-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 1.25rem 1rem 1.25rem;
	border: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--white);
	text-align: center;
	transition: box-shadow 0.2s ease;
}

.jmb-product-card:hover {
	box-shadow: var(--wp--preset--shadow--card);
}

.jmb-product-card__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	color: inherit;
	text-decoration: none;
}

.jmb-product-card__image {
	width: 100%;
	max-width: 220px;
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
	margin-bottom: 1rem;
}

.jmb-product-card__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
	line-height: 1.3;
	text-transform: uppercase;
}

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

.jmb-product-card__price {
	margin: 0.5rem 0 0.9rem;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 700;
}

.jmb-product-card__price del {
	margin-right: 0.3em;
	font-weight: 400;
	opacity: 0.6;
}

.jmb-product-card__price ins {
	text-decoration: none;
}

.jmb-product-card__note {
	margin: -0.4rem 0 0.9rem;
	color: var(--wp--preset--color--slate);
	font-size: var(--wp--preset--font-size--x-small);
}

.jmb-product-card__button {
	margin-top: auto;
	padding: 0.55em 1em;
	font-size: var(--wp--preset--font-size--x-small);
	text-decoration: none;
}

.jmb-product-card__button[aria-busy="true"] {
	opacity: 0.6;
	cursor: progress;
}

/* ─── Carte article ──────────────────────────────────────────────────────── */
.jmb-post-card {
	display: grid;
	grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
	gap: 1.25rem;
	align-items: center;
	justify-items: start;
	padding: 1rem;
	text-align: left;
	background: var(--wp--preset--color--surface);
}

.jmb-post-card__media img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.jmb-post-card__title {
	margin: 0 0 0.5rem;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: 1.35;
	text-transform: uppercase;
}

.jmb-post-card__title a {
	color: inherit;
	text-decoration: none;
}

.jmb-post-card__title a:hover {
	text-decoration: underline;
}

.jmb-post-card__excerpt {
	margin: 0 0 0.75rem;
	font-size: var(--wp--preset--font-size--small);
}

.jmb-post-card__more {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	text-transform: uppercase;
	text-decoration: none;
}

/* ─── Articles : grille et carte (blog, « à lire aussi », conseils d'une catégorie produit) ─── */
.jmb-post-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(1rem, 2vw, 1.5rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* La liste WordPress ajoute un écart vertical entre ses éléments : celui de la grille suffit. */
.jmb-post-grid > li {
	margin: 0;
}

.jmb-post-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--surface);
	transition: box-shadow 0.15s ease;
}

.jmb-post-tile:hover {
	box-shadow: 0 6px 20px rgb(30 41 83 / 14%);
}

.jmb-post-tile:focus-within {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.jmb-post-tile__media img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.jmb-post-tile__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1rem 1.25rem 1.25rem;
}

.jmb-post-tile__topic {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	margin: 0;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.jmb-post-tile__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1.35;
	text-transform: uppercase;
}

.jmb-post-tile__title a {
	color: inherit;
	text-decoration: none;
}

/* Toute la carte est cliquable : le lien du titre la couvre. */
.jmb-post-tile__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.jmb-post-tile__title a:focus-visible {
	outline: none;
}

.jmb-post-tile__excerpt {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
}

.jmb-post-tile__meta {
	margin: auto 0 0;
	padding-top: 0.25rem;
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--slate);
}

/* Picto d'une thématique : picto d'univers (masque) ou picto Font Awesome, en vert. */
.jmb-topic-picto {
	display: inline-block;
	flex: none;
	width: 1.6em;
	height: 1.6em;
	color: var(--wp--preset--color--accent-dark);
}

.jmb-topic-picto.jmb-univers-mask::before {
	inset: 0;
}

.jmb-topic-picto--fa {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.jmb-related-posts,
.jmb-post-products,
.jmb-term-posts {
	margin-top: var(--wp--preset--spacing--60);
}

@media (max-width: 1023.98px) {
	.jmb-post-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

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

/* ─── Date de livraison (extension jmb-delivery-planner) ────────────────────── */
.dp-postcode-widget {
	margin: 1rem 0;
	padding: 1rem 1.25rem;
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--surface);
}

.dp-postcode-widget label,
.dp-postcode-label {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 700;
}

.dp-postcode-label {
	margin: 0;
}

.dp-postcode-widget label::before,
.dp-postcode-label::before {
	content: "";
	width: 1.3em;
	height: 1.3em;
	background-color: var(--wp--preset--color--accent);
	-webkit-mask: url(../icons/light/truck-fast.svg) center / contain no-repeat;
	mask: url(../icons/light/truck-fast.svg) center / contain no-repeat;
}

.dp-postcode-input {
	min-height: 2.75rem;
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
	font-family: inherit;
	letter-spacing: 0.05em;
}

.dp-availability-result {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
}

.dp-availability-date {
	color: var(--wp--preset--color--accent-dark);
	font-size: var(--wp--preset--font-size--medium);
}

.dp-availability-date::first-letter {
	text-transform: uppercase;
}

.dp-availability-detail {
	color: var(--wp--preset--color--slate);
}

.dp-postcode-widget.is-unavailable .dp-availability-result {
	color: #c0392b;
}

/* Code postal desservi, mais aucune tournée planifiée : information, pas une erreur. */
.dp-postcode-widget.is-pending .dp-availability-result {
	color: var(--wp--preset--color--primary);
}

/* Commande : choix de la date. */
.dp-checkout-delivery-box {
	margin: 0 0 1.25rem;
}

.dp-checkout-delivery-title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	text-transform: uppercase;
}

.dp-checkout-delivery-box p {
	font-size: var(--wp--preset--font-size--small);
}

.dp-tournee-heading {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--slate);
}

.dp-date {
	min-height: 3rem;
	border-color: rgba(39, 53, 107, 0.2);
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--white);
	font-weight: 500;
}

.dp-date:has(input:checked) {
	border-color: var(--wp--preset--color--accent);
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--accent);
}

.dp-date input {
	width: 1.2rem;
	height: 1.2rem;
	margin: 0;
	accent-color: var(--wp--preset--color--accent);
}

/* ─── Bandeau « guide + avis clients » au-dessus du pied de page (inc/guide-band.php) ─── */
.jmb-guide-band {
	display: grid;
	grid-template-columns: minmax(0, 66%) minmax(11rem, 21.3%);
	justify-content: space-between;
	gap: 1.5rem;
	width: min(100% - 2 * clamp(1rem, 4vw, 2rem), 1300px);
	margin: var(--wp--preset--spacing--60) auto 0;
}

.jmb-guide-band__card {
	display: grid;
	grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
	gap: clamp(1rem, 3vw, 2rem);
	overflow: hidden;
	min-height: 14rem;
	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 fixer la hauteur de la carte ; détourée : entière, posée sur le bas. */
.jmb-guide-band__media {
	position: relative;
	min-height: 9rem;
}

.jmb-guide-band__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.jmb-guide-band__media--cutout img {
	inset: 0.75rem 0 0 1rem;
	width: calc(100% - 1rem);
	height: calc(100% - 0.75rem);
	object-fit: contain;
	object-position: 50% 100%;
}

.jmb-guide-band__body {
	align-self: center;
	padding-block: 1.25rem;
}

.jmb-guide-band__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
	font-weight: 600;
	line-height: 1.15;
	text-transform: uppercase;
}

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

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

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

.jmb-guide-band__stars {
	display: flex;
	gap: 0.2rem;
	color: #fbd400;
	font-size: 1.375rem;
}

.jmb-guide-band__badge-label {
	text-transform: uppercase;
}

.jmb-guide-band__rating {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 2.75rem;
	font-weight: 600;
	line-height: 1.1;
}

.jmb-guide-band__badge-text {
	margin-top: 0.5rem;
	font-size: var(--wp--preset--font-size--x-small);
	line-height: 1.35;
	text-transform: uppercase;
}

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

	.jmb-guide-band__card {
		grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
		min-height: 0;
	}

	/* Pastille en une ligne compacte sous la carte. */
	.jmb-guide-band__badge {
		flex-flow: row wrap;
		gap: 0.25rem 0.75rem;
		padding: 0.75rem 1rem;
	}

	.jmb-guide-band__rating {
		font-size: 1.75rem;
	}

	.jmb-guide-band__badge-text {
		flex-basis: 100%;
		margin-top: 0;
	}
}

/* ─── Récapitulatif de l'abonnement (panier, commande, mini-panier) ───────── */
.jmb-sub-summary,
.jmb-mini-subscription {
	margin: 0 0 1rem;
	padding: 0.9rem 1rem;
	border: 1px solid var(--wp--preset--color--accent);
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--small);
}

.jmb-mini-subscription {
	margin: 1.25rem 0 0;
}

.jmb-sub-summary__title {
	margin: 0 0 0.25rem;
	font-weight: 700;
	text-transform: uppercase;
}

.jmb-sub-summary__rhythm {
	margin: 0 0 0.5rem;
}

.jmb-sub-summary__rhythm label {
	display: block;
	font-size: var(--wp--preset--font-size--x-small);
}

.jmb-sub-summary__rhythm select {
	width: 100%;
	min-height: 2.75rem;
	padding: 0.4rem 0.75rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--large);
	background-color: var(--wp--preset--color--white);
	color: inherit;
	font: inherit;
}

.jmb-sub-summary__lines {
	display: grid;
	gap: 0.2rem;
	margin: 0 0 0.5rem;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--x-small);
}

.jmb-sub-summary__lines li,
.jmb-sub-summary__total {
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
}

.jmb-sub-summary__total {
	margin: 0;
	padding-top: 0.5rem;
	border-top: 1px solid var(--wp--preset--color--surface);
}

.jmb-sub-summary__note {
	margin: 0.5rem 0 0;
	color: var(--wp--preset--color--slate);
	font-size: 0.6875rem;
	line-height: 1.4;
}

/* Tarifs dégressifs : palier suivant d'une ligne du mini-panier (« Ajoutez-en 3 pour passer à 39 € pièce »). */
.jmb-tier-next {
	color: var(--wp--preset--color--accent-dark);
	font-weight: 600;
}
