/**
 * YAHU SANTÉ — Charte graphique front-end
 * =======================================
 *
 * Constat : la charte était éclatée. Le bleu par défaut de WordPress
 * (#007cba) apparaissait 34 fois dans le CSS global, le vert émeraude de la
 * marque (#059669) n'apparaissait nulle part, et trois verts différents
 * coexistaient (#16a34a, #10b981, #059669) sans règle claire. Les titres
 * étaient tantôt en Marcellus, tantôt en DM Sans, tantôt en Helvetica.
 *
 * Ce fichier fixe une source unique de vérité :
 *   - variables de couleur et de typographie ;
 *   - suppression du bleu WordPress ;
 *   - Marcellus pour les titres, DM Sans pour le texte ;
 *   - composants (boutons, cartes, encadrés, tableaux, formulaires) ;
 *   - retouches de lisibilité (interlignage, largeur de lecture).
 *
 * Il est chargé APRÈS les feuilles du thème et des extensions, donc ses
 * règles l'emportent à spécificité égale sans avoir à forcer partout.
 */

/* -------------------------------------------------------------------------
 * 1. JETONS DE DESIGN
 * ---------------------------------------------------------------------- */

:root {
	/* Couleurs de marque */
	--yahu-emerald: #059669;
	--yahu-emerald-dark: #047857;
	--yahu-emerald-soft: #ecfdf5;
	--yahu-green: #16a34a;
	--yahu-gold: #d4af37;
	--yahu-gold-soft: #fdf9ec;

	/* Neutres */
	--yahu-ink: #0f172a;
	--yahu-slate: #334155;
	--yahu-text: #475569;
	--yahu-muted: #64748b;
	--yahu-line: #e2e8f0;
	--yahu-bg: #ffffff;
	--yahu-bg-soft: #fbfbfb;
	--yahu-bg-tint: #f8fafc;

	/* Formes */
	--yahu-radius: 12px;
	--yahu-radius-lg: 18px;
	--yahu-radius-pill: 999px;
	--yahu-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);
	--yahu-shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.08), 0 20px 48px rgba(15, 23, 42, 0.10);
	--yahu-ring: 0 0 0 4px rgba(5, 150, 105, 0.15);

	/* Typographie */
	--yahu-font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--yahu-font-head: "Marcellus", Georgia, "Times New Roman", serif;
}

/* -------------------------------------------------------------------------
 * 2. SUPPRESSION DU BLEU WORDPRESS PAR DÉFAUT
 *
 * --wp-admin-theme-color est injectée par le CSS global de WordPress et
 * contamine les liens, les boutons et les contours de champs sur le site
 * public. On la réaffecte sur l'émeraude de la marque.
 * ---------------------------------------------------------------------- */

:root,
body,
.wp-block-button__link,
.editor-styles-wrapper {
	--wp-admin-theme-color: #059669;
	--wp-admin-theme-color--rgb: 5, 150, 105;
	--wp-admin-theme-color-darker-10: #047857;
	--wp-admin-theme-color-darker-10--rgb: 4, 120, 87;
	--wp-admin-theme-color-darker-20: #036c4e;
	--wp-admin-theme-color-darker-20--rgb: 3, 108, 78;
}

/* Filet de sécurité : toute règle résiduelle en dur sur le bleu WP. */
a:not(.yahu-keep-blue),
.wp-block-button__link,
.wp-element-button {
	--wp--preset--color--vivid-cyan-blue: #059669;
}

/* -------------------------------------------------------------------------
 * 3. TYPOGRAPHIE
 * ---------------------------------------------------------------------- */

body,
.ast-separate-container .ast-article-post,
.ast-separate-container .ast-article-single,
.entry-content,
.widget {
	font-family: var(--yahu-font-body);
	color: var(--yahu-text);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4,
.entry-title,
.site-title,
.wp-block-heading,
.uagb-heading-text {
	font-family: var(--yahu-font-head);
	color: var(--yahu-ink);
	font-weight: 400;
	letter-spacing: 0.01em;
	line-height: 1.25;
}

h1, .entry-title { font-size: clamp(2rem, 4.5vw, 3rem); }
h2, .wp-block-heading h2 { font-size: clamp(1.5rem, 3vw, 2.125rem); margin-top: 2rem; }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); margin-top: 1.5rem; }
h4 { font-size: 1.15rem; }

