/**
 * L'Assemblée — identité visuelle dédiée (institutionnelle, ≠ charte Almanach).
 * Scope : .la-shell (posé sur le wrapper de chaque page/panneau du module).
 * Ne dépend d'aucune police supplémentaire (Lora / Source Sans 3 / Courier
 * Prime sont déjà chargées par astra-child/functions.php).
 */

.la-shell {
    --la-ink: #1b2430;
    --la-civic: #24466b;
    --la-civic-d: #17304c;
    --la-civic-l: #3d6b9c;
    --la-paper: #f7f8fa;
    --la-paper-warm: #fbfaf6;
    --la-line: #d5dae2;
    --la-line-strong: #9aa6b4;
    --la-muted: #5d6874;
    --la-seal: #a8842f;
    --la-seal-l: #cdae5f;
    --la-green: #2d6a4f;
    --la-green-bg: #eaf5ef;
    --la-red: #9b2c2c;
    --la-red-bg: #fbecec;
    --la-radius: 6px;
    --la-radius-lg: 10px;
    --la-mono: 'Courier Prime', ui-monospace, SFMono-Regular, Menlo, monospace;
    --la-serif: 'Lora', Georgia, serif;
    --la-sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--la-ink);
    background: var(--la-paper);
    font-family: var(--la-sans);
    line-height: 1.55;
}
.la-shell * { box-sizing: border-box; }
.la-shell a { color: var(--la-civic-d); }
.la-shell h1, .la-shell h2, .la-shell h3, .la-shell h4 {
    font-family: var(--la-serif);
    color: var(--la-ink);
    line-height: 1.25;
    margin: 0 0 .5em;
}
.la-shell h1 { font-size: clamp(28px, 4vw, 40px); }
.la-shell h2 { font-size: clamp(22px, 3vw, 28px); margin-top: 2.2em; }
.la-shell h3 { font-size: 19px; }
.la-shell p { margin: 0 0 1em; }

.la-container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* Focus visible partout — jamais retiré à la souris */
.la-shell a:focus-visible,
.la-shell button:focus-visible,
.la-shell input:focus-visible,
.la-shell select:focus-visible,
.la-shell textarea:focus-visible,
.la-shell [tabindex]:focus-visible {
    outline: 3px solid var(--la-seal);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .la-shell * { animation: none !important; transition: none !important; }
}

/* ── En-tête d'acte ─────────────────────────────────────────────────────── */
.la-act-header {
    background: var(--la-civic);
    color: #fff;
    border-radius: var(--la-radius-lg);
    padding: 22px 24px;
    margin-bottom: 24px;
}
.la-act-num {
    font-family: var(--la-mono);
    font-size: 13px;
    opacity: .85;
    letter-spacing: .02em;
    display: block;
    margin-bottom: 6px;
}
.la-act-header h1 { color: #fff; margin-bottom: 10px; }
.la-act-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13.5px; opacity: .95; }
.la-act-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ── Cartes ──────────────────────────────────────────────────────────────── */
.la-card {
    background: var(--la-paper-warm);
    border: 1px solid var(--la-line);
    border-radius: var(--la-radius-lg);
    padding: 20px 22px;
    margin-bottom: 20px;
}
.la-card > h3:first-child, .la-card > h2:first-child { margin-top: 0; }
.la-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin: 16px 0;
}
.la-card-link {
    display: block;
    background: var(--la-paper-warm);
    border: 1px solid var(--la-line);
    border-radius: var(--la-radius-lg);
    padding: 16px 18px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, transform .15s ease;
}
.la-card-link:hover, .la-card-link:focus-visible { border-color: var(--la-civic-l); }
.la-card-link strong { display: block; font-family: var(--la-serif); font-size: 16px; margin-bottom: 8px; color: var(--la-ink); }

/* ── Badges / pastilles ─────────────────────────────────────────────────── */
.la-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12.5px;
    font-weight: 700;
    background: #eef1f5;
    color: var(--la-ink);
    white-space: nowrap;
}
.la-badge + .la-badge { margin-left: 6px; }
.la-badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.la-badge-civic { background: #e4ecf5; color: var(--la-civic-d); }
.la-badge-adopted { background: var(--la-green-bg); color: var(--la-green); }
.la-badge-rejected { background: var(--la-red-bg); color: var(--la-red); }
.la-badge-vote { background: #f6ecd8; color: #7a5a17; }

/* ── Sceau (décision adoptée) ───────────────────────────────────────────── */
.la-seal-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--la-seal);
    color: #fff;
    font-size: 16px;
    transform: rotate(-8deg);
    flex-shrink: 0;
}

