/*
Theme Name: EAsymage
Theme URI:
Author: EAsymage
Description: Thème de blocs maison EAsymage (charte Cristal Fenêtres Production). Fonctionne avec les blocs natifs de WordPress et les extensions EAsymage (blocs-easymage, easymage-forms, popup-easymage, easymage-google-reviews). Aucune dépendance à un thème ou une bibliothèque de blocs tierce.
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.0
Version: 1.1.15
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: easymage
*/

/* ---------------------------------------------------------------
   Réglages globaux non exprimables dans theme.json
   --------------------------------------------------------------- */

:root {
	--eaz-topbar-h: 38px;
}

html {
	scroll-behavior: smooth;
}

/* Ancres (#modeles, #solutions…) : le titre visé ne doit pas passer sous l'en-tête collant. */
[id] {
	scroll-margin-top: 120px;
}

/* Les conteneurs EAsymage « pleine largeur » font 100vw, barre de défilement comprise : sans ceci,
   la page défile de quelques pixels à l'horizontale. « clip » (et non « hidden ») ne casse pas l'en-tête collant. */
body {
	overflow-x: clip;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

img,
video {
	max-width: 100%;
	height: auto;
}

/* Les navigateurs n'appliquent pas la police de la page aux éléments de formulaire :
   on la fait hériter (formulaires EAsymage Forms, recherche...). :where() = spécificité nulle,
   un réglage de police d'un formulaire ou d'un bloc garde la priorité. */
:where(button, input, select, textarea) {
	font-family: inherit;
}

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

a,
.wp-element-button,
.wp-block-button__link {
	transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ---------------------------------------------------------------
   Compatibilité avec les contenus faits sous l'ancien thème (STAX)
   Les pages utilisent encore les noms de couleurs de STAX (« Bleu CF »,
   white, dark-gray, bg-light…) : ils sont redirigés vers la palette du thème,
   sans avoir à réécrire les pages. Ces couleurs n'apparaissent plus dans le
   sélecteur de l'éditeur (on choisit désormais Principale, Accent…).
   --------------------------------------------------------------- */

:root {
	--wp--preset--color--custom-bleu-cf: var(--wp--preset--color--primary);
	--wp--preset--color--custom-rouge-cf: var(--wp--preset--color--accent);
	--wp--preset--color--white: #ffffff;
	--wp--preset--color--black: #000000;
	--wp--preset--color--dark-gray: var(--wp--preset--color--body-text);
	--wp--preset--color--medium-gray: #656d6f;
	--wp--preset--color--light-gray: #dddddd;
	--wp--preset--color--bg-light: var(--wp--preset--color--surface);
	--wp--preset--color--vivid-cyan-blue: #0693e3;
	--wp--preset--color--pale-pink: #f78da7;
}

/* Même ordre que WordPress sous STAX : couleurs par défaut, puis celles du thème, puis les couleurs
   personnalisées (« Bleu CF », « Rouge CF ») EN DERNIER. Certains blocs portent deux couleurs à la fois
   (ex. « white » + « Bleu CF ») : c'est la dernière déclarée qui l'emportait, il faut garder cet ordre. */
.has-white-color { color: var(--wp--preset--color--white) !important; }
.has-black-color { color: var(--wp--preset--color--black) !important; }
.has-vivid-cyan-blue-color { color: var(--wp--preset--color--vivid-cyan-blue) !important; }
.has-pale-pink-color { color: var(--wp--preset--color--pale-pink) !important; }
.has-dark-gray-color { color: var(--wp--preset--color--dark-gray) !important; }
.has-medium-gray-color { color: var(--wp--preset--color--medium-gray) !important; }
.has-light-gray-color { color: var(--wp--preset--color--light-gray) !important; }
.has-bg-light-color { color: var(--wp--preset--color--bg-light) !important; }
.has-custom-bleu-cf-color { color: var(--wp--preset--color--custom-bleu-cf) !important; }
.has-custom-rouge-cf-color { color: var(--wp--preset--color--custom-rouge-cf) !important; }

.has-white-background-color { background-color: var(--wp--preset--color--white) !important; }
.has-black-background-color { background-color: var(--wp--preset--color--black) !important; }
.has-vivid-cyan-blue-background-color { background-color: var(--wp--preset--color--vivid-cyan-blue) !important; }
.has-pale-pink-background-color { background-color: var(--wp--preset--color--pale-pink) !important; }
.has-dark-gray-background-color { background-color: var(--wp--preset--color--dark-gray) !important; }
.has-medium-gray-background-color { background-color: var(--wp--preset--color--medium-gray) !important; }
.has-light-gray-background-color { background-color: var(--wp--preset--color--light-gray) !important; }
.has-bg-light-background-color { background-color: var(--wp--preset--color--bg-light) !important; }
.has-custom-bleu-cf-background-color { background-color: var(--wp--preset--color--custom-bleu-cf) !important; }
.has-custom-rouge-cf-background-color { background-color: var(--wp--preset--color--custom-rouge-cf) !important; }

.has-white-border-color { border-color: var(--wp--preset--color--white) !important; }
.has-light-gray-border-color { border-color: var(--wp--preset--color--light-gray) !important; }
.has-custom-bleu-cf-border-color { border-color: var(--wp--preset--color--custom-bleu-cf) !important; }
.has-custom-rouge-cf-border-color { border-color: var(--wp--preset--color--custom-rouge-cf) !important; }

/* Liens dans les titres (« Menuiseries Aluminium », listes de produits…) : non soulignés, comme sous STAX. */
:where(h1, h2, h3, h4, h5, h6) a:where(:not(.wp-element-button)) {
	text-decoration: none;
}

:where(h1, h2, h3, h4, h5, h6) a:where(:not(.wp-element-button)):hover {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-underline-offset: 5px;
}

/* ---------------------------------------------------------------
   En-tête : bandeau bleu (adresse, téléphone, devis) + barre blanche (logo, menu)
   --------------------------------------------------------------- */

/* Tout l'en-tête est collant, mais décalé de la hauteur du bandeau : au défilement, le bandeau
   bleu disparaît et seule la barre blanche (logo + menu) reste en haut de l'écran. */
.wp-site-blocks > header.wp-block-template-part:has(.eaz-header) {
	position: sticky;
	top: calc(-1 * var(--eaz-topbar-h));
	z-index: 100;
}

body.admin-bar .wp-site-blocks > header.wp-block-template-part:has(.eaz-header) {
	top: calc(var(--wp-admin--admin-bar--height, 32px) - var(--eaz-topbar-h));
}

/* Écran étroit : la barre d'admin WordPress n'est plus collante, l'en-tête remonte en haut. */
@media (max-width: 600px) {
	body.admin-bar .wp-site-blocks > header.wp-block-template-part:has(.eaz-header) {
		top: calc(-1 * var(--eaz-topbar-h));
	}
}

.eaz-header__barre {
	box-shadow: 0 4px 18px rgba(28, 45, 69, 0.10);
}

/* Bandeau bleu */
.eaz-topbar {
	font-size: 0.85rem;
	font-weight: 500;
}

.eaz-topbar__row {
	min-height: var(--eaz-topbar-h);
	height: var(--eaz-topbar-h);
	gap: 1.5rem;
}

.eaz-topbar__actions {
	gap: 1.5rem;
}

.eaz-topbar p {
	margin: 0;
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 0.45rem;
}

.eaz-topbar a {
	text-decoration: none;
}

.eaz-topbar a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Pictogrammes (repère, téléphone) dessinés en CSS : pas de balisage à maintenir dans la partie. */
.eaz-topbar__adresse::before,
.eaz-topbar__tel::before {
	content: "";
	width: 15px;
	height: 15px;
	flex: none;
	background-color: currentColor;
	-webkit-mask: var(--eaz-picto) center / contain no-repeat;
	mask: var(--eaz-picto) center / contain no-repeat;
	opacity: 0.85;
}

.eaz-topbar__adresse::before {
	--eaz-picto: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a7 7 0 0 0-7 7c0 5.2 7 13 7 13s7-7.8 7-13a7 7 0 0 0-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}

.eaz-topbar__tel::before {
	--eaz-picto: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.6 10.8a15.1 15.1 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.25 11.4 11.4 0 0 0 3.6.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.25 1z'/%3E%3C/svg%3E");
}

.eaz-topbar__tel {
	font-weight: 700;
}

/* Téléphone : l'adresse est masquée, le téléphone reste (centré). */
@media (max-width: 781px) {
	.eaz-topbar__adresse {
		display: none !important;
	}

	.eaz-topbar__row {
		justify-content: center !important;
	}
}

/* Barre blanche : logo à gauche ; à droite le menu puis le bouton « Devis gratuit ».
   Le bouton est dans la barre blanche (collante) : il reste visible au défilement. */
.eaz-header__row {
	gap: 1.5rem;
	justify-content: flex-start !important;
}

.eaz-header__row .wp-block-site-logo {
	margin-right: auto;
}

.eaz-header__cta {
	flex: none;
	margin: 0;
}

.eaz-header__cta .wp-block-button__link {
	font-size: 0.9rem;
	font-weight: 700;
	white-space: nowrap;
	border-radius: 6px;
}

/* Menu en « hamburger » : le bouton passe à gauche de l'icône du menu, l'icône tout à droite. */
@media (max-width: 1279px) {
	.eaz-header__row .wp-block-navigation {
		order: 3;
	}
}

.eaz-header.eaz-nav-compact .eaz-header__row .wp-block-navigation {
	order: 3;
}

@media (max-width: 781px) {
	.eaz-header__row {
		gap: 0.9rem;
	}

	.eaz-header__cta .wp-block-button__link {
		padding: 0.45rem 0.8rem !important;
		font-size: 0.85rem;
	}
}

.eaz-header .wp-block-site-logo {
	flex: none;
}

.eaz-header .wp-block-navigation a {
	text-decoration: none;
}

.eaz-header .wp-block-navigation-item__label {
	white-space: nowrap;
}

/* Le menu « Main Menu » contient le logo du site en 1re entrée (héritage STAX, où il n'y avait pas d'autre logo).
   L'en-tête a déjà son logo : celui du menu est masqué (sans modifier le menu en base). */
.eaz-header .wp-block-navigation-item:has(> .wp-block-site-logo) {
	display: none !important;
}

/* Survol et page courante : soulignés en rouge CF. */
.eaz-header .wp-block-navigation a:hover,
.eaz-header .wp-block-navigation .current-menu-item > a,
.eaz-header .wp-block-navigation .current-menu-ancestor > a {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 7px;
}

/* Sous-menus (Nos produits, Parrainage) : carte blanche avec liseré rouge. */
.eaz-header .wp-block-navigation .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--base) !important;
	color: var(--wp--preset--color--primary) !important;
	border: 0 !important;
	border-top: 3px solid var(--wp--preset--color--accent) !important;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 12px 32px rgba(28, 45, 69, 0.16);
	padding: 0.5rem 0;
	min-width: 260px;
}

