/*
Theme Name: GAEC d’Anglemont
Theme URI: https://www.gaecdanglemont.com
Description: Thème du site du GAEC d’Anglemont (la ferme, Thiebaut Énergie, Terragri). Palette « Grès des Vosges », une couleur par entreprise.
Version: 1.1.2
Requires at least: 6.6
Tested up to: 6.8
Requires PHP: 8.0
License: GPLv2 or later
Text Domain: anglemont
*/

/* ------------------------------------------------------------------
   Couleur de la page : chaque modèle de page choisit sa couleur.
   Les blocs utilisent ces variables (sur-titres, boutons, fonds).
   ------------------------------------------------------------------ */
body.branche-ferme {
	--wp--custom--accent: var(--wp--preset--color--prairie);
	--wp--custom--accent-clair: var(--wp--preset--color--prairie-clair);
	--wp--custom--accent-texte: var(--wp--preset--color--prairie-texte);
	--wp--custom--sur-accent: var(--wp--preset--color--lin);
	--wp--custom--bouton--fond: var(--wp--preset--color--sapin);
	--wp--custom--bouton--texte: var(--wp--preset--color--lin);
	--wp--custom--bouton--survol: #2B4D3F;
}
body.branche-energie {
	--wp--custom--accent: var(--wp--preset--color--braise);
	--wp--custom--accent-clair: var(--wp--preset--color--braise-clair);
	--wp--custom--accent-texte: var(--wp--preset--color--braise-texte);
	--wp--custom--sur-accent: var(--wp--preset--color--sapin);
	--wp--custom--bouton--fond: var(--wp--preset--color--braise);
	--wp--custom--bouton--texte: var(--wp--preset--color--sapin);
	--wp--custom--bouton--survol: var(--wp--preset--color--braise-clair);
}
body.branche-terragri {
	--wp--custom--accent: var(--wp--preset--color--gres);
	--wp--custom--accent-clair: var(--wp--preset--color--gres-clair);
	--wp--custom--accent-texte: var(--wp--preset--color--gres);
	--wp--custom--sur-accent: var(--wp--preset--color--lin);
	--wp--custom--bouton--fond: var(--wp--preset--color--gres);
	--wp--custom--bouton--texte: var(--wp--preset--color--lin);
	--wp--custom--bouton--survol: #B5523F;
}

/* Pas d’espace entre en-tête, contenu et pied de page */
.wp-site-blocks > * { margin-block-start: 0; }

/* ------------------------------------------------------------------
   Styles de section (menu « Styles » d’un groupe ou d’une colonne)
   ------------------------------------------------------------------ */
.is-style-section-sapin {
	background-color: var(--wp--preset--color--sapin);
	color: var(--wp--preset--color--lin);
	--wp--custom--accent-texte: var(--wp--custom--accent-clair);
}
.is-style-section-blanc {
	background-color: var(--wp--preset--color--blanc);
}
.is-style-section-ferme,
.is-style-section-energie,
.is-style-section-terragri,
.is-style-section-accent {
	--wp--custom--bouton--fond: var(--wp--preset--color--sapin);
	--wp--custom--bouton--texte: var(--wp--preset--color--lin);
	--wp--custom--bouton--survol: #2B4D3F;
}
.is-style-section-ferme { background-color: var(--wp--preset--color--prairie); color: var(--wp--preset--color--lin); --wp--custom--accent-texte: var(--wp--preset--color--lin); }
.is-style-section-energie { background-color: var(--wp--preset--color--braise); color: var(--wp--preset--color--sapin); --wp--custom--accent-texte: var(--wp--preset--color--sapin); }
.is-style-section-terragri { background-color: var(--wp--preset--color--gres); color: var(--wp--preset--color--lin); --wp--custom--accent-texte: var(--wp--preset--color--lin); }
.is-style-section-accent { background-color: var(--wp--custom--accent); color: var(--wp--custom--sur-accent); --wp--custom--accent-texte: var(--wp--custom--sur-accent); }
.is-style-section-sapin a:not(.wp-element-button),
.is-style-section-ferme a:not(.wp-element-button),
.is-style-section-terragri a:not(.wp-element-button) { color: var(--wp--preset--color--lin); }

/* Bouton « contour » : suit la couleur du texte de la section */
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: currentColor;
	box-shadow: inset 0 0 0 2px currentColor;
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: transparent; opacity: .8; }

