/* ==========================================================================
   meilleurecreatine.fr — Labo mineral
   Archivo (titres) / Newsreader (corps) / Geist Mono (donnees chiffrees)
   ========================================================================== */

:root {
  /* Palette */
  --c-fond: #F4F5F1;
  --c-encre: #15171C;
  --c-cobalt: #2843D6;
  --c-cobalt-sombre: #1C31A6;
  --c-citron: #D9F24F;
  --c-brume: #DCE3EA;
  --c-brume-sombre: #B9C5D0;
  --c-gris: #5A6472;

  /* Typographie */
  --f-titre: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --f-corps: 'Newsreader', Georgia, 'Times New Roman', serif;
  --f-mono: 'Geist Mono', 'SFMono-Regular', Consolas, monospace;

  /* Echelle modulaire (1.25) */
  --t-xs: 0.8rem;
  --t-s: 0.9375rem;
  --t-base: 1.0625rem;
  --t-m: 1.25rem;
  --t-l: 1.5625rem;
  --t-xl: 1.953rem;
  --t-2xl: 2.441rem;
  --t-3xl: 3.052rem;
  --t-4xl: 3.815rem;

  /* Mesures */
  --measure-article: 840px;
  --measure-large: 1240px;
  --gouttiere: 1.5rem;

  /* Rythme */
  --esp-section: 5.5rem;

  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--c-fond);
  color: var(--c-encre);
  font-family: var(--f-corps);
  font-size: var(--t-base);
  line-height: 1.68;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/* --- Reset images (anti-distorsion reseau) --- */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Titres --- */
h1, h2, h3, h4 {
  font-family: var(--f-titre);
  font-weight: 600;
  font-stretch: 115%;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 5.2vw, var(--t-4xl)); font-weight: 700; font-stretch: 120%; letter-spacing: -0.028em; }
h2 { font-size: clamp(1.6rem, 3.4vw, var(--t-2xl)); margin-top: 2.4em; }
h3 { font-size: var(--t-l); margin-top: 1.9em; font-stretch: 110%; }
h4 { font-size: var(--t-m); margin-top: 1.6em; font-stretch: 108%; }

p { margin: 0 0 1.2em; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 650; }

a {
  color: var(--c-cobalt);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--c-cobalt) 42%, transparent);
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}
a:hover { color: var(--c-cobalt-sombre); text-decoration-color: currentColor; }

