/* ============================================================
   LA MACHINERIE v2 — design system « dessin technique habité »
   Un seul fichier. Tokens d'abord, composants ensuite.
   Règles bloquantes : plancher 0,9 rem (14,4 px), texte
   secondaire 1 rem, contraste AA, aucune couleur hors tokens.
   ============================================================ */

:root {
  /* Palette */
  --papier:    #faf7f0;
  --encre:     #1f2933;
  --nuit:      #1a3a5c;   /* structure : nav, footer, titres */
  --cuivre:    #9c4a1e;   /* comprendre : essais, fil conducteur */
  --bordeaux:  #6b2737;   /* identifier les enjeux : fictions, vigilance */
  --vert:      #2f5d46;   /* agir : ressources */
  --pierre:    #5f5a52;   /* méta — AA sur papier */
  --filet:     rgba(31, 41, 51, 0.15);
  --filet-fort: rgba(31, 41, 51, 0.3);
  --voile:     rgba(250, 247, 240, 0.94);

  /* Typographie */
  --titres: 'Fraunces', Georgia, serif;
  --texte:  'Spectral', Georgia, serif;
  --ui:     'Inter', 'Helvetica Neue', Arial, sans-serif;

  /* Mesures */
  --colonne: 700px;     /* ≈ 68 caractères en Spectral 19px */
  --large:   1080px;
  --plancher: 0.9rem;   /* plancher : étiquettes, méta, navigation */
  --second:   1rem;     /* texte secondaire : résumés, notes, références */
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--papier);
  color: var(--encre);
  font-family: var(--texte);
  font-size: 19px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--cuivre); color: var(--papier); }

/* ---------- Typographie de base ---------- */

h1, h2, h3 { font-family: var(--titres); font-weight: 500; color: var(--nuit); line-height: 1.15; }

/* Texte courant justifié, avec césure française (lang="fr" requis sur <html>) */
p, .faq dd, .references li, .liminaire, .fiche dd {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

a { color: var(--cuivre); text-decoration: none; border-bottom: 1px solid rgba(156, 74, 30, 0.35); transition: color 0.15s, border-color 0.15s; }
a:hover { color: var(--nuit); border-bottom-color: var(--nuit); }

.etiquette {
  font-family: var(--ui);
  font-size: var(--plancher);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Navigation ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--voile);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--filet);
  padding: 0.8rem 1.6rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
}

.nav .marque {
  font-family: var(--titres);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--nuit);
  border: none;
  letter-spacing: 0.01em;
  margin-right: auto;
}

.nav .liens { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; align-items: center; }

.nav .liens a {
  font-family: var(--ui);
  font-size: var(--plancher);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--encre);
  border-bottom: 2px solid transparent;
  padding: 0.35rem 0.1rem;
}

.nav .liens a:hover { color: var(--cuivre); border-bottom-color: var(--cuivre); }
.nav .liens a[aria-current="true"] { color: var(--cuivre); border-bottom-color: var(--cuivre); font-weight: 600; }

.nav .langue { font-family: var(--ui); font-size: var(--plancher); color: var(--pierre); border: none; }
.nav .langue strong { color: var(--nuit); }
.nav .langue a { border: none; color: var(--pierre); }
.nav .langue a:hover { color: var(--nuit); }

/* ---------- Hero ---------- */

.hero {
  max-width: var(--large);
  margin: 0 auto;
  padding: 5rem 1.6rem 3.5rem;
  text-align: left;
}

.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.2rem);
  font-weight: 600;
  margin: 0.6rem 0 1rem;
}

.hero .devise {
  font-family: var(--titres);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-style: italic;
  color: var(--cuivre);
  margin-bottom: 1.4rem;
}

.hero .position {
  max-width: var(--colonne);
  font-size: 1.05rem;
  color: var(--encre);
  margin-bottom: 2rem;
}

.bouton {
  display: inline-block;
  font-family: var(--ui);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--papier);
  background: var(--nuit);
  border: 1px solid var(--nuit);
  padding: 0.85rem 1.8rem;
  transition: background 0.15s;
}
.bouton:hover { background: var(--cuivre); border-color: var(--cuivre); color: var(--papier); }

