/* ==========================================================================
   Home Invest — habillages que les blocs natifs ne fournissent pas.
   Tout le reste (couleurs, typo, espacements) est piloté par theme.json
   et modifiable dans Apparence > Éditeur > Styles.
   ========================================================================== */

/* --- Carte : bloc Groupe, style « Carte Home Invest » ------------------- */
.is-style-hi-carte {
	background: var(--wp--preset--color--base);
	border: 1px solid #E4EDDC;
	border-radius: 14px;
	padding: var(--wp--preset--spacing--40);
	box-shadow: 0 1px 2px rgba(20, 48, 28, 0.04);
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.is-style-hi-carte:hover,
.is-style-hi-carte:focus-within {
	transform: translateY(-3px);
	border-color: var(--wp--preset--color--accent-2);
	box-shadow: 0 10px 26px rgba(20, 48, 28, 0.10);
}

/* La carte reste lisible quand elle contient une image en tête */
.is-style-hi-carte > .wp-block-image:first-child {
	margin-block-start: 0;
}

/* --- Chiffre clé : bloc Groupe, style « Chiffre clé » ------------------- */
.is-style-hi-carte-chiffre:not(.has-background) {
	background: var(--wp--preset--color--accent-5);
}

.is-style-hi-carte-chiffre {
	text-align: center;
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--30);
	border-radius: 14px;
}

.is-style-hi-carte-chiffre :where(h2, h3, .wp-block-heading) {
	color: var(--wp--preset--color--accent-3);
	margin-block-end: 0.25rem;
}

.is-style-hi-carte-chiffre p {
	color: var(--wp--preset--color--accent-4);
	font-size: var(--wp--preset--font-size--small);
	margin-block-start: 0;
}

/* --- Liste à coches : bloc Liste, style « Liste à coches vertes » ------- */
.is-style-hi-check {
	list-style: none;
	padding-left: 0;
	margin-left: 0;
}

.is-style-hi-check li {
	position: relative;
	padding-left: 2rem;
	margin-bottom: 0.65rem;
}

.is-style-hi-check li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.35em;
	width: 1.15rem;
	height: 1.15rem;
	border-radius: 50%;
	background-color: var(--wp--preset--color--accent-1);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
	background-size: 0.72rem;
	background-repeat: no-repeat;
	background-position: center;
}

/* --- Média arrondi : bloc Image, style « Média arrondi Home Invest » ---- */
.is-style-hi-media img {
	border-radius: 14px;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* --- Surtitre : bloc Titre, style « Surtitre vert » --------------------- */
.is-style-hi-surtitre {
	color: var(--wp--preset--color--accent-1);
	font-size: var(--wp--preset--font-size--small) !important;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	margin-block-end: 0.5rem;
}

/* --- Confort de lecture et cohérence générale --------------------------- */
/* Une carte seule dans sa colonne s'étire à la hauteur de la rangée, pour que
   les cartes voisines s'alignent. La règle est volontairement limitée au cas
   « une carte par colonne » : plusieurs cartes empilées doivent garder leur
   hauteur naturelle. */
.wp-block-column > .is-style-hi-carte:only-child {
	height: 100%;
	display: flex;
	flex-direction: column;
}

.wp-block-column > .is-style-hi-carte:only-child > :last-child {
	margin-block-end: 0;
	margin-block-start: auto;
	padding-block-start: 0.6rem;
}

/* Logo du site : hauteur maîtrisée dans l'en-tête */
.wp-block-site-logo img {
	height: auto;
	max-height: 64px;
	width: auto;
}

/* Accessibilité : focus toujours visible */
:where(a, button, input, textarea, select, .wp-block-button__link):focus-visible {
	outline: 3px solid var(--wp--preset--color--accent-2);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ==========================================================================
   Formulaires Contact Form 7 — alignés sur la charte, sans plugin de style
   ========================================================================== */

.wpcf7-form p {
	margin-block: 0 1.1rem;
}

/* CF7 insère un <br> après chaque label : superflu, le label est déjà en bloc */
.wpcf7-form label + br {
	display: none;
}

.wpcf7-form label {
	display: block;
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--contrast);
	margin-bottom: 0.4rem;
}

.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form input[type="date"],
.wpcf7-form input[type="number"],
.wpcf7-form select,
.wpcf7-form textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 0.8rem 0.95rem;
	font-family: inherit;
	font-size: 1rem;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--base);
	border: 1px solid #D5E2C9;
	border-radius: 8px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wpcf7-form input:focus,
.wpcf7-form select:focus,
.wpcf7-form textarea:focus {
	border-color: var(--wp--preset--color--accent-1);
	box-shadow: 0 0 0 3px rgba(75, 147, 39, 0.16);
	outline: none;
}