.eaz-header .wp-block-navigation .wp-block-navigation__submenu-container a {
	padding: 0.5rem 1.1rem;
}

@media (max-width: 781px) {
	.eaz-header .wp-block-site-logo img {
		width: 96px !important;
		height: auto;
	}
}

/* Menu « hamburger » : WordPress ne bascule qu'en dessous de 600 px. Le menu de ce site est long
   (8 entrées, libellés longs) : il passe en hamburger dès qu'il ne tient plus sur une ligne.
   - assets/js/menu.js ajoute la classe .eaz-nav-compact quand le menu déborde (s'adapte
     tout seul si on ajoute / renomme des entrées) ;
   - en dessous de 1280 px, hamburger d'office (évite un flash avant le chargement du script). */
@media (min-width: 600px) and (max-width: 1279px) {
	.eaz-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}

	.eaz-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}
}

@media (min-width: 600px) {
	.eaz-header.eaz-nav-compact .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}

	.eaz-header.eaz-nav-compact .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}
}

.eaz-header .wp-block-navigation__responsive-container-open svg {
	width: 30px;
	height: 30px;
}

/* Menu ouvert (plein écran) : entrées plus grandes, alignées à gauche, sous-menus indentés. */
.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: var(--wp--preset--spacing--50);
	font-size: var(--wp--preset--font-size--medium);
}

