:root {
  --paper: #fbf9f4;
  --card: #fffefb;
  --fg: #25221e;
  --muted: #6a645a;
  --rule: #e6dfd0;
  --accent: #1f4e79;
  --accent-soft: #e9eff5;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14171b;
    --card: #1a1e23;
    --fg: #e8e6e1;
    --muted: #a09b92;
    --rule: #2c3238;
    --accent: #8fb4dc;
    --accent-soft: #1d2733;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.16rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
.inner, main {
  max-width: 46rem;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* En-tête */
header.top {
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}
header.top .inner {
  padding-top: 1rem;
  padding-bottom: .75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .4rem 2rem;
}
.brand {
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: .01em;
}
.menus { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
header.top nav { display: flex; flex-wrap: wrap; justify-content: flex-end; font-family: var(--sans); }
header.top nav.l1 { gap: .1rem 1.1rem; font-size: .9rem; }
header.top nav.l2 { gap: .1rem .9rem; font-size: .74rem; }
header.top nav a {
  color: var(--muted);
  text-decoration: none;
  padding: .15rem 0;
  border-bottom: 2px solid transparent;
}
header.top nav a:hover { color: var(--fg); border-bottom-color: var(--rule); }
header.top nav a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 40rem) {
  .menus { align-items: flex-start; }
  header.top nav { justify-content: flex-start; }
}

/* Contenu */
main { padding-top: 2.5rem; padding-bottom: 4rem; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1 {
  font-size: 2.1rem;
  line-height: 1.2;
  margin: 0 0 1.1rem;
  letter-spacing: -.01em;
}
h1::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  background: var(--accent);
  margin-top: .8rem;
}
.home h1 { font-size: 2.6rem; font-style: italic; }
h2 {
  font-size: 1.4rem;
  line-height: 1.3;
  margin: 2.8rem 0 .7rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.1rem; margin: 1.8rem 0 .3rem; color: var(--accent); }
.lede { font-size: 1.2rem; color: var(--muted); font-style: italic; margin-top: 0; }
article p > strong:first-child { color: var(--accent); }
ul, ol { padding-left: 1.4rem; }
li { margin: .25rem 0; }
::selection { background: var(--accent-soft); }

/* Sommaire */
.toc {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: .9rem 1.2rem;
  margin: 1.5rem 0 2rem;
  font-family: var(--sans);
  font-size: .88rem;
  line-height: 1.5;
}
.toc ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 2rem; }
.toc ul ul { columns: 1; padding-left: .8rem; }
.toc li { margin: .2rem 0; break-inside: avoid; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
@media (max-width: 36rem) { .toc ul { columns: 1; } }

/* Cartes de la page d'accueil */
.cards {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: .9rem;
}
.cards li { margin: 0; }
.cards a {
  display: block;
  height: 100%;
  padding: .9rem 1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color .15s, transform .15s;
}
.cards a:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-title { display: block; font-weight: 600; color: var(--accent); }
.card-desc { display: block; font-family: var(--sans); font-size: .82rem; line-height: 1.45; color: var(--muted); margin-top: .2rem; }

/* Tableaux, code, citations */
table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: .9rem;
  line-height: 1.5;
  margin: 1.2rem 0;
  background: var(--card);
  border: 1px solid var(--rule);
}
th, td { border-bottom: 1px solid var(--rule); padding: .55rem .7rem; text-align: left; vertical-align: top; }
th { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
@media (max-width: 40rem) { table { display: block; overflow-x: auto; } }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85rem; }
pre {
  overflow-x: auto;
  background: var(--accent-soft);
  border-radius: 6px;
  padding: .9rem 1rem;
  line-height: 1.5;
}
blockquote { margin: 1.2rem 0; padding: .1rem 1rem; border-left: 3px solid var(--accent); color: var(--muted); }

/* Pied de page */
footer { border-top: 1px solid var(--rule); background: var(--card); }
footer .inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .3rem 2rem;
  padding-top: 1.2rem;
  padding-bottom: 1.5rem;
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--muted);
}