/* Sous-titres et chapôs : DM Sans, plus lisible que le serif. */
h5, h6,
.uagb-desc-text,
.yahu-lead {
	font-family: var(--yahu-font-body);
	font-weight: 600;
	color: var(--yahu-slate);
}

p, li {
	font-size: 1.0625rem;
	line-height: 1.75;
}

/* Largeur de lecture confortable sur les pages de contenu long. */
.entry-content > p,
.entry-content > ul,
.entry-content > ol {
	max-width: 72ch;
}

strong { color: var(--yahu-ink); font-weight: 700; }

/* -------------------------------------------------------------------------
 * 4. LIENS
 * ---------------------------------------------------------------------- */

.entry-content a:not(.wp-block-button__link):not(.button),
.ast-blog-single-element a,
.yahu-prose a {
	color: var(--yahu-emerald-dark);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	transition: color 0.15s ease;
}

.entry-content a:not(.wp-block-button__link):not(.button):hover {
	color: var(--yahu-emerald);
	text-decoration-thickness: 2px;
}

/* -------------------------------------------------------------------------
 * 5. BOUTONS
 * ---------------------------------------------------------------------- */

.wp-block-button__link,
.wp-element-button,
button,
input[type="submit"],
.ast-button,
.yahu-btn {
	font-family: var(--yahu-font-body);
	font-weight: 600;
	font-size: 1rem;
	letter-spacing: 0.01em;
	border-radius: var(--yahu-radius-pill);
	padding: 0.85em 1.9em;
	border: 2px solid transparent;
	background-color: var(--yahu-emerald);
	color: #fff;
	text-decoration: none;
	transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
	box-shadow: 0 1px 2px rgba(5, 150, 105, 0.25);
}

.wp-block-button__link:hover,
.wp-element-button:hover,
button:hover,
input[type="submit"]:hover,
.ast-button:hover,
.yahu-btn:hover {
	background-color: var(--yahu-emerald-dark);
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(5, 150, 105, 0.28);
}

.wp-block-button__link:focus-visible,
button:focus-visible,
a:focus-visible {
	outline: none;
	box-shadow: var(--yahu-ring);
}

/* Variante secondaire : contour émeraude sur fond clair. */
.is-style-outline .wp-block-button__link,
.wp-block-button.is-style-outline > .wp-block-button__link,
.yahu-btn--ghost {
	background-color: transparent;
	color: var(--yahu-emerald-dark);
	border-color: var(--yahu-emerald);
	box-shadow: none;
}

.is-style-outline .wp-block-button__link:hover,
.yahu-btn--ghost:hover {
	background-color: var(--yahu-emerald-soft);
	color: var(--yahu-emerald-dark);
}

/* Variante or : réservée aux mises en avant premium. */
.yahu-btn--gold {
	background-color: var(--yahu-gold);
	color: var(--yahu-ink);
}

.yahu-btn--gold:hover {
	background-color: #c39c2c;
	color: var(--yahu-ink);
}

/* -------------------------------------------------------------------------
 * 6. CARTES ET ENCADRÉS
 * ---------------------------------------------------------------------- */

.yahu-card,
.wp-block-group.has-background,
.uagb-container-inner-blocks-wrap > .wp-block-group {
	border-radius: var(--yahu-radius-lg);
}

.yahu-card {
	background: var(--yahu-bg);
	border: 1px solid var(--yahu-line);
	box-shadow: var(--yahu-shadow);
	padding: 1.75rem;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.yahu-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--yahu-shadow-lg);
}

.yahu-card h3 { margin-top: 0; }

