/**
 * Styles front — La Ferme de Belval.
 * Tout est préfixé « .belval-ferme » pour ne pas polluer le thème.
 */

.belval-ferme {
	/* Charte graphique Belval. */
	--vert-belval: #4A6741;
	--vert-clair: #6A8F60;
	--vert-tendre: #D4E6CF;
	--vert-profond: #2E4329;
	--blanc-naturel: #F5F7F4;
	--terre-bois: #A07850;
	--terre-clair: #E8D5BF;
	--gris-pierre: #8A8E84;
	--gris-clair: #E4E7E0;
	--noir-vegetal: #1E2A1B;

	color: var(--vert-profond);
	font-family: "Merriweather", Georgia, serif;
	font-size: 16px;
	line-height: 1.6;
}

.belval-ferme *,
.belval-ferme *::before,
.belval-ferme *::after {
	box-sizing: border-box;
}

.belval-ferme h3,
.belval-ferme h4,
.belval-ferme legend,
.belval-ferme .belval-btn {
	font-family: "Alan Sans", "Segoe UI", sans-serif;
	font-weight: 600;
	color: var(--noir-vegetal);
}

/* ---------------------------------------------------------------------
 *  Boutons
 * ------------------------------------------------------------------- */
.belval-ferme .belval-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: var(--vert-belval);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 12px 28px;
	font-size: 16px;
	line-height: 1.25;
	text-align: center;
	white-space: normal;
	word-break: break-word;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.belval-ferme .belval-btn:hover,
.belval-ferme .belval-btn:focus {
	background: var(--vert-clair);
	color: #fff;
}

.belval-ferme .belval-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ---------------------------------------------------------------------
 *  Bon de commande — intro & filtres
 * ------------------------------------------------------------------- */
.belval-intro {
	background: var(--vert-tendre);
	color: var(--vert-profond);
	border-radius: 12px;
	padding: 16px 20px;
	margin-bottom: 24px;
}

.belval-intro p {
	margin: 0;
}

/* Navigation : menu latéral à gauche (desktop) + produits à droite. */
.belval-nav {
	display: flex;
	align-items: flex-start;
	gap: 24px;
	margin-bottom: 24px;
}

.belval-nav .belval-produits {
	flex: 1;
	min-width: 0;
}

.belval-filtres {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 0 0 220px;
	position: sticky;
	top: 16px;
}

.belval-filtre {
	font-family: "Alan Sans", "Segoe UI", sans-serif;
	font-weight: 600;
	background: #fff;
	color: var(--vert-profond);
	border: 1px solid var(--gris-clair);
	border-radius: 8px;
	padding: 10px 16px;
	cursor: pointer;
	text-align: left;
	transition: all 0.2s ease;
}

.belval-filtre:hover {
	border-color: var(--vert-clair);
}

.belval-filtre.est-actif {
	background: var(--vert-belval);
	color: #fff;
	border-color: var(--vert-belval);
}

/* Sur mobile : toutes les catégories visibles au-dessus des produits,
 * réparties sur plusieurs lignes (AUCUN défilement horizontal à faire). */
@media (max-width: 782px) {
	.belval-nav {
		flex-direction: column;
		gap: 16px;
	}

	.belval-filtres {
		flex: 1 1 auto;
		flex-direction: row;
		flex-wrap: wrap;
		overflow: visible;
		position: static;
		width: 100%;
	}

	.belval-filtre {
		flex: 0 0 auto;
		border-radius: 22px;
		padding: 10px 18px;
		font-size: 15px;
	}
}

/* ---------------------------------------------------------------------
 *  Grille & cartes produits
 * ------------------------------------------------------------------- */
.belval-groupe {
	margin-bottom: 32px;
}

.belval-groupe-titre {
	font-size: 22px;
	margin: 0 0 16px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--vert-tendre);
	color: var(--vert-belval);
}

.belval-grille {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 20px;
}