.bouton.secondaire { background: transparent; color: var(--nuit); }
.bouton.secondaire:hover { background: var(--nuit); color: var(--papier); }

/* ---------- Sections ---------- */

.section { max-width: var(--large); margin: 0 auto; padding: 0 1.6rem 5rem; }

.section-titre {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  border-top: 1px solid var(--filet-fort);
  padding-top: 1.1rem;
  margin-bottom: 2.2rem;
}

.section-titre .numero {
  font-family: var(--titres);
  font-size: 1rem;
  color: var(--pierre);
}

.section-titre h2 { font-size: 1.5rem; }
.section-titre .annexe { margin-left: auto; font-family: var(--ui); font-size: var(--plancher); }

/* ---------- L'établi : trois gestes ---------- */

.etabli { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.4rem; }

.geste { border-top: 3px solid var(--accent, var(--cuivre)); padding-top: 1.1rem; }
.geste.comprendre { --accent: var(--cuivre); }
.geste.enjeux     { --accent: var(--bordeaux); }
.geste.agir       { --accent: var(--vert); }

.geste h3 {
  font-size: 1.35rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.geste .definition {
  font-size: var(--second);
  font-style: italic;
  color: var(--pierre);
  margin-bottom: 1.2rem;
}

.geste ul { list-style: none; }

.geste li { border-bottom: 1px solid var(--filet); }

.geste li a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0.1rem;
  border-bottom: none;
  color: var(--encre);
  font-size: 1.05rem;
}
.geste li a:hover { color: var(--accent); }

.geste .duree {
  font-family: var(--ui);
  font-size: var(--plancher);
  color: var(--pierre);
  white-space: nowrap;
}

/* ---------- La fil conducteur (frise) ---------- */

.chaine-frise {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--filet-fort);
  background: #fffdf8;
}

.maillon {
  flex: 1 1 0;
  min-width: 130px;
  padding: 1rem 1.1rem 1.1rem;
  border-right: 1px solid var(--filet);
  border-bottom: none;
  color: var(--encre);
  position: relative;
}
.maillon:last-child { border-right: none; }
.maillon:hover { background: rgba(156, 74, 30, 0.06); color: var(--encre); }

.maillon .strate {
  font-family: var(--ui);
  font-size: var(--plancher);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pierre);
  display: block;
  margin-bottom: 0.25rem;
}

.maillon .nom { font-family: var(--titres); font-size: 1.05rem; color: var(--nuit); display: block; line-height: 1.25; }

.maillon::after {
  content: '→';
  position: absolute;
  right: -0.55rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--papier);
  color: var(--cuivre);
  font-size: 0.85rem;
  z-index: 2;
  padding: 0 0.1rem;
}
.maillon:last-child::after { content: none; }

.maillon.actif { background: rgba(156, 74, 30, 0.1); }
.maillon.actif .nom { color: var(--cuivre); }

/* Bandeau du fil conducteur compact (pages d'essai) */
.bandeau-chaine {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  font-family: var(--ui);
  font-size: var(--plancher);
  letter-spacing: 0.04em;
  color: var(--pierre);
  border-top: 1px solid var(--filet);
  border-bottom: 1px solid var(--filet);
  padding: 0.7rem 0;
  margin: 1.8rem 0 0;
}
.bandeau-chaine a { color: var(--pierre); border: none; }
.bandeau-chaine a:hover { color: var(--cuivre); }
.bandeau-chaine .ici { color: var(--cuivre); font-weight: 600; }
.bandeau-chaine .fleche { color: var(--filet-fort); }
.bandeau-chaine .boussole { margin-left: auto; color: var(--cuivre); font-weight: 600; }

/* ---------- Cartes de textes ---------- */

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.6rem; }

.carte {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border: 1px solid var(--filet-fort);
  border-top: 3px solid var(--accent, var(--cuivre));
  background: #fffdf8;
  padding: 1.4rem 1.5rem 1.5rem;
  color: var(--encre);
  transition: transform 0.15s, box-shadow 0.15s;
}
.carte:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(31,41,51,0.08); color: var(--encre); }

.carte .statut {
  font-family: var(--ui);
  font-size: var(--plancher);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent, var(--cuivre));
}