/* Encadré d'information (charte YAHU : fond vert très clair, filet émeraude). */
.yahu-note,
.yahu-callout {
	background: var(--yahu-emerald-soft);
	border-left: 4px solid var(--yahu-emerald);
	border-radius: var(--yahu-radius);
	padding: 1.25rem 1.5rem;
	margin: 1.75rem 0;
}

.yahu-note p:last-child,
.yahu-callout p:last-child { margin-bottom: 0; }

/* Encadré d'avertissement médical : or, pour le distinguer du reste. */
.yahu-disclaimer {
	background: var(--yahu-gold-soft);
	border-left: 4px solid var(--yahu-gold);
	border-radius: var(--yahu-radius);
	padding: 1.25rem 1.5rem;
	margin: 1.75rem 0;
	font-size: 0.95rem;
	color: var(--yahu-slate);
}

/* Grille de cartes responsive sans dépendance à un constructeur. */
.yahu-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 1.5rem;
	margin: 2rem 0;
}

/* Bandeau de confiance (paiement, livraison, conseil). */
.yahu-trust {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.5rem;
	justify-content: center;
	align-items: center;
	padding: 1rem 1.25rem;
	background: var(--yahu-bg-tint);
	border: 1px solid var(--yahu-line);
	border-radius: var(--yahu-radius-pill);
	margin: 1.5rem 0;
	font-size: 0.925rem;
	font-weight: 500;
	color: var(--yahu-slate);
}

.yahu-trust span { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Badges produits. */
.yahu-badge {
	display: inline-block;
	padding: 0.25rem 0.7rem;
	border-radius: var(--yahu-radius-pill);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	background: var(--yahu-emerald-soft);
	color: var(--yahu-emerald-dark);
}

.yahu-badge--gold { background: var(--yahu-gold-soft); color: #8a6d1f; }

/* -------------------------------------------------------------------------
 * 7. TABLEAUX
 * ---------------------------------------------------------------------- */

.entry-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.75rem 0;
	font-size: 0.975rem;
	border: 1px solid var(--yahu-line);
	border-radius: var(--yahu-radius);
	overflow: hidden;
}

.entry-content th {
	background: var(--yahu-emerald-soft);
	color: var(--yahu-ink);
	font-family: var(--yahu-font-body);
	font-weight: 700;
	text-align: left;
	padding: 0.85rem 1rem;
}

.entry-content td {
	padding: 0.85rem 1rem;
	border-top: 1px solid var(--yahu-line);
}

.entry-content tbody tr:nth-child(even) { background: var(--yahu-bg-soft); }

/* -------------------------------------------------------------------------
 * 8. FORMULAIRES
 * ---------------------------------------------------------------------- */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
	font-family: var(--yahu-font-body);
	font-size: 1rem;
	color: var(--yahu-ink);
	background: var(--yahu-bg);
	border: 1.5px solid var(--yahu-line);
	border-radius: var(--yahu-radius);
	padding: 0.75rem 1rem;
	width: 100%;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--yahu-emerald);
	box-shadow: var(--yahu-ring);
}

::placeholder { color: var(--yahu-muted); opacity: 1; }

/* -------------------------------------------------------------------------
 * 9. CARTES PRODUITS WOOCOMMERCE
 * ---------------------------------------------------------------------- */

ul.products li.product {
	border: 1px solid var(--yahu-line);
	border-radius: var(--yahu-radius-lg);
	overflow: hidden;
	background: var(--yahu-bg);
	box-shadow: var(--yahu-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	padding-bottom: 1rem;
}

ul.products li.product:hover {
	transform: translateY(-3px);
	box-shadow: var(--yahu-shadow-lg);
}

ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--yahu-font-head);
	font-size: 1.1rem;
	color: var(--yahu-ink);
	padding: 0.9rem 1rem 0.35rem;
}

ul.products li.product .price {
	color: var(--yahu-emerald-dark);
	font-weight: 700;
	font-size: 1.05rem;
	padding: 0 1rem;
}

ul.products li.product .button,
ul.products li.product .add_to_cart_button {
	margin: 0.75rem 1rem 0;
	width: calc(100% - 2rem);
	text-align: center;
}