.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	border-top: 0 !important;
	box-shadow: none;
	min-width: 0;
	padding: 0.4rem 0 0 1rem;
	font-size: var(--wp--preset--font-size--normal);
}

.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
	padding: var(--wp--preset--spacing--60) clamp(1.5rem, 6vw, 3rem);
}

.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,
.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	align-items: flex-start !important;
	text-align: left;
}

.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	gap: 0.9rem;
}

/* Menu ouvert : entrées principales en grand, sous-entrées un cran en dessous ; les libellés longs
   (« Véranda / Pergola neuf & rénovation ») passent à la ligne au lieu de déborder. */
.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	font-size: 1.15rem !important;
	font-weight: 700;
}

.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item {
	font-size: 1rem !important;
	font-weight: 500;
}

.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__label {
	white-space: normal;
}

/* ---------------------------------------------------------------
   Pied de page (bleu nuit)
   --------------------------------------------------------------- */

.eaz-footer a {
	text-decoration: none;
}

.eaz-footer a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.eaz-footer h3 {
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.eaz-footer h3::after {
	content: "";
	display: block;
	width: 32px;
	height: 3px;
	margin-top: 0.6rem;
	background: var(--wp--preset--color--accent);
	border-radius: 2px;
}

/* Logo (bleu / rouge) sur une pastille blanche : illisible directement sur le fond bleu nuit. */
.eaz-footer__logo img {
	background: var(--wp--preset--color--base);
	padding: 10px 14px;
	border-radius: 10px;
	box-sizing: content-box;
}

.eaz-footer__liens {
	list-style: none;
	padding-left: 0;
	line-height: 2;
}

.eaz-footer .wp-block-social-links .wp-social-link {
	background-color: rgba(255, 255, 255, 0.12);
}

.eaz-footer .wp-block-social-links .wp-social-link:hover {
	background-color: var(--wp--preset--color--accent);
}

/* ---------------------------------------------------------------
   Blocs natifs
   --------------------------------------------------------------- */

/* Accordéon (bloc Détails) */
.wp-block-details {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	padding: 0.9rem 1.2rem;
	background: var(--wp--preset--color--base);
}

.wp-block-details + .wp-block-details {
	margin-top: 0.75rem;
}

.wp-block-details summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--wp--preset--color--contrast);
}

