/* ============================================================
   Kit d'auto-cadrage — feuille de style
   Charte alignée sur les propositions commerciales Shodo (livrable client) :
   DM Serif Display + Inter + JetBrains Mono, accent orange #ff6500.
   Autonome, sans dépendance externe — polices bundlées en local (fonts/).
   ============================================================ */

/* ---------- Polices locales (sous-ensembles latin + latin-ext) ---------- */

/* DM Serif Display — titres */
@font-face {
  font-family: 'DM Serif Display';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/dmserif-normal-lat.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Serif Display';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/dmserif-normal-latext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Serif Display';
  font-style: italic; font-weight: 400; font-display: swap;
  src: url(fonts/dmserif-italic-lat.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Serif Display';
  font-style: italic; font-weight: 400; font-display: swap;
  src: url(fonts/dmserif-italic-latext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Inter — corps de texte (police variable, plage de poids 100→900) */
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-normal-lat.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-normal-latext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* JetBrains Mono — labels, code, arborescences */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/jetbrainsmono-normal-lat.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/jetbrainsmono-normal-latext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens : charte propositions commerciales ---------- */

:root {
  /* Échelle orange (marque) */
  --primary-highest: #461604;
  --primary-higher:  #a1380b;
  --primary-high:    #cc4802;
  --primary-medium:  #ff6500;   /* accent unique : CTA, liserés, états actifs */
  --primary-low:     #ffc26d;
  --primary-lower:   #ffefd3;
  --primary-lowest:  #fff8ec;

  /* Échelle grise (neutre) */
  --secondary-highest: #211f1f;
  --secondary-higher:  #3f3b3c;
  --secondary-high:    #554f4f;
  --secondary-medium:  #807778;
  --secondary-low:     #bfbaba;
  --secondary-lower:   #f0eeee;
  --secondary-lowest:  #f8f7f7;

  /* États sémantiques */
  --success-high:   #1b7a44;
  --success-medium: #2fcc71;

  /* Alias texte (sémantique) */
  --text-highest: var(--secondary-highest);
  --text-higher:  var(--secondary-higher);
  --text-medium:  var(--secondary-medium);
  --text-low:     var(--secondary-low);

  /* Alias rétro-compat (anciens noms re-mappés sur la nouvelle palette) */
  --ink:      var(--secondary-highest);
  --ink-soft: var(--secondary-higher);
  --muted:    var(--secondary-medium);
  --line:     var(--secondary-lower);
  --bg:       #ffffff;
  --bg-soft:  var(--secondary-lowest);
  --brand:    var(--secondary-highest);
  --brand-2:  var(--primary-high);
  --accent:   var(--primary-medium);
  --ok:       var(--success-high);

  /* Polices */
  --font:         'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'DM Serif Display', Georgia, "Times New Roman", serif;
  --mono:         'JetBrains Mono', "Fira Code", ui-monospace, Menlo, Consolas, monospace;

  /* Ombre légère signature des cartes */
  --shadow-card: 0 1px 4px rgba(33, 31, 31, .06);

  /* Structure */
  --radius:  12px;
  --maxw:    860px;
  --sidebar: 268px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text-highest);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Layout : sommaire collant + contenu ---------- */

.layout { display: flex; align-items: flex-start; }

nav.toc {
  position: sticky;
  top: 0;
  width: var(--sidebar);
  height: 100vh;
  overflow-y: auto;
  flex: 0 0 var(--sidebar);
  padding: 32px 22px 40px;
  background: var(--secondary-lowest);
  border-right: 1px solid var(--secondary-lower);
  font-size: 14px;
}
nav.toc .toc-brand {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--text-highest);
  letter-spacing: 0;
  margin-bottom: 20px;
  font-size: 20px;
  line-height: 1.15;
}
nav.toc a {
  display: block;
  color: var(--text-higher);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
nav.toc a:hover {
  background: var(--primary-lowest);
  color: var(--primary-high);
  border-left-color: var(--primary-medium);
}
nav.toc a.lvl-2 { padding-left: 22px; font-size: 13.5px; color: var(--text-medium); }
nav.toc .toc-sep {
  font-family: var(--mono);
  margin: 18px 0 8px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-medium);
}

main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 48px;
  display: flex;
  justify-content: center;
}
.content { width: 100%; max-width: var(--maxw); padding: 56px 0 120px; }

/* ---------- Typographie ---------- */

h1, h2 { font-family: var(--font-display); font-weight: 400; color: var(--text-highest); line-height: 1.15; }
h3, h4 { font-family: var(--font); color: var(--text-highest); line-height: 1.3; font-weight: 600; }

h1 { font-size: 2.6rem; margin: 0 0 .3em; letter-spacing: -.01em; }
h2 {
  font-size: 2.05rem;
  margin: 2.4em 0 .6em;
  padding-bottom: .25em;
  border-bottom: 1px solid var(--secondary-lower);
  scroll-margin-top: 20px;
}
h3 { font-size: 1.375rem; margin: 1.9em 0 .5em; scroll-margin-top: 20px; }
h4 {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  margin: 1.4em 0 .4em;
  color: var(--text-medium);
  text-transform: uppercase;
  letter-spacing: .1em;
}
p { margin: .7em 0; }
a { color: var(--primary-high); }
strong { color: var(--text-highest); font-weight: 600; }
em { font-style: italic; }
ul, ol { padding-left: 1.4em; }
li { margin: .3em 0; }
code {
  font-family: var(--mono);
  background: var(--secondary-lower);
  padding: .12em .4em;
  border-radius: 4px;
  font-size: .85em;
  color: var(--primary-higher);
}

/* ---------- Couverture (hero orange) ---------- */

.cover {
  background: linear-gradient(135deg, var(--primary-high) 0%, var(--primary-medium) 100%);
  color: #fff;
  border-radius: 16px;
  padding: 56px 48px;
  margin-bottom: 8px;
}
.cover .eyebrow {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  opacity: .92;
  margin: 0 0 18px;
}
.cover h1 { font-family: var(--font-display); color: #fff; font-size: 3rem; margin: 0 0 .25em; line-height: 1.05; }
.cover p { color: #fff; font-size: 1.12rem; max-width: 62ch; margin: 0; }

/* ---------- Encadrés (filet gauche + fond blanc + ombre) ---------- */

.callout {
  background: #fff;
  border: 1px solid var(--secondary-lower);
  border-left: 3px solid var(--primary-medium);
  border-radius: 0 8px 8px 0;
  padding: 18px 22px;
  margin: 1.4em 0;
  box-shadow: var(--shadow-card);
}
.callout .callout-title {
  font-family: var(--mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .72rem;
  color: var(--primary-high);
  display: block;
  margin-bottom: .5em;
}
.callout.note { border-left-color: var(--secondary-high); }
.callout.note .callout-title { color: var(--secondary-high); }
.callout.warn { border-left-color: var(--primary-higher); }
.callout.warn .callout-title { color: var(--primary-higher); }
.callout.tip  { border-left-color: var(--success-high); }
.callout.tip  .callout-title { color: var(--success-high); }

/* ---------- Blocs modèle / exemple ---------- */

.block {
  border-radius: var(--radius);
  margin: 1.2em 0;
  overflow: hidden;
  border: 1px solid var(--secondary-lower);
  box-shadow: var(--shadow-card);
}
.block > .block-head {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.block.template { border-color: var(--secondary-lower); }
.block.template > .block-head { background: var(--secondary-lowest); color: var(--text-medium); }
.block.example  { border-color: var(--primary-lower); }
.block.example  > .block-head { background: var(--primary-lowest); color: var(--primary-high); }

pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.6;
  background: #fff;
  color: var(--text-higher);
  white-space: pre-wrap;
  word-wrap: break-word;
  tab-size: 2;
}
.block.template pre { background: #fff; }
.block.example  pre { background: #fffdf9; }

/* Bouton copier */
.copy-btn {
  margin-left: auto;
  border: 1px solid var(--secondary-low);
  background: #fff;
  color: var(--text-medium);
  font: inherit;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
}
.copy-btn:hover { color: var(--primary-high); border-color: var(--primary-medium); background: var(--primary-lowest); }
.copy-btn.copied { color: var(--success-high); border-color: var(--success-high); background: #fff; }

/* Bouton "Télécharger tous les modèles (.zip)" */
.dl-templates {
  display: inline-flex; align-items: center; gap: .55em;
  border: none; cursor: pointer; text-decoration: none;
  background: var(--primary-medium); color: #fff;
  font-family: var(--mono); font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 20px; border-radius: 8px;
  transition: filter .15s ease, transform .15s ease;
}
.dl-templates:hover { filter: brightness(.93); color: #fff; }
.dl-templates:active { transform: translateY(1px); }
.dl-templates .dl-ico { font-size: 1.05em; line-height: 1; }
@media print { .dl-templates { display: none; } }

/* ---------- Tableaux ---------- */

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.4em 0;
  font-size: .94rem;
  border: 1px solid var(--secondary-lower);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
th, td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--secondary-lower); }
th {
  font-family: var(--mono);
  background: var(--secondary-lowest);
  color: var(--text-medium);
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
td { color: var(--text-higher); }
tbody tr:nth-child(even) { background: var(--secondary-lowest); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Schéma du flot (cartes) ---------- */

.flow { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; margin: 1.6em 0; }
.flow-step {
  flex: 1 1 180px;
  background: #fff;
  border: 1px solid var(--secondary-lower);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.flow-step .num {
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  color: var(--primary-high);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.flow-step .ttl { font-weight: 600; color: var(--text-highest); margin: 4px 0 6px; }
.flow-step p { margin: 0; font-size: .9rem; color: var(--text-higher); }
.flow-step.highlight { border-color: var(--primary-lower); background: var(--primary-lowest); }

/* Arborescence cible (file tree) */
.filetree, .filetree ul { list-style: none; margin: 0; padding: 0; }
.filetree {
  background: var(--secondary-lowest);
  border: 1px solid var(--secondary-lower);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 1.6em 0;
  overflow-x: auto;
}
.filetree ul { padding-left: .8em; margin-left: .4em; border-left: 1px solid var(--secondary-lower); }
.filetree li { padding: 3px 0; line-height: 1.5; white-space: nowrap; }
.filetree li > ul { margin-top: 3px; }

.ft-name { font-family: var(--mono); font-size: .82rem; color: var(--text-higher); }
.filetree .dir > .ft-name { color: var(--text-highest); font-weight: 600; }
.filetree .more { font-family: var(--mono); font-size: .82rem; color: var(--text-medium); }

.ft-desc { color: var(--text-medium); font-size: .82rem; margin-left: .55em; white-space: normal; }
.ft-desc::before { content: "— "; }

.ft-tag {
  display: inline-block;
  font-family: var(--mono); font-size: .6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--primary-high); background: var(--primary-lowest);
  border: 1px solid var(--primary-lower); border-radius: 5px;
  padding: 0 6px; margin-left: .55em; vertical-align: 1px;
}

/* ---------- Checklist ---------- */

ul.checklist { list-style: none; padding-left: 0; }
ul.checklist li { padding-left: 30px; position: relative; margin: .55em 0; }
ul.checklist li::before {
  content: "☐";
  position: absolute; left: 0; top: -1px;
  font-size: 1.15em; color: var(--primary-medium);
}

/* ---------- Divers ---------- */

.lead { font-size: 1.14rem; color: var(--text-higher); }
.section-num {
  font-family: var(--mono);
  color: var(--primary-high);
  font-weight: 700;
  margin-right: .5em;
}
hr.sep { border: none; border-top: 1px solid var(--secondary-lower); margin: 3em 0; }
footer.doc-footer {
  margin-top: 4em;
  padding-top: 1.6em;
  border-top: 2px solid var(--primary-medium);
  color: var(--text-medium);
  font-size: .88rem;
}

/* ============================================================
   Responsive : sous 980px, le sommaire passe en bandeau
   ============================================================ */
@media (max-width: 980px) {
  .layout { flex-direction: column; }
  nav.toc {
    position: static; width: 100%; height: auto;
    border-right: none; border-bottom: 1px solid var(--secondary-lower);
  }
  main { padding: 0 22px; }
  .content { padding: 32px 0 80px; }
  .cover { padding: 36px 26px; }
  .cover h1 { font-size: 2.1rem; }
  h2 { font-size: 1.7rem; }
}

/* ============================================================
   Impression / export PDF
   ============================================================ */
@page { size: A4; margin: 1.5cm; }

@media print {
  :root { --maxw: 100%; }
  nav.toc, .copy-btn { display: none !important; }
  .layout { display: block; }
  main { padding: 0; display: block; }
  .content { max-width: 100%; padding: 0; }
  body { font-size: 11.5pt; line-height: 1.5; color: #000; }
  a { color: #000; text-decoration: none; }

  .cover {
    background: var(--primary-medium) !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    border-radius: 0;
  }
  .block, .callout, .flow-step, .filetree, table {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    box-shadow: none;
  }

  h1, h2, h3 { break-after: avoid; }
  h2 { break-before: page; padding-top: 0; }
  section.intro h2:first-of-type { break-before: avoid; }
  .block, .callout, table, .flow-step, .filetree { break-inside: avoid; }
  pre { white-space: pre-wrap; }
  p, li { orphans: 3; widows: 3; }
}