/* -------------------------------------------------------------------------
 * 10. FILET DE SÉCURITÉ ANTI-BLEU
 *
 * Certaines extensions écrivent le bleu WordPress en dur dans leurs styles.
 * Ces règles ciblent les composants les plus visibles pour garantir la
 * cohérence de la charte, sans toucher à la structure.
 * ---------------------------------------------------------------------- */

/* Surlignage des titres Spectra.
 *
 * Le CSS généré par Spectra écrit « background: #007cba » sur
 * .uagb-highlight dans 33 règles distinctes (une par bloc de titre). Ce CSS
 * est produit APRÈS la charte, donc une simple redéfinition de variable ne
 * suffit pas : il faut reprendre le sélecteur avec la même spécificité et
 * l'emporter par la cascade. Le « !important » est ici nécessaire parce que
 * Spectra génère lui-même des « !important » dans 147 règles.
 *
 * Résultat : le surlignage de marque devient un vert émeraude doux sur fond
 * clair, cohérent avec la charte et lisible (contraste > 7:1). */
.wp-block-uagb-advanced-heading .uagb-highlight,
.uagb-highlight {
	background: var(--yahu-emerald-soft) !important;
	color: var(--yahu-emerald-dark) !important;
	-webkit-text-fill-color: var(--yahu-emerald-dark) !important;
	padding: 0.05em 0.25em;
	border-radius: 4px;
}

/* Surlignage de sélection (sélection à la souris dans le titre). */
.wp-block-uagb-advanced-heading .uagb-highlight::selection,
.uagb-highlight::selection {
	background: var(--yahu-emerald) !important;
	color: #fff !important;
	-webkit-text-fill-color: #fff !important;
}

.woocommerce-info,
.woocommerce-message {
	border-top-color: var(--yahu-emerald);
	background: var(--yahu-emerald-soft);
	color: var(--yahu-ink);
}

.woocommerce-info::before,
.woocommerce-message::before { color: var(--yahu-emerald); }

.woocommerce-error { border-top-color: #dc2626; }

.ast-menu-toggle,
.main-header-menu > .menu-item > .menu-link:hover,
.main-header-menu > .menu-item.current-menu-item > .menu-link {
	color: var(--yahu-emerald-dark);
}

/* Le sélecteur de langue et le logo gardent leur mise en page d'origine. */
.wpyahu-switcher img,
.custom-logo { border-radius: 4px; }

/* -------------------------------------------------------------------------
 * 11. RETOUCHES DE LISIBILITÉ
 * ---------------------------------------------------------------------- */

/* Titre de page : un peu d'air au-dessus et en dessous. */
.entry-header { margin-bottom: 1.75rem; }

/* Listes à puces : puce émeraude, plus lisible. */
.entry-content ul:not(.wp-block-list) li::marker,
.entry-content .wp-block-list li::marker {
	color: var(--yahu-emerald);
}

/* Séparateurs discrets. */
.entry-content hr,
.wp-block-separator {
	border: 0;
	border-top: 1px solid var(--yahu-line);
	margin: 2.5rem 0;
}

/* Citations : filet émeraude. */
.entry-content blockquote,
.wp-block-quote {
	border-left: 4px solid var(--yahu-emerald);
	background: var(--yahu-bg-tint);
	border-radius: var(--yahu-radius);
	padding: 1.25rem 1.5rem;
	margin: 1.75rem 0;
	font-style: normal;
	color: var(--yahu-slate);
}

/* Images de contenu : coins arrondis et ombre légère. */
.entry-content img:not(.custom-logo):not(.emoji) {
	border-radius: var(--yahu-radius);
}

/* -------------------------------------------------------------------------
 * 12. ACCESSIBILITÉ
 * ---------------------------------------------------------------------- */

/* Respect du réglage système « réduire les animations ». */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Sur mobile, on réduit l'emphase typographique. */
@media (max-width: 544px) {
	body { font-size: 16px; }
	h1, .entry-title { font-size: 1.85rem; }
	.yahu-card { padding: 1.25rem; }
	.yahu-trust { border-radius: var(--yahu-radius); }
}