/* ------------------------------------------------------------------
   Styles de paragraphe, d’image et de liste
   ------------------------------------------------------------------ */
.is-style-sur-titre {
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--custom--accent-texte);
}
.is-style-chiffre {
	font-family: var(--wp--preset--font-family--titres);
	font-weight: 700;
	font-size: clamp(2.3rem, 2.4vw + 1.2rem, 3.4rem);
	line-height: 1;
	letter-spacing: -0.025em;
}
.is-style-chiffre + p { margin-block-start: 0.4rem !important; font-size: 0.95rem; opacity: 0.85; }
.is-style-coins-arrondis img { border-radius: 14px; }
.wp-block-cover { color: var(--wp--preset--color--lin); }
.wp-block-cover .is-style-sur-titre { color: var(--wp--custom--accent-clair); }
.wp-block-cover h1 { max-width: 15ch; }

/* Carte de service ou de métier */
.carte { border-radius: 16px; }
.carte.wp-block-column { display: flex; flex-direction: column; }
.carte .wp-block-buttons { margin-top: auto !important; padding-top: 1rem; }
.carte-ligne { border-top: 2px solid currentColor; }

/* Étapes numérotées */
.etape-num {
	width: 2.6rem; height: 2.6rem; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-family: var(--wp--preset--font-family--titres); font-weight: 700; font-size: 1.15rem;
	background: var(--wp--custom--accent); color: var(--wp--custom--sur-accent);
}
.is-style-section-sapin .etape-num { background: var(--wp--custom--accent-clair); color: var(--wp--preset--color--sapin); }
.etape-ferme .etape-num { background: var(--wp--preset--color--prairie); color: var(--wp--preset--color--lin); }
.etape-energie .etape-num { background: var(--wp--preset--color--braise); color: var(--wp--preset--color--sapin); }
.etape-terragri .etape-num { background: var(--wp--preset--color--gres); color: var(--wp--preset--color--lin); }

/* Citation */
.wp-block-quote { border-left: 4px solid var(--wp--custom--accent); padding-left: 1.4rem; margin-left: 0; margin-right: 0; margin-block: 1.6rem; }
.wp-block-quote p { font-family: var(--wp--preset--font-family--titres); font-size: var(--wp--preset--font-size--moyen); font-weight: 600; line-height: 1.35; }
.wp-block-quote cite { font-size: 0.9rem; font-style: normal; opacity: .8; }

/* ------------------------------------------------------------------
   En-tête
   ------------------------------------------------------------------ */
.logo-anglemont { display: inline-flex; align-items: center; gap: 10px; color: var(--wp--preset--color--lin); text-decoration: none; font-family: var(--wp--preset--font-family--titres); font-weight: 700; letter-spacing: 0.08em; font-size: 1.2rem; }
.logo-anglemont svg { width: 38px; height: 38px; flex-shrink: 0; }
.entete .wp-block-navigation a { color: var(--wp--preset--color--lin); text-decoration: none; opacity: .82; padding-block: 4px; }
.entete .wp-block-navigation a:hover { opacity: 1; color: var(--wp--preset--color--lin); }
.entete .wp-block-navigation .current-menu-item > a { opacity: 1; box-shadow: 0 2px 0 var(--wp--custom--accent-clair); }
.bouton-tel .wp-block-button__link { background: var(--wp--preset--color--lin); color: var(--wp--preset--color--sapin); padding: 0.7rem 1.2rem; font-size: 0.95rem; }
.bouton-tel .wp-block-button__link:hover { background: var(--wp--preset--color--blanc); color: var(--wp--preset--color--sapin); }

/* ------------------------------------------------------------------
   Pied de page
   ------------------------------------------------------------------ */
