/* Altern'info — prototype. Mobile d'abord, sobre, accessible. */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1d21;
  --muted: #565a64;
  --border: #d9dbe0;
  --primary: #2741a8;
  --primary-ink: #ffffff;
  --primary-soft: #e9edfb;
  --focus: #f0a400;
  --ok: #1d6b3a;      --ok-bg: #e2f3e8;
  --wip: #8a5300;     --wip-bg: #fdf0d8;
  --todo: #5b4a9e;    --todo-bg: #ece8f8;
  --protect: #8a1c1c; --protect-bg: #fdeaea; --protect-border: #e2a3a3;
  --mark-bg: #fff3b0; --mark-ink: #5a4500;
  --verify-bg: #ffd9c2; --verify-ink: #6b2600;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1f2026;
    --text: #ececef;
    --muted: #a8acb8;
    --border: #383a44;
    --primary: #9fb2ff;
    --primary-ink: #11131a;
    --primary-soft: #262c47;
    --ok: #8ee0aa;      --ok-bg: #173323;
    --wip: #f5c26b;     --wip-bg: #3a2c12;
    --todo: #c8bcff;    --todo-bg: #2c2645;
    --protect: #ffb4b4; --protect-bg: #3a1c1e; --protect-border: #7a3a3c;
    --mark-bg: #4a3f10; --mark-ink: #ffe98a;
    --verify-bg: #4d2a14; --verify-ink: #ffc9a6;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
.wrap { max-width: 60rem; margin: 0 auto; padding: 0 16px; }
a { color: var(--primary); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.6rem; margin: .6rem 0 .5rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0 0 .25rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: 8px; top: -60px; background: var(--surface); color: var(--text); padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip-link:focus { top: 8px; }

/* En-tête */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-top: 10px; padding-bottom: 6px; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.site-nav { width: 100%; overflow-x: auto; }
.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0 0 4px; white-space: nowrap; }
.site-nav a { display: inline-block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .95rem; }
.site-nav a:hover { color: var(--text); background: var(--bg); }
.site-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.nav-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-left: 2px; vertical-align: middle; }
@media (min-width: 760px) {
  .site-nav { width: auto; margin-left: auto; }
  .site-nav ul { padding: 0; }
}
.proto-banner { background: var(--mark-bg); color: var(--mark-ink); font-size: .85rem; padding: 4px 0; }

main { padding-top: 12px; padding-bottom: 48px; }
main:focus, main h1:focus { outline: none; }
.site-footer { border-top: 1px solid var(--border); padding: 16px 0 32px; font-size: .9rem; }

/* Fil d'Ariane */
.breadcrumb ol { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .875rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-right: 4px; }

/* Badges */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; vertical-align: middle; }
.badge-valide { color: var(--ok); background: var(--ok-bg); }
.badge-en-cours { color: var(--wip); background: var(--wip-bg); }
.badge-a-discuter { color: var(--todo); background: var(--todo-bg); }
.badge-neutral { color: var(--muted); background: var(--bg); border: 1px solid var(--border); }
.badge-grave { color: var(--protect); background: var(--protect-bg); }

/* Marqueurs de contenu provisoire */
mark.todo { background: var(--mark-bg); color: var(--mark-ink); padding: 0 4px; border-radius: 4px; font-size: .9em; }
mark.verify { background: var(--verify-bg); color: var(--verify-ink); padding: 0 4px; border-radius: 4px; font-size: .9em; font-weight: 600; }

/* Cartes */
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
@media (min-width: 600px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .cards.cards-3 { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); height: 100%; }
.card:hover { border-color: var(--primary); }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.card a.stretched { color: var(--text); text-decoration: none; }
.card a.stretched::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card a.stretched:focus-visible { outline: none; }
.card .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card .icon { font-size: 1.4rem; line-height: 1; margin-right: 8px; }
.card p { margin: .35rem 0 0; color: var(--muted); font-size: .925rem; }

/* Sujets dans un thème */
.subject-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.subject-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; position: relative; }
.subject-item:hover { border-color: var(--primary); }
.subject-item:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.subject-item h3 a { color: var(--text); text-decoration: none; }
.subject-item h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.subject-item h3 a:focus-visible { outline: none; }
.subject-item p { margin: .25rem 0 0; font-size: .925rem; color: var(--muted); }
.subject-item .flags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }

.mention-item { border-style: dashed; background: transparent; }
.mention-item .mention-label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.blocks-row { display: grid; gap: 0 24px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .blocks-row.side-by-side { grid-template-columns: 1fr 1fr; } }
.block-aside { background: var(--primary-soft); border-radius: var(--radius); padding: 2px 16px 16px; }
@media (max-width: 819px) { .block-aside { margin-top: 1.5rem; } }

/* Encadrés */
.box { border-radius: var(--radius); padding: 12px 16px; margin: 14px 0; border: 1px solid var(--border); background: var(--surface); }
.box > :first-child { margin-top: 0; }
.box > :last-child { margin-bottom: 0; }
.box-title { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.box-protect { background: var(--protect-bg); border-color: var(--protect-border); }
.box-protect .box-title { color: var(--protect); }
.box-info { background: var(--primary-soft); border-color: transparent; }
.box-note { background: transparent; border-style: dashed; }

.lead { font-size: 1.075rem; }
.level-1 { background: var(--surface); border-left: 4px solid var(--primary); }
.level-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--muted); }

/* Niveaux dépliables */
details.level { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 10px 0; }
details.level > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 48px; }
details.level > summary::-webkit-details-marker { display: none; }
details.level > summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--muted); }
details.level[open] > summary::after { content: "–"; }
details.level > summary .level-label { display: block; }
details.level .level-body { padding: 0 16px 14px; }

