/* ============================================================
   bluecoout.fr — refonte
   Design system unique (brief §4). Mobile-first, sans framework.
   Feuille de style commune aux 5 pages.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap");

/* ------------------------------------------------------------
   1. TOKENS
   ------------------------------------------------------------ */
:root {
  /* Palette claire */
  --paper: #F7F5F0;
  --paper-raised: #FFFFFF;
  --ink: #1A1C20;
  --ink-soft: #4A4E57;
  --ink-faint: #8A8E96;
  --accent: #1D5FAD;
  --accent-deep: #14417A;
  --rule: #D8D4CB;
  --rule-strong: #B9B4A8;
  --table-band: #EFECE4;
  --quote-bg: #EDF2F9;
  --badge-doc: #2E6B45;
  --badge-doc-bg: #E4EFE7;
  --badge-ana: #8A5A16;
  --badge-ana-bg: #F4ECDD;
  --badge-unk: #6B6E76;
  --badge-unk-bg: #ECEBE7;
  --focus: #1D5FAD;

  /* Espacement — échelle 4/8/12/16/24/32/48/72 */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s6b: 48px;
  --s7: 72px;

  /* Typographie */
  --font-titles: "Archivo", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;

  /* Colonne de lecture */
  --measure: 42rem;
  --measure-wide: 52rem;
}

/* Mode sombre — « papier de nuit », jamais un négatif */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15171B;
    --paper-raised: #1D2026;
    --ink: #E8E6E1;
    --ink-soft: #A9ACB4;
    --ink-faint: #7A7E86;
    --accent: #6FA3E0;
    --accent-deep: #92BCEB;
    --rule: #2C3038;
    --rule-strong: #3B404A;
    --table-band: #1A1D22;
    --quote-bg: #1B2431;
    --badge-doc: #7FBF97;
    --badge-doc-bg: rgba(127, 191, 151, 0.12);
    --badge-ana: #D4A85C;
    --badge-ana-bg: rgba(212, 168, 92, 0.12);
    --badge-unk: #A2A6AE;
    --badge-unk-bg: rgba(162, 166, 174, 0.12);
    --focus: #6FA3E0;
  }
}

/* ------------------------------------------------------------
   2. BASE
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%; /* jamais < 16 px */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
}

/* Aucune animation ; seules transitions autorisées : color/background 120 ms */
a,
button {
  transition: color 120ms ease, background-color 120ms ease;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-deep);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Colonne de lecture centrée */
main {
  display: block;
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--s6) 20px var(--s7);
}

section + section {
  margin-top: var(--s6b);
}

/* ------------------------------------------------------------
   3. TITRES ET TEXTES
   ------------------------------------------------------------ */
h1,
h2,
h3,
h4 {
  font-family: var(--font-titles);
  color: var(--ink);
  text-transform: none; /* jamais de capitales d'emphase */
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin: var(--s5) 0 var(--s4);
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 3.5rem 0 var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule-strong);
}

h3 {
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  margin: var(--s6) 0 var(--s3);
}

@media (min-width: 768px) {
  h1 { font-size: 2.75rem; }
  h2 { font-size: 1.75rem; }
}

p {
  margin: 0 0 var(--s4);
}

ul,
ol {
  margin: 0 0 var(--s4);
  padding-left: 1.4em;
}

li {
  margin-bottom: var(--s2);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s6) 0;
}

strong {
  font-weight: 600;
}

/* Surtitre / kicker — seul usage autorisé des capitales (avec les badges) */
.kicker {
  display: block;
  font-family: var(--font-titles);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: var(--s2);
}

/* Un h2 précédé de son surtitre : le filet porte sur le groupe */
.section-head {
  margin-top: 3.5rem;
  padding-top: var(--s4);
  border-top: 1px solid var(--rule-strong);
}

.section-head .kicker {
  margin-bottom: var(--s1);
}

.section-head h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* Légendes, notes de bas de bloc */
.note,
figcaption,
caption {
  font-size: 0.875rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Métadonnées (dates, mentions de mise à jour) */
.meta {
  font-family: var(--font-titles);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-faint);
}

/* Chapô / résumé d'accueil */
.lede {
  font-size: 1.125rem;
  line-height: 1.7;
}

/* Appels de note [n] */
sup {
  line-height: 0;
}

sup a {
  font-family: var(--font-titles);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

sup a:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

/* Liste des sources (methode.html) */
.sources-list li {
  margin-bottom: var(--s3);
}

.sources-list .src-org {
  font-family: var(--font-titles);
  font-weight: 600;
}

.sources-list .src-title {
  font-style: italic;
}

.sources-list .src-url {
  word-break: break-all;
}

/* ------------------------------------------------------------
   4. EN-TÊTE ET NAVIGATION
   ------------------------------------------------------------ */
.site-header {
  position: static; /* non sticky */
  background: var(--paper);
  border-bottom: 1px solid var(--rule-strong);
}

.site-header__inner {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: var(--s3) 20px;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

@media (min-width: 768px) {
  .site-header__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding-top: var(--s2);
    padding-bottom: var(--s2);
  }
}

.site-header__brand {
  text-decoration: none;
  color: var(--ink);
}

.site-header__brand:hover {
  color: var(--ink);
}

.site-header__title {
  font-family: var(--font-titles);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  display: block;
  line-height: 1.2;
}

.site-header__subtitle {
  font-family: var(--font-titles);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-faint);
  display: block;
  margin-top: 2px;
}

