:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --fg: #e6e1d6;
  --muted: #9a9486;
  --line: rgba(230, 225, 214, 0.14);
  --panel: #111116;
  --accent: #d2c29a;
  --dot: rgba(230, 225, 214, 0.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
:lang(zh) { --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif; }
:lang(ja) { --serif: "Hiragino Mincho ProN", "Noto Serif JP", "Yu Mincho", serif; }
:lang(ko) { --serif: "AppleMyungjo", "Noto Serif KR", "Nanum Myeongjo", serif; }
:lang(ar) { --serif: "Geeza Pro", "Noto Naskh Arabic", "Amiri", serif; }
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  padding: 0 16px 96px;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
:lang(ar) body, body:lang(ar) { line-height: 1.9; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--fg); }
bdi { unicode-bidi: isolate; }
sup { line-height: 0; }

/* Barre du haut : la marque */
.barre { max-width: 42rem; margin: 0 auto; padding: 22px 0 0; display: flex; align-items: center; gap: 16px; font-size: 0.92rem; }
.marque { color: var(--muted); text-decoration: none; letter-spacing: 0.06em; }
.marque:hover { color: var(--fg); }

/* Accueil */
.accueil main { max-width: 42rem; margin: 0 auto; padding-top: 18vh; text-align: center; }
.accueil h1 { margin: 0; font-size: clamp(3.25rem, 14vw, 7.5rem); font-weight: 400; letter-spacing: 0.04em; line-height: 1; }
.devise { margin: 1.25rem 0 0; color: var(--muted); font-size: clamp(1rem, 3.2vw, 1.25rem); font-style: italic; }
.verdict { margin: 2.5rem auto 0; max-width: 34rem; font-size: clamp(1rem, 3vw, 1.15rem); }
.travaux { margin-top: 14vh; text-align: start; border-top: 1px solid var(--line); padding-top: 18px; }
.travaux h2 { margin: 0 0 10px; color: var(--muted); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
.travail { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 0; color: var(--fg); text-decoration: none; }
.travail:hover .titre { color: var(--accent); }
.travail .date { color: var(--muted); font-size: 0.9rem; }
.accueil main { animation: apparition 1.4s ease-out both; }
@keyframes apparition { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .accueil main { animation: none; } }

/* Article */
.article main { max-width: 42rem; margin: 0 auto; }
.article header { padding: 48px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.surtitre { margin: 0 0 12px; color: var(--muted); font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; }
.article h1 { margin: 0; font-size: clamp(2rem, 6vw, 2.9rem); font-weight: 400; line-height: 1.15; }
.sous-titre { margin: 16px 0 0; color: var(--muted); font-size: 1.12rem; font-style: italic; }
.meta { margin: 20px 0 0; color: var(--muted); font-size: 0.9rem; }
.article h2 { margin: 56px 0 16px; font-size: 1.45rem; font-weight: 500; line-height: 1.3; }
.article h3 { margin: 36px 0 10px; font-size: 1.12rem; font-weight: 600; }
.article p, .article ul, .article ol { margin: 0 0 18px; }
.article li { margin-bottom: 8px; }
.article strong { font-weight: 600; }
:lang(zh) em, :lang(ja) em, :lang(ko) em { font-style: normal; font-weight: 600; }
.resume { margin: 0 0 8px; }
.resume h2 { margin-top: 0 !important; }
.resume ul { padding-inline-start: 1.1em; }
.tableau { overflow-x: auto; margin: 8px 0 22px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: end; white-space: nowrap; }
th:first-child, td:first-child { text-align: start; }
td:last-child:not(:first-child) { white-space: normal; min-width: 9rem; }
th { color: var(--muted); font-weight: 500; }
/* Tableau dont les cellules sont des phrases (synthèse) : retour à la ligne, texte aligné au début */
.phrases th, .phrases td { white-space: normal; text-align: start; vertical-align: top; }
.katex { font-size: 1.05em; direction: ltr; unicode-bidi: isolate; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
pre { margin: 0 0 18px; padding: 0; overflow-x: auto; font-size: 0.85rem; direction: ltr; text-align: left; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.sources { font-size: 0.9rem; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .resume { padding: 18px 18px 4px; }
  .article header { padding-top: 32px; }
}

@media print {
  :root { color-scheme: light; --fg: #111; --muted: #555; --line: #ccc; --panel: #f6f4ef; --accent: #111; }
  html, body { background: #fff; }
  body { font-size: 10.5pt; padding: 0; background-image: none; }
  .barre { display: none; }
  .article header { padding-top: 0; }
  a { text-decoration: none; }
  h2, h3 { break-after: avoid; }
  .resume, table, .katex-display, pre { break-inside: avoid; }
  @page { margin: 16mm 15mm; }
}

.verdict-net { margin: 0 0 8px; }
.verdict-net h2 { margin-top: 0 !important; }

/* Accueil : la théorie expliquée, avec ses visuels ; les travaux n'en sont qu'une partie */
.landing .hero { position: relative; min-height: 92vh; max-width: 60rem; margin: 0 auto; padding: 12vh 0 8vh;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
body.landing { background-image: none; }
.landing .pluie { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.landing > :not(.pluie) { position: relative; z-index: 1; }
.landing h1 { margin: 0; font-size: clamp(3.25rem, 14vw, 7.5rem); font-weight: 400; letter-spacing: 0.04em; line-height: 1; }
.landing .accroche { max-width: 34rem; margin: 2rem auto 0; font-size: clamp(1.02rem, 2.6vw, 1.15rem); }
.landing .liens-hero { margin: 2rem 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; }
.landing main { max-width: 42rem; margin: 0 auto; }
.landing main > section { margin: 16vh 0 0; }
.landing main > section:first-child { margin-top: 6vh; }
.landing h2 { margin: 0 0 18px; font-size: clamp(1.6rem, 4.6vw, 2.1rem); font-weight: 400; line-height: 1.2; }
.landing h3 { margin: 64px 0 12px; font-size: 1.22rem; font-weight: 500; }
.landing p { margin: 0 0 18px; }
.landing .suite { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 0.95rem; }
.trilemme { margin: 8px 0 22px; padding-inline-start: 1.4em; }
.trilemme li { margin-bottom: 6px; }
.landing figure { margin: 22px 0 26px; }
.landing figure svg { display: block; width: 100%; height: auto; }
.landing figcaption { margin-top: 12px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.fig-ciel { margin-inline: min(0px, (42rem - 100vw) / 2 + 16px); }
@media (min-width: 900px) { .fig-ciel { margin-inline: -7rem; } }
.paire { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 22px 0 26px; }
.paire figure { margin: 0; }
@media (max-width: 600px) { .paire { grid-template-columns: 1fr; } }
.landing .travaux { margin-top: 16vh; border-top: none; padding-top: 0; text-align: start; }
.landing .travaux h2 { margin: 0 0 10px; color: var(--fg); font-size: clamp(1.6rem, 4.6vw, 2.1rem); font-weight: 400;
  letter-spacing: normal; text-transform: none; }
.landing .methode { margin: 12vh 0 0; color: var(--muted); font-size: 0.9rem; }

/* Visuels (SVG générés par site/visuels.py) */
.carte .grille { fill: none; stroke: var(--line); stroke-width: 1; }
.carte .contour { fill: none; stroke: rgba(230, 225, 214, 0.32); stroke-width: 1; }
.carte .hors-vue { fill: rgba(230, 225, 214, 0.07); }
.carte .limite { fill: none; stroke: var(--muted); stroke-width: 1; }
.carte .repere { fill: var(--muted); font-family: var(--serif); font-size: 15px; }
.carte .point { fill: var(--accent); stroke: var(--bg); stroke-width: 2; paint-order: stroke; }
.carte .cible { fill: transparent; }
.carte .evt:hover .point { fill: var(--fg); }
.bits rect { fill: var(--fg); opacity: 0.82; }
.reseau .maille { stroke: var(--line); stroke-width: 1; }
.reseau .noeud { fill: var(--muted); }
.reseau .axe { stroke: var(--accent); stroke-width: 3; }
.reseau .diagonale { stroke: var(--fg); stroke-width: 3; }
.reseau .axe-pointe { fill: var(--accent); }
.reseau .diagonale-pointe { fill: var(--fg); }
.reseau .lib { fill: var(--fg); font-family: var(--serif); font-size: 19px; }
@media print { .landing .pluie { display: none; } .landing .hero { min-height: 0; } }
@media (max-width: 600px) {
  .landing .hero { min-height: 78vh; }
  .reseau .lib { font-size: 32px; }
  .carte .repere { font-size: 26px; }
  .carte .point { stroke-width: 1.5; }
}

.sources-courtes { color: var(--muted); font-size: 0.85rem; }
.facteurs .grille { stroke: var(--line); stroke-width: 1; }
.facteurs .unite { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.facteurs .axe, .facteurs .val { fill: var(--muted); font-family: var(--serif); font-size: 15px; }
.facteurs .lib { fill: var(--fg); font-family: var(--serif); font-size: 16px; }
.facteurs .besoin rect { fill: var(--accent); }
.facteurs .mesure rect { fill: var(--muted); }
.article figure { margin: 24px 0 28px; }
.article figure svg { display: block; width: 100%; height: auto; }
.article figcaption { margin-top: 10px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
@media (max-width: 600px) { .facteurs .lib { font-size: 20px; } .facteurs .axe, .facteurs .val { font-size: 19px; } }
