/*
Theme Name: EAsymage
Theme URI:
Author: EAsymage
Description: Thème de blocs maison EAsymage. 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.5
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(15, 63, 95, 0.08);
}

.eaz-header .wp-block-navigation a:hover,
.eaz-header .wp-block-navigation .current-menu-item > a {
	color: var(--wp--preset--color--primary);
}

.eaz-header .wp-block-navigation .current-menu-item > a {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

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

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

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

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

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

.eaz-footer a {
	text-decoration: 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(15, 63, 95, 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;
	}
}