/* Encarts conditionnels */
.encart { border-left: 4px solid var(--todo); }
.encart.match { border-left-color: var(--ok); background: var(--ok-bg); }
.encart .who { font-size: .8rem; color: var(--muted); }
details.others { margin: 8px 0; }
details.others > summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: 6px 0; }

/* Renvois */
.renvois { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.renvoi { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.renvoi .where { font-size: .8rem; color: var(--muted); display: block; }
.renvoi a { font-weight: 600; }

/* Boutons et formulaires */
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--primary); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px 16px; margin: 0 0 12px; }
legend { font-weight: 700; padding: 0 4px; }
.radio { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.radio input { width: 20px; height: 20px; accent-color: var(--primary); }
.search { width: 100%; font: inherit; padding: 12px 14px; border-radius: 8px; border: 2px solid var(--border); background: var(--surface); color: var(--text); }
.search:focus { border-color: var(--primary); }
label.field-label { display: block; font-weight: 600; margin-bottom: 6px; }

/* Situations */
.situations { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.situation { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.situation.grave { border-color: var(--protect-border); }
.situation > details > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; min-height: 48px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.situation .situation-body { padding: 0 16px 12px; }

/* Index des droits */
.rights { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rights li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.rights li:last-child { border-bottom: 0; }
.rights .right-label { font-weight: 600; display: block; }
.rights .right-links { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .925rem; }

/* Navigation précédent/suivant */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 2rem; flex-wrap: wrap; }
.pager a { display: block; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; max-width: 100%; }
.pager .dir { display: block; font-size: .8rem; color: var(--muted); }

/* ===== Document interactif ===== */
.idoc-wrap { margin: 16px 0; }
.idoc {
  position: relative;
  margin: 0;
  width: 100%;
  max-width: 640px;
  background: #fff;
  color: #222;
  border: 1px solid #bfc3cc;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  container-type: inline-size;
}
.idoc-layer { position: absolute; inset: 0; }
.idoc-el { position: absolute; display: flex; align-items: flex-start; padding: .8cqw 1.2cqw; overflow: hidden; font-size: 2.3cqw; line-height: 1.25; }
.idoc-el.st-titre { font-weight: 800; font-size: 3.6cqw; align-items: center; justify-content: center; border-bottom: 2px solid #222; }
.idoc-el.st-sous-titre { font-weight: 700; font-size: 2.8cqw; }
.idoc-el.st-note { font-style: italic; color: #8a1c1c; font-size: 2cqw; justify-content: center; align-items: center; }
.idoc-el.st-section { border: 1px solid #555; font-weight: 700; background: repeating-linear-gradient(to bottom, transparent 0 4.4cqw, #e4e6ea 4.4cqw calc(4.4cqw + 1px)); }
.idoc-el.st-champ { border: 1px solid #888; color: #555; }
.idoc-el.st-entete { background: #e9ebef; font-weight: 700; border: 1px solid #888; white-space: pre; align-items: center; }
.idoc-el.st-ligne { border-bottom: 1px dotted #999; align-items: center; justify-content: space-between; }
.idoc-el.st-ligne::after, .idoc-el.st-total::after { content: "x xxx,xx"; color: #999; font-family: ui-monospace, monospace; }
.idoc-el.st-total { font-weight: 800; background: #f1f2f4; border-top: 1px solid #555; align-items: center; justify-content: space-between; }
.idoc-mockup-img { width: 100%; height: 100%; object-fit: contain; display: block; }

.idoc-zone {
  position: absolute;
  margin: 0; padding: 0;
  border: 2px dashed rgba(39, 65, 168, .55);
  background: rgba(39, 65, 168, .06);
  border-radius: 3px;
  cursor: pointer;
  color: transparent;
}
.idoc-zone:hover { background: rgba(39, 65, 168, .16); border-style: solid; }
.idoc-zone:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; background: rgba(240, 164, 0, .18); }
.idoc-zone[aria-expanded="true"] { background: rgba(240, 164, 0, .25); border: 2px solid #c27c00; }
.idoc-zone .zone-num {
  position: absolute; top: -1px; right: -1px;
  background: #2741a8; color: #fff; font: 700 11px/1 system-ui, sans-serif;
  padding: 3px 5px; border-radius: 0 2px 0 4px;
}

.idoc-bubble {
  position: absolute;
  z-index: 10;
  width: min(320px, 90%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  padding: 12px 14px;
  font-size: .95rem;
}
.idoc-bubble h3 { padding-right: 32px; }
.idoc-bubble .close { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border: 0; background: transparent; color: var(--text); font-size: 1.4rem; cursor: pointer; border-radius: 6px; }
.idoc-bubble .close:hover { background: var(--bg); }
@media (max-width: 599px) {
  .idoc-bubble {
    position: fixed; left: 8px !important; right: 8px; bottom: 8px; top: auto !important;
    width: auto; max-height: 50vh; overflow: auto;
  }
}
.zone-list { padding-left: 1.4rem; }
.zone-list button { background: none; border: 0; padding: 4px 0; color: var(--primary); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; min-height: 32px; }

/* Vérificateur */
.check-ok { color: var(--ok); font-weight: 600; }
.check-list li { margin: 4px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875em; background: var(--bg); border: 1px solid var(--border); padding: 0 4px; border-radius: 4px; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
.nav-dot[hidden] { display: none; }
.idoc-el.st-ligne, .idoc-el.st-total { padding-right: 5cqw; }