.carte h3 { font-size: 1.25rem; }
.carte p  { font-size: var(--second); color: var(--pierre); }
.carte .pied { margin-top: auto; font-family: var(--ui); font-size: var(--plancher); color: var(--pierre); padding-top: 0.6rem; }

.carte.fiction  { --accent: var(--bordeaux); }
.carte.atelier  { --accent: var(--vert); }
.carte.source   { --accent: var(--nuit); }

/* ---------- Listes de rubrique ---------- */

.liste-textes { list-style: none; max-width: var(--colonne); }
.liste-textes li { border-bottom: 1px solid var(--filet); }
.liste-textes a {
  display: flex;
  justify-content: space-between;
  gap: 1.4rem;
  align-items: baseline;
  padding: 1rem 0.1rem;
  border-bottom: none;
  color: var(--encre);
}
.liste-textes a:hover h3 { color: var(--cuivre); }
.liste-textes h3 { font-size: 1.15rem; transition: color 0.15s; }
.liste-textes .resume { font-size: var(--second); color: var(--pierre); margin-top: 0.2rem; }
.liste-textes .duree { font-family: var(--ui); font-size: var(--plancher); color: var(--pierre); white-space: nowrap; }

/* ---------- Article ---------- */

.article-tete { max-width: var(--colonne); margin: 0 auto; padding: 4rem 1.6rem 0; }

.article-tete .kicker { color: var(--cuivre); display: block; margin-bottom: 1rem; }
.article-tete h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 600; margin-bottom: 0.9rem; }

.idee {
  font-family: var(--titres);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--encre);
  margin-bottom: 1.1rem;
}

.article-meta {
  font-family: var(--ui);
  font-size: var(--plancher);
  letter-spacing: 0.05em;
  color: var(--pierre);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  align-items: center;
}

.badge-statut {
  display: inline-block;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid currentColor;
  padding: 0.15rem 0.55rem;
  color: var(--cuivre);
}
.badge-statut.source  { color: var(--nuit); }
.badge-statut.fiction { color: var(--bordeaux); }
.badge-statut.atelier { color: var(--vert); }

.article-corps { max-width: var(--colonne); margin: 0 auto; padding: 2.6rem 1.6rem 4rem; }

.article-corps p { margin-bottom: 1.4rem; }
.article-corps h2 {
  font-size: 1.55rem;
  margin: 3rem 0 1.1rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--filet);
}
.article-corps h3 { font-size: 1.15rem; margin: 1.8rem 0 0.7rem; color: var(--cuivre); }
.article-corps sup { font-size: 0.7em; }
.article-corps sup a { border: none; }

/* Définition en marge */
.marge {
  float: right;
  clear: right;
  width: 240px;
  margin: 0.3rem -280px 1.2rem 1.6rem;
  padding: 0.9rem 0 0.2rem;
  border-top: 2px solid var(--cuivre);
  font-family: var(--ui);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--pierre);
}
.marge strong { display: block; color: var(--nuit); font-size: 0.95rem; letter-spacing: 0.03em; margin-bottom: 0.25rem; }

@media (max-width: 1320px) {
  .marge { float: none; width: auto; margin: 1.4rem 0; padding: 0.9rem 1.1rem; border: 1px solid var(--filet); border-left: 3px solid var(--cuivre); }
}

/* FAQ + références */
.faq dt { font-family: var(--titres); font-size: 1.05rem; color: var(--nuit); margin-top: 1.3rem; }
.faq dd { margin-top: 0.4rem; }

.references { font-size: var(--second); color: var(--pierre); }
.references li { margin-bottom: 0.6rem; margin-left: 1.2rem; }
.references .statut-ref {
  font-family: var(--ui);
  font-size: var(--plancher);
  color: var(--pierre);
  font-style: italic;
}

/* ---------- Parcours conseillé (4 cases) ---------- */

.parcours {
  max-width: var(--large);
  margin: 0 auto;
  padding: 0 1.6rem 4.5rem;
}

.parcours-grille { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.4rem; }

.parcours-case {
  border-top: 2px solid var(--filet-fort);
  padding-top: 0.9rem;
}
.parcours-case.pratique { border-top-color: var(--vert); }

.parcours-case .role {
  font-family: var(--ui);
  font-size: var(--plancher);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pierre);
  display: block;
  margin-bottom: 0.4rem;
}
.parcours-case.pratique .role { color: var(--vert); }

