/* =========================================================
   Ecoptimiz - blog
   Se charge APRÈS css/style.css et n'en redéfinit rien :
   mêmes variables, mêmes rayons, même typographie.
   ========================================================= */

/* ---------- en-tête du blog ---------- */
.blog-hero {
  padding-top: clamp(2.5rem, 4vw, 4rem);
  padding-bottom: clamp(2rem, 3vw, 3rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(70% 120% at 15% 0%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.blog-hero-inner { max-width: 62ch; }
.blog-hero h1 { margin-top: 0.9rem; text-wrap: balance; }
.blog-hero .lede { margin-top: 1.2rem; }

.blog-liste { padding-top: clamp(2.5rem, 4vw, 3.5rem); }

/* ---------- barre de recherche et filtres ---------- */
.blog-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 2rem;
}
@media (min-width: 900px) {
  .blog-toolbar { flex-direction: row; align-items: center; justify-content: space-between; gap: 2rem; }
}

.blog-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  width: 100%;
  max-width: 22rem;
}
.blog-search svg {
  position: absolute;
  left: 1rem;
  width: 17px; height: 17px;
  color: var(--text-faint);
  pointer-events: none;
}
.blog-search input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.7rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  transition: border-color 0.25s var(--ease);
}
.blog-search input::placeholder { color: var(--text-faint); }
.blog-search input:focus { outline: none; border-color: var(--accent); }
.blog-search input:focus-visible { outline: none; }
.blog-search input::-webkit-search-cancel-button { filter: invert(0.7); cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
button.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
/* Puce d'affichage seule, jamais cliquable : thème d'un article. */
.chip--statique {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-bright);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.chip--epingle {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.blog-compteur {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1.2rem;
}

/* ---------- grille d'articles ---------- */
.post-grid {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 720px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }
.post-grid--suite { margin-top: 1.8rem; }
@media (min-width: 1080px) { .post-grid--suite { grid-template-columns: repeat(2, 1fr); } }

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 100%;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.post-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.post-card:focus-within { border-color: var(--accent); }

.post-card-lien { display: flex; flex-direction: column; height: 100%; }
.post-card-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-alt); }
.post-card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.post-card:hover .post-card-media img { transform: scale(1.04); }

.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.6rem 1.6rem 1.7rem;
  flex: 1;
}
.post-card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.post-card-titre {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
  text-wrap: balance;
}
.post-card-chapo {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-faint);
}
.post-meta .sep, .article-meta .sep { color: var(--border-strong); }

.post-card-suite {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-bright);
}
.post-card-suite svg { width: 1em; height: 1em; transition: transform 0.3s var(--ease); }
.post-card:hover .post-card-suite svg { transform: translateX(4px); }

/* Carte à la une : pleine largeur, image à gauche à partir du bureau. */
@media (min-width: 720px) {
  .post-card--vedette { grid-column: 1 / -1; }
  .post-card--vedette .post-card-lien { flex-direction: row; }
  /* Ratio imposé : sans lui, une photo en portrait étirerait la carte
     sur toute sa hauteur naturelle. */
  .post-card--vedette .post-card-media { flex: 0 0 45%; aspect-ratio: 4 / 3; }
  .post-card--vedette .post-card-body { padding: 2.2rem 2.2rem 2.3rem; justify-content: center; }
  .post-card--vedette .post-card-titre { font-size: clamp(1.4rem, 1.5vw + 1rem, 1.9rem); }
  .post-card--vedette .post-card-chapo { font-size: 1rem; max-width: 56ch; }
}