/* Onglet « À la une » : mêmes cartes lisibles que les catégories. */
.belval-grille-avant {
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.belval-carte {
	background: #fff;
	border: 1px solid var(--gris-clair);
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.belval-carte-photo {
	position: relative;
	height: 210px;
	background: var(--vert-tendre);
	display: flex;
	align-items: center;
	justify-content: center;
}

.belval-carte-photo img,
.belval-carte-image {
	width: 100%;
	height: 210px;
	object-fit: cover;
	display: block;
}

.belval-carte-noimage {
	font-size: 48px;
}

.belval-carte-corps {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.belval-carte-titre {
	font-size: 18px;
	margin: 0;
}

.belval-carte-desc {
	margin: 0;
	font-size: 14px;
	color: var(--gris-pierre);
	flex: 1;
}

.belval-carte-prix {
	margin: 0;
	font-size: 18px;
	color: var(--vert-belval);
}

.belval-carte-prix strong {
	font-family: "Alan Sans", "Segoe UI", sans-serif;
}

.belval-carte-unite {
	font-size: 14px;
	color: var(--gris-pierre);
}

/* Conditionnement (« À l'unité », « Au poids ») : mention discrète sous le prix. */
.belval-carte-conditionnement {
	margin: 0;
	font-size: 13px;
	color: var(--gris-pierre);
	font-style: italic;
}

/* ---------------------------------------------------------------------
 *  Ajout au panier : quantité libre + bouton « Ajouter à la commande »
 * ------------------------------------------------------------------- */
.belval-ajout {
	margin-top: 4px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.belval-ajout-label {
	font-family: "Alan Sans", "Segoe UI", sans-serif;
	font-weight: 600;
	font-size: 14px;
	color: var(--vert-profond);
}

.belval-qte-saisie {
	width: 100%;
	min-width: 0;
	height: 44px;
	padding: 10px 12px;
	border: 1px solid var(--gris-clair);
	border-radius: 8px;
	font-family: inherit;
	font-size: 16px;
	background: #fff;
}

/* Le texte saisi et le placeholder ne doivent jamais être tronqués. */
.belval-qte-saisie::placeholder {
	color: var(--gris-pierre);
	opacity: 1;
}

.belval-qte-saisie:focus {
	outline: none;
	border-color: var(--vert-belval);
	box-shadow: 0 0 0 2px var(--vert-tendre);
}

.belval-qte-saisie.est-vide {
	border-color: var(--terre-bois);
	box-shadow: 0 0 0 2px var(--terre-clair);
}

.belval-btn-ajouter {
	width: 100%;
	justify-content: center;
	padding: 11px 16px;
	font-size: 15px;
}

.belval-carte.est-choisi {
	border-color: var(--vert-belval);
	box-shadow: 0 0 0 2px var(--vert-tendre);
}

/* Une fois ajouté, le bouton passe en « terre » pour signaler l'état. */
.belval-carte.est-choisi .belval-btn-ajouter {
	background: var(--terre-bois);
}

.belval-carte.est-choisi .belval-btn-ajouter:hover,
.belval-carte.est-choisi .belval-btn-ajouter:focus {
	background: #8a6540;
}

/* ---------------------------------------------------------------------
 *  Récapitulatif
 * ------------------------------------------------------------------- */
.belval-recap {
	background: #fff;
	border: 1px solid var(--gris-clair);
	border-radius: 12px;
	padding: 20px;
	margin: 32px 0;
}

.belval-recap h3 {
	margin: 0 0 12px;
	font-size: 20px;
	color: var(--vert-belval);
}

.belval-recap-lignes {
	list-style: none;
	margin: 0 0 12px;
	padding: 0;
}

.belval-recap-lignes li {
	display: flex;
	justify-content: space-between;
	padding: 6px 0;
	border-bottom: 1px solid var(--gris-clair);
	font-size: 15px;
}

.belval-recap-vide {
	color: var(--gris-pierre);
	font-style: italic;
	justify-content: flex-start !important;
	border-bottom: none !important;
}

.belval-recap-ligne {
	gap: 10px;
	align-items: center;
}

.belval-recap-produit {
	flex: 1;
	min-width: 0;
}

.belval-recap-qte {
	font-family: "Alan Sans", "Segoe UI", sans-serif;
	font-weight: 600;
	color: var(--vert-belval);
	white-space: nowrap;
}

.belval-recap-suppr {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid var(--gris-clair);
	background: #fff;
	color: var(--terre-bois);
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.belval-recap-suppr:hover,
.belval-recap-suppr:focus {
	background: var(--terre-clair);
	border-color: var(--terre-bois);
	outline: none;
}

.belval-recap-mention {
	margin: 8px 0 0;
	font-size: 13px;
	font-style: italic;
	color: var(--gris-pierre);
}

/* ---------------------------------------------------------------------
 *  Coordonnées / formulaire
 * ------------------------------------------------------------------- */
.belval-coordonnees {
	border: 1px solid var(--gris-clair);
	border-radius: 12px;
	padding: 20px;
	margin: 0 0 20px;
}

.belval-coordonnees legend {
	padding: 0 8px;
	font-size: 18px;
}

.belval-champs-grille {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
}

.belval-champ {
	margin: 0 0 12px;
}

.belval-champ label {
	display: block;
	margin-bottom: 4px;
	font-family: "Alan Sans", "Segoe UI", sans-serif;
	font-weight: 600;
	font-size: 14px;
}

.belval-champ input[type="text"],
.belval-champ input[type="email"],
.belval-champ input[type="tel"],
.belval-champ textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--gris-clair);
	border-radius: 8px;
	font-family: inherit;
	font-size: 16px;
	background: #fff;
}

.belval-champ input:focus,
.belval-champ textarea:focus {
	outline: none;
	border-color: var(--vert-belval);
	box-shadow: 0 0 0 2px var(--vert-tendre);
}

.belval-req {
	color: var(--terre-bois);
}

.belval-rgpd label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
	font-family: "Merriweather", Georgia, serif;
	font-size: 14px;
}

.belval-rgpd input {
	margin-top: 4px;
}

/* Honeypot : caché à l'écran mais présent dans le DOM. */
.belval-hp {
	position: absolute;
	left: -9999px;
	top: -9999px;
	height: 0;
	overflow: hidden;
}

.belval-actions {
	text-align: center;
	margin: 8px 0;
}

/* ---------------------------------------------------------------------
 *  Messages (succès / erreur)
 * ------------------------------------------------------------------- */
.belval-message {
	margin: 16px 0;
	padding: 14px 18px;
	border-radius: 8px;
	font-size: 15px;
}

.belval-message.est-succes {
	background: var(--vert-tendre);
	color: var(--vert-profond);
	border: 1px solid var(--vert-clair);
}

.belval-message.est-erreur {
	background: var(--terre-clair);
	color: #7a3b1e;
	border: 1px solid var(--terre-bois);
}

.belval-vide {
	background: var(--vert-tendre);
	color: var(--vert-profond);
	padding: 20px;
	border-radius: 12px;
	text-align: center;
}

/* ---------------------------------------------------------------------
 *  PDF du mois
 * ------------------------------------------------------------------- */
.belval-pdf {
	text-align: center;
	margin: 16px 0;
}

.belval-pdf .dashicons {
	width: auto;
	height: auto;
	font-size: 20px;
}

.belval-pdf-maj {
	margin: 8px 0 0;
	font-family: "Merriweather", Georgia, serif;
	font-style: italic;
	font-size: 13px;
	color: var(--gris-pierre);
}

/* ---------------------------------------------------------------------
 *  Bandeau d'annonce ([belval_bandeau])
 * ------------------------------------------------------------------- */
.belval-bandeau {
	display: block;
	width: 100%;
	padding: 8px 16px;
	background: var(--terre-clair); /* #E8D5BF */
	color: var(--terre-bois);       /* #A07850 */
	font-family: "Alan Sans", "Segoe UI", sans-serif;
	font-weight: 600;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
}

.belval-bandeau .belval-bandeau-lien {
	color: var(--terre-bois);
	text-decoration: underline;
	margin-left: 6px;
}

.belval-bandeau .belval-bandeau-lien:hover,
.belval-bandeau .belval-bandeau-lien:focus {
	color: var(--terre-bois);
	text-decoration: underline;
}

/* Case newsletter du bon de commande (distincte de la case RGPD). */
.belval-newsletter-optin label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-family: "Merriweather", Georgia, serif;
	font-weight: 400;
	font-size: 14px;
}

.belval-newsletter-optin input {
	margin-top: 4px;
}

/* ---------------------------------------------------------------------
 *  Newsletter
 * ------------------------------------------------------------------- */
.belval-newsletter {
	background: #fff;
	border: 1px solid var(--gris-clair);
	border-radius: 12px;
	padding: 24px;
	max-width: 640px;
}

.belval-nl-titre {
	margin: 0 0 16px;
	font-size: 20px;
	color: var(--vert-belval);
}

.belval-nl-champs {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
}

/* ---------------------------------------------------------------------
 *  Responsive
 * ------------------------------------------------------------------- */
@media (max-width: 600px) {
	/* Un produit par ligne, en trois temps : la photo, puis la quantité, puis
	   le bouton. */
	.belval-grille,
	.belval-grille-avant {
		grid-template-columns: 1fr;
		gap: 14px;
	}

	.belval-carte {
		flex-direction: column;
	}

	/*
	 * Photo carrée sur toute la largeur. Dans une colonne étroite de 130 px
	 * aussi haute que la carte, le cadrage « cover » rognait les côtés du
	 * produit : un bocal n'y montrait plus que sa tranche centrale.
	 */
	.belval-carte-photo {
		width: 100%;
		height: auto;
		aspect-ratio: 1 / 1;
	}

	.belval-carte-photo img,
	.belval-carte-image {
		width: 100%;
		height: 100%;
		/* Sans ce rappel, l'image impose sa propre hauteur (les photos de la
		   ferme sont en 3/4) et le cadre cesse d'être carré. */
		aspect-ratio: 1 / 1;
		object-fit: cover;
	}

	.belval-carte-corps {
		padding: 12px 14px;
		gap: 6px;
	}

	.belval-carte-titre {
		font-size: 17px;
	}

	/* Champ quantité + bouton bien lisibles et jamais tronqués. */
	.belval-qte-saisie {
		font-size: 16px;
	}

	.belval-btn-ajouter {
		font-size: 15px;
		padding: 12px 14px;
	}

	/* Plus d'espace utile : on réduit le padding intérieur des encadrés. */
	.belval-intro,
	.belval-recap,
	.belval-coordonnees {
		padding: 14px;
	}

	.belval-champs-grille {
		gap: 12px;
	}
}
