/*
Theme Name: GP Child Echo Santé
Theme URI: https://echo-sante.fr
Description: Thème enfant GeneratePress pour Echo Santé — magazine éditorial santé.
Author: Echo Santé
Author URI: https://echo-sante.fr
Template: generatepress
Version: 1.0.0
Text Domain: gp-child-echo-sante
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&display=swap');

/* ========== VARIABLES ========== */
:root {
  --es-navy: #0B2341;
  --es-navy-2: #102A43;
  --es-gold: #F4B731;
  --es-gold-hover: #E0A11C;
  --es-gold-soft: rgba(244, 183, 49, 0.12);
  --es-white: #FFFFFF;
  --es-bg: #F8FAFC;
  --es-border: #E5E7EB;
  --es-text: #102A43;
  --es-mute: #6B7280;
  --es-card: #FFFFFF;
  --es-shadow: 0 1px 2px rgba(11, 35, 65, 0.04), 0 4px 16px rgba(11, 35, 65, 0.06);
  --es-shadow-lg: 0 10px 30px rgba(11, 35, 65, 0.10);
  --es-radius: 14px;
  --es-radius-sm: 8px;
  --es-header-h: 72px;
}

/* ========== RESET / BASE ========== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--es-text);
  background: var(--es-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* lesson § 28 : header est position:sticky → pas de compensateur padding-top */
}

/* Safety net : kill tout padding-top fantôme sur body (cache browser, plugin, etc.) */
html body { padding-top: 0 !important; }

h1, h2, h3, h4, h5, h6 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  color: var(--es-navy);
  line-height: 1.2;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

p { margin: 0 0 1em; }

a {
  color: var(--es-navy);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--es-gold-hover); }

img { max-width: 100%; height: auto; display: block; }

/* ========== GP CRITICAL OVERRIDES (sans dépendance .one-container) ==========
   On évite les sélecteurs `.one-container` / `.separate-containers` qui sont des
   classes GP base : si l'utilisateur change de layout GP dans le customizer, nos
   overrides cassent. On utilise plutôt des classes WP-standard (.home, .single,
   .page, .page-template-*) qui sont stables. */

/* Background transparent — sur tous les wrappers GP qu'on hide ou customize */
html body .inside-article,
html body .comments-area,
html body .page-header,
html body .paging-navigation,
html body .inside-page-header { background-color: transparent !important; }

/* Padding du .site-content : SEULEMENT pages standard (pas single, pas home, pas templates).
   Sur les SINGLE, on laisse padding: 0 → les wraps internes (.es-guide-wrap, .es-single-standard)
   gèrent eux-mêmes leur padding. UN SEUL niveau de padding (lesson § 36 anti-double-padding).

   ⚠️ JAMAIS de sélecteur escaladé style `html body.one-container .site-content` !important :
   ça crée des collisions avec d'autres règles enfants. Préférer une classe simple. */
body.single-post .site-content { padding: 0; }
body.page:not(.home):not(.page-template-page-blog):not(.page-template-page-guides-archive) .site-content {
  padding: 40px 24px;
}
@media (max-width: 768px) {
  body.page:not(.home):not(.page-template-page-blog):not(.page-template-page-guides-archive) .site-content {
    padding: 16px 14px 32px;
  }
}

/* CRITICAL: GeneratePress applique display:flex; flex-direction:row sur .site-content
   pour gérer la sidebar. On force layout block/column sinon nos sections s'empilent
   horizontalement. */
html body .site-content {
  display: block !important;
  flex-direction: column !important;
}
html body .site-content > .content-area {
  display: block !important;
  width: 100% !important;
  float: none !important;
  margin: 0 !important;
}
html body .site-content > .widget-area { display: none !important; }

/* Sur la home : fullbleed */
body.home .site-content,
body.home main,
body.home article,
body.home .inside-article {
  padding: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}

/* Templates blog & archive : fullbleed (le hero gère son propre layout) */
body.page-template-page-blog .site-content,
body.page-template-page-guides-archive .site-content {
  padding: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}