/* Apparition des cartes injectées par le script. */
.post-card--entree {
  opacity: 0;
  animation: post-in 0.55s var(--ease) forwards;
}
@keyframes post-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- état vide et messages ---------- */
.blog-empty {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: clamp(1.8rem, 3vw, 2.6rem);
  display: grid;
  gap: 1rem;
  justify-items: start;
  max-width: 62ch;
}
.blog-empty-titre { font-size: 1.25rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.blog-empty p { font-size: 0.98rem; }
.blog-empty a:not(.btn) { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.blog-empty .btn { margin-top: 0.4rem; }

/* ---------- barre de progression de lecture ---------- */
.lecture-progress {
  position: sticky;
  top: var(--nav-h);
  z-index: 48;
  height: 2px;
  background: transparent;
}
.lecture-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---------- en-tête d'article ---------- */
.article-head {
  padding-top: clamp(2rem, 3.5vw, 3.2rem);
  padding-bottom: clamp(1.6rem, 2.5vw, 2.4rem);
}
.fil {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 1.6rem;
}
.fil a { transition: color 0.2s var(--ease); }
.fil a:hover { color: var(--accent-bright); }

.article-head .chip { margin-bottom: 1rem; }
.article-head h1 {
  font-size: clamp(1.9rem, 2.9vw + 1rem, 3.1rem);
  max-width: 22ch;
  text-wrap: balance;
}
.article-head .lede { margin-top: 1.2rem; max-width: 62ch; }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.6rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-faint);
}

.article-couverture {
  margin-bottom: clamp(2rem, 3vw, 3rem);
}
.article-couverture img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* ---------- mise en page de l'article ---------- */
.article-layout {
  display: grid;
  gap: 2.5rem;
  align-items: start;
}
@media (min-width: 1000px) {
  .article-layout { grid-template-columns: 15rem minmax(0, 1fr); gap: 4rem; }
  .article-aside { position: sticky; top: calc(var(--nav-h) + 2rem); }
}

.toc {
  border-left: 2px solid var(--border-strong);
  padding-left: 1.1rem;
}
.toc-titre {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
}
.toc ol { display: grid; gap: 0.6rem; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: block;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-faint);
  transition: color 0.2s var(--ease);
}
.toc a::before {
  content: counter(toc, decimal-leading-zero) '. ';
  color: var(--accent);
  font-size: 0.78rem;
}
.toc a:hover, .toc a.is-active { color: var(--text); }

.partage { margin-top: 2rem; }
.partage-row { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.partage-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.partage-btn svg { width: 16px; height: 16px; }
.partage-btn:hover { color: var(--accent-bright); border-color: var(--accent); }
.partage-retour { margin-top: 0.7rem; font-size: 0.8rem; color: var(--accent-bright); }

/* ---------- corps de l'article ---------- */
.prose {
  max-width: 70ch;
  font-size: 1.05rem;
  line-height: 1.78;
}
.prose > * + * { margin-top: 1.35rem; }
.prose p { color: var(--text-muted); }
.prose a { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--text); }
.prose strong { color: var(--text); font-weight: 600; }

.prose h2 {
  font-size: clamp(1.45rem, 1.2vw + 1rem, 1.8rem);
  margin-top: 3rem;
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}
.prose h2 + * { margin-top: 1rem; }
.prose h3 {
  font-size: 1.18rem;
  margin-top: 2.2rem;
  color: var(--text);
}
.prose h3 + * { margin-top: 0.8rem; }

.prose-liste { display: grid; gap: 0.75rem; }
.prose-liste li {
  position: relative;
  padding-left: 1.7rem;
  color: var(--text-muted);
  line-height: 1.65;
}
.prose-liste li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.62em;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
}
.prose-liste--num { counter-reset: pnum; }
.prose-liste--num li { counter-increment: pnum; padding-left: 2.2rem; }
.prose-liste--num li::before {
  content: counter(pnum, decimal-leading-zero);
  width: auto; height: auto;
  top: 0;
  background: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.prose-citation {
  border-left: 3px solid var(--accent);
  padding: 0.3rem 0 0.3rem 1.6rem;
  margin-block: 2.2rem;
}
.prose-citation p {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--text);
  font-style: italic;
}
.prose-citation cite {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.85rem;
  font-style: normal;
  color: var(--text-faint);
}

.prose-encadre {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 1.5rem 1.6rem;
  margin-block: 2.2rem;
}
.prose-encadre-titre {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text) !important;
  margin-bottom: 0.5rem;
}
.prose-encadre p { font-size: 0.98rem; }