.wp-block-details[open] summary {
	margin-bottom: 0.75rem;
	color: var(--wp--preset--color--accent);
}

/* Tableaux de caractéristiques */
.wp-block-table table,
.entry-content table {
	border-collapse: collapse;
	width: 100%;
}

.wp-block-table th,
.wp-block-table td,
.entry-content table th,
.entry-content table td {
	border: 1px solid var(--wp--preset--color--border);
	padding: 0.6rem 0.9rem;
	text-align: left;
	overflow-wrap: anywhere;
}

/* Sur téléphone : cellules plus compactes pour que le tableau tienne dans la largeur. */
@media (max-width: 600px) {
	.wp-block-table th,
	.wp-block-table td,
	.entry-content table th,
	.entry-content table td {
		padding: 0.5rem 0.55rem;
		font-size: var(--wp--preset--font-size--small);
	}
}

.wp-block-table th,
.entry-content table th {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	font-weight: 600;
}

/* Bouton style « contour » */
.wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base);
}

/* Bannières (cover) : sur mobile, le texte passe sur toute la largeur de l'image,
   un dégradé horizontal ne suffit plus à le rendre lisible → voile uniforme. */
@media (max-width: 781px) {
	.wp-block-cover .wp-block-cover__background.has-background-gradient {
		background: color-mix(in srgb, var(--wp--preset--color--secondary) 75%, transparent) !important;
		opacity: 1 !important;
	}
}

/* Cartes (groupe avec style « carte ») */
.is-style-eaz-carte {
	background: var(--wp--preset--color--base);
	border-radius: 12px;
	box-shadow: 0 6px 24px rgba(28, 45, 69, 0.1);
	overflow: hidden;
}

