/*
Theme Name: Eco-Impact
Theme URI: https://eco-impact.be
Author: Octave Agency
Author URI: https://octave-agency.be
Description: Thème éditorial naturel & organique pour blog environnement, optimisé SEO. Léger, accessible et entièrement personnalisable.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: eco-impact
Tags: blog, two-columns, custom-menu, featured-images, editor-style, translation-ready
*/

/* =========================================================
   ECO-IMPACT — DESIGN SYSTEM
   Tout est piloté par des variables CSS : pour repersonnaliser
   le thème, modifie surtout le bloc :root ci-dessous.
   ========================================================= */

:root {
  /* Couleurs (cf. DA) */
  --c-forest:      #1F4D2E;
  --c-forest-dark: #143620;
  --c-sage:        #7C9A78;
  --c-terra:       #C66A45;
  --c-clay:        #E4B58F;
  --c-sand:        #F6F2E9;
  --c-cream:       #FBF8F1;
  --c-ink:         #2B2722;
  --c-bark:        #5C564E;
  --c-line:        #E5DECF;
  --c-ivory:       #FFFEFB;

  /* Accents par catégorie */
  --cat-climat:  #2F6E8F;
  --cat-nature:  #3E7D4F;
  --cat-vie:     #C66A45;
  --cat-societe: #8A6FB0;

  /* Typo */
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Échelle */
  --fs-h1: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  --fs-h2: clamp(1.6rem, 1.2rem + 1.6vw, 2.125rem);
  --fs-h3: 1.5rem;
  --fs-body: 1.125rem;
  --fs-small: 0.9375rem;

  /* Layout */
  --maxw: 1180px;
  --maxw-text: 720px;
  --radius: 16px;
  --radius-sm: 10px;
  --gap: clamp(1rem, 0.6rem + 1.6vw, 2rem);
  --shadow: 0 6px 20px rgba(31,77,46,.08);
  --shadow-lg: 0 14px 40px rgba(31,77,46,.12);
  --header-h: 76px;
}

/* ---------- Reset léger ---------- */
*,*::before,*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--c-ink);
  background: var(--c-sand);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-forest); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--c-terra); }
h1,h2,h3,h4 { font-family: var(--font-head); color: var(--c-forest-dark); line-height: 1.2; font-weight: 600; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0 0 1.2em; }

/* ---------- Accessibilité ---------- */
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px); clip-path: inset(50%); word-wrap: normal !important;
}
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--c-forest); color: #fff;
  padding: 12px 18px; z-index: 1000; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--c-terra); outline-offset: 2px; }

/* ---------- Conteneurs ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.section { padding-block: clamp(2.5rem, 5vw, 4.5rem); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; font-family: var(--font-body);
  font-weight: 600; font-size: 1rem; line-height: 1; padding: .85rem 1.4rem;
  border-radius: 999px; border: 2px solid transparent; cursor: pointer;
  text-decoration: none; transition: transform .15s ease, background .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--c-terra); color: #fff; }
.btn--primary:hover { background: #b25a37; color: #fff; }
.btn--ghost { background: transparent; color: var(--c-forest); border-color: var(--c-forest); }
.btn--ghost:hover { background: var(--c-forest); color: #fff; }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 100; background: var(--c-ivory);
  border-bottom: 1px solid var(--c-line); backdrop-filter: saturate(1.1);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: var(--header-h);
}
.site-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.site-brand img { max-height: 44px; width: auto; }
/* Logo personnalisé WordPress (image) — contraint à la hauteur du header */
.custom-logo-link { display: inline-flex; align-items: center; line-height: 0; text-decoration: none; }
.custom-logo { max-height: 52px; width: auto; height: auto; }
.site-brand__text { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; color: var(--c-forest-dark); }
.site-brand__text span { color: var(--c-terra); }

