
/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --accent:    #388bfd;
  --warn:      #d29922;
  --danger:    #f85149;
  --ok:        #3fb950;
  --proposal:  #1a2a1a;
  --proposal-b:#3fb950;
  --unknown-bg:#1c1c24;
  --unknown-t: #8b949e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* ── Layout ── */
body { min-height: 100vh; display: flex; flex-direction: column; }
header { background: var(--surface); border-bottom: 1px solid var(--border);
         padding: .75rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
header h1 { font-size: 1rem; font-weight: 600; color: var(--text); }
header .back { color: var(--accent); text-decoration: none; font-size: .875rem; }
header .back:hover { text-decoration: underline; }
main { flex: 1; max-width: 900px; margin: 0 auto; padding: 1.25rem; width: 100%; }

/* ── Loading / error ── */
#loading { text-align: center; color: var(--muted); padding: 3rem; }
#error-box { background: #2a1010; border: 1px solid var(--danger); border-radius: 6px;
             padding: 1rem 1.25rem; color: var(--danger); margin-bottom: 1rem; }
#error-box a { color: var(--accent); }

/* ── Bannière non-validée ── */
.banner-unvalidated {
  background: var(--proposal); border: 1px solid var(--proposal-b);
  border-radius: 6px; padding: .75rem 1rem; margin-bottom: 1.25rem;
  font-size: .875rem; color: #7ee787;
}
.banner-unvalidated strong { display: block; margin-bottom: .25rem; }

/* ── Résumé mobile (collapsible) ── */
.mobile-summary { background: var(--surface); border: 1px solid var(--border);
                  border-radius: 6px; margin-bottom: 1.25rem; }
.mobile-summary summary { padding: .75rem 1rem; cursor: pointer;
                           font-weight: 600; list-style: none; display: flex;
                           justify-content: space-between; align-items: center; }
.mobile-summary summary::after { content: "▸"; color: var(--muted); }
.mobile-summary[open] summary::after { content: "▾"; }
.mobile-summary-body { padding: .75rem 1rem 1rem; border-top: 1px solid var(--border); }
.mobile-summary-body .field { margin-bottom: .5rem; }
.mobile-summary-body .label { color: var(--muted); font-size: .8rem; }

/* ── Sections ── */
section { margin-bottom: 1.5rem; }
section h2 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .75rem;
             padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
section h3 { font-size: .9rem; font-weight: 600; color: var(--muted); margin-bottom: .5rem; }
p { margin-bottom: .5rem; }
ul { padding-left: 1.25rem; }
ul li { margin-bottom: .35rem; }

/* ── Méta-données ── */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
             gap: .5rem 1rem; margin-bottom: 1rem; }
.meta-item { font-size: .85rem; }
.meta-item .k { color: var(--muted); }
.meta-item .v { word-break: break-all; }
.sha256 { font-family: monospace; font-size: .75rem; color: var(--muted); word-break: break-all; }

/* ── Inconnue / valeur absente ── */
.val-unknown { background: var(--unknown-bg); color: var(--unknown-t);
               padding: .1rem .4rem; border-radius: 3px; font-size: .85rem; }

