/* ==========================================================================
   Le signal dans le bruit — parcours d'intelligence économique
   Charte : nuit végétale, vert tendre & lilas. Sombre par défaut.
   Type : Young Serif (titres) · Figtree (texte) · IBM Plex Mono (repères)
   ========================================================================== */

:root {
  --fond: #0f1311;
  --surface: #151b18;
  --surface-2: #1b231f;
  --ligne: #28322c;
  --encre: #e9eee9;
  --sourdine: #9fafa5;
  --vert: #a5e3bf;
  --vert-fort: #7bd3a2;
  --vert-fonce: #223a2e;
  --lilas: #c7b5ef;
  --lilas-fort: #ab8fe6;
  --lilas-fonce: #322a45;
  --alerte: #e6b8a2;
  --degrade: linear-gradient(135deg, var(--vert) 0%, var(--lilas) 100%);
  --rayon: 10px;
  --mesure: 68ch;
  color-scheme: dark;
}

[data-theme="light"] {
  --fond: #f4f6f2;
  --surface: #ffffff;
  --surface-2: #eef1ea;
  --ligne: #d7ded6;
  --encre: #1d241f;
  --sourdine: #5a6a60;
  --vert: #23744c;
  --vert-fort: #1d5f3f;
  --vert-fonce: #dcefe3;
  --lilas: #6b4fb0;
  --lilas-fort: #59409a;
  --lilas-fonce: #e9e2f7;
  --alerte: #a05a3a;
  color-scheme: light;
}

/* ---------- Socle ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Young Serif", Georgia, serif;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); margin: 0.4em 0 0.35em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin: 2.2em 0 0.5em; }
h3 { font-size: 1.15rem; margin: 1.6em 0 0.4em; }

p { margin: 0 0 1em; }

a { color: var(--vert); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--lilas); }

strong { font-weight: 600; }

::selection { background: var(--lilas-fonce); color: var(--encre); }
[data-theme="light"] ::selection { background: var(--lilas-fonce); }

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

.acces-rapide {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  color: var(--encre);
  padding: 0.6rem 1rem;
  z-index: 50;
}
.acces-rapide:focus { left: 1rem; top: 1rem; }

/* ---------- Utilitaires ---------- */

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contenu {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}

/* ---------- Barre de navigation ---------- */

.barre {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--fond) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ligne);
}

.barre-int {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.marque {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.05rem;
  color: var(--encre);
  text-decoration: none;
  white-space: nowrap;
}
.marque .tiret { color: var(--vert); }
.marque:hover { color: var(--encre); }
.marque:hover .tiret { color: var(--lilas); }

.barre-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.barre-nav a {
  color: var(--sourdine);
  text-decoration: none;
  font-size: 0.92rem;
}
.barre-nav a:hover, .barre-nav a[aria-current="page"] { color: var(--encre); }

.bouton-theme {
  border: 1px solid var(--ligne);
  background: var(--surface);
  color: var(--encre);
  border-radius: 999px;
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  line-height: 1;
}
.bouton-theme:hover { border-color: var(--vert); }

/* ---------- Héros (accueil) ---------- */

.heros {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 5vw, 3.5rem);
  position: relative;
}

.heros .sur-titre { margin-bottom: 1.2rem; }

.heros h1 {
  font-size: clamp(2.3rem, 6vw, 4.1rem);
  max-width: 17ch;
  margin: 0 0 0.5em;
}

.heros h1 em {
  font-style: normal;
  background: var(--degrade);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chapo {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--sourdine);
  max-width: 56ch;
  text-wrap: pretty;
}

.sur-titre {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lilas);
  margin: 0 0 0.8rem;
}

.signal {
  display: block;
  width: 100%;
  height: auto;
  margin: clamp(1.5rem, 4vw, 3rem) 0 0;
  overflow: visible;
}

.signal path {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.signal .bruit { stroke: var(--lilas); opacity: 0.55; }
.signal .propre { stroke: var(--vert); }

@media (prefers-reduced-motion: no-preference) {
  .signal.anime path {
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
    animation: tracer 2.4s ease-out forwards;
  }
  .signal.anime .propre { animation-delay: 0.5s; }
  @keyframes tracer { to { stroke-dashoffset: 0; } }
}

.heros-actions { margin-top: 2rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }

.bouton {
  display: inline-block;
  background: var(--vert);
  color: var(--fond);
  font-weight: 600;
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
}
.bouton:hover { background: var(--lilas); color: var(--fond); }
[data-theme="light"] .bouton { color: #fff; }

.bouton-second {
  display: inline-block;
  color: var(--encre);
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--ligne);
  font-size: 1rem;
}
.bouton-second:hover { border-color: var(--lilas); color: var(--lilas); }

/* ---------- Ligne de parcours (accueil) ---------- */

.parcours { padding: clamp(2rem, 5vw, 4rem) 0 clamp(3rem, 6vw, 5rem); }

.parcours-liste {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  position: relative;
}

.parcours-liste::before {
  content: "";
  position: absolute;
  left: 1.05rem;
  top: 1.4rem;
  bottom: 1.4rem;
  width: 2px;
  background: linear-gradient(to bottom, var(--vert), var(--lilas));
  opacity: 0.7;
}

.station {
  position: relative;
  padding: 0 0 0 3.2rem;
  margin: 0 0 1.1rem;
}

.station-lien {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 1.1rem 1.3rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.station-lien:hover {
  border-color: var(--vert);
  transform: translateX(4px);
  color: inherit;
}

.station-point {
  position: absolute;
  left: 0.35rem;
  top: 1.15rem;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--fond);
  border: 2px solid var(--vert);
  display: grid;
  place-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--vert);
  z-index: 1;
}

