/* =========================================================
   Deux poids — feuille de style
   Palette : encre vert-noir, vert tendre (le social, le nombre),
   lilas (le pouvoir, la norme). Les deux couleurs ne décorent pas :
   elles désignent les deux côtés de chaque asymétrie.
   ========================================================= */

:root {
  --ink-900:  #0F1413;
  --ink-850:  #131B18;
  --ink-800:  #18211E;
  --ink-700:  #202B27;
  --paper:    #E7EFE9;
  --mute:     #93A89B;
  --sage:     #A9D6B0;
  --sage-dim: #6FA97E;
  --lilas:    #C6B4F0;
  --lilas-dim:#9781D4;
  --line:     rgba(169, 214, 176, .16);
  --line-soft:rgba(169, 214, 176, .09);

  --bg:       var(--ink-900);
  --surface:  var(--ink-850);
  --raised:   var(--ink-800);
  --fg:       var(--paper);

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --measure: 68ch;
  --gap: clamp(1.5rem, 4vw, 3rem);
  --radius: 3px;
}

html[data-theme="light"] {
  --bg:      #F4F6F1;
  --surface: #ECF0E9;
  --raised:  #E4EAE1;
  --fg:      #17201C;
  --mute:    #55665C;
  --sage-dim:#3D7B4E;
  --lilas-dim:#5A44A0;
  --sage:    #3D7B4E;
  --lilas:   #5A44A0;
  --line:    rgba(23, 32, 28, .16);
  --line-soft: rgba(23, 32, 28, .08);
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 350;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fine grain : une trame très légère, pour éviter l'aplat numérique */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: radial-gradient(circle at 1px 1px, rgba(169,214,176,.06) 1px, transparent 0);
  background-size: 4px 4px;
}
html[data-theme="light"] body::before { opacity: .5; background-image: radial-gradient(circle at 1px 1px, rgba(23,32,28,.05) 1px, transparent 0); }

.wrap { width: min(100% - 2.5rem, 1120px); margin-inline: auto; position: relative; z-index: 1; }

a { color: var(--sage); text-decoration-color: color-mix(in oklab, var(--sage) 40%, transparent); text-underline-offset: .18em; }
a:hover { color: var(--lilas); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--lilas); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--lilas); color: #10131a; padding: .6rem 1rem; font-weight: 600;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.masthead__inner { display: flex; align-items: center; gap: 1.25rem; min-height: 66px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--fg); margin-right: auto; }
.brand__mark { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.brand__mark span { display: block; width: 5px; background: var(--sage); }
.brand__mark span:first-child { height: 22px; }
.brand__mark span:last-child { height: 8px; background: var(--lilas); }
.brand__text b { font-family: var(--display); font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; display: block; line-height: 1.15; }
.brand__text em {
  font-style: normal; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--mute); display: block;
}
.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .875rem; }
.nav a { color: var(--mute); text-decoration: none; padding: .25rem 0; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--sage); }
.nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--lilas); }
.theme {
  background: transparent; border: 1px solid var(--line); color: var(--mute);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: .9rem; line-height: 1;
}
.theme:hover { color: var(--sage); border-color: var(--sage-dim); }

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
.hero__kicker {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--sage-dim); margin: 0 0 1.4rem;
}
.hero__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.2rem, 5.4vw, 3.9rem);
  line-height: .98;
  letter-spacing: -.028em;
  margin: 0;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  text-wrap: balance;
  max-width: 24ch;
}
.hero__title .alt { color: var(--lilas); }
.hero__title .acc { color: var(--sage); }
.hero__lede {
  max-width: 60ch; font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--mute);
  margin: 1.6rem 0 0; line-height: 1.55;
}
.hero__lede strong { color: var(--fg); font-weight: 600; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 2rem; max-width: 60ch; }
.hero__meta .mono { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }

/* ---------- Prose ---------- */
.prose { padding-bottom: 5rem; }
.prose > * { max-width: var(--measure); }
.prose > .rulers, .prose > .cards, .prose > .flaws, .prose > .wide, .prose > figure { max-width: none; }

.prose h2 {
  font-family: var(--display); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(1.6rem, 3.6vw, 2.15rem); line-height: 1.12;
  margin: 3.6rem 0 1rem; padding-top: 1.6rem; border-top: 1px solid var(--line);
  text-wrap: balance;
}
.prose h3 {
  font-family: var(--display); font-weight: 600; font-size: 1.24rem; letter-spacing: -.01em;
  margin: 2.4rem 0 .6rem; line-height: 1.25;
}
.prose h4 { font-family: var(--body); font-weight: 600; font-size: 1rem; margin: 1.8rem 0 .4rem; color: var(--sage); }
.prose p { margin: 0 0 1.15rem; }
.prose p.lede { font-size: 1.15rem; color: var(--mute); }
.prose strong { font-weight: 600; color: var(--fg); }
.prose em { font-style: italic; }
.prose ul, .prose ol { padding-left: 1.15rem; margin: 0 0 1.3rem; }
.prose li { margin-bottom: .5rem; }
.prose li::marker { color: var(--lilas-dim); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }
.prose blockquote {
  margin: 2rem 0; padding: .3rem 0 .3rem 1.4rem; border-left: 2px solid var(--lilas-dim);
  font-family: var(--display); font-size: 1.15rem; line-height: 1.45; color: var(--fg);
}
.prose blockquote cite { display: block; font-family: var(--mono); font-size: .72rem; font-style: normal;
  letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin-top: .8rem; }
