/* Registre 2027 — feuille de style unique, sans police ni ressource externe. */
:root {
  --paper: #ffffff;
  --paper-alt: #f5f6f7;
  --ink: #15181d;
  --ink-soft: #4b515a;
  --ink-faint: #666d76;
  --rule: #d9dde2;
  --rule-strong: #a7aeb7;
  --accent: #1f3b5c;
  --accent-ink: #14283f;
  --max: 46rem;
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --space-6: 3.5rem;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, .brand, .num {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem); margin: 0 0 var(--space-3); }
h2 { font-size: clamp(1.3rem, 1.15rem + 0.7vw, 1.6rem); margin: var(--space-6) 0 var(--space-2);
     padding-bottom: var(--space-1); border-bottom: 1px solid var(--rule); }
h3 { font-size: 1.05rem; margin: 0 0 var(--space-1); }
p { margin: 0 0 var(--space-3); max-width: 68ch; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-ink); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.95em;
       background: var(--paper-alt); padding: 0.1em 0.3em; border-radius: 3px; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--space-4); }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
        padding: var(--space-2) var(--space-3); z-index: 10; }
.skip:focus { left: var(--space-3); top: var(--space-3); }

.site-head { border-bottom: 1px solid var(--rule); padding-top: var(--space-5); }
.site-head .brand { margin: 0; font-size: 1.15rem; letter-spacing: 0.04em;
                    text-transform: uppercase; }
.site-head .brand a { color: var(--ink); text-decoration: none; }
.site-head .tagline { margin: 0.15rem 0 var(--space-3); color: var(--ink-soft);
                      font-size: 0.95rem; }
.nav { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4);
       margin: 0; padding: 0 0 var(--space-1); border-bottom: 0; }
.nav li { margin: 0; }
.nav a { display: inline-block; padding: 0.4rem 0; text-decoration: none; color: var(--ink-soft);
         border-bottom: 2px solid transparent; font-size: 0.95rem; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent);
                              font-weight: 600; }

main { padding-block: var(--space-5); }
.lead { font-size: 1.125rem; color: var(--ink-soft); }

.facts, .dires, .scrutins-brief, .rules { list-style: none; margin: 0; padding: 0; }
.facts { display: grid; gap: var(--space-3); }
.fact { border: 1px solid var(--rule); border-left: 3px solid var(--accent);
        padding: var(--space-3) var(--space-4); background: var(--paper); }
.fact .period { color: var(--ink-faint); font-family: inherit; font-size: 0.85rem;
                font-weight: 400; letter-spacing: 0; }
.figure { margin: 0.2rem 0 var(--space-2); }
.num { font-size: clamp(1.6rem, 1.3rem + 1.3vw, 2.1rem); font-variant-numeric: tabular-nums;
       display: inline-block; overflow-wrap: anywhere; }
.meth { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: var(--space-1); }
.sources { color: var(--ink-soft); font-size: 0.85rem; margin: 0; overflow-wrap: anywhere; }
.license { display: block; margin-top: 0.15rem; color: var(--ink-faint); }
.note { color: var(--ink-soft); font-size: 0.95rem; }
.latest { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.latest li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.9rem;
             border-bottom: 1px solid var(--rule); padding: 0.5rem 0; }