.station:nth-child(n+5) .station-point { border-color: var(--lilas); color: var(--lilas); }

.station.fait .station-point {
  background: var(--vert);
  color: var(--fond);
}
.station:nth-child(n+5).fait .station-point { background: var(--lilas); }

.station-titre {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.2rem;
  margin: 0.15rem 0 0.3rem;
}

.station-resume { color: var(--sourdine); font-size: 0.95rem; margin: 0; }

.station-meta {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  color: var(--sourdine);
}

.station .badge-fait {
  display: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--vert);
}
.station.fait .badge-fait { display: inline; }

/* ---------- Trio « pourquoi » (accueil) ---------- */

.trio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.carte {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 1.3rem 1.4rem;
}
.carte h3 { margin-top: 0.4rem; }
.carte p { color: var(--sourdine); font-size: 0.95rem; margin: 0; }

/* ---------- Article de module ---------- */

.module {
  max-width: var(--mesure);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1rem, 4vw, 2rem) 3rem;
}

.module .chapo { font-size: 1.15rem; margin-bottom: 2rem; }

.module figure { margin: 2rem 0; }

.essentiel {
  border: 1px solid var(--vert);
  border-left-width: 4px;
  background: color-mix(in srgb, var(--vert) 7%, var(--surface));
  border-radius: var(--rayon);
  padding: 1.1rem 1.3rem;
  margin: 2rem 0;
}
.essentiel .etiquette { color: var(--vert-fort); }
[data-theme="dark"] .essentiel .etiquette { color: var(--vert); }
.essentiel p:last-child { margin-bottom: 0; }

.terrain {
  border: 1px solid var(--lilas);
  border-left-width: 4px;
  background: color-mix(in srgb, var(--lilas) 7%, var(--surface));
  border-radius: var(--rayon);
  padding: 1.1rem 1.3rem;
  margin: 2rem 0;
}
.terrain .etiquette { color: var(--lilas); }
.terrain p:last-child { margin-bottom: 0; }

.etiquette {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.reperes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  margin: 2rem 0;
}

.repere {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 1rem 1.1rem;
}

.repere .chiffre {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.7rem;
  display: block;
  background: var(--degrade);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.repere .legende {
  color: var(--sourdine);
  font-size: 0.85rem;
  line-height: 1.4;
  display: block;
  margin-top: 0.3rem;
}

ul, ol { padding-left: 1.3rem; }
li { margin-bottom: 0.5em; }
li::marker { color: var(--lilas); }

/* ---------- Quiz ---------- */

.quiz {
  margin-top: 3rem;
  border-top: 1px solid var(--ligne);
  padding-top: 1.5rem;
}

.question { margin: 1.6rem 0; }

.question > p { font-weight: 600; margin-bottom: 0.7rem; }

.reponses { display: grid; gap: 0.5rem; }

.reponses button {
  text-align: left;
  font: inherit;
  font-size: 0.97rem;
  color: var(--encre);
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}
.reponses button:hover:not(:disabled) { border-color: var(--vert); }
.reponses button:disabled { cursor: default; opacity: 0.75; }
.reponses button.juste { border-color: var(--vert); background: color-mix(in srgb, var(--vert) 12%, var(--surface)); opacity: 1; }
.reponses button.faux { border-color: var(--alerte); color: var(--alerte); }

.explication {
  margin-top: 0.7rem;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--lilas);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  color: var(--sourdine);
  font-size: 0.95rem;
}

/* ---------- Fin de module ---------- */

.valider { margin: 2.5rem 0 0; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.valider .fait-msg { color: var(--vert); font-size: 0.95rem; display: none; }
.valider.est-fait .fait-msg { display: inline; }
.valider.est-fait .bouton { background: var(--surface); color: var(--sourdine); border: 1px solid var(--ligne); }

.pagination {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ligne);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination a {
  text-decoration: none;
  color: var(--sourdine);
  max-width: 46%;
}
.pagination a:hover .pagination-titre { color: var(--lilas); }
.pagination .pagination-sens { display: block; }
.pagination .pagination-titre {
  display: block;
  color: var(--encre);
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.02rem;
  margin-top: 0.2rem;
}
.pagination .suivant { margin-left: auto; text-align: right; }

/* ---------- Glossaire & sources ---------- */

.glossaire dt {
  font-family: "Young Serif", Georgia, serif;
  font-size: 1.1rem;
  margin-top: 1.6rem;
  color: var(--vert);
}
.glossaire dt:nth-of-type(even) { color: var(--lilas); }
.glossaire dd { margin: 0.3rem 0 0; color: var(--sourdine); }

.liste-sources li { margin-bottom: 0.9em; color: var(--sourdine); }
.liste-sources strong { color: var(--encre); }

/* ---------- Pied de page ---------- */

.pied {
  border-top: 1px solid var(--ligne);
  margin-top: 3rem;
}

.pied-int {
  max-width: 1060px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: var(--sourdine);
  font-size: 0.9rem;
}

.pied a { color: var(--sourdine); }
.pied a:hover { color: var(--lilas); }

/* ---------- Réactivité ---------- */

@media (max-width: 640px) {
  .barre-nav .masquable { display: none; }
  .pagination a { max-width: 100%; }
  .pagination .suivant { margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .station-lien { transition: none; }
}