/* ── Boutons ─────────────────────────────────────────────────────────────── */
.la-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: var(--la-radius);
    border: 1.5px solid transparent;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--la-sans);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.la-btn:disabled { opacity: .55; cursor: not-allowed; }
.la-btn-primary { background: var(--la-civic); color: #fff; }
.la-btn-primary:hover:not(:disabled) { background: var(--la-civic-d); }
.la-btn-outline { background: transparent; border-color: var(--la-civic); color: var(--la-civic-d); }
.la-btn-outline:hover:not(:disabled) { background: #eef3f9; }
.la-btn-danger { background: transparent; border-color: var(--la-red); color: var(--la-red); }
.la-btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }
.la-btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }

/* ── Formulaires ─────────────────────────────────────────────────────────── */
.la-field { margin-bottom: 16px; }
.la-field label {
    display: block;
    font-weight: 700;
    font-size: 13.5px;
    margin-bottom: 6px;
    color: var(--la-ink);
}
.la-field .la-help { display: block; font-size: 12.5px; color: var(--la-muted); margin-top: 4px; font-weight: 400; }
.la-field input[type=text], .la-field input[type=number], .la-field input[type=date],
.la-field select, .la-field textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--la-line);
    border-radius: var(--la-radius);
    font-size: 15px;
    font-family: inherit;
    color: var(--la-ink);
    background: #fff;
}
.la-field input:focus, .la-field select:focus, .la-field textarea:focus {
    outline: none;
    border-color: var(--la-civic);
    box-shadow: 0 0 0 3px rgba(36, 70, 107, .12);
}
.la-field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.la-field-row .la-field { flex: 1 1 160px; margin-bottom: 0; }
.la-radiogroup fieldset { border: 0; padding: 0; margin: 0; }
.la-radiogroup legend { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; padding: 0; }
.la-radiogroup label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 8px; cursor: pointer; }
.la-checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.la-checkbox input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }

/* ── Frise de phases (stepper) — jamais la couleur seule ────────────────── */
.la-stepper { display: flex; flex-wrap: wrap; gap: 0; list-style: none; margin: 16px 0; padding: 0; }
.la-stepper li {
    flex: 1 1 auto;
    min-width: 110px;
    text-align: center;
    padding: 10px 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--la-muted);
    border-bottom: 4px solid var(--la-line);
    position: relative;
}
.la-stepper li.la-step-done { color: var(--la-green); border-bottom-color: var(--la-green); }
.la-stepper li.la-step-done::before { content: '✓ '; }
.la-stepper li.la-step-active { color: var(--la-civic-d); border-bottom-color: var(--la-civic); font-weight: 800; }
.la-stepper li.la-step-active::before { content: '● '; }
.la-stepper li.la-step-future::before { content: '○ '; opacity: .5; }

/* ── Jauge (soutiens / quorum) ──────────────────────────────────────────── */
.la-gauge-wrap { margin: 14px 0; }
.la-gauge-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.la-gauge {
    height: 12px;
    border-radius: 100px;
    background: #e6e9ee;
    overflow: hidden;
    position: relative;
}
.la-gauge-fill { height: 100%; background: var(--la-civic); border-radius: 100px; transition: width .3s ease; }
.la-gauge-fill.la-gauge-reached { background: var(--la-green); }

/* ── Bulletin de vote ───────────────────────────────────────────────────── */
.la-ballot { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.la-ballot-opt {
    flex: 1 1 140px;
    min-height: 52px;
    border: 1.5px solid var(--la-line);
    border-radius: var(--la-radius);
    background: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.la-ballot-opt:hover:not(:disabled) { border-color: var(--la-civic); }
.la-ballot-opt.la-opt-pour { color: var(--la-green); }
.la-ballot-opt.la-opt-contre { color: var(--la-red); }
.la-ballot-opt.la-opt-abstention { color: var(--la-muted); }
.la-ballot-secret-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--la-muted); margin-top: 8px; }