/* Hide GP defaults */
.site-header, .site-footer { display: none; }

/* No sidebar partout */
.content-area { width: 100%; }
.widget-area { display: none; }

/* ========== FULLBLEED PATTERN (no width:100vw) ========== */
body.home .es-fullbleed { width: 100%; margin: 0; }
body.home .es-fullbleed-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px;
  box-sizing: border-box;
}

/* ========== SECTIONS GÉNÉRIQUES ========== */
.es-section {
  padding: 80px 24px;
}
.es-section-inner { max-width: 1200px; margin: 0 auto; }
.es-section--dark { background: var(--es-navy); color: var(--es-white); }
.es-section--dark h1, .es-section--dark h2, .es-section--dark h3 { color: var(--es-white); }
.es-section--bg { background: var(--es-bg); }

@media (max-width: 720px) {
  .es-section { padding: 48px 20px; }
  body.home .es-fullbleed-inner { padding: 40px 20px; }
}

/* ========== HEADER STICKY ========== */
.es-site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--es-white);
  border-bottom: 1px solid var(--es-border);
  height: var(--es-header-h);
}
.es-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  height: var(--es-header-h);
}
.es-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--es-navy);
}
.es-brand-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: var(--es-navy);
}
.es-brand-text { display: flex; flex-direction: column; line-height: 1; }
.es-brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--es-navy);
  letter-spacing: -0.01em;
}
.es-brand-tagline {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--es-gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 4px;
}

.es-nav { display: flex; align-items: center; gap: 4px; }
.es-nav a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--es-navy);
  transition: all .15s ease;
}
.es-nav a:hover { background: var(--es-bg); color: var(--es-gold-hover); }
.es-nav a.is-active {
  background: var(--es-gold-soft);
  color: var(--es-gold-hover);
  font-weight: 600;
}

.es-header-cta { white-space: nowrap; }

/* Defensive vs GP base CSS qui force tous les <button> en `color:#fff; bg:#55555e`
   (sélecteur tag → notre .es-burger gagne sur le default mais PAS sur :hover/:focus
   où GP a une spé. supérieure). Donc !important sur tous les états. */
.es-site-header button.es-burger {
  display: none;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--es-navy) !important;
  padding: 0;
}
.es-site-header button.es-burger:hover,
.es-site-header button.es-burger:focus {
  background: rgba(11, 35, 65, 0.06) !important;
  background-color: rgba(11, 35, 65, 0.06) !important;
  color: var(--es-navy) !important;
}
.es-burger svg { width: 24px; height: 24px; }

.es-mobile-nav {
  display: none;
  position: fixed;
  top: var(--es-header-h);
  left: 0;
  right: 0;
  background: var(--es-white);
  border-bottom: 1px solid var(--es-border);
  padding: 16px 20px 24px;
  box-shadow: var(--es-shadow-lg);
  z-index: 999;
}
.es-mobile-nav.is-open { display: block; }
.es-mobile-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--es-navy);
}
.es-mobile-nav a:hover, .es-mobile-nav a.is-active {
  background: var(--es-gold-soft);
  color: var(--es-gold-hover);
}
.es-mobile-nav .es-btn-primary {
  display: block;
  text-align: center;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .es-nav, .es-header-cta { display: none; }
  .es-site-header button.es-burger { display: inline-flex; }
}

/* ========== BOUTONS ========== */
.es-btn-primary,
.es-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .18s ease;
  white-space: nowrap;
}
/* Defensive : GP base force `a.button { color:#fff; bg:#55555e }`. Comme nos
   .es-btn-primary peuvent aussi avoir un état :hover GP-base, on protège explicitement. */