.latest .period { color: var(--ink-faint); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.latest .val { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.latest .src { font-size: 0.8rem; }
.more { margin-top: var(--space-3); }
.empty { border: 1px dashed var(--rule-strong); background: var(--paper-alt);
         color: var(--ink-soft); padding: var(--space-3); font-size: 0.95rem; }

.dires { display: grid; gap: var(--space-4); }
.dire { border-top: 1px solid var(--rule); padding-top: var(--space-3); }
.verbatim { margin: 0 0 var(--space-2); padding-left: var(--space-3);
            border-left: 2px solid var(--rule-strong); }
.verbatim p { font-family: Georgia, "Times New Roman", serif; font-size: 1.1rem; margin: 0 0 var(--space-1); }
.verbatim footer { color: var(--ink-soft); font-size: 0.9rem; }
.verbatim .party { color: var(--ink-faint); }
.claim { color: var(--ink-soft); font-size: 0.9rem; }
.verdict { margin: 0 0 var(--space-1); }
.verdict-label { display: inline-block; border: 1px solid var(--ink); padding: 0.15rem 0.55rem;
                 font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
                 font-weight: 600; }
.verdict-na .verdict-label { border-style: dashed; font-weight: 500; }
.verdict-detail { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: var(--space-1); }
.verdict-text { color: var(--ink); font-size: 0.95rem; }
.pending-note { color: var(--ink-soft); font-size: 0.9rem; border-left: 2px solid var(--rule);
                padding-left: var(--space-2); }

.scrutins-brief { display: grid; gap: var(--space-1); }
.scrutins-brief li { display: flex; flex-wrap: wrap; gap: 0.2rem 0.75rem; border-bottom: 1px solid var(--rule); padding: 0.5rem 0; }
.scrutins-brief .date { color: var(--ink-faint); font-size: 0.85rem; min-width: 9rem; }
.scrutins-brief .sort { color: var(--ink-soft); font-size: 0.85rem; }

.facts-table th[scope="row"] { font-weight: 500; text-align: left; vertical-align: top; }
.facts-table .row-meth { display: block; margin-top: 0.2rem; max-width: 52ch;
                         font-size: 0.78rem; font-weight: 400; line-height: 1.35;
                         color: var(--ink-faint); }
.facts-table td.val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts-table tbody tr:last-child th, .facts-table tbody tr:last-child td { border-bottom: 0; }
.ind-source { margin: 0 0 var(--space-5); color: var(--ink-soft); font-size: 0.85rem; }
.scrutins-list { min-width: 34rem; }
.scrutins-list thead th { white-space: normal; }
/* largeurs fixes pour les colonnes courtes : tout l'espace restant va à l'intitulé */
.scrutins-list thead th:nth-child(1) { width: 8.5rem; }
.scrutins-list thead th:nth-child(3) { width: 6.5rem; }
.scrutins-list thead th:nth-child(n + 4) { width: 6.5rem; }
.scrutins-list td:nth-child(2) { min-width: 20rem; }
/* pages de données : colonne plus large, les intitulés parlementaires sont longs */
.page-chiffres .wrap { max-width: 52rem; }
.page-votes .wrap { max-width: 60rem; }
.scrutins-list td { vertical-align: top; }
.scrutins-list td:nth-child(1) { color: var(--ink-soft); }
/* seul le texte reste à gauche ; les compteurs sont alignés à droite et insécables */
.scrutins-list td:nth-child(2) { text-align: left; }
.scrutins-list td:nth-child(3) { white-space: nowrap; color: var(--ink-soft); }
.scrutins-list td:nth-child(n + 4) { text-align: right; white-space: nowrap;
                                     font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin: 0 0 var(--space-4); border: 1px solid var(--rule); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
caption { caption-side: top; text-align: left; padding: var(--space-2) var(--space-3);
          font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--rule); }
th, td { padding: 0.45rem var(--space-3); text-align: left; border-bottom: 1px solid var(--rule); }
thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
           color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
tbody th { font-weight: 500; }
td:not(:first-child), th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
tr.total th, tr.total td { font-weight: 600; border-top: 2px solid var(--rule-strong);
                           border-bottom: 0; }
.scrutin { margin-bottom: var(--space-4); }
.scrutin .ref { color: var(--ink-soft); font-size: 0.9rem; }

.rules { display: grid; gap: var(--space-1); padding-left: 1.1rem; list-style: disc; }
.rules li { max-width: 68ch; }

.site-foot { border-top: 1px solid var(--rule); margin-top: var(--space-6);
             padding-block: var(--space-4); color: var(--ink-soft); font-size: 0.88rem; }
.site-foot p { margin-bottom: var(--space-1); }

@media (min-width: 40rem) {
  .facts { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
  .facts .fact { display: flex; flex-direction: column; }
  /* Nombre impair de chiffres : la dernière carte occupe toute la largeur,
     chiffre à droite, commentaire à gauche (évite une carte vide à droite). */
  .facts .fact:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--space-4);
    align-items: start;
  }
  .facts .fact:last-child:nth-child(odd) .figure { grid-column: 2; grid-row: 1 / span 3;
    margin: 0; align-self: center; }
}
@media (max-width: 40rem) {
  /* petit écran : chaque scrutin devient un bloc lisible, pas de défilement latéral */
  .scrutins-list { min-width: 0; border: 0; }
  .scrutins-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden;
                         clip-path: inset(50%); white-space: nowrap; }
  .scrutins-list, .scrutins-list tbody, .scrutins-list tr, .scrutins-list td { display: block; }
  .scrutins-list tr { border-bottom: 1px solid var(--rule); padding: var(--space-2) 0; }
  .scrutins-list td { border: 0; padding: 0.1rem 0; text-align: left !important; white-space: normal; }
  .scrutins-list td::before { content: attr(data-label) " : "; color: var(--ink-faint);
                              font-size: 0.8rem; }
  .scrutins-list td:nth-child(n + 2) { display: inline-block; margin-right: 0.9rem; }
  .scrutins-list td:nth-child(n + 2)::before { content: attr(data-label) " "; }
  .scrutins-list td:nth-child(2) { display: block; margin-right: 0; }
}
@media (max-width: 24rem) {
  .wrap { padding-inline: var(--space-3); }
  h1 { font-size: 1.6rem; }
  .num { font-size: 1.5rem; }
  .scrutins-brief .date { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --- Programmes des partis --- */
.parties { display: grid; gap: var(--space-5); }
.party { padding-top: var(--space-3); border-top: 1px solid var(--rule); }
.party:first-child { border-top: 0; padding-top: 0; }
.party h2 { margin-bottom: var(--space-1); }
.party-status { margin: 0 0 var(--space-1); color: var(--ink-soft); }
.party-note { margin: 0 0 var(--space-3); color: var(--ink-faint); font-size: 0.94rem; }
.doc { border-left: 3px solid var(--rule); padding-left: var(--space-3);
       margin-bottom: var(--space-4); }
.doc h3 { font-size: 1.05rem; margin: 0 0 var(--space-1); }
.doc-meta { margin: 0 0 var(--space-1); color: var(--ink-faint); font-size: 0.86rem; }
.doc .src { font-size: 0.9rem; }
.theme-label { margin: var(--space-3) 0 var(--space-1); font-size: 0.82rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint);
  font-family: "Segoe UI", system-ui, sans-serif; font-weight: 700; }
.extracts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.extract { margin: 0; }
.extract .verbatim { border-left: 3px solid var(--rule-strong); background: var(--paper-alt);
  padding: var(--space-1) var(--space-2); }
.nowrap { white-space: nowrap; }
.extract-loc { margin: 0 0 0 var(--space-3); color: var(--ink-soft); font-size: 0.84rem; }
.no-bullet { list-style: none; padding-left: 0; }
.parties-empty { padding-left: var(--space-4); }
.parties-empty li { margin-bottom: var(--space-1); }
.party-toc { margin: 0 0 var(--space-4); }
.party-toc ul { list-style: none; margin: 0; padding: 0; display: flex;
  flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
.party-toc .doc-meta { margin: 0 0 var(--space-1); text-transform: uppercase;
  letter-spacing: 0.06em; }
.sha { font-family: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", monospace;
  font-size: 0.8rem; word-break: break-all; }
.sha-full summary { cursor: pointer; color: var(--ink-faint); font-size: 0.82rem;
  margin-bottom: var(--space-1); }
.sha-full p { margin: 0 0 var(--space-2); color: var(--ink-faint); }
.doc-noextract { border-left-color: transparent; padding-left: var(--space-3); }
.doc-noextract .doc-meta { margin-bottom: var(--space-1); }
/* --- Onglets (CSS pur, sans JavaScript : radios masquées + labels frères) --- */
.tabs { margin: 0 0 var(--space-4); }
.tab-input { position: absolute; opacity: 0; width: 1px; height: 1px;
             pointer-events: none; }
.tab-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 var(--space-4);
            border-bottom: 2px solid var(--rule); padding-bottom: 0; }
.tab { cursor: pointer; display: inline-flex; align-items: center; gap: 0.45rem;
       padding: 0.55rem 0.9rem; font-size: 0.92rem; color: var(--ink-soft);
       border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0;
       margin-bottom: -2px; background: transparent; line-height: 1.2; }
.tab:hover { color: var(--ink); background: var(--paper-alt); }
.tab { min-height: 3.6rem; }
.tab-count { font-size: 0.78rem; color: var(--ink-faint); background: var(--paper-alt);
             border-radius: 999px; padding: 0.05rem 0.4rem; font-variant-numeric: tabular-nums; }
/* tous les onglets d'un groupe restent listés (un seul groupe de radios : le premier
   panneau est toujours le premier parti, le masquage se fait panneau par panneau) */
.tab-panel { display: none; padding-top: var(--space-3); }

/* Onglets principaux : un par parti, avec vignette */
.tabs-top { display: grid; grid-template-areas: "tabs" "panels"; }
.tabs-top > .tab-list { grid-area: tabs; gap: 0.5rem; }
.tabs-top > .tab-panel { grid-area: panels; }
.tab-party { flex-direction: column; gap: 0.35rem; padding: 0.6rem 0.75rem;
             min-width: 6.5rem; text-align: center; }
.tab-party .tab-name { font-size: 0.8rem; line-height: 1.15; }
.emblem { display: block; width: 40px; height: 40px; border-radius: 7px; }

/* Onglets de documents à l'intérieur d'un parti */
.party .tabs { margin-top: var(--space-3); }
.party .tab-list { gap: 0.25rem; }
.party .tab { font-size: 0.85rem; padding: 0.45rem 0.7rem; max-width: 100%; }
.party .tab-count { font-size: 0.72rem; }

/* État actif : le radio est le premier enfant. nth-of-type compte par type de balise
   (les radios sont des INPUT, les panneaux des DIV), donc le k-ième panneau visible
   est bien le radio k :checked. L'ordre du document est garanti par le générateur. */
.tabs > .tab-input:nth-of-type(1):checked ~ .tab-list .tab:nth-of-type(1),
.tabs > .tab-input:nth-of-type(2):checked ~ .tab-list .tab:nth-of-type(2),
.tabs > .tab-input:nth-of-type(3):checked ~ .tab-list .tab:nth-of-type(3),
.tabs > .tab-input:nth-of-type(4):checked ~ .tab-list .tab:nth-of-type(4),
.tabs > .tab-input:nth-of-type(5):checked ~ .tab-list .tab:nth-of-type(5),
.tabs > .tab-input:nth-of-type(6):checked ~ .tab-list .tab:nth-of-type(6) {
  color: var(--ink); background: var(--paper-alt); border-color: var(--rule);
  border-bottom: 3px solid var(--accent); font-weight: 600; }
.tabs > .tab-input:nth-of-type(1):checked ~ .tab-list .tab:nth-of-type(1) .tab-count,
.tabs > .tab-input:nth-of-type(2):checked ~ .tab-list .tab:nth-of-type(2) .tab-count,
.tabs > .tab-input:nth-of-type(3):checked ~ .tab-list .tab:nth-of-type(3) .tab-count,
.tabs > .tab-input:nth-of-type(4):checked ~ .tab-list .tab:nth-of-type(4) .tab-count,
.tabs > .tab-input:nth-of-type(5):checked ~ .tab-list .tab:nth-of-type(5) .tab-count,
.tabs > .tab-input:nth-of-type(6):checked ~ .tab-list .tab:nth-of-type(6) .tab-count {
  background: var(--accent); color: #fff; }
/* Panneaux : nth-of-type compte les DIV, donc le premier panneau est :nth-of-type(2)
   (le .tab-list est le DIV n°1) et le k-ième est :nth-of-type(k+1).
   On ne lie volontairement PAS le radio au panneau par un sélecteur conditionnel
   fragile : on utilise :has() sur un état global par bloc. */
.tabs:has(> .tab-input:nth-of-type(1):checked) > .tab-panel:nth-of-type(2),
.tabs:has(> .tab-input:nth-of-type(2):checked) > .tab-panel:nth-of-type(3),
.tabs:has(> .tab-input:nth-of-type(3):checked) > .tab-panel:nth-of-type(4),
.tabs:has(> .tab-input:nth-of-type(4):checked) > .tab-panel:nth-of-type(5),
.tabs:has(> .tab-input:nth-of-type(5):checked) > .tab-panel:nth-of-type(6),
.tabs:has(> .tab-input:nth-of-type(6):checked) > .tab-panel:nth-of-type(7) { display: block; }
.tabs > .tab-input:focus-visible ~ .tab-list .tab { outline: 3px solid var(--accent);
  outline-offset: 2px; }

/* --- Programmes : en-tête de parti avec vignette --- */
.party { border: 1px solid var(--rule); border-radius: 10px; background: var(--paper);
         padding: var(--space-4) var(--space-4) var(--space-3); }
.party-head { display: flex; gap: var(--space-3); align-items: flex-start;
              margin-bottom: var(--space-2); }
.party-head .emblem { width: 64px; height: 64px; border-radius: 9px; flex: 0 0 auto; }
.party-id { min-width: 0; }
.party-id h2 { margin: 0 0 0.15rem; font-size: 1.3rem; border-bottom: 0; padding-bottom: 0; }
.party-status { margin: 0 0 0.15rem; color: var(--ink-soft); font-size: 0.94rem; }
.party-count { margin: 0; color: var(--ink-faint); font-size: 0.82rem;
               text-transform: uppercase; letter-spacing: 0.05em; }
.parties { display: grid; gap: var(--space-4); }

@media (max-width: 34rem) {
  .tabs-top > .tab-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
                          border-bottom: 1px solid var(--rule); }
  .tab-party { min-width: 0; }
  .tab-party .tab-name { font-size: 0.72rem; }
  .party { padding: var(--space-3); }
  .party-head .emblem { width: 48px; height: 48px; }
  .party .tab-list { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .party .tab { white-space: nowrap; }
}