/* ── Résultat ────────────────────────────────────────────────────────────── */
.la-result-bars { margin: 14px 0; }
.la-result-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 14px; }
.la-result-row .la-result-label { width: 110px; flex-shrink: 0; font-weight: 700; }
.la-result-row .la-result-track { flex: 1; height: 20px; background: #e6e9ee; border-radius: 4px; overflow: hidden; }
.la-result-row .la-result-fill { height: 100%; background: var(--la-civic); }
.la-result-row .la-result-fill.la-fill-pour { background: var(--la-green); }
.la-result-row .la-result-fill.la-fill-contre { background: var(--la-red); }
.la-result-row .la-result-num { width: 50px; text-align: right; flex-shrink: 0; font-family: var(--la-mono); }
.la-result-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
.la-result-table caption { text-align: left; font-size: 12px; color: var(--la-muted); margin-bottom: 6px; }
.la-result-table th, .la-result-table td { padding: 6px 10px; border-bottom: 1px solid var(--la-line); text-align: left; }

/* ── Registre (transparence) ────────────────────────────────────────────── */
.la-registry { font-family: var(--la-mono); }
.la-registry-status {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--la-radius); margin-bottom: 16px; font-weight: 700; font-size: 14px;
}
.la-registry-status.la-ok { background: var(--la-green-bg); color: var(--la-green); }
.la-registry-status.la-bad { background: var(--la-red-bg); color: var(--la-red); }
.la-registry-table-wrap { overflow-x: auto; border: 1px solid var(--la-line); border-radius: var(--la-radius-lg); }
.la-registry-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.la-registry-table th {
    background: var(--la-civic); color: #fff; text-align: left; padding: 10px 14px; font-family: var(--la-sans); font-weight: 700;
}
.la-registry-table td { padding: 9px 14px; border-bottom: 1px solid var(--la-line); }
.la-registry-hash { font-size: 12px; color: var(--la-muted); }

/* ── Accordéon (natif <details>) ────────────────────────────────────────── */
.la-accordion { border: 1px solid var(--la-line); border-radius: var(--la-radius-lg); margin-bottom: 14px; overflow: hidden; }
.la-accordion summary {
    padding: 14px 18px; cursor: pointer; font-weight: 700; list-style: none;
    display: flex; justify-content: space-between; align-items: center; background: var(--la-paper-warm);
}
.la-accordion summary::-webkit-details-marker { display: none; }
.la-accordion summary::after { content: '▾'; color: var(--la-muted); transition: transform .15s ease; }
.la-accordion[open] summary::after { transform: rotate(180deg); }
.la-accordion-body { padding: 16px 18px; border-top: 1px solid var(--la-line); }

/* ── Différences d'amendement ───────────────────────────────────────────── */
.la-diff { border-left: 4px solid var(--la-seal); background: #fdf8ee; padding: 12px 16px; border-radius: 0 var(--la-radius) var(--la-radius) 0; margin: 12px 0; }
.la-diff-meta { font-size: 12.5px; color: var(--la-muted); margin-bottom: 6px; }

/* ── Deux colonnes d'arguments ──────────────────────────────────────────── */
.la-args-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
@media (max-width: 640px) { .la-args-cols { grid-template-columns: 1fr; } }
.la-args-col h4 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.la-args-col.la-args-pour h4 { color: var(--la-green); }
.la-args-col.la-args-contre h4 { color: var(--la-red); }
.la-arg-item { border: 1px solid var(--la-line); border-radius: var(--la-radius); padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }

/* ── États vides ─────────────────────────────────────────────────────────── */
.la-empty { text-align: center; padding: 32px 20px; border: 1.5px dashed var(--la-line-strong); border-radius: var(--la-radius-lg); }
.la-empty-icon { font-size: 30px; margin-bottom: 10px; }
.la-empty-title { font-weight: 700; margin-bottom: 4px; }
.la-empty-text { color: var(--la-muted); font-size: 14px; }

/* ── Toasts ──────────────────────────────────────────────────────────────── */
#la-toast-region { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.la-toast {
    background: var(--la-ink); color: #fff; padding: 12px 18px; border-radius: var(--la-radius);
    font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
    opacity: 0; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease;
}
.la-toast.la-toast-show { opacity: 1; transform: translateY(0); }
.la-toast.la-toast-error { background: var(--la-red); }
.la-toast.la-toast-success { background: var(--la-green); }