.wpcf7-form textarea {
	min-height: 150px;
	resize: vertical;
}

/* Cases à cocher et boutons radio : lisibles, alignés */
.wpcf7-form .wpcf7-checkbox .wpcf7-list-item,
.wpcf7-form .wpcf7-radio .wpcf7-list-item {
	display: block;
	margin: 0 0 0.5rem 0;
}

.wpcf7-form .wpcf7-list-item-label {
	font-weight: 400;
	margin-left: 0.45rem;
}

.wpcf7-form input[type="checkbox"],
.wpcf7-form input[type="radio"] {
	accent-color: var(--wp--preset--color--accent-1);
	width: 1.05rem;
	height: 1.05rem;
	vertical-align: -0.15em;
}

/* Bouton d'envoi : même apparence que les boutons du thème */
.wpcf7-form input[type="submit"] {
	background: var(--wp--preset--color--accent-1);
	color: #fff;
	font-family: inherit;
	font-weight: 700;
	font-size: var(--wp--preset--font-size--medium);
	border: 0;
	border-radius: 8px;
	padding: 0.95rem 2rem;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.wpcf7-form input[type="submit"]:hover {
	background: var(--wp--preset--color--accent-3);
}

.wpcf7-form .wpcf7-spinner {
	vertical-align: middle;
}

/* Messages de retour */
.wpcf7 form .wpcf7-response-output {
	border-radius: 8px;
	border-width: 1px;
	padding: 0.9rem 1.1rem;
	margin: 1.2rem 0 0;
	font-size: var(--wp--preset--font-size--small);
}

.wpcf7 form.sent .wpcf7-response-output {
	border-color: var(--wp--preset--color--accent-1);
	background: var(--wp--preset--color--accent-5);
	color: var(--wp--preset--color--accent-3);
}

.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output {
	border-color: #C9791E;
	background: var(--wp--preset--color--energie-clair);
	color: #8A5410;
}

.wpcf7-not-valid-tip {
	color: #B3651A;
	font-size: var(--wp--preset--font-size--small);
	margin-top: 0.3rem;
}

/* Deux colonnes sur les formulaires, à partir du format tablette */
@media (min-width: 700px) {
	.hi-form-grid {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 0 1.4rem;
	}
	.hi-form-grid .hi-full {
		grid-column: 1 / -1;
	}
}

/* ==========================================================================
   Bande de qualifications (en-tête)
   ========================================================================== */

.hi-bande-qualifs .hi-badge {
	margin: 0;
	line-height: 0;
}

.hi-bande-qualifs .hi-badge img {
	display: block;
	height: auto;
	filter: saturate(1);
	transition: transform 0.15s ease;
}

.hi-bande-qualifs .hi-badge:hover img {
	transform: translateY(-2px);
}

.hi-bande-libelle {
	margin: 0 0.6rem 0 0;
}

/* Sur mobile, les logos se resserrent pour tenir sur deux rangées.
   Le facteur est appliqué en `scale` sur la largeur portée par chaque image,
   pour conserver les proportions très différentes des deux organismes. */
@media (max-width: 781px) {
	/* On dimensionne en hauteur : la largeur suit d'elle-même le ratio
	   propre à chaque logo (3,02:1 pour Qualit'EnR, 0,82:1 pour Qualibat). */
	.hi-bande-qualifs .hi-badge img {
		width: auto !important;
		height: 40px;
	}
	.hi-bande-qualifs .hi-badge-carre img {
		height: 48px;
	}
	.hi-bande-libelle {
		width: 100%;
		text-align: center;
		margin: 0 0 0.4rem;
	}
}

/* Titres de carte : césure propre sur les mots longs en colonne étroite.
   Pas de `overflow-wrap: break-word` : il couperait « thermodynamique »
   n'importe où au lieu de renvoyer le mot entier à la ligne. */
.is-style-hi-carte h2,
.is-style-hi-carte h3,
.is-style-hi-carte h4 {
	/* le thème parent applique `word-break: break-word`, qui coupe
	   « thermodynamique » au milieu : on rétablit un retour à la ligne normal */
	word-break: normal;
	overflow-wrap: normal;
	hyphens: auto;
}

/* Titres un cran plus petits dans les cartes en grille de quatre :
   les mots longs du vocabulaire technique y tiennent sans césure. */
.is-style-hi-carte h3 {
	font-size: 1.32rem;
}

/* Toutes les vignettes de carte au même format, quel que soit le cadrage
   d'origine de la photo — sinon une image carrée déforme la rangée. */
.is-style-hi-carte > .wp-block-image img {
	aspect-ratio: 3 / 2;
	object-fit: cover;
	width: 100%;
}