.main-nav ul { list-style: none; display: flex; gap: 1.4rem; margin: 0; padding: 0; }
.main-nav a { font-weight: 500; text-decoration: none; color: var(--c-ink); padding: .4rem 0; position: relative; }
.main-nav a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0;
  background: var(--c-terra); transition: width .2s ease;
}
.main-nav a:hover, .main-nav .current-menu-item > a { color: var(--c-forest); }
.main-nav a:hover::after, .main-nav .current-menu-item > a::after { width: 100%; }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: .5rem; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 24px; height: 2px; background: var(--c-forest-dark); position: relative; transition: .2s;
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -7px; } .nav-toggle span::after { top: 7px; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .main-nav { position: absolute; inset: var(--header-h) 0 auto 0; background: var(--c-ivory);
    border-bottom: 1px solid var(--c-line); padding: 1rem clamp(1rem,4vw,2rem);
    transform: translateY(-120%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .main-nav[data-open="true"] { transform: translateY(0); }
  .main-nav ul { flex-direction: column; gap: .25rem; }
  .main-nav a { display: block; padding: .7rem 0; border-bottom: 1px solid var(--c-line); }
}

/* =========================================================
   HERO (front-page)
   ========================================================= */
.hero { position: relative; background: var(--c-forest); color: var(--c-cream); overflow: hidden; }
.hero__inner { position: relative; z-index: 2; padding-block: clamp(3rem, 7vw, 5.5rem); max-width: 760px; }
.hero h1 { color: #fff; margin: 0 0 1rem; }
.hero p { color: rgba(255,255,255,.88); font-size: 1.25rem; margin-bottom: 1.6rem; }
.hero__leaf { position: absolute; right: -60px; bottom: -60px; width: 360px; opacity: .12; z-index: 1; }
.wave { display: block; width: 100%; height: auto; margin-top: -1px; }
.wave path { fill: var(--c-sand); }

/* =========================================================
   CARTES D'ARTICLES
   ========================================================= */
.posts-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); }
.card {
  background: var(--c-cream); border: 1px solid var(--c-line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card__media { aspect-ratio: 16/10; overflow: hidden; background: var(--c-line); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card__media img { transform: scale(1.05); }
.card__body { padding: 1.25rem 1.4rem 1.5rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.card__title { font-size: 1.35rem; margin: 0; }
.card__title a { text-decoration: none; color: var(--c-forest-dark); }
.card__title a:hover { color: var(--c-terra); }
.card__excerpt { color: var(--c-bark); font-size: 1rem; margin: 0; }
.card__meta { margin-top: auto; font-size: var(--fs-small); color: var(--c-bark); display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

/* Badge catégorie */
.cat-badge {
  display: inline-block; font-size: .8rem; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; padding: .3rem .7rem; border-radius: 999px; text-decoration: none;
  color: #fff; background: var(--c-sage); line-height: 1;
}
.cat-badge:hover { color: #fff; filter: brightness(.95); }
.cat-climat  { background: var(--cat-climat); }
.cat-nature  { background: var(--cat-nature); }
.cat-vie     { background: var(--cat-vie); }
.cat-societe { background: var(--cat-societe); }

/* =========================================================
   PAGE / ARTICLE
   ========================================================= */
.layout { display: grid; gap: clamp(2rem,4vw,3.5rem); grid-template-columns: minmax(0,1fr) 320px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

.entry { background: var(--c-cream); border: 1px solid var(--c-line); border-radius: var(--radius); padding: clamp(1.5rem, 4vw, 3rem); }
.entry-header { margin-bottom: 1.5rem; }
.entry-title { margin: .4rem 0 .8rem; }
.entry-meta { font-size: var(--fs-small); color: var(--c-bark); display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.entry-thumb { border-radius: var(--radius); overflow: hidden; margin: 1.5rem 0; }

/* Contenu rédactionnel — confort de lecture (SEO : temps passé) */
.entry-content { max-width: var(--maxw-text); }
.entry-content > * { margin-left: auto; margin-right: auto; }
.entry-content p, .entry-content ul, .entry-content ol { font-size: var(--fs-body); }
.entry-content h2 { margin: 2rem 0 .8rem; }
.entry-content h3 { margin: 1.6rem 0 .6rem; }
.entry-content img { border-radius: var(--radius-sm); }
.entry-content blockquote {
  margin: 1.6rem 0; padding: 1rem 1.4rem; border-left: 4px solid var(--c-terra);
  background: var(--c-sand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-style: italic;
}
.entry-content a { font-weight: 500; }
.entry-content ul, .entry-content ol { padding-left: 1.3rem; }
.entry-content li { margin-bottom: .4rem; }


/* =========================================================
   FIL D'ARIANE (SEO)
   ========================================================= */
.breadcrumbs { font-size: var(--fs-small); color: var(--c-bark); margin: 1rem 0 1.4rem; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 .4rem; color: var(--c-sage); }

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar .widget { background: var(--c-cream); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.5rem; }
.sidebar .widget-title { font-size: 1.15rem; margin: 0 0 1rem; padding-bottom: .6rem; border-bottom: 2px solid var(--c-line); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: .4rem 0; border-bottom: 1px dashed var(--c-line); }
.sidebar li:last-child { border-bottom: 0; }
.sidebar a { text-decoration: none; }
.sidebar a:hover { text-decoration: underline; }

/* Encart d'appel optionnel */
.cta-box { background: var(--c-forest); color: #fff; border: 0; }
.cta-box .widget-title, .cta-box h3 { color: #fff; border-color: rgba(255,255,255,.2); }
.cta-box p { color: rgba(255,255,255,.85); }

/* =========================================================
   CATEGORY HERO
   ========================================================= */
.cat-hero { background: var(--c-cream); border-bottom: 1px solid var(--c-line); padding-block: clamp(2rem,4vw,3rem); }
.cat-hero h1 { margin: .3rem 0; }
.cat-hero p { color: var(--c-bark); max-width: 680px; margin: 0; }

/* Section catégories en home */
.cat-tiles { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); }
.cat-tile {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 180px; padding: 1.4rem; border-radius: var(--radius); color: #fff;
  text-decoration: none; overflow: hidden; background: var(--c-forest);
  transition: transform .2s ease, box-shadow .2s ease;
}
.cat-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: #fff; }
.cat-tile h3 { color: #fff; margin: 0 0 .2rem; }
.cat-tile span { font-size: var(--fs-small); opacity: .9; }
.cat-tile--climat  { background: linear-gradient(160deg,#2F6E8F,#1c4256); }
.cat-tile--nature  { background: linear-gradient(160deg,#3E7D4F,#244c30); }
.cat-tile--vie     { background: linear-gradient(160deg,#C66A45,#8c4528); }
.cat-tile--societe { background: linear-gradient(160deg,#8A6FB0,#5a487a); }

/* =========================================================
   PAGINATION
   ========================================================= */
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; margin-top: 2.5rem; }
.pagination .page-numbers {
  display: inline-flex; min-width: 42px; height: 42px; align-items: center; justify-content: center;
  padding: 0 .6rem; border-radius: var(--radius-sm); border: 1px solid var(--c-line);
  background: var(--c-cream); text-decoration: none; color: var(--c-ink);
}
.pagination .page-numbers.current { background: var(--c-forest); color: #fff; border-color: var(--c-forest); }
.pagination .page-numbers:hover { border-color: var(--c-terra); color: var(--c-terra); }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer { background: var(--c-forest-dark); color: rgba(255,255,255,.82); margin-top: 3rem; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { color: var(--c-clay); text-decoration: underline; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1.4fr repeat(3, 1fr); padding-block: 3rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; font-size: 1.05rem; margin: 0 0 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .5rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-block: 1.2rem; font-size: var(--fs-small); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem; }

/* =========================================================
   UTILITAIRES
   ========================================================= */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}


/* =========================================================
   COMPOSANTS UTILES (ajouts)
   ========================================================= */

/* Barre de progression de lecture (articles) */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 4px; width: 0;
  background: linear-gradient(90deg, var(--c-terra), var(--c-sage));
  z-index: 200; transition: width .1s linear;
}

/* Sommaire (table des matières) auto-généré */
.toc {
  background: var(--c-sand); border: 1px solid var(--c-line); border-left: 4px solid var(--c-terra);
  border-radius: var(--radius-sm); padding: 1.1rem 1.3rem; margin: 0 0 1.8rem;
}
.toc__title { font-family: var(--font-head); font-weight: 600; color: var(--c-forest-dark); margin: 0 0 .6rem; font-size: 1.05rem; }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li { margin: .25rem 0; }
.toc li.toc--h3 { margin-left: 1rem; list-style: circle; font-size: .95rem; }
.toc a { text-decoration: none; color: var(--c-forest); }
.toc a:hover { color: var(--c-terra); text-decoration: underline; }
.entry-content :is(h2,h3) { scroll-margin-top: calc(var(--header-h) + 16px); }

/* Boutons de partage */
.share { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 2rem 0 .5rem; padding-top: 1.4rem; border-top: 1px solid var(--c-line); }
.share__label { font-weight: 600; color: var(--c-bark); font-size: var(--fs-small); }
.share a, .share button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  height: 40px; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--c-line);
  background: var(--c-cream); color: var(--c-forest); text-decoration: none; cursor: pointer;
  font: inherit; font-size: var(--fs-small); font-weight: 500; transition: .15s;
}
.share a:hover, .share button:hover { border-color: var(--c-terra); color: var(--c-terra); transform: translateY(-2px); }
.share svg { width: 18px; height: 18px; fill: currentColor; }

/* Encart auteur (E-E-A-T / confiance SEO) */
.author-box {
  display: flex; gap: 1rem; align-items: flex-start; margin-top: 2rem;
  background: var(--c-sand); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 1.3rem 1.4rem;
}
.author-box__avatar { border-radius: 50%; overflow: hidden; flex: 0 0 64px; width: 64px; height: 64px; }
.author-box__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-box__name { font-family: var(--font-head); font-weight: 600; color: var(--c-forest-dark); margin: 0 0 .2rem; font-size: 1.1rem; }
.author-box__bio { margin: 0; color: var(--c-bark); font-size: var(--fs-small); }

/* Bouton retour en haut */
.back-to-top {
  position: fixed; right: 20px; bottom: 20px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--c-forest); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center;
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .2s, transform .2s, visibility .2s; z-index: 150;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--c-terra); }
.back-to-top svg { width: 22px; height: 22px; fill: #fff; }

/* =========================================================
   HOME — intro, à la une, sections par catégorie (ajouts)
   ========================================================= */

/* Encart éditorial d'intro */
.home-intro { text-align: center; max-width: 760px; margin-inline: auto; }
.home-intro__kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 600; color: var(--c-terra); margin: 0 0 .6rem; }
.home-intro p { color: var(--c-bark); font-size: 1.15rem; }

/* Bandeau À la une (1 grand + 3 secondaires) */
.featured-grid { display: grid; gap: var(--gap); grid-template-columns: 1.5fr 1fr; align-items: stretch; }
@media (max-width: 860px) { .featured-grid { grid-template-columns: 1fr; } }
.featured-main { margin: 0; }
.featured-main .card__media { aspect-ratio: 16/10; }
.featured-main .card__title { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); }
.featured-side { display: grid; gap: 1rem; align-content: start; }
.mini-post { display: grid; grid-template-columns: 104px 1fr; gap: .9rem; background: var(--c-cream); border: 1px solid var(--c-line); border-radius: var(--radius-sm); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.mini-post:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.mini-post__thumb { background: var(--c-sage); overflow: hidden; }
.mini-post__thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-post__body { padding: .7rem .9rem .7rem 0; display: flex; flex-direction: column; gap: .25rem; justify-content: center; }
.mini-post__title { font-family: var(--font-head); font-weight: 600; font-size: 1.02rem; line-height: 1.25; margin: 0; }
.mini-post__title a { color: var(--c-forest-dark); text-decoration: none; }
.mini-post__title a:hover { color: var(--c-terra); }
.mini-post__meta { font-size: .82rem; color: var(--c-bark); }

/* En-tête de section catégorie (pastille couleur) */
.cat-head h2 { display: inline-flex; align-items: center; gap: .55rem; }
.cat-dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: var(--c-sage); }

/* Date de mise à jour (article) */
.entry-updated { font-size: var(--fs-small); color: var(--c-bark); margin-top: .35rem; display: inline-flex; align-items: center; gap: .35rem; }
.entry-updated::before { content: "↻"; color: var(--c-terra); font-weight: 700; }

/* En-tête de catégorie enrichi */
.cat-hero--rich { --cat-accent: var(--c-forest); background: linear-gradient(135deg, var(--cat-accent), var(--c-forest-dark)); color: #fff; border-bottom: 0; }
.cat-hero--rich h1 { color: #fff; }
.cat-hero--rich p { color: rgba(255,255,255,.9); max-width: 720px; }
.cat-hero--rich .breadcrumbs, .cat-hero--rich .breadcrumbs a { color: rgba(255,255,255,.85); }
.cat-hero--rich .breadcrumbs .sep { color: rgba(255,255,255,.55); }
.cat-hero--rich .cat-hero__count { display: inline-block; margin-top: .6rem; font-size: var(--fs-small); background: rgba(255,255,255,.18); padding: .25rem .7rem; border-radius: 999px; }

/* Sélecteur de langue (dans le menu) */
.main-nav { display: flex; align-items: center; gap: 1.4rem; }
.lang-switcher { list-style: none; display: flex; align-items: center; gap: .2rem; margin: 0; padding: 0 0 0 1rem; border-left: 1px solid var(--c-line); }
.lang-switcher li { margin: 0; padding: 0; }
.lang-switcher a { display: inline-block; text-transform: uppercase; font-size: .8rem; font-weight: 600; letter-spacing: .03em; color: var(--c-bark); text-decoration: none; padding: .25rem .45rem; border-radius: 6px; }
.lang-switcher a::after { display: none; }
.lang-switcher a:hover { color: var(--c-terra); background: var(--c-sand); }
.lang-switcher .current-lang > a, .lang-switcher .current-lang { color: var(--c-forest); }
@media (max-width: 860px) {
  .main-nav { display: block; }
  .lang-switcher { padding: .6rem 0 0; border-left: 0; border-top: 1px solid var(--c-line); margin-top: .4rem; }
}