/* ── Modale (réutilise le pattern libertaModalA11y côté JS) ─────────────── */
.la-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: center; justify-content: center; z-index: 9998; padding: 20px; }
.la-modal-overlay.la-modal-open { display: flex; }
.la-modal { background: #fff; border-radius: var(--la-radius-lg); max-width: 480px; width: 100%; padding: 24px; max-height: 86vh; overflow-y: auto; }
.la-modal-close { float: right; background: none; border: 0; font-size: 22px; cursor: pointer; line-height: 1; color: var(--la-muted); }

/* ── Barre d'action fixe mobile ──────────────────────────────────────────── */
.la-actionbar {
    position: sticky; bottom: 0; left: 0; right: 0;
    background: #fff; border-top: 1px solid var(--la-line);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    display: flex; gap: 10px; z-index: 40; margin: 20px -20px -20px;
}
.la-actionbar .la-btn { flex: 1; }
@media (min-width: 720px) {
    .la-actionbar { position: static; box-shadow: none; margin: 20px 0 0; border-radius: var(--la-radius-lg); border: 1px solid var(--la-line); }
}

/* ── Skeleton ────────────────────────────────────────────────────────────── */
.la-skeleton { background: linear-gradient(90deg, #eceff3 25%, #f5f6f8 50%, #eceff3 75%); background-size: 200% 100%; animation: la-shimmer 1.4s infinite; border-radius: var(--la-radius); height: 16px; margin-bottom: 8px; }
@keyframes la-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Délégué — recherche ─────────────────────────────────────────────────── */
.la-delegate-picker { position: relative; }
.la-delegate-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--la-line); border-radius: var(--la-radius); box-shadow: 0 8px 20px rgba(0,0,0,.1); z-index: 20; max-height: 220px; overflow-y: auto; display: none; }
.la-delegate-results.la-open { display: block; }
.la-delegate-results button { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; background: none; cursor: pointer; font-size: 14px; }
.la-delegate-results button:hover, .la-delegate-results button:focus-visible { background: var(--la-paper); }

/* ── Vitrine (page d'accueil de l'Assemblée) ─────────────────────────────── */
.la-hero { background: var(--la-civic); color: #fff; border-radius: var(--la-radius-lg); padding: 40px 32px; margin-bottom: 28px; }
.la-hero h1 { color: #fff; }
.la-hero-trust { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 20px; font-size: 13.5px; }
.la-hero-trust span { display: flex; align-items: center; gap: 8px; }
.la-section-intro { color: var(--la-muted); max-width: 640px; }

/* ── Responsive tables (les tableaux ne débordent jamais du body) ────────── */
.la-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Utilitaire lecteur d'écran ──────────────────────────────────────────── */
.la-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Jugement majoritaire / Condorcet (lot 2) ──────────────────────────── */
.la-registry-table th[scope="row"] { color: var(--la-ink); font-family: var(--la-sans); font-weight: 700; text-align: left; background: transparent; }
.la-registry-table thead th { font-size: 12px; white-space: nowrap; }
.la-registry-table td input[type="radio"] { width: 18px; height: 18px; cursor: pointer; }
.la-condorcet-rank { width: 100%; }

/* ── Vote quadratique / conviction — scrutin ouvert assumé ──────────────── */
.la-open-vote-note {
    display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: #7a5a17;
    background: #fbf3e0; border: 1px solid #edd9a3; border-radius: var(--la-radius); padding: 10px 14px; margin-bottom: 14px;
}

/* ── Bandeau « environnement de test » ───────────────────────────────────
   Volontairement hors de l'identité institutionnelle bleue du module
   (--la-civic) pour ne jamais être confondu avec un contenu officiel — motif
   de hachures façon ruban de chantier, couleur ambre distincte de toute
   autre couleur du site (ni le bleu civique, ni le vert/terre cuite de la
   charte Almanach du reste de Liberta Local). Piloté par un seul
   interrupteur (LIBERTA_ASM_TEST_MODE, assemblee-core.php) : disparaît
   partout d'un coup à l'ouverture publique réelle. */
.la-test-banner {
    display: flex; align-items: flex-start; gap: 14px;
    background: repeating-linear-gradient(135deg, #fff3cd, #fff3cd 12px, #ffe69c 12px, #ffe69c 24px);
    border: 2px solid #cc9a06;
    border-radius: var(--la-radius-lg);
    padding: 16px 20px;
    margin-bottom: 22px;
    color: #5c4400;
}
.la-test-banner-icon { font-size: 26px; line-height: 1; flex-shrink: 0; }
.la-test-banner strong { display: block; font-family: var(--la-serif); font-size: 16px; margin-bottom: 4px; }
.la-test-banner p { margin: 0; font-size: 13.5px; line-height: 1.5; }
/* Variante compacte pour les bandeaux/badges hors de .la-shell (homepage, nav) */
.la-test-tag {
    display: inline-flex; align-items: center; gap: 5px;
    background: #ffe69c; color: #5c4400; border: 1px solid #cc9a06;
    padding: 2px 10px; border-radius: 100px; font-size: 11px; font-weight: 800;
    text-transform: uppercase; letter-spacing: .03em; vertical-align: middle;
}

/* ── Spectre d'opinion (cartographie d'opinion, assemblee-deliberation.php)
   Nuage de points 1D : chaque participant est un point coloré par tendance.
   Ajouté suite à un retour utilisateur — le texte seul (% par "camp") était
   incompréhensible sans rien à regarder ; recommandation confirmée par une
   recherche externe sur Pol.is/vTaiwan (même limite documentée chez eux). */
.la-opinion-spectre { margin: 14px 0 18px; }
.la-opinion-spectre svg { display: block; }
.la-spectre-legende { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.la-spectre-legende-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--la-muted); }
.la-spectre-pastille { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