/* ── Fait avec mesures ── */
.fact { background: var(--surface); border: 1px solid var(--border);
        border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
.fact-statement { font-weight: 500; margin-bottom: .75rem; }
.fact-attribution { font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }
.measurements { width: 100%; border-collapse: collapse; font-size: .875rem; margin-bottom: .75rem; }
.measurements th { background: #0d1117; color: var(--muted); text-align: left;
                   padding: .35rem .6rem; font-weight: 500; border-bottom: 1px solid var(--border); }
.measurements td { padding: .3rem .6rem; border-bottom: 1px solid #21262d; vertical-align: top; }
.measurements tr:last-child td { border-bottom: none; }
.measurements .val { font-weight: 600; color: var(--text); }

/* ── Sources (paragraphes) ── */
.source-refs { margin-top: .5rem; }
.source-ref-badge { display: inline-block; background: #21262d; color: var(--accent);
                    font-size: .75rem; font-family: monospace; padding: .1rem .35rem;
                    border-radius: 3px; margin-right: .25rem; cursor: pointer; }
.source-ref-badge:hover { background: #2d333b; }
.source-paragraph { font-size: .85rem; color: var(--muted); background: #0d1117;
                    border-left: 3px solid var(--border); padding: .5rem .75rem;
                    margin-top: .3rem; border-radius: 0 4px 4px 0; display: none; }
.source-paragraph.visible { display: block; }
.source-missing { color: var(--danger); font-size: .8rem; }

/* ── Synthesis & uncertainties ── */
.synthesis-text { background: var(--surface); border: 1px solid var(--border);
                  border-radius: 6px; padding: 1rem; font-style: italic;
                  color: var(--text); }
.uncertainty { padding: .4rem 0; border-bottom: 1px solid #21262d; font-size: .9rem; }
.uncertainty:last-child { border-bottom: none; }
.uncertainty::before { content: "◦ "; color: var(--warn); }

/* ── Proposition modèle ── */
.proposal-box { background: var(--proposal); border: 1px solid var(--proposal-b);
                border-radius: 6px; padding: 1rem; }
.proposal-action { font-family: monospace; font-size: .8rem; background: #0d1117;
                   padding: .15rem .4rem; border-radius: 3px; color: #7ee787; }
.proposal-changes li { margin-bottom: .5rem; }

/* ── Champs holding/thèse/décision ── */
.decision-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
                 gap: .75rem; }
.decision-card { background: var(--surface); border: 1px solid var(--border);
                 border-radius: 6px; padding: .75rem; }
.decision-card .k { font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }

/* ── Texte complet ── */
details.full-text { margin-top: 1.5rem; }
details.full-text summary { cursor: pointer; color: var(--accent); font-size: .9rem; padding: .5rem 0; }
.full-text-body { background: var(--surface); border: 1px solid var(--border);
                  border-radius: 6px; padding: 1rem; font-size: .875rem;
                  white-space: pre-wrap; word-break: break-word; color: var(--muted); max-height: 60vh; overflow-y: auto; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .meta-grid { grid-template-columns: 1fr; }
  .decision-grid { grid-template-columns: 1fr; }
  .measurements { font-size: .8rem; }
}

[hidden] { display: none !important; }
html { --dossier-style-ready: 1; }
#header-label { color: var(--muted); font-size: .85rem; margin-left: auto; }
.mt-small { margin-top: .5rem; }
.mb-small { margin-bottom: .5rem; }
.mb-medium { margin-bottom: .75rem; }
.small-muted { font-size: .8rem; color: var(--muted); }
.small-text { font-size: .85rem; }
.small-muted-paragraph { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
.source-row { margin-bottom: .4rem; }
.resource-warning { color: var(--warn); padding: .75rem; }
.source-ref-badge:focus { outline: 2px solid var(--accent); }
.measurements .val { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Print each complete source paragraph once, in the source section. */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --text: #111; --muted: #333;
    --border: #aaa; --accent: #111; --proposal: #fff; --proposal-b: #aaa;
    --unknown-bg: #fff; --unknown-t: #333;
    font-size: 10pt;
    font-family: Arial, sans-serif;
    font-kerning: none;
    font-variant-ligatures: none;
  }
  body { display: block; min-height: auto; }
  main { max-width: none; width: 100%; padding: 0; }
  header { background: #fff; padding: 0 0 .5cm; }
  header .back, .resource-warning { display: none; }
  .banner-unvalidated, .proposal-action { color: #111; }
  .measurements th, .source-paragraph, .source-ref-badge { background: #fff; }
  .measurements tr { break-inside: avoid; }
  .fact .source-paragraph { display: none !important; }
  .source-row .source-paragraph { display: block !important; max-height: none; overflow: visible; }
  .source-row { break-inside: avoid; }
  .full-text-body { max-height: none; overflow: visible; }
  a { color: #111; overflow-wrap: anywhere; }
  @page { size: A4; margin: 16mm; }
}