.prose code, .mono { font-family: var(--mono); font-size: .86em; }
.prose :not(pre) > code { background: var(--raised); padding: .1em .35em; border-radius: 2px; color: var(--sage); }
.headerlink { text-decoration: none; opacity: 0; margin-left: .4rem; color: var(--lilas-dim); font-size: .7em; }
h2:hover .headerlink, h3:hover .headerlink { opacity: 1; }

.prose sup { font-size: .7em; }

/* Tableaux */
.prose table { width: 100%; border-collapse: collapse; margin: 1.8rem 0 2.2rem; font-size: .93rem; }
.prose thead th {
  text-align: left; font-family: var(--mono); font-size: .68rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--mute);
  border-bottom: 1px solid var(--line); padding: .5rem .8rem .5rem 0;
}
.prose tbody td { padding: .7rem .8rem .7rem 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td:first-child { color: var(--fg); }

/* Encarts */
.note, .warn, .method {
  border: 1px solid var(--line); border-left-width: 2px; background: var(--surface);
  padding: 1.15rem 1.3rem; margin: 2rem 0; border-radius: var(--radius); font-size: .96rem;
}
.note { border-left-color: var(--sage-dim); }
.warn { border-left-color: var(--lilas-dim); }
.method { border-left-color: var(--mute); }
.note > :last-child, .warn > :last-child, .method > :last-child { margin-bottom: 0; }
.note__t, .warn__t, .method__t {
  display: block; font-family: var(--mono); font-size: .67rem; letter-spacing: .13em;
  text-transform: uppercase; margin-bottom: .5rem;
}
.note__t { color: var(--sage); }
.warn__t { color: var(--lilas); }
.method__t { color: var(--mute); }

/* ---------- Sommaire ---------- */
.toc {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem;
  margin: 0 0 2.8rem; max-width: var(--measure); background: var(--surface);
}
.toc .toc__h {
  font-family: var(--mono); font-size: .67rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--mute); margin: 0 0 .6rem; font-weight: 500;
  border-top: 0; padding-top: 0; line-height: 1.4;
}
.toc .toc__h .headerlink { display: none; }
.toc ul { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.toc ul ul { padding-left: 1rem; margin-top: .3rem; }
.toc li { margin-bottom: .3rem; }
.toc a { text-decoration: none; color: var(--mute); }
.toc a:hover { color: var(--sage); }
.toc .headerlink { display: none; }

/* ---------- Signature : les réglettes d'asymétrie ---------- */
.rulers { display: grid; gap: 2.6rem; margin: 3rem 0 3.5rem; }
@media (min-width: 900px) { .rulers { grid-template-columns: repeat(2, 1fr); gap: 3rem 3.5rem; } }

.ruler { border-top: 1px solid var(--line); padding-top: 1.1rem; }
.ruler__title {
  font-family: var(--display); font-size: 1.12rem; font-weight: 600; letter-spacing: -.01em;
  margin: 0 0 1.2rem; line-height: 1.25;
}
.ruler__bars { display: grid; gap: .75rem; margin-bottom: 1.1rem; }
.ruler__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem; }
@media (min-width: 520px) {
  .ruler__row { grid-template-columns: 15ch 1fr auto; align-items: center; gap: .8rem; }
}
.ruler__label { font-size: .78rem; color: var(--mute); line-height: 1.25; }
.ruler__label[data-side="a"] { border-left: 2px solid var(--sage); padding-left: .5rem; }
.ruler__label[data-side="b"] { border-left: 2px solid var(--lilas); padding-left: .5rem; }
.ruler__track { display: block; height: 9px; background: var(--raised); border-radius: 1px; overflow: hidden; }
.ruler__fill {
  display: block; height: 100%; width: 0; border-radius: 1px;
  transition: width 1.1s cubic-bezier(.16,.84,.34,1);
}
.ruler__fill--a { background: linear-gradient(90deg, var(--sage-dim), var(--sage)); }
.ruler__fill--b { background: linear-gradient(90deg, var(--lilas-dim), var(--lilas)); }
.is-in .ruler__fill { width: var(--w); }
.ruler__value { font-family: var(--mono); font-size: .8rem; color: var(--fg); white-space: nowrap; }
.ruler__note, .ruler__caveat { font-size: .86rem; margin: 0 0 .55rem; color: var(--mute); line-height: 1.55; }
.ruler__note strong { color: var(--sage); font-weight: 500; }
.ruler__caveat { padding-left: .9rem; border-left: 1px solid var(--line); }
.ruler__caveat strong { color: var(--lilas); font-weight: 500; }
.ruler__note em, .ruler__caveat em { font-style: italic; }
.ruler__caveat strong:not(:first-child) { color: var(--fg); }