/* Page qui se termine par une section pleine largeur (ex. bandeau devis) : pas de bande
   entre cette section et le pied de page. */
.wp-block-post-content:has(> .alignfull:last-child) {
	padding-bottom: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}

/* Carte EAsymage suivie d'une légende dans le même groupe : la carte (height:100%) ne doit pas
   occuper toute la cellule, sinon la légende déborde sur la ligne suivante de la grille. */
.wp-block-group > .easymage-card:not(:only-child) {
	height: auto;
}

/* Titre précédé d'un petit trait rouge (cartes d'avantages). Classe à ajouter au titre : eaz-titre-accent. */
.eaz-titre-accent::before {
	content: "";
	display: block;
	width: 40px;
	height: 3px;
	margin-bottom: 0.7rem;
	background: var(--wp--preset--color--accent);
	border-radius: 2px;
}

/* Encadré de performances (fiches produits). Classe de paragraphe : eaz-perf. */
.eaz-perf {
	background: var(--wp--preset--color--surface);
	border-left: 3px solid var(--wp--preset--color--accent);
	border-radius: 4px;
	padding: 0.6rem 0.9rem;
}

/* Colonnes « texte | image » : sur téléphone, l'image repasse au-dessus du texte.
   Classe à ajouter au bloc Colonnes : eaz-inverse-mobile. */
@media (max-width: 781px) {
	.wp-block-columns.eaz-inverse-mobile {
		flex-direction: column-reverse;
	}
}

/* Liens dans le texte d'une section sombre : couleur du texte + soulignés (le bleu serait illisible). */
.wp-block-post-content :is(.has-secondary-background-color, .has-primary-background-color, .has-custom-bleu-cf-background-color) a:not(.wp-element-button):not(.wp-block-button__link) {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Bandeau de titre des pages « Page » (espaces parrainage, mentions…) */
.eaz-titre-page h1 {
	margin: 0;
}

/* Cartes des agences (« Trouver mon agence ») : toutes de la même hauteur (lignes égales), photo entière
   centrée verticalement. Classe ajoutée aux blocs Média et texte : eaz-carte-agence. */
.easymage-grid:has(.eaz-carte-agence) {
	align-items: stretch;
	grid-template-rows: none !important;
	grid-auto-rows: 1fr !important;
	/* Nombre de colonnes selon la place disponible (3 / 2 / 1), au lieu des 3 colonnes fixes du bloc :
	   une carte ne descend jamais sous 250 px. */
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)) !important;
}

.easymage-slide-free:has(.eaz-carte-agence),
.easymage-slide-free:has(.eaz-carte-agence) > .easymage-slide-free-content {
	height: 100%;
}

.eaz-carte-agence {
	height: 100%;
}

/* Photo entière (portrait du responsable incrusté en haut à droite) : centrée verticalement, jamais recadrée. */
.eaz-carte-agence .wp-block-media-text__media {
	align-self: center;
}

.eaz-carte-agence .wp-block-media-text__content {
	padding: 1.5rem 1.4rem;
}

.eaz-carte-agence h3 {
	font-size: 1.2rem !important;
	line-height: 1.3;
	margin-bottom: 0.6rem;
}

/* Carte d'agence étroite (2 colonnes sur tablette, ou 3 colonnes serrées) : la photo passe au-dessus du texte.
   Requête de conteneur : dépend de la largeur de la CARTE, pas de celle de l'écran. */
.easymage-slide-free:has(> .easymage-slide-free-content > .eaz-carte-agence) {
	container-type: inline-size;
}

@container (max-width: 400px) {
	.eaz-carte-agence {
		grid-template-columns: 100% !important;
		grid-template-rows: auto 1fr;
	}

	.eaz-carte-agence > .wp-block-media-text__media {
		grid-column: 1;
		grid-row: 1;
		align-self: start;
	}

	.eaz-carte-agence > .wp-block-media-text__content {
		grid-column: 1;
		grid-row: 2;
		padding: 1rem 1.2rem 1.3rem;
		align-self: start !important;
	}
}