a.es-btn-primary,
.es-mobile-nav a.es-btn-primary {
  background: var(--es-gold) !important;
  background-color: var(--es-gold) !important;
  color: var(--es-navy) !important;
}
a.es-btn-primary:hover,
.es-mobile-nav a.es-btn-primary:hover {
  background: var(--es-navy) !important;
  background-color: var(--es-navy) !important;
  color: var(--es-white) !important;
}
.es-btn-secondary {
  background: transparent;
  color: var(--es-navy);
  border-color: var(--es-navy);
}
.es-btn-secondary:hover {
  background: var(--es-navy);
  color: var(--es-white);
}

/* ========== CARDS ========== */
.es-card {
  background: var(--es-card);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius);
  box-shadow: var(--es-shadow);
  overflow: hidden;
  transition: all .2s ease;
}
.es-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--es-shadow-lg);
  border-color: var(--es-gold);
}
.es-card-body { padding: 24px; }
.es-card-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--es-navy);
  margin: 0 0 8px;
}
.es-card-meta { color: var(--es-mute); font-size: 13px; }

/* ========== FOOTER ========== */
.es-site-footer {
  background: var(--es-navy);
  color: rgba(255,255,255,0.78);
  padding: 56px 24px 24px;
  margin-top: 0;
}
.es-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
}
.es-footer-col h4 {
  color: var(--es-white);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 16px;
}
.es-footer-col ul { list-style: none; padding: 0; margin: 0; }
.es-footer-col li { margin-bottom: 10px; }
.es-footer-col a {
  color: rgba(255,255,255,0.78);
  font-size: 14px;
  transition: color .15s;
}
.es-footer-col a:hover { color: var(--es-gold); }

.es-footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.es-footer-brand-icon { width: 40px; height: 40px; color: var(--es-gold); }
.es-footer-brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--es-white);
}
.es-footer-tagline {
  color: var(--es-gold);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.es-footer-desc { font-size: 14px; color: rgba(255,255,255,0.7); line-height: 1.6; }

.es-footer-bottom {
  max-width: 1200px;
  margin: 40px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.10);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.55);
}
.es-footer-bottom a { color: rgba(255,255,255,0.55); }
.es-footer-bottom a:hover { color: var(--es-gold); }
.es-footer-bottom-links { display: flex; gap: 18px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .es-footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .es-footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .es-footer-bottom { justify-content: flex-start; }
}

/* ========== UTILS ========== */
.es-text-center { text-align: center; }
.es-mt-0 { margin-top: 0; }
.es-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--es-gold);
  margin-bottom: 12px;
}

/* ========== ARTICLE / GUIDE SINGLE ========== */
body.es-guide-single .entry-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  color: var(--es-navy);
}
body.es-guide-single .entry-content {
  max-width: 760px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.75;
}
body.es-guide-single .entry-content h2 {
  margin-top: 2em;
  border-left: 4px solid var(--es-gold);
  padding-left: 14px;
}
body.es-guide-single .entry-content .bz-tool {
  margin: 32px 0;
  padding: 24px;
  background: var(--es-bg);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius);
}

/* ========== RESPONSIVE GENERAL ========== */
@media (max-width: 600px) {
  .es-header-inner { padding: 12px 16px; }
  .es-brand-name { font-size: 16px; }
  .es-brand-tagline { font-size: 10px; }
}

/* ========== ADMIN BAR WP : compenser le header sticky ========== */
/* Quand l'utilisateur est connecté, WP injecte html { margin-top: 32px } pour
   réserver la place de l'admin-bar. Le header sticky doit se caler à top:32px
   pour être collé sous l'admin-bar (sinon blanc visible au-dessus du header). */
body.admin-bar .es-site-header {
  top: 32px;
}
@media screen and (max-width: 782px) {
  body.admin-bar .es-site-header {
    top: 46px;
  }
}

/* Reset margin-top accidentels sur les wrappers de contenu (GP / WP par défaut). */
html body #page,
html body #content,
html body main,
html body article { margin-top: 0 !important; }

/* Pages avec template archive : pas de margin-top supplémentaire. */
body.page-template-page-blog main,
body.blog main,
body.archive main { margin-top: 0 !important; }