/* Débats */
main.large { max-width: 68rem; }
.etroit { max-width: 42rem; }
.cotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr)); gap: 1.1rem; align-items: start; margin: 1rem 0; }
.cotes .contribution { margin: 0; min-width: 0; }
.muted { color: var(--muted); }
.fil { font-family: var(--sans); font-size: .82rem; margin: 0 0 .6rem; }
.meta { font-family: var(--sans); font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; margin: .2rem 0 1rem; }
.badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: .1rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  vertical-align: middle;
}
.badge.s-cours { color: var(--accent); background: var(--accent-soft); }
.badge.s-fin { color: var(--muted); border-color: var(--rule); background: transparent; }
.avis { font-family: var(--sans); font-size: .88rem; background: var(--accent-soft); border-left: 3px solid var(--accent); padding: .7rem 1rem; border-radius: 0 4px 4px 0; }
.telechargements { font-family: var(--sans); font-size: .88rem; }
table.contrat th { width: 7rem; background: transparent; color: var(--muted); }
.debats { list-style: none; padding: 0; display: grid; gap: .8rem; }
.debats li { margin: 0; }
.debats a { display: block; padding: .9rem 1rem; background: var(--card); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 4px; text-decoration: none; color: var(--fg); }
.debats a:hover { border-color: var(--accent); }
.debats .card-title { display: inline; margin-right: .6rem; }
.tour h2 { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.contribution { background: var(--card); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 4px; padding: .2rem 1.1rem .6rem; margin: 1.1rem 0; }
.contribution h3 { margin-top: 1rem; }
.pid { font-family: var(--sans); font-size: .7rem; color: var(--accent); margin-right: .55rem; vertical-align: .1em; }
.commentaire { border-top: 1px solid var(--rule); margin-top: .8rem; padding-top: .3rem; }
.commentaire .cible { font-family: var(--sans); font-size: .8rem; color: var(--muted); margin-bottom: .1rem; }
.qualif { display: inline-block; margin-left: .6rem; padding: .05rem .5rem; border-radius: 3px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.refs { font-family: var(--sans); font-size: .82rem; line-height: 1.5; padding-left: 1.6rem; }
.empreinte { font-family: var(--sans); font-size: .76rem; color: var(--muted); }
.empreintes { font-family: var(--sans); font-size: .85rem; }

@media print {
  header.top, footer, .telechargements, .fil { display: none; }
  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.5; }
  main { max-width: none; padding: 0; }
  .contribution { border-left: 2px solid #444; background: #fff; }
  .cotes { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .cotes .contribution { padding: .1rem .7rem .4rem; font-size: 9.5pt; }
  .commentaire, .refs li { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
  h1::after { display: none; }
}

footer a { color: var(--muted); text-underline-offset: .18em; }
footer a:hover { color: var(--accent); }

/* Passages : titres, listes, source */
.passage { margin: .9rem 0; }
.passage .pid { display: block; margin: 0 0 .1rem; }
.passage h4 { margin: .1rem 0 .3rem; color: var(--accent); font-size: 1rem; line-height: 1.35; }
.passage h4.n1 { font-size: 1.12rem; }
.passage p { margin: .3rem 0; }
.passage ul, .passage ol { margin: .3rem 0; padding-left: 1.3rem; }
details.source { margin: .9rem 0 .4rem; font-family: var(--sans); font-size: .82rem; }
details.source summary { cursor: pointer; color: var(--accent); }
details.source pre { white-space: pre; overflow-x: auto; background: var(--accent-soft); border-radius: 6px; padding: .7rem .9rem; margin: .5rem 0 0; font-size: .78rem; line-height: 1.5; }
@media print {
  details.source::details-content { content-visibility: visible; }
  details.source pre { white-space: pre-wrap; font-size: .68rem; }
}
