/*
Theme Name: EAsymage
Theme URI:
Author: EAsymage
Description: Thème de blocs maison EAsymage (charte C.F.P Menuiseries). 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.0.14
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
   --------------------------------------------------------------- */

html {
	scroll-behavior: smooth;
}

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

body {
	-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;
}

/* ---------------------------------------------------------------
   En-tête
   --------------------------------------------------------------- */

/* Le collant s'applique au conteneur <header> de la partie de modèle (parent direct de .wp-site-blocks),
   sinon il resterait limité à la hauteur de l'en-tête lui-même. */
.wp-site-blocks > header.wp-block-template-part:has(.eaz-header) {
	position: sticky;
	top: 0;
	z-index: 100;
}

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

.eaz-header {
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* En-tête sombre (CFP) : survol et page courante soulignés en rouge, le texte reste blanc (lisibilité). */
.eaz-header .wp-block-navigation a {
	text-decoration: none;
}

.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: 6px;
}

/* Sous-menus (ALUMINIUM) : même fond sombre que l'en-tête. */
.eaz-header .wp-block-navigation .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--secondary) !important;
	color: var(--wp--preset--color--base) !important;
	border: 0 !important;
	border-top: 2px solid var(--wp--preset--color--accent) !important;
	padding: 0.4rem 0;
	min-width: 220px;
}

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

.eaz-header__tel a {
	text-decoration: none;
	white-space: nowrap;
}

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

@media (max-width: 1319px) {
	.eaz-header__tel {
		display: none !important;
	}
}

/* Téléphone : le bouton « Nous contacter » reste visible (le menu n'a plus d'entrée « Contact »), en version compacte. */
@media (max-width: 781px) {
	.eaz-header .wp-block-site-logo img {
		width: 120px !important;
		height: auto;
	}

	.eaz-header__cta .wp-block-button__link {
		padding: 0.45rem 0.8rem !important;
		font-size: var(--wp--preset--font-size--small);
		white-space: nowrap;
	}
}

/* ---------------------------------------------------------------
   Pied de page
   --------------------------------------------------------------- */

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

.eaz-footer .wp-block-list {
	list-style: none;
}

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

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

/* ---------------------------------------------------------------
   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--primary);
}

/* 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--primary);
	border-color: var(--wp--preset--color--primary);
	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(30, 35, 38, 0.1);
	overflow: hidden;
}

/* Page qui se termine par une section pleine largeur (ex. bandeau devis) : pas de bande
   blanche 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--primary);
	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 (fond anthracite) : couleur du texte + soulignés (le rouge serait illisible). */
.wp-block-post-content .has-secondary-background-color a:not(.wp-element-button):not(.wp-block-button__link) {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Menu « hamburger » jusqu’à 1179 px (WordPress ne le bascule qu'en dessous de 600 px) :
   sur tablette et petit écran, le menu de 7 entrées passait sur deux lignes. */
@media (min-width: 600px) and (max-width: 1179px) {
	.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;
	}
}

/* Menu ouvert (plein écran) : entrées plus grandes, sous-menu ALUMINIUM sans cadre de liste déroulante. */
.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--large);
}

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

/* Menu ouvert : entrées alignées à gauche (le menu de l'en-tête est aligné à droite sur ordinateur). */
.eaz-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
	padding: var(--wp--preset--spacing--50) 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;
}

/* Quand le menu est en « hamburger » (< 1180 px), l'icône passe à l'extrême droite, après le bouton « Nous contacter ». */
@media (max-width: 1179px) {
	.eaz-header .wp-block-navigation {
		order: 3;
	}
}