/* Nav : ligne scrollable sur mobile, pas de burger, pas de JS */
.site-nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--s4);
  white-space: nowrap;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  display: inline-block;
  font-family: var(--font-titles);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: var(--s3) 2px; /* cible tactile ≥ 44 px avec la hauteur de ligne */
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------
   5. TABLEAUX DE DONNÉES
   ------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--s5) 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-titles);
  font-variant-numeric: tabular-nums;
}

caption {
  text-align: left;
  caption-side: top;
  padding-bottom: var(--s2);
  font-family: var(--font-body);
}

th {
  font-family: var(--font-titles);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-align: left;
  padding: var(--s2) var(--s3);
  border-bottom: 2px solid var(--rule-strong);
}

td {
  font-size: 0.9375rem;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: var(--table-band);
}

td.num,
th.num {
  text-align: right;
}

tr.total td {
  font-family: var(--font-titles);
  font-weight: 600;
  border-top: 2px solid var(--rule-strong);
}

/* ------------------------------------------------------------
   6. BADGES [documenté] / [analyse] / [inconnu]
   Jamais en début de titre, jamais plus d'un par bloc.
   ------------------------------------------------------------ */
.badge {
  display: inline-block;
  font-family: var(--font-titles);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 2px;
  vertical-align: middle;
}

.badge--doc {
  color: var(--badge-doc);
  background: var(--badge-doc-bg);
}

.badge--ana {
  color: var(--badge-ana);
  background: var(--badge-ana-bg);
}

.badge--unk {
  color: var(--badge-unk);
  background: var(--badge-unk-bg);
}

/* ------------------------------------------------------------
   7. ENCADRÉ PIÈCE
   ------------------------------------------------------------ */
.piece {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: var(--s4);
  margin: var(--s5) 0;
}

@media (min-width: 900px) {
  .piece {
    max-width: var(--measure-wide);
    margin-left: calc((var(--measure-wide) - var(--measure)) / -2);
    margin-right: calc((var(--measure-wide) - var(--measure)) / -2);
  }
}

.piece__label {
  font-family: var(--font-titles);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  display: block;
  margin-bottom: var(--s1);
}

.piece__title {
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 var(--s3);
}

.piece img {
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  padding: var(--s3);
  margin-bottom: var(--s3);
}

.piece figcaption {
  margin-bottom: var(--s2);
}

.piece__provenance {
  font-family: var(--font-titles);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-faint);
  display: block;
  margin-top: var(--s1);
}

.piece__reading-note {
  border-top: 1px solid var(--rule);
  margin-top: var(--s3);
  padding-top: var(--s3);
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.piece__reading-note .kicker {
  margin-bottom: var(--s1);
}

.piece__download {
  display: block;
  margin-top: var(--s3);
  font-family: var(--font-titles);
  font-size: 0.875rem;
  font-weight: 500;
}

/* ------------------------------------------------------------
   8. CITATION
   ------------------------------------------------------------ */
blockquote {
  background: var(--quote-bg);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  margin: var(--s5) 0;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.0625rem;
}

blockquote p:last-child {
  margin-bottom: 0;
}

.quote-source {
  font-family: var(--font-titles);
  font-style: normal;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: var(--s2);
}

.quote-source::before {
  content: "— ";
}

/* ------------------------------------------------------------
   9. SCHÉMA DE CHAÎNE DE DÉTENTION (HTML/CSS pur, imprimable)
   ------------------------------------------------------------ */
.chain {
  list-style: none;
  margin: var(--s5) auto;
  padding: 0;
  max-width: 30rem;
}

.chain li {
  margin: 0;
}

.chain__card {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: var(--s3) var(--s4);
  text-align: center;
}

.chain__name {
  font-family: var(--font-titles);
  font-size: 0.9375rem;
  font-weight: 600;
  display: block;
}

.chain__detail {
  font-family: var(--font-titles);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
  display: block;
  margin-top: 2px;
}

/* Connecteur vertical : filet 2 px × 24 px + libellé */
.chain__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

.chain__link::before,
.chain__link::after {
  content: "";
  display: block;
  width: 2px;
  height: 24px;
  background: var(--rule-strong);
}

.chain__link-label {
  font-family: var(--font-titles);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-faint);
  padding: 2px 0;
}

/* Carte Midco : badge ambre « 1 100 actions nanties » */
.chain__card--pledged .chain__flag {
  display: inline-block;
  font-family: var(--font-titles);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--badge-ana);
  background: var(--badge-ana-bg);
  padding: 2px 8px;
  border-radius: 2px;
  margin-top: var(--s2);
}

