/* RC-Structura — le site. Une feuille, sans dépendance externe.
   Les couleurs reprennent celles des plans de l'application :
   vert des barres, rouge des cadres, encre noire sur papier. */

:root {
  --papier: #f6f5f1;
  --surface: #ffffff;
  --encre: #17191c;
  --sourdine: #5a6068;
  --trait: #d9d6cd;
  --trait-fort: #b9b5aa;
  --bleu: #1f4e79;
  --bleu-clair: #e6eef6;
  --vert: #1a7a37;
  --vert-clair: #e5f2e8;
  --rouge: #b42318;
  --rouge-clair: #fbe9e7;
  --ambre: #8a5a00;
  --ambre-clair: #fdf1d8;
  --feuille: #ffffff;          /* fond des dessins, clair dans les deux thèmes */
  --ombre: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .05);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --papier: #121417;
    --surface: #1a1d21;
    --encre: #e8e9eb;
    --sourdine: #a0a6ae;
    --trait: #2e3238;
    --trait-fort: #454a52;
    --bleu: #8fb8e3;
    --bleu-clair: #1b2a3a;
    --vert: #6cc785;
    --vert-clair: #16291c;
    --rouge: #f08a7e;
    --rouge-clair: #35191a;
    --ambre: #e8b960;
    --ambre-clair: #33270f;
    --feuille: #f4f2ec;
    --ombre: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --papier: #121417; --surface: #1a1d21; --encre: #e8e9eb; --sourdine: #a0a6ae;
  --trait: #2e3238; --trait-fort: #454a52; --bleu: #8fb8e3; --bleu-clair: #1b2a3a;
  --vert: #6cc785; --vert-clair: #16291c; --rouge: #f08a7e; --rouge-clair: #35191a;
  --ambre: #e8b960; --ambre-clair: #33270f; --feuille: #f4f2ec;
  --ombre: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 16px/1.6 var(--sans);
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--bleu); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); margin: 0 0 .75rem; }
h3 { font-size: 1.15rem; margin: 0 0 .4rem; }
p { margin: 0 0 1rem; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.conteneur { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .conteneur { padding: 0 28px; } }

/* --- En-tête ---------------------------------------------------------- */
.entete {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--papier) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--trait);
}
.entete .conteneur { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.marque { display: flex; align-items: center; gap: 10px; color: var(--encre); text-decoration: none; font-weight: 700; letter-spacing: .01em; }
.marque img { width: 32px; height: 32px; border-radius: 7px; }
.marque small { font-weight: 500; color: var(--sourdine); font-size: .78rem; border: 1px solid var(--trait-fort); border-radius: 4px; padding: 0 5px; }
.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--encre); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .95rem; }
.nav a:hover { background: var(--surface); }
.nav a[aria-current="page"] { color: var(--bleu); font-weight: 600; box-shadow: inset 0 -2px 0 var(--bleu); border-radius: 0; }
.langues { display: flex; gap: 0; border: 1px solid var(--trait-fort); border-radius: 6px; overflow: hidden; font-size: .85rem; }
.langues a, .langues span { padding: 3px 9px; text-decoration: none; color: var(--sourdine); }
.langues span { background: var(--encre); color: var(--papier); font-weight: 600; }
@media (max-width: 719px) {
  .entete .conteneur { gap: 6px 12px; padding-top: 8px; padding-bottom: 6px; }
  .nav { order: 3; width: 100%; margin-left: -10px; }
  .langues { margin-left: auto; }
  html { scroll-padding-top: 120px; }
}

/* --- Sections ----------------------------------------------------------- */
section { padding: 56px 0; }
section + section { border-top: 1px solid var(--trait); }
.surtitre { font: 600 .78rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--sourdine); margin-bottom: .6rem; }
.chapo { font-size: 1.15rem; color: var(--sourdine); max-width: 70ch; }
.etroit { max-width: 72ch; }