.pied a { color: var(--wp--preset--color--lin); text-decoration: none; }
.pied a:hover { text-decoration: underline; color: var(--wp--preset--color--lin); }
.pied .discret { color: #B9C4B4; }
@media (max-width: 781px) { .pied p a { display: inline-block; padding-block: .3rem; } }
.bande-boucle { display: flex; height: 6px; }
.bande-boucle span { flex: 1; }

/* Formulaire de contact (Contact Form 7) aux couleurs du site */
.wpcf7 input, .wpcf7 select, .wpcf7 textarea { width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid #C9C4B6; border-radius: 10px; background: var(--wp--preset--color--lin); }
.wpcf7 input[type="submit"] { width: auto; border: 0; border-radius: 999px; background: var(--wp--custom--bouton--fond); color: var(--wp--custom--bouton--texte); font-weight: 700; padding: 0.95rem 1.6rem; cursor: pointer; }
.formulaire-attente { border: 2px dashed var(--wp--preset--color--pierre); border-radius: 16px; }

/* ------------------------------------------------------------------
   En-tête collant : il se resserre quand on descend dans la page
   ------------------------------------------------------------------ */
header.wp-block-template-part { position: sticky; top: var(--wp-admin--admin-bar--height, 0px); z-index: 100; }
.entete { transition: padding .35s ease, box-shadow .35s ease; }
.est-defile .entete { box-shadow: 0 10px 30px -18px rgba(10, 25, 18, .7); }
.logo-anglemont svg { transition: transform .9s cubic-bezier(.34, 1.3, .64, 1); }
.logo-anglemont:hover svg { transform: rotate(360deg); }

/* ------------------------------------------------------------------
   Bandeau photo : la photo respire, le texte monte, l’anneau se dessine
   ------------------------------------------------------------------ */
.hero-anneau { position: absolute; right: -14rem; bottom: -16rem; width: 44rem; height: 44rem; pointer-events: none; opacity: .9; }
.hero-anneau path { stroke-dasharray: 100; }
.hero-anneau .a1 { stroke: var(--anneau-1, var(--wp--preset--color--prairie-clair)); }
.hero-anneau .a2 { stroke: var(--anneau-2, var(--wp--preset--color--braise-clair)); }
.hero-anneau .a3 { stroke: var(--anneau-3, var(--wp--preset--color--gres-clair)); }
body.branche-ferme { --anneau-1: var(--wp--preset--color--prairie-clair); --anneau-2: rgba(242,240,233,.18); --anneau-3: rgba(242,240,233,.18); }
body.branche-energie { --anneau-1: rgba(242,240,233,.18); --anneau-2: var(--wp--preset--color--braise-clair); --anneau-3: rgba(242,240,233,.18); }
body.branche-terragri { --anneau-1: rgba(242,240,233,.18); --anneau-2: rgba(242,240,233,.18); --anneau-3: var(--wp--preset--color--gres-clair); }
@media (max-width: 781px) { .hero-anneau { right: -8rem; bottom: -8rem; top: auto; width: 17rem; height: 17rem; opacity: .75; } }

/* Boucle de l’accueil */
.boucle-anim svg { width: 100%; height: auto; display: block; overflow: visible; }
.boucle-anim [data-arc] { transition: stroke-width .6s ease, opacity .6s ease; }
.boucle-anim .b-feuille { transition: fill .6s ease; }
.boucle-anim .orbite { transform-box: view-box; transform-origin: 50px 50px; }
.boucle .etape-ferme, .boucle .etape-energie, .boucle .etape-terragri { cursor: pointer; border-radius: 12px; transition: opacity .5s ease, transform .5s ease; }
.boucle.est-active .etape-ferme, .boucle.est-active .etape-energie, .boucle.est-active .etape-terragri { opacity: .45; }
.boucle.est-active .etape-ferme.est-allumee, .boucle.est-active .etape-energie.est-allumee, .boucle.est-active .etape-terragri.est-allumee { opacity: 1; transform: translateX(6px); }

/* Cartes, boutons, photos : réactions au survol */
.carte { transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease; }
.carte:hover { transform: translateY(-5px); box-shadow: 0 22px 40px -24px rgba(10, 25, 18, .55); }
.wp-block-button__link { transition: background-color .2s ease, transform .2s ease; }
.wp-block-button__link:hover { transform: translateY(-1px); }
.carte .wp-block-button__link::after, .wp-block-cover .wp-block-button:first-child .wp-block-button__link::after { content: "→"; display: inline-block; margin-left: .45em; transition: transform .25s ease; }
.carte .wp-block-button__link:hover::after, .wp-block-cover .wp-block-button:first-child .wp-block-button__link:hover::after { transform: translateX(4px); }
.is-style-coins-arrondis { overflow: hidden; border-radius: 14px; }
.is-style-coins-arrondis img { transition: transform 1.2s cubic-bezier(.2, .8, .2, 1); }
.is-style-coins-arrondis:hover img { transform: scale(1.04); }
.bande-boucle span { transform-origin: left; }

/* Animations légères, sur tous les écrans */
@media (prefers-reduced-motion: no-preference) {
	.logo-anglemont svg path.arc { stroke-dasharray: 100; animation: anglemont-trace 1s cubic-bezier(.65, 0, .35, 1) both; }
	.logo-anglemont svg path.arc:nth-of-type(2) { animation-delay: .2s; }
	.logo-anglemont svg path.arc:nth-of-type(3) { animation-delay: .4s; }
	.logo-anglemont svg > path:last-child { transform-box: fill-box; transform-origin: 50% 100%; animation: anglemont-pousse .6s cubic-bezier(.34, 1.56, .64, 1) .8s both; }
	.wp-block-cover__inner-container .is-style-sur-titre,
	.wp-block-cover__inner-container h1,
	.wp-block-cover__inner-container h1 + p,
	.wp-block-cover__inner-container .wp-block-buttons { animation: anglemont-monte .9s cubic-bezier(.2, .8, .2, 1) both; }
	.wp-block-cover__inner-container h1 { animation-delay: .12s; }
	.wp-block-cover__inner-container h1 + p { animation-delay: .3s; }
	.wp-block-cover__inner-container .wp-block-buttons { animation-delay: .45s; }
	.hero-anneau path { animation: anglemont-trace 1.8s cubic-bezier(.65, 0, .35, 1) both; }
	.hero-anneau .a1 { animation-delay: .3s; }
	.hero-anneau .a2 { animation-delay: .6s; }
	.hero-anneau .a3 { animation-delay: .9s; }
	.boucle-anim .orbite { animation: anglemont-tourne 9s linear infinite; }
}

/* Animations plus lourdes, seulement sur ordinateur (grand écran et souris) */
@media (prefers-reduced-motion: no-preference) and (min-width: 782px) and (hover: hover) {
	@view-transition { navigation: auto; }
	header.wp-block-template-part { view-transition-name: entete; }
	.wp-block-cover__image-background { animation: anglemont-respire 26s ease-in-out infinite alternate; }
	.hero-anneau g { transform-box: view-box; transform-origin: 50px 50px; animation: anglemont-tourne 90s linear infinite; }

	/* Les blocs glissent en place quand ils entrent à l’écran (navigateurs récents) */
	@supports (animation-timeline: view()) {
		.entry-content .wp-block-columns > .wp-block-column,
		.entry-content .wp-block-image,
		.entry-content > .alignfull > .wp-block-group > .wp-block-heading {
			animation: anglemont-apparait linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 38%;
		}
		.bande-boucle span { animation: anglemont-etire linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
	}
}
@keyframes anglemont-pousse { 0% { transform: scale(0); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes anglemont-trace { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes anglemont-monte { from { transform: translateY(22px); } to { transform: none; } }
@keyframes anglemont-respire { from { transform: scale(1.02); } to { transform: scale(1.1); } }
@keyframes anglemont-tourne { to { transform: rotate(360deg); } }
@keyframes anglemont-apparait { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes anglemont-etire { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ------------------------------------------------------------------
   Frise, questions fréquentes, liste à puces de couleur
   ------------------------------------------------------------------ */
.frise { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1.5rem 1.25rem; }
.frise > * { margin: 0 !important; }
.frise-item { border-top: 2px solid var(--wp--preset--color--pierre); padding-top: 1rem; position: relative; }
.frise-item::before { content: ""; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--wp--custom--accent); }
.frise-annee { font-family: var(--wp--preset--font-family--titres); font-weight: 700; font-size: 1.6rem; line-height: 1; color: var(--wp--custom--accent-texte); }
.frise-item p + p { margin-top: .4rem !important; }
.faq .wp-block-details { border-bottom: 1px solid color-mix(in srgb, currentColor 22%, transparent); padding: 1rem 0; margin: 0 !important; }
.faq .wp-block-details:first-child { border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.faq summary { cursor: pointer; font-family: var(--wp--preset--font-family--titres); font-weight: 700; font-size: 1.15rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; transition: transform .3s ease; color: var(--wp--custom--accent-texte); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin-top: .6rem !important; opacity: .9; }
.is-style-liste-points { list-style: none; padding-left: 0 !important; columns: 2 16rem; column-gap: 2rem; }
.is-style-liste-points li { break-inside: avoid; padding: .55rem 0 .55rem 1.4rem; position: relative; border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent); }
.is-style-liste-points li::before { content: ""; position: absolute; left: 0; top: 1.05rem; width: 8px; height: 8px; border-radius: 50%; background: var(--wp--custom--accent); }

/* ------------------------------------------------------------------
   Téléphone : en-tête sur une ligne, sans trou sous la barre WordPress
   ------------------------------------------------------------------ */
@media (max-width: 600px) {
	header.wp-block-template-part { top: 0; }
}
@media (min-width: 782px) {
	.entete .lien-tel { display: none; }
}
@media (max-width: 781px) {
	.entete > .wp-block-group { flex-wrap: nowrap !important; }
	.entete .logo-anglemont { font-size: 1.05rem; }
	.entete .logo-anglemont svg { width: 32px; height: 32px; }
	.entete .bouton-tel { display: none; }
	.entete .wp-block-navigation__responsive-container-open { color: var(--wp--preset--color--lin); }
	.entete .wp-block-navigation__responsive-container.is-menu-open { padding: 1.25rem 1.75rem 2rem !important; }
	.entete .wp-block-navigation__responsive-container-close { top: 1.25rem !important; right: 1.5rem !important; }
	.entete .wp-block-navigation__responsive-container-close svg { width: 30px; height: 30px; }
	.entete .is-menu-open .wp-block-navigation__responsive-container-content { align-items: stretch !important; padding-top: 3.5rem !important; }
	.entete .is-menu-open .wp-block-navigation__container { align-items: stretch !important; gap: 0 !important; width: 100%; }
	.entete .is-menu-open .wp-block-navigation-item { width: 100%; border-bottom: 1px solid rgba(242, 240, 233, .16); }
	.entete .is-menu-open .wp-block-navigation-item a { display: block; padding: 1.05rem .25rem !important; font-family: var(--wp--preset--font-family--titres); font-weight: 700; font-size: 1.75rem; letter-spacing: -.01em; opacity: 1; }
	.entete .is-menu-open .current-menu-item > a { color: var(--wp--custom--accent-clair) !important; box-shadow: none; }
	.entete .is-menu-open .lien-tel { border-bottom: 0; margin-top: 1.75rem; }
	.entete .is-menu-open .lien-tel a { display: inline-block; background: var(--wp--preset--color--braise); color: var(--wp--preset--color--sapin) !important; border-radius: 999px; padding: .85rem 1.5rem !important; font-family: var(--wp--preset--font-family--texte); font-size: 1.1rem; }
	.wp-block-cover { min-height: 480px !important; }
}

/* Formulaire de démonstration (page Contact), en attendant Contact Form 7 */
.formulaire-demo { display: grid; gap: 1rem; }
.formulaire-demo label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 600; }
.formulaire-demo .fd-ligne { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 1rem; }
.formulaire-demo label > * { min-width: 0; }
.formulaire-demo input:not([type=checkbox]), .formulaire-demo select, .formulaire-demo textarea { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; margin: 0; line-height: 1.35; -webkit-appearance: none; appearance: none; font: inherit; font-weight: 400; font-size: 1rem; padding: .8rem .9rem; border: 1.5px solid #C9C4B6; border-radius: 10px; background: var(--wp--preset--color--lin); color: var(--wp--preset--color--sapin); min-height: 48px; }
.formulaire-demo select { -webkit-appearance: auto; appearance: auto; }
.formulaire-demo textarea { min-height: 8rem; resize: vertical; }
.formulaire-demo input:focus, .formulaire-demo select:focus, .formulaire-demo textarea:focus { outline: 3px solid var(--wp--preset--color--braise); outline-offset: 1px; border-color: transparent; }
.formulaire-demo .fd-accord { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; font-size: .85rem; }
.formulaire-demo .fd-accord input { margin-top: .2rem; width: 1.1rem; height: 1.1rem; accent-color: var(--wp--preset--color--prairie); }
.formulaire-demo button { justify-self: start; border: 0; cursor: pointer; }
.formulaire-demo .fd-erreur { border-color: #B8432F !important; }
.formulaire-demo .fd-retour { margin: 0; padding: .9rem 1rem; border-radius: 10px; background: var(--wp--preset--color--prairie); color: var(--wp--preset--color--lin); font-weight: 600; }
.formulaire-demo .fd-retour.fd-ko { background: #B8432F; }
.formulaire-demo .fd-note { margin: 0; font-size: .8rem; color: var(--wp--preset--color--gris); }