.prose-figure { margin-block: 2.2rem; }
.prose-figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.prose-figure figcaption {
  margin-top: 0.7rem;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.prose-cta {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 1.6rem 1.7rem;
  margin-block: 2.5rem;
  display: grid;
  gap: 1.1rem;
  justify-items: start;
}
.prose-cta p { color: var(--text); font-size: 1.1rem; line-height: 1.45; }

/* ---------- pied d'article ---------- */
.article-cta {
  margin-top: clamp(3rem, 5vw, 4.5rem);
  padding: 1.8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  align-items: flex-start;
}
@media (min-width: 820px) {
  .article-cta { flex-direction: row; align-items: center; justify-content: space-between; gap: 2.5rem; padding: 2rem 2.2rem; }
}
.article-cta-titre { font-size: 1.2rem; font-weight: 600; color: var(--text); margin-bottom: 0.35rem; }
.article-cta p { font-size: 0.98rem; max-width: 56ch; }
.article-cta .btn { flex: none; }

.article-suite {
  padding-top: clamp(3rem, 5vw, 4.5rem);
  padding-bottom: clamp(3rem, 5vw, 5rem);
}
.suite-titre {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- contenu écrit dans WordPress ----------
   L'éditeur produit des balises nues : listes, citations, images, tableaux.
   Elles reçoivent ici le même traitement que les blocs maison. */
.prose ul:not(.prose-liste),
.prose ol:not(.prose-liste) { display: grid; gap: 0.75rem; padding-left: 0; }
.prose ul:not(.prose-liste) li,
.prose ol:not(.prose-liste) li {
  position: relative;
  padding-left: 1.7rem;
  color: var(--text-muted);
  line-height: 1.65;
}
.prose ul:not(.prose-liste) li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.62em;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
}
.prose ol:not(.prose-liste) { counter-reset: wpnum; }
.prose ol:not(.prose-liste) li { counter-increment: wpnum; padding-left: 2.2rem; }
.prose ol:not(.prose-liste) li::before {
  content: counter(wpnum, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}
/* Listes imbriquées : on repart d'un cran, sans réinitialiser le compteur parent. */
.prose li > ul, .prose li > ol { margin-top: 0.6rem; }

.prose h4 { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-top: 1.8rem; }

.prose blockquote:not(.prose-citation) {
  border-left: 3px solid var(--accent);
  padding: 0.3rem 0 0.3rem 1.6rem;
  margin-block: 2.2rem;
}
.prose blockquote:not(.prose-citation) p {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--text);
  font-style: italic;
}
.prose blockquote cite { display: block; margin-top: 0.7rem; font-size: 0.85rem; font-style: normal; color: var(--text-faint); }

.prose img { border-radius: var(--radius); height: auto; }
.prose figure:not(.prose-figure) { margin-block: 2.2rem; }
.prose figcaption { margin-top: 0.7rem; font-size: 0.82rem; color: var(--text-faint); }
.prose .wp-block-image { margin-block: 2.2rem; }
.prose .alignleft, .prose .alignright, .prose .aligncenter { margin-inline: auto; }

.prose hr {
  border: none;
  border-top: 1px solid var(--border-strong);
  margin-block: 2.5rem;
}

/* Un tableau large défile dans son cadre plutôt que d'élargir la page. */
.prose .wp-block-table, .prose figure.wp-block-table { overflow-x: auto; }
.prose table {
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.prose th, .prose td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text-muted);
}
.prose th { color: var(--text); font-weight: 600; background: var(--surface); }

.prose code {
  font-size: 0.88em;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--accent-bright);
}
.prose pre {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; color: var(--text-muted); }

.prose iframe, .prose video { max-width: 100%; border-radius: var(--radius); }
.prose .wp-block-embed__wrapper { position: relative; }

/* ---------- pagination du blog ----------
   Volontairement pas la pagination de WordPress : la sienne enveloppe ses
   liens dans une classe « nav-links », déjà prise par le menu du site. */
.pagination-blog { margin-top: 3rem; }
.pagination-liste { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.pagination-liste .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.pagination-liste a.page-numbers:hover { color: var(--text); border-color: var(--accent); }
.pagination-liste .page-numbers.current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
}
.pagination-liste .page-numbers.dots { border-color: transparent; }

/* ---------- mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  .post-card--entree { opacity: 1; animation: none; }
  .post-card:hover { transform: none; }
  .post-card:hover .post-card-media img { transform: none; }
  .lecture-progress { display: none; }
}