/* ---------- Cartes dossiers ---------- */
.cards { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 2.5rem 0 3rem; border-radius: var(--radius); overflow: hidden; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--bg); padding: 1.6rem 1.5rem 1.4rem; text-decoration: none; color: var(--fg);
  display: flex; flex-direction: column; gap: .55rem; transition: background .25s ease;
}
.card:hover { background: var(--surface); color: var(--fg); }
.card__eyebrow { font-family: var(--mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--lilas-dim); }
.card__title { font-family: var(--display); font-size: 1.28rem; font-weight: 600; letter-spacing: -.015em; margin: 0; line-height: 1.18; }
.card__desc { font-size: .9rem; color: var(--mute); margin: 0; flex: 1; line-height: 1.55; }
.card__more { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--sage); margin-top: .6rem; }
.card:hover .card__more { color: var(--lilas); }
.card__more::after { content: " →"; }

/* ---------- Failles ---------- */
.flaws { display: grid; gap: 1.6rem; margin: 2.5rem 0 3rem; }
.flaw { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.5rem 1.2rem; background: var(--surface); }
.flaw__head { display: flex; align-items: baseline; gap: .9rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.flaw__num { font-family: var(--mono); font-size: .78rem; color: var(--lilas); letter-spacing: .06em; }
.flaw__title { font-family: var(--display); font-size: 1.3rem; font-weight: 600; letter-spacing: -.015em; margin: 0; flex: 1 1 16ch; line-height: 1.2; }
.flaw__strength {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid currentColor; padding: .2rem .5rem; border-radius: 100px; white-space: nowrap;
}
.flaw__strength[data-level="solide"] { color: var(--sage); }
.flaw__strength[data-level="plaidable"] { color: var(--lilas); }
.flaw__strength[data-level="fragile"] { color: var(--mute); }
.flaw__strength[data-level="non justiciable"] { color: var(--mute); opacity: .7; }
.flaw__grid { margin: 0; display: grid; gap: .2rem; }
@media (min-width: 720px) { .flaw__grid { grid-template-columns: 15ch 1fr; column-gap: 1.6rem; } }
.flaw__grid dt {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--mute); padding-top: .85rem; border-top: 1px solid var(--line-soft);
}
.flaw__grid dd { margin: 0; padding: .85rem 0 .9rem; border-top: 1px solid var(--line-soft); font-size: .95rem; line-height: 1.6; }
@media (max-width: 719px) {
  .flaw__grid dt { border-top: 1px solid var(--line-soft); padding-bottom: .2rem; }
  .flaw__grid dd { border-top: 0; padding-top: 0; }
}
.flaw__grid dd.mono { font-family: var(--mono); font-size: .82rem; color: var(--sage); line-height: 1.7; }

/* ---------- Listes de sources ---------- */
.srclist { list-style: none; padding: 0; margin: 0 0 2.2rem; max-width: var(--measure); }
.srclist li { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline;
  padding: .6rem 0; border-bottom: 1px solid var(--line-soft); font-size: .93rem; }
.srclist__org { font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; color: var(--mute); }

/* ---------- Pied ---------- */
.foot { border-top: 1px solid var(--line); background: var(--surface); padding: 2.6rem 0 3.4rem; margin-top: auto; }
.foot__inner { display: grid; gap: 1rem; max-width: 1120px; }
.foot p { margin: 0; font-size: .87rem; color: var(--mute); line-height: 1.6; }
.foot__sig strong { color: var(--fg); font-weight: 600; }
.foot__note { font-family: var(--mono); font-size: .68rem; letter-spacing: .05em; }
.foot__warn { font-size: .78rem; opacity: .75; max-width: 70ch; border-top: 1px solid var(--line-soft); padding-top: 1rem; }

/* ---------- Divers ---------- */
.pill-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.6rem 0 2.4rem; }
.pill {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--line); padding: .35rem .7rem; border-radius: 100px; color: var(--mute); text-decoration: none;
}
.pill:hover { border-color: var(--sage-dim); color: var(--sage); }

.next {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 1.4rem; margin-top: 3.5rem; max-width: var(--measure);
  font-family: var(--mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase;
}

/* python-markdown enveloppe son sommaire dans un div.toc : on neutralise l'imbrication */
.toc .toc { border: 0; padding: 0; margin: 0; background: none; }

/* ---------- Mobile : l'en-tête ne doit pas manger l'écran ---------- */
@media (max-width: 800px) {
  .masthead { position: static; }
  .masthead__inner { flex-wrap: wrap; gap: .6rem; padding-top: .6rem; }
  .brand__text b { white-space: nowrap; }
  .brand__text em { display: none; }
  .nav {
    order: 3; flex-basis: 100%; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none; padding: 0 0 .7rem;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  .ruler__value { font-size: .9rem; }
}