:focus-visible {
  outline: 3px solid var(--c-cobalt);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Conteneurs --- */
.contenu {
  width: 100%;
  max-width: var(--measure-large);
  margin-inline: auto;
  padding-inline: var(--gouttiere);
}

.contenu-article {
  width: 100%;
  max-width: var(--measure-article);
  margin-inline: auto;
  padding-inline: var(--gouttiere);
}

.section { padding-block: var(--esp-section); }
.section--brume { background: var(--c-brume); }
.section--encre { background: var(--c-encre); color: var(--c-fond); }
.section--encre h2,
.section--encre h3 { color: var(--c-fond); }
.section--encre a:not(.bouton) { color: var(--c-citron); }
.section--encre .bouton--primaire { color: var(--c-encre); }
/* Le pied suit immediatement une section sombre : pas de double marge.
   Le footer est hors du <main>, donc on cible via :has() sur le main. */
main:has(> .section--encre:last-child) + .pied { margin-top: 0; }

/* --- Wrappers images anti-distorsion --- */
.img-hero,
.img-card,
.img-body,
.img-portrait {
  overflow: hidden;
  background: var(--c-brume);
}
.img-hero { aspect-ratio: 3 / 2; }
.img-card { aspect-ratio: 3 / 2; }
.img-body { aspect-ratio: 3 / 2; }
.img-portrait { aspect-ratio: 1 / 1; }

.img-hero img,
.img-card img,
.img-body img,
.img-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* --- Figures et legendes --- */
figure {
  margin: 2.4rem 0;
}
figure figcaption,
.figure-legende {
  display: block;
  position: static;
  margin-top: 0.65rem;
  font-family: var(--f-titre);
  font-size: var(--t-s);
  font-stretch: 100%;
  line-height: 1.45;
  color: var(--c-gris);
  border-left: 2px solid var(--c-cobalt);
  padding-left: 0.75rem;
}

/* --- En-tete --- */
.entete {
  background: var(--c-encre);
  color: var(--c-fond);
  position: sticky;
  top: 0;
  z-index: 40;
}
.entete__interieur {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}
.entete__marque {
  font-family: var(--f-titre);
  font-weight: 700;
  font-stretch: 122%;
  font-size: var(--t-m);
  letter-spacing: -0.03em;
  color: var(--c-fond);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.entete__marque:hover { color: var(--c-fond); }
.entete__marque svg { width: 26px; height: 26px; flex: none; }

.nav { display: flex; }
.nav__liste {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__lien {
  display: block;
  padding: 0.45rem 0.7rem;
  font-family: var(--f-titre);
  font-size: var(--t-s);
  font-stretch: 104%;
  font-weight: 500;
  color: var(--c-brume);
  text-decoration: none;
  border-radius: 3px;
}
.nav__lien:hover,
.nav__lien[aria-current='page'] {
  color: var(--c-encre);
  background: var(--c-citron);
}

.nav__bascule {
  display: none;
  background: none;
  border: 1px solid var(--c-gris);
  color: var(--c-fond);
  font-family: var(--f-titre);
  font-size: var(--t-s);
  padding: 0.4rem 0.7rem;
  border-radius: 3px;
  cursor: pointer;
}

@media (max-width: 920px) {
  .nav__bascule { display: block; }
  .nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: var(--c-encre);
    border-top: 1px solid #2A2E36;
    padding: 0.75rem var(--gouttiere) 1.25rem;
  }
  .nav[hidden] { display: none; }
  .nav__liste { flex-direction: column; gap: 0.1rem; }
  .nav__lien { padding: 0.6rem 0.5rem; font-size: var(--t-base); }
}

/* --- Hero --- */
.hero { background: var(--c-encre); color: var(--c-fond); }
.hero__grille {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
}
.hero__texte {
  padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1.5rem, 4vw, 3.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero__titre {
  color: var(--c-fond);
  margin-bottom: 1rem;
}
.hero__chapo {
  font-size: clamp(1.05rem, 1.6vw, var(--t-m));
  line-height: 1.6;
  color: var(--c-brume);
  max-width: 34ch;
  margin-bottom: 1.8rem;
}
.hero__media { position: relative; min-height: 340px; }
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

@media (max-width: 860px) {
  .hero__grille { grid-template-columns: 1fr; }
  .hero__media { min-height: 260px; order: -1; aspect-ratio: 3 / 2; }
}

/* Hero interne (pages piliers) */
.hero-page { background: var(--c-encre); color: var(--c-fond); }
.hero-page__media { aspect-ratio: 24 / 9; overflow: hidden; }
.hero-page__media img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hero-page__texte { padding-block: clamp(2.2rem, 4vw, 3.4rem); }
.hero-page__titre { color: var(--c-fond); max-width: 24ch; }
.hero-page__chapo { color: var(--c-brume); max-width: 62ch; font-size: var(--t-m); margin-bottom: 0; }

@media (max-width: 760px) {
  .hero-page__media { aspect-ratio: 3 / 2; }
}

/* --- Boutons --- */
.bouton {
  display: inline-block;
  font-family: var(--f-titre);
  font-weight: 600;
  font-stretch: 108%;
  font-size: var(--t-s);
  padding: 0.75rem 1.4rem;
  border-radius: 3px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.bouton--primaire {
  background: var(--c-citron);
  color: var(--c-encre);
}
.bouton--primaire:hover { background: #E4FA6E; color: var(--c-encre); }
.bouton--secondaire {
  background: transparent;
  color: var(--c-fond);
  border-color: var(--c-brume-sombre);
}
.bouton--secondaire:hover { background: #22262E; color: var(--c-fond); }
.bouton--cobalt { background: var(--c-cobalt); color: #fff; }
.bouton--cobalt:hover { background: var(--c-cobalt-sombre); color: #fff; }

/* --- Badge niveau de preuve --- */
.preuve {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--c-brume-sombre);
  border-radius: 3px;
  background: #fff;
  color: var(--c-gris);
}
.preuve__note {
  font-weight: 700;
  color: var(--c-encre);
  border-bottom: 3px solid var(--c-cobalt);
}
.preuve--a .preuve__note { border-bottom-color: var(--c-cobalt); }
.preuve--b .preuve__note { border-bottom-color: #7A8DE8; }
.preuve--c .preuve__note { border-bottom-color: var(--c-brume-sombre); }

/* --- Cards articles --- */
.grille-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 2rem 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--c-brume-sombre);
  border-radius: 4px;
  overflow: hidden;
  height: 100%;
}
.card__media { flex: none; }
.card__corps {
  padding: 1.1rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--f-titre);
  font-size: var(--t-xs);
  font-stretch: 100%;
}
.card__categorie {
  background: var(--c-citron);
  color: var(--c-encre);
  padding: 0.18rem 0.5rem;
  border-radius: 2px;
  font-weight: 600;
}
.card__date { color: var(--c-gris); font-family: var(--f-mono); }
.card__titre {
  font-size: var(--t-m);
  margin: 0;
  line-height: 1.22;
}
.card__titre a { color: var(--c-encre); text-decoration: none; }
.card__titre a:hover { color: var(--c-cobalt); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
.card__resume {
  font-size: var(--t-s);
  color: var(--c-gris);
  margin: 0;
  line-height: 1.55;
}

/* --- Liste editoriale piliers --- */
.piliers { list-style: none; margin: 0; padding: 0; }
.pilier {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: 0 2rem;
  padding-block: 1.9rem;
  border-top: 1px solid var(--c-brume-sombre);
  align-items: center;
}
.piliers > .pilier:last-child { border-bottom: 1px solid var(--c-brume-sombre); }
.pilier__vignette { overflow: hidden; border-radius: 3px; aspect-ratio: 1 / 1; background: var(--c-brume); }
.pilier__vignette img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.pilier__titre { font-size: var(--t-l); margin: 0 0 0.35rem; }
.pilier__titre a { color: var(--c-encre); text-decoration: none; }
.pilier__titre a:hover { color: var(--c-cobalt); text-decoration: underline; text-underline-offset: 0.16em; }
.pilier__desc { margin: 0; color: var(--c-gris); font-size: var(--t-s); max-width: 68ch; }

@media (max-width: 620px) {
  .pilier { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 0 1.2rem; align-items: start; }
  .pilier__titre { font-size: var(--t-m); }
}

/* --- Corps d'article --- */
.article__entete { padding-block: 2.5rem 1.5rem; }
.article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  font-family: var(--f-titre);
  font-size: var(--t-s);
  color: var(--c-gris);
  margin-bottom: 1.2rem;
}
.article__corps { font-size: 1.1rem; }
.article__corps > ul,
.article__corps > ol { margin: 0 0 1.4em; padding-left: 1.4em; }
.article__corps li { margin-bottom: 0.5em; }
.article__corps li::marker { color: var(--c-cobalt); }
.article__corps blockquote {
  margin: 2rem 0;
  padding: 0.3rem 0 0.3rem 1.3rem;
  border-left: 3px solid var(--c-cobalt);
  font-size: var(--t-m);
  line-height: 1.55;
  color: var(--c-encre);
}
.article__corps blockquote p:last-child { margin-bottom: 0; }

/* Listes et tableaux : styles explicites (regle reseau) */
.article__corps table,
.tableau-technique {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-family: var(--f-mono);
  font-size: var(--t-s);
  background: #fff;
}
.article__corps table caption { caption-side: top; text-align: left; font-family: var(--f-titre); font-size: var(--t-s); color: var(--c-gris); padding-bottom: 0.6rem; }
.article__corps th,
.article__corps td {
  border: 1px solid var(--c-brume-sombre);
  padding: 0.6rem 0.8rem;
  text-align: left;
  vertical-align: top;
}
.article__corps th {
  background: var(--c-brume);
  font-weight: 600;
  font-family: var(--f-titre);
  font-stretch: 104%;
}
.article__corps tbody tr:nth-child(even) td { background: #FAFBF8; }

.table-enveloppe { overflow-x: auto; margin: 2rem 0; }
.table-enveloppe table { margin: 0; }

/* Encadres editoriaux */
.encadre {
  margin: 2.2rem 0;
  padding: 1.3rem 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--c-brume-sombre);
  background: #fff;
}
.encadre > :last-child { margin-bottom: 0; }
.encadre__titre {
  font-family: var(--f-titre);
  font-size: var(--t-s);
  font-weight: 650;
  font-stretch: 106%;
  margin: 0 0 0.6rem;
  color: var(--c-encre);
}
.encadre--science { border-left: 4px solid var(--c-cobalt); }
.encadre--pratique { border-left: 4px solid var(--c-citron); background: #FCFDF6; }
.encadre--avertissement { border-left: 4px solid #C2410C; background: #FEF7F3; }

/* Chiffre cle surligne */
.chiffre-cle {
  background: linear-gradient(transparent 58%, color-mix(in srgb, var(--c-citron) 72%, transparent) 58%);
  font-family: var(--f-mono);
  font-weight: 500;
  padding-inline: 0.1em;
}

/* --- Sommaire automatique --- */
.article-sommaire {
  margin: 2rem 0 2.6rem;
  padding: 1.2rem 1.4rem;
  background: var(--c-brume);
  border-radius: 4px;
}
.article-sommaire__titre {
  font-family: var(--f-titre);
  font-size: var(--t-s);
  font-weight: 650;
  font-stretch: 106%;
  margin: 0 0 0.7rem;
}
.article-sommaire ol {
  margin: 0;
  padding-left: 1.3em;
  font-family: var(--f-titre);
  font-size: var(--t-s);
  font-stretch: 102%;
}
.article-sommaire li { margin-bottom: 0.4em; }
.article-sommaire li::marker { color: var(--c-gris); font-family: var(--f-mono); }
.article-sommaire a { color: var(--c-encre); text-decoration: none; }
.article-sommaire a:hover { color: var(--c-cobalt); text-decoration: underline; text-underline-offset: 0.16em; }

/* --- FAQ --- */
.faq { margin-block: 3rem 0; }
.faq__item {
  border-top: 1px solid var(--c-brume-sombre);
  padding-block: 1.1rem;
}
.faq__item:last-child { border-bottom: 1px solid var(--c-brume-sombre); }
.faq__question {
  font-family: var(--f-titre);
  font-size: var(--t-m);
  font-weight: 600;
  font-stretch: 106%;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}
.faq__reponse { margin: 0; }
.faq__reponse > :last-child { margin-bottom: 0; }

/* --- Filtre categories (blog) --- */
.filtre {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--c-brume-sombre);
  padding-bottom: 1.5rem;
}
.filtre__bouton {
  font-family: var(--f-titre);
  font-size: var(--t-s);
  font-weight: 500;
  font-stretch: 104%;
  padding: 0.45rem 0.85rem;
  background: #fff;
  color: var(--c-encre);
  border: 1px solid var(--c-brume-sombre);
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.filtre__bouton:hover { border-color: var(--c-cobalt); }
.filtre__bouton[aria-pressed='true'] {
  background: var(--c-encre);
  color: var(--c-fond);
  border-color: var(--c-encre);
}
.filtre__compte { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--c-gris); }

/* --- Maillage : liens dans le corps --- */
.liens-connexes,
.article-nav-related {
  margin-block: 3rem 0;
  padding-top: 1.6rem;
  border-top: 2px solid var(--c-encre);
}
.liens-connexes__titre { font-size: var(--t-l); margin-top: 0; }

/* --- Formulaire --- */
.formulaire { display: grid; gap: 1.1rem; max-width: 34rem; }
.champ { display: grid; gap: 0.35rem; }
.champ__label {
  font-family: var(--f-titre);
  font-size: var(--t-s);
  font-weight: 600;
  font-stretch: 104%;
}
.champ__aide { font-size: var(--t-xs); color: var(--c-gris); }
.champ input,
.champ textarea {
  font-family: var(--f-corps);
  font-size: var(--t-base);
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--c-brume-sombre);
  border-radius: 3px;
  background: #fff;
  color: var(--c-encre);
  width: 100%;
}
.champ input:focus-visible,
.champ textarea:focus-visible { border-color: var(--c-cobalt); }
.champ textarea { min-height: 9rem; resize: vertical; }
.pot-de-miel { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.formulaire__retour {
  font-family: var(--f-titre);
  font-size: var(--t-s);
  padding: 0.8rem 1rem;
  border-radius: 3px;
}
.formulaire__retour--succes { background: #ECF7E4; border: 1px solid #7FB069; color: #1F3A14; }
.formulaire__retour--erreur { background: #FEF0EC; border: 1px solid #C2410C; color: #6B2309; }

/* --- Pied de page --- */
.pied {
  background: var(--c-encre);
  color: var(--c-brume);
  padding-block: 3.5rem 2rem;
  margin-top: var(--esp-section);
}
.pied__grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 2.5rem 2rem;
}
.pied__titre {
  font-family: var(--f-titre);
  font-size: var(--t-s);
  font-weight: 650;
  font-stretch: 106%;
  color: var(--c-fond);
  margin: 0 0 0.8rem;
}
.pied__liste { list-style: none; margin: 0; padding: 0; font-size: var(--t-s); }
.pied__liste li { margin-bottom: 0.45rem; }
.pied__liste a { color: var(--c-brume); text-decoration: none; }
.pied__liste a:hover { color: var(--c-citron); text-decoration: underline; text-underline-offset: 0.16em; }
.pied__legal {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #2A2E36;
  font-size: var(--t-xs);
  color: var(--c-gris);
}
.pied__legal p { margin-bottom: 0.4em; }

/* --- Accessibilite --- */
.saut-contenu {
  position: absolute;
  left: -9999px;
  background: var(--c-citron);
  color: var(--c-encre);
  padding: 0.7rem 1.1rem;
  font-family: var(--f-titre);
  font-weight: 600;
  z-index: 100;
}
.saut-contenu:focus {
  left: var(--gouttiere);
  top: 0.5rem;
}

.visuellement-cache {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Fil d'ariane --- */
.ariane {
  font-family: var(--f-titre);
  font-size: var(--t-xs);
  color: var(--c-gris);
  padding-block: 1rem 0;
}
.ariane ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; }
.ariane li:not(:last-child)::after { content: '/'; margin-left: 0.4rem; color: var(--c-brume-sombre); }
.ariane a { color: var(--c-gris); text-decoration: none; }
.ariane a:hover { color: var(--c-cobalt); text-decoration: underline; }

/* --- Bandeau methodologie --- */
.methodo__grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
}
.methodo__item > h3 { margin-top: 0; font-size: var(--t-m); }
.methodo__item p { color: var(--c-brume); margin-bottom: 0; font-size: var(--t-s); }

/* --- Utilitaires --- */
.mesure-lecture { max-width: 68ch; }
.texte-gris { color: var(--c-gris); }