.hero { padding: 64px 0 40px; }
.hero h1 span { color: var(--vert); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 8px; }
.bouton {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 8px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--encre); color: var(--encre); background: transparent;
}
.bouton.plein { background: var(--encre); color: var(--papier); }
.bouton.plein:hover { background: var(--bleu); border-color: var(--bleu); }
.bouton:hover { text-decoration: none; border-color: var(--bleu); color: var(--bleu); }
.bouton.plein:hover { color: var(--papier); }
.bouton small { font-weight: 400; opacity: .8; white-space: nowrap; }
.bouton { flex-wrap: wrap; }
.codes-ligne { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* --- Feuille de dessin (fond clair dans les deux thèmes) --------------- */
.feuille {
  background: var(--feuille); color: #17191c;
  border: 1px solid var(--trait-fort); border-radius: 6px;
  box-shadow: var(--ombre);
  margin: 0;
}
.feuille .defile { overflow-x: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.feuille .defile img { display: block; max-width: none; }
.feuille .large img { width: 1180px; }
.feuille figcaption, figure.capture figcaption {
  font-size: .85rem; color: #4d535b; border-top: 1px solid #ddd9cf; padding: 8px 12px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
figure.capture { margin: 0; border: 1px solid var(--trait-fort); border-radius: 6px; overflow: hidden; background: var(--surface); box-shadow: var(--ombre); }
figure.capture img { display: block; width: auto; max-width: 100%; }
.partie figure.capture { width: fit-content; max-width: 100%; }
figure.capture figcaption { color: var(--sourdine); border-top-color: var(--trait); }
.cartouche { font-family: var(--mono); font-size: .75rem; color: #6a6f76; }

/* --- La chaîne ---------------------------------------------------------- */
.chaine { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(5, 1fr); counter-reset: etape; }
.chaine li {
  background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; padding: 16px 14px 14px;
  position: relative; counter-increment: etape;
}
.chaine li::before { content: counter(etape, decimal-leading-zero); font: 600 .8rem var(--mono); color: var(--vert); display: block; margin-bottom: 6px; }
.chaine li:not(:last-child)::after {
  content: ""; position: absolute; right: -10px; top: 50%; width: 8px; height: 8px;
  border-top: 2px solid var(--trait-fort); border-right: 2px solid var(--trait-fort); transform: translateY(-50%) rotate(45deg);
}
.chaine strong { display: block; margin-bottom: 4px; }
.chaine p { font-size: .9rem; color: var(--sourdine); margin: 0; }
@media (max-width: 900px) {
  .chaine { grid-template-columns: 1fr; }
  .chaine li:not(:last-child)::after { right: 50%; top: auto; bottom: -10px; transform: translateX(50%) rotate(135deg); }
}

/* --- Grilles et cartes ------------------------------------------------- */
.grille { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grille.deux { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 28px; align-items: start; }
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; padding: 20px; }
.carte h3 { margin-bottom: .5rem; }
.carte p:last-child, .carte ul:last-child { margin-bottom: 0; }
.chiffres { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); margin: 24px 0; }
.chiffre { border-left: 3px solid var(--vert); padding: 4px 0 4px 14px; }
.chiffre b { display: block; font: 700 2rem/1.1 var(--mono); }
.chiffre span { color: var(--sourdine); font-size: .9rem; }

ul.coches { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.coches li { padding-left: 1.5em; position: relative; margin-bottom: .35rem; }
ul.coches li::before { content: ""; position: absolute; left: .2em; top: .55em; width: .6em; height: .32em; border-left: 2px solid var(--vert); border-bottom: 2px solid var(--vert); transform: rotate(-45deg); }
ul.tirets li::marker { color: var(--sourdine); }

/* Pastilles de règlement */
.pastille { display: inline-block; font: 600 .74rem/1 var(--mono); padding: 5px 8px; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; }
.p-bael { color: #1f4e79; } .p-aci { color: #8a3b00; } .p-ec2 { color: #186a3b; }
.p-ec8 { color: #6b2c91; } .p-ps92 { color: #7a1f3d; } .p-meca { color: #4a4f57; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .p-bael { color: #8fb8e3; } :root:not([data-theme="light"]) .p-aci { color: #f0a46b; }
  :root:not([data-theme="light"]) .p-ec2 { color: #74d197; } :root:not([data-theme="light"]) .p-ec8 { color: #c9a0e8; }
  :root:not([data-theme="light"]) .p-ps92 { color: #ec93ae; } :root:not([data-theme="light"]) .p-meca { color: #b5bac1; }
}

/* --- Éléments (page Application) -------------------------------------- */
.element { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); padding: 36px 0; border-top: 1px solid var(--trait); }
.element:first-of-type { border-top: 0; }
@media (min-width: 900px) { .element.avec-image { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.element h3 { font-size: 1.35rem; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.element h3 .mono { color: var(--vert); font-size: .9rem; }
.par-code { display: grid; gap: 8px; margin: 12px 0; }
.par-code div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; font-size: .94rem; }
.par-code .pastille { justify-self: start; }
.horschamp { font-size: .9rem; color: var(--sourdine); border-left: 3px solid var(--trait-fort); padding-left: 12px; }

/* --- Tableaux ---------------------------------------------------------- */
.tableau { overflow-x: auto; border: 1px solid var(--trait); border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--trait); vertical-align: top; }
th { font-weight: 600; background: color-mix(in srgb, var(--surface) 70%, var(--papier)); font-size: .82rem; color: var(--sourdine); text-transform: none; }
tbody tr:last-child td { border-bottom: 0; }
td.nb, th.nb { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.matrice td:not(:first-child), .matrice th:not(:first-child) { text-align: center; }
.oui { color: var(--vert); font-weight: 600; }
.non { color: var(--rouge); font-weight: 600; }
.partiel { color: var(--ambre); font-weight: 600; }

/* --- Vérification ------------------------------------------------------ */
.filtres { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.filtres button {
  font: 500 .88rem var(--sans); padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--trait-fort); background: var(--surface); color: var(--encre);
}
.filtres button[aria-pressed="true"] { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.filtres button .compte { font-family: var(--mono); opacity: .7; margin-left: 4px; }

.exemples { display: grid; gap: 12px; }
details.exemple { background: var(--surface); border: 1px solid var(--trait); border-radius: 8px; }
details.exemple > summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  display: grid; grid-template-columns: 44px 96px 1fr auto; gap: 12px; align-items: center;
}
details.exemple > summary::-webkit-details-marker { display: none; }
details.exemple > summary .no { font: 700 1rem var(--mono); color: var(--sourdine); }
details.exemple > summary .titre { font-weight: 600; }
details.exemple > summary .titre small { display: block; font-weight: 400; color: var(--sourdine); font-size: .85rem; }
details.exemple > summary .ouvrir { width: 10px; height: 10px; border-right: 2px solid var(--sourdine); border-bottom: 2px solid var(--sourdine); transform: rotate(45deg); transition: transform .15s; margin-right: 6px; }
details.exemple[open] > summary .ouvrir { transform: rotate(-135deg); }
details.exemple[open] > summary { border-bottom: 1px solid var(--trait); }
@media (max-width: 640px) {
  details.exemple > summary { grid-template-columns: 34px 1fr auto; }
  details.exemple > summary .pastille { grid-column: 2; grid-row: 2; justify-self: start; }
}
.corps { padding: 16px; display: grid; gap: 14px; }
.corps .source { font-size: .9rem; }
.corps .source b { color: var(--sourdine); font-weight: 600; }
.verdicts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.verdict { border: 1px solid var(--trait); border-radius: 6px; padding: 10px 12px; font-size: .9rem; }
.verdict b { display: block; font: 600 .75rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--sourdine); margin-bottom: 2px; }
.liens-constats a { font-family: var(--mono); font-size: .85rem; margin-right: 6px; }
.corps table td:first-child { width: 50%; }
.ecart { color: var(--sourdine); font-size: .82rem; }

.genre { display: inline-block; font-size: .75rem; padding: 2px 7px; border-radius: 4px; white-space: nowrap; font-weight: 600; }
.g-insecurite { background: var(--rouge-clair); color: var(--rouge); }
.g-texte { background: var(--bleu-clair); color: var(--bleu); }
.g-silence { background: var(--ambre-clair); color: var(--ambre); }
.g-prudence { background: var(--vert-clair); color: var(--vert); }
.g-autre { background: color-mix(in srgb, var(--trait) 60%, transparent); color: var(--sourdine); }
.etat { font-size: .82rem; white-space: nowrap; }
.etat.corrige { color: var(--vert); } .etat.dit { color: var(--ambre); }
.constats td:nth-child(1) { font-family: var(--mono); white-space: nowrap; }
.constats td:nth-child(2) { white-space: nowrap; }
tr:target, details:target { outline: 2px solid var(--bleu); outline-offset: -2px; }

/* --- Bêta --------------------------------------------------------------- */
.etapes { counter-reset: e; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.etapes > li { counter-increment: e; display: grid; grid-template-columns: 40px 1fr; gap: 14px; }
.etapes > li::before { content: counter(e); font: 700 1rem var(--mono); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--vert); color: var(--vert); }
.etapes > li p:last-child { margin-bottom: 0; }
.encadre { border: 1px solid var(--trait-fort); border-left: 4px solid var(--ambre); background: var(--surface); padding: 14px 16px; border-radius: 6px; }
.encadre.vert { border-left-color: var(--vert); }
.telechargement { display: grid; gap: 14px; }
.empreinte { font: .78rem/1.4 var(--mono); word-break: break-all; color: var(--sourdine); }
pre { background: var(--surface); border: 1px solid var(--trait); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font: .85rem/1.5 var(--mono); margin: 0 0 1rem; }
dl.faq dt { font-weight: 600; margin-top: 1rem; }
dl.faq dd { margin: .25rem 0 0; color: var(--sourdine); }

/* --- Pied --------------------------------------------------------------- */
.pied { border-top: 1px solid var(--trait); padding: 28px 0 40px; font-size: .85rem; color: var(--sourdine); }
.titre-plan { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); border: 1px solid var(--trait-fort); border-radius: 4px; }
.titre-plan div { padding: 10px 12px; border-right: 1px solid var(--trait); }
.titre-plan div:last-child { border-right: 0; }
.titre-plan b { display: block; font: 600 .7rem var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--sourdine); margin-bottom: 2px; }
.titre-plan span { color: var(--encre); }
.pied p { margin: 14px 0 0; max-width: 90ch; }

.sauter { position: absolute; left: -9999px; }
.sauter:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 20; }
:focus-visible { outline: 2px solid var(--bleu); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* --- Guide ---------------------------------------------------------------- */
.guide { display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); padding-bottom: 40px; }
@media (min-width: 1000px) { .guide { grid-template-columns: 220px minmax(0, 1fr); } }
.sommaire { font-size: .92rem; }
.sommaire b { display: block; font: 600 .75rem var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--sourdine); margin-bottom: 6px; }
.sommaire ol { margin: 0; padding-left: 1.3em; }
.sommaire li { margin: 3px 0; }
.sommaire a { color: var(--encre); text-decoration: none; }
.sommaire a:hover { color: var(--bleu); text-decoration: underline; }
@media (min-width: 1000px) { .sommaire { position: sticky; top: 80px; align-self: start; } }
@media (max-width: 999px) { .sommaire { border: 1px solid var(--trait); border-radius: 8px; padding: 14px 16px; background: var(--surface); } }
.guide-corps { max-width: 78ch; }
.partie { padding: 28px 0; border-top: 1px solid var(--trait); }
.partie:first-child { border-top: 0; padding-top: 0; }
.partie h3 { margin-top: 1.4rem; }
.partie ol, .partie ul { padding-left: 1.3em; }
.partie li { margin-bottom: .35rem; }
.partie figure { margin: 18px 0; }
.partie .tableau { margin: 10px 0 14px; }

@media print {
  .entete, .pied, .sommaire, .actions, .sauter { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  section, .partie { padding: 12px 0; border: 0; }
  .partie { break-before: page; }
  .partie:first-child { break-before: auto; }
  figure { break-inside: avoid; box-shadow: none; }
  a { color: inherit; text-decoration: none; }
  .guide { display: block; }
  .guide-corps { max-width: none; }
}