.parcours-case a { display: block; font-family: var(--titres); font-size: 1.05rem; color: var(--nuit); border: none; margin-bottom: 0.3rem; }
.parcours-case a:hover { color: var(--cuivre); }
.parcours-case p { font-size: var(--second); color: var(--pierre); }

/* ---------- Fiches ressource ---------- */

.fiche {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  border: 1px solid var(--filet-fort);
  border-left: 4px solid var(--vert);
  background: #fffdf8;
  padding: 1.8rem 2rem;
  margin-bottom: 1.8rem;
}

.fiche h3 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.fiche .pour { font-size: var(--second); color: var(--encre); margin-bottom: 1rem; }
.fiche .texte-source { font-size: var(--second); color: var(--pierre); }

.fiche dl { font-family: var(--ui); font-size: 0.95rem; align-self: start; }
.fiche dt { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: var(--plancher); color: var(--vert); margin-top: 0.7rem; }
.fiche dd { color: var(--encre); }

/* ---------- Note de transparence ---------- */

.transparence {
  max-width: var(--colonne);
  margin: 0 auto;
  padding: 0 1.6rem 4rem;
  font-size: var(--second);
  color: var(--pierre);
}
.transparence .etiquette { color: var(--nuit); display: block; margin-bottom: 0.6rem; }

/* ---------- Footer-plan ---------- */

footer {
  background: var(--nuit);
  color: rgba(250, 247, 240, 0.8);
  padding: 3.2rem 1.6rem 2.4rem;
  font-family: var(--ui);
  font-size: 0.95rem;
}

.footer-plan {
  max-width: var(--large);
  margin: 0 auto 2.4rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.footer-plan h4 {
  font-family: var(--ui);
  font-size: var(--plancher);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(250, 247, 240, 0.55);
  margin-bottom: 0.8rem;
}

.footer-plan ul { list-style: none; }
.footer-plan li { margin-bottom: 0.45rem; }
.footer-plan a { color: rgba(250, 247, 240, 0.85); border: none; }
.footer-plan a:hover { color: #fff; border-bottom: 1px solid rgba(255,255,255,0.5); }

.footer-signature {
  max-width: var(--large);
  margin: 0 auto;
  border-top: 1px solid rgba(250, 247, 240, 0.2);
  padding-top: 1.4rem;
  color: rgba(250, 247, 240, 0.7);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.footer-signature a { color: rgba(250, 247, 240, 0.85); border: none; }
.footer-signature a:hover { color: #fff; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .etabli, .trio { grid-template-columns: 1fr; gap: 1.8rem; }
  .parcours-grille { grid-template-columns: repeat(2, 1fr); }
  .footer-plan { grid-template-columns: repeat(2, 1fr); }
  .fiche { grid-template-columns: 1fr; }
  .chaine-frise { flex-direction: column; }
  .maillon { border-right: none; border-bottom: 1px solid var(--filet); }
  .maillon:last-child { border-bottom: none; }
  .maillon::after { content: '↓'; right: 1rem; top: auto; bottom: -0.7rem; }
  .maillon:last-child::after { content: none; }
}

@media (max-width: 560px) {
  body { font-size: 17px; }
  .hero { padding: 3.5rem 1.2rem 2.5rem; }
  .section { padding: 0 1.2rem 3.5rem; }
  .parcours-grille { grid-template-columns: 1fr; }
  .footer-plan { grid-template-columns: 1fr; }
  .nav {
    padding: 0.5rem 0.9rem 0.45rem;
    gap: 0.35rem 0.75rem;
  }
  .nav .marque {
    font-size: 0.95rem;
    line-height: 1.2;
  }
  .nav .langue {
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .nav .liens {
    width: 100%;
    flex-wrap: nowrap;
    gap: 0.75rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav .liens::-webkit-scrollbar { display: none; }
  .nav .liens a {
    flex: 0 0 auto;
    font-size: 0.72rem;
    letter-spacing: 0.045em;
    padding: 0.18rem 0.05rem 0.28rem;
    white-space: nowrap;
  }
  .bandeau-chaine .boussole { margin-left: 0; width: 100%; }
}