/* Bifurcation Chelsea / BlueCo Alsace */
.chain__fork {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
}

@media (min-width: 640px) {
  .chain__fork {
    grid-template-columns: 1fr 1fr;
    max-width: 36rem;
    margin-left: -3rem;
    margin-right: -3rem;
  }
}

.chain__branch {
  display: flex;
  flex-direction: column;
}

.chain__branch--secondary {
  opacity: 0.75;
}

.chain__branch .chain__link::before,
.chain__branch .chain__link::after {
  height: 16px;
}

/* Carte Racing : bordure accent 2 px */
.chain__card--club {
  border: 2px solid var(--accent);
}

/* ------------------------------------------------------------
   10. BLOC LETTRE + BOUTON COPIER
   ------------------------------------------------------------ */
details {
  margin: var(--s4) 0;
}

summary {
  font-family: var(--font-titles);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: var(--s3) 0; /* cible tactile */
}

summary:hover {
  color: var(--accent-deep);
}

.letter {
  position: relative;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: var(--s5) var(--s4) var(--s4);
  margin-top: var(--s2);
}

.letter pre {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  color: var(--ink);
}

.copy-btn {
  position: absolute;
  top: var(--s3);
  right: var(--s3);
  font-family: var(--font-titles);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: var(--s2) var(--s3);
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--paper-raised);
  background: var(--accent);
}

.copy-btn[data-copied="true"] {
  color: var(--paper-raised);
  background: var(--accent);
}

/* Rappel destinataire sous chaque lettre */
.letter-recipient {
  font-size: 0.875rem;
  color: var(--ink-soft);
  margin-top: var(--s3);
}

/* Gabarit commun des leviers : ce que ça obtient / qui / comment / coût */
.lever {
  margin: var(--s6) 0;
}

.lever dl {
  margin: var(--s3) 0 0;
}

.lever dt {
  font-family: var(--font-titles);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-top: var(--s4);
}

.lever dd {
  margin: var(--s1) 0 0;
}

/* ------------------------------------------------------------
   11. CHIFFRES-CLÉS (usage parcimonieux)
   ------------------------------------------------------------ */
.keyfigs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  margin: var(--s5) 0;
}

@media (min-width: 768px) {
  .keyfigs {
    grid-template-columns: repeat(4, 1fr);
  }
}

.keyfigs > div {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: var(--s4);
}

.keyfigs .fig {
  font-family: var(--font-titles);
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: block;
  line-height: 1.2;
}

.keyfigs .fig-label {
  font-family: var(--font-titles);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
  display: block;
  margin-top: var(--s1);
}

/* ------------------------------------------------------------
   12. ENCADRÉ ÉCHÉANCE (aucun compte à rebours)
   ------------------------------------------------------------ */
.deadline {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: var(--s4) var(--s5);
  margin: var(--s5) 0;
}

.deadline h3 {
  margin: 0 0 var(--s2);
}

.deadline p:last-of-type {
  margin-bottom: var(--s2);
}

/* ------------------------------------------------------------
   13. FOOTER
   ------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--rule-strong);
  background: var(--paper);
  margin-top: var(--s7);
}

.site-footer__inner {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: var(--s6) 20px var(--s6b);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s5);
}

@media (min-width: 768px) {
  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
  }
}

.site-footer h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  border: 0;
  margin: 0 0 var(--s2);
  padding: 0;
}

.site-footer p {
  font-size: 0.875rem;
  color: var(--ink-soft);
  margin-bottom: var(--s2);
}

/* ------------------------------------------------------------
   14. UTILITAIRES
   ------------------------------------------------------------ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wide {
  /* bloc autorisé à déborder de la colonne de lecture sur desktop */
}

@media (min-width: 900px) {
  .wide {
    max-width: var(--measure-wide);
    margin-left: calc((var(--measure-wide) - var(--measure)) / -2);
    margin-right: calc((var(--measure-wide) - var(--measure)) / -2);
  }
}

/* ------------------------------------------------------------
   15. IMPRESSION — l'impression propre du dossier est un
   critère de recette.
   ------------------------------------------------------------ */
@media print {
  :root {
    --paper: #FFFFFF;
    --paper-raised: #FFFFFF;
    --ink: #000000;
    --ink-soft: #333333;
    --ink-faint: #555555;
    --rule: #999999;
    --rule-strong: #666666;
    --table-band: #F2F2F2;
    --quote-bg: #F2F2F2;
  }

  body {
    background: #FFFFFF;
    color: #000000;
  }

  .site-nav,
  .copy-btn {
    display: none;
  }

  /* URLs des liens sources visibles à l'impression */
  main a[href^="http"]::after,
  .site-footer a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.75rem;
    color: #333333;
    word-break: break-all;
  }

  details {
    display: block;
  }

  details > *:not(summary) {
    display: block;
  }

  .piece,
  .letter,
  blockquote,
  .deadline,
  .chain__card {
    break-inside: avoid;
  }

  h2,
  h3 {
    break-after: avoid;
  }
}
