/* ============================================================
   resonance — système de design de la PG (7 diapos 16:9)
   Niveau prépa. Montrer la physique, pas l'incanter.
   Autonome : fontes + KaTeX en local (../fonts, ../katex).
   ============================================================ */

/* ---------- Fontes locales (variable woff2) ---------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-wght-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ---------- Jetons de design ---------- */
:root {
  /* couleurs */
  --paper:      #f4f1ea;
  --paper-2:    #ece7dc;
  --card:       #ffffff;
  --ink:        #18222f;
  --ink-soft:   #51617a;
  --ink-faint:  #8a93a3;
  --line:       #e0dacd;
  --line-soft:  #ece8de;

  --brain:      #15808d;   /* teal — structure / viscoélastique / calme */
  --brain-deep: #0d5560;
  --brain-tint: #dcecee;
  --brain-tint2:#eef6f7;

  --accent:     #e0533d;   /* corail — résonance, pic, danger */
  --accent-deep:#b53a27;
  --accent-tint:#fbe4de;

  --amber:      #e3a13a;   /* surlignage chiffres-clés */
  --amber-tint: #f8edd6;

  /* typo */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* géométrie diapo */
  --slide-w: 1280px;
  --slide-h: 720px;
  --pad-x: 60px;
  --pad-y: 42px;
  --radius: 16px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 15% -10%, #fbfaf6 0%, transparent 60%),
    radial-gradient(1100px 800px at 110% 120%, var(--brain-tint2) 0%, transparent 55%),
    var(--paper-2);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ---------- Pile de diapos (écran) ---------- */
.deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 40px 20px 80px;
}

.slide {
  position: relative;
  width: var(--slide-w);
  height: var(--slide-h);
  flex: 0 0 auto;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 22px 60px -28px rgba(20,30,45,.45), 0 2px 8px rgba(20,30,45,.06);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: var(--pad-y) var(--pad-x) 26px;
  isolation: isolate;
}

/* liseré teal en haut de chaque diapo */
.slide::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--brain) 0%, var(--brain-deep) 45%, var(--accent) 100%);
  z-index: 5;
}

/* ---------- En-tête de diapo ---------- */
.slide-head { display: flex; flex-direction: column; gap: 8px; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.kicker .num {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0;
}
.kicker .num.is-accent { background: var(--accent); }
.kicker .of { color: var(--ink-faint); font-weight: 500; letter-spacing: .1em; }

.slide-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 33px;
  line-height: 1.12;
  margin: 0;
  letter-spacing: -.01em;
  color: var(--ink);
  max-width: 1000px;
}
.slide-title em { font-style: italic; color: var(--brain-deep); }

.slide-body { min-height: 0; padding-top: 14px; }

/* ---------- Fil rouge (chaîne portée sur chaque diapo) ---------- */
.filrouge {
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-faint);
  margin-top: 6px;
  line-height: 1.2;
  font-weight: 500;
}
.filrouge b { color: var(--accent-deep); font-weight: 700; }
.filrouge .sep { color: #c2bba9; margin: 0 7px; }

/* fil rouge sur la diapo 1 (héro) : body en 1fr, fil rouge + pied en auto */
#s1 { grid-template-rows: 1fr auto auto; }
#s1 .filrouge { margin: 4px 0 10px; align-self: start; }

/* diapo 1 : titre long (4 lignes) + paragraphe d'accroche → rythme resserré */
#s1 .slide-body { align-self: stretch; padding-top: 6px; }
#s1 .hero { align-items: center; gap: 36px; }
#s1 .hero h1 { font-size: 44px; line-height: 1.05; margin: 0 0 12px; }
#s1 .hero .sub { font-size: 17px; margin-bottom: 14px; }
#s1 .hero .metrics { margin-bottom: 14px !important; }
#s1 .hero .byline { line-height: 1.4; }

/* ---------- Pied : bibliographie ---------- */
.biblio {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 8px;
}
.biblio .tag {
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--ink-soft);
  background: var(--line-soft);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.biblio .refs { line-height: 1.4; }
.biblio .refs b { color: var(--ink-soft); font-weight: 600; }

/* ---------- Briques génériques ---------- */
.cols { display: grid; gap: 26px; height: 100%; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-12-10 { grid-template-columns: 1.2fr 1fr; }
.cols-10-12 { grid-template-columns: 1fr 1.2fr; }
.stack { display: flex; flex-direction: column; gap: 14px; min-height: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 18px 20px;
  box-shadow: 0 1px 0 rgba(20,30,45,.02);
}
.card.tint-brain { background: var(--brain-tint2); border-color: #cfe3e5; }
.card.tint-accent { background: var(--accent-tint); border-color: #f3cabf; }
.card.tint-amber { background: var(--amber-tint); border-color: #eedcb4; }

.card-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brain-deep);
  margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.card-title.accent { color: var(--accent-deep); }
.card-title .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brain); }
.card-title.accent .dot { background: var(--accent); }

p { margin: 0 0 10px; line-height: 1.5; }
.lead { font-size: 17px; color: var(--ink-soft); line-height: 1.5; }
.lead b, p b { color: var(--ink); font-weight: 700; }
.hl { background: linear-gradient(transparent 58%, var(--amber-tint) 58%); padding: 0 2px; font-weight: 700; color: var(--ink); }
.hl-accent { color: var(--accent-deep); font-weight: 700; }
.hl-brain { color: var(--brain-deep); font-weight: 700; }

ul.clean { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
ul.clean li { position: relative; padding-left: 22px; line-height: 1.42; font-size: 15px; }
ul.clean li::before {
  content: ""; position: absolute; left: 2px; top: 8px;
  width: 8px; height: 8px; border-radius: 2px; background: var(--brain);
  transform: rotate(45deg);
}
ul.clean.accent li::before { background: var(--accent); }

/* puces problème / solution numérotées en miroir */
.pair-list { display: flex; flex-direction: column; gap: 11px; }
.pair-item { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.pair-item .n {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  font-family: var(--serif); font-weight: 600; font-size: 15px;
  background: var(--line-soft); color: var(--ink-soft);
}
.pair-item.accent .n { background: var(--accent-tint); color: var(--accent-deep); }
.pair-item.brain .n { background: var(--brain-tint); color: var(--brain-deep); }
.pair-item .t { font-size: 14.5px; line-height: 1.4; }
.pair-item .t b { color: var(--ink); }

/* ---------- Métriques / chiffres-clés ---------- */
.metrics { display: flex; gap: 16px; }
.metric { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.metric .v { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1; color: var(--accent-deep); letter-spacing: -.01em; }
.metric .v.brain { color: var(--brain-deep); }
.metric .l { font-size: 12.5px; color: var(--ink-soft); margin-top: 7px; line-height: 1.35; }

/* ---------- Équations ---------- */
.eq {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brain);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0;
  display: flex; align-items: center; gap: 14px;
}
.eq.accent { border-left-color: var(--accent); }
.eq .katex { font-size: 1.12em; }
.eq .note { font-size: 12px; color: var(--ink-faint); line-height: 1.3; }
.eq-row { display: flex; gap: 12px; flex-wrap: wrap; }
.eq-inline { background: var(--brain-tint2); border-radius: 7px; padding: 6px 12px; border: 1px solid #cfe3e5; }

/* ---------- Tableaux ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-weight: 700; font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-soft);
  padding: 7px 10px; border-bottom: 2px solid var(--line);
}
table.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); line-height: 1.35; vertical-align: top; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl .dom { font-weight: 700; color: var(--brain-deep); white-space: nowrap; }
table.tbl tr.is-brain td { background: var(--brain-tint2); }
table.tbl tr.is-brain .mat { font-weight: 700; color: var(--brain-deep); }
table.tbl .mat { font-weight: 600; }
table.tbl .val { font-variant-numeric: tabular-nums; color: var(--ink-soft); }

.warn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--accent-deep);
  background: var(--accent-tint); border-radius: 6px; padding: 2px 8px;
  font-weight: 600;
}

/* ---------- Figures SVG ---------- */
.fig { width: 100%; height: auto; display: block; }
.fig-cap { font-size: 12px; color: var(--ink-faint); text-align: center; margin-top: 6px; line-height: 1.35; }
.fig-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }

/* ---------- Diapo 1 — héro ---------- */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; height: 100%; }
.hero-eyebrow {
  font-size: 14px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--brain-deep); margin-bottom: 18px; display: flex; align-items: center; gap: 12px;
}
.hero-eyebrow .line { height: 1px; width: 46px; background: var(--brain); }
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 52px;
  line-height: 1.06;
  letter-spacing: -.02em;
  margin: 0 0 18px;
  color: var(--ink);
}
.hero h1 .q { color: var(--accent-deep); font-style: italic; }
.hero .sub { font-size: 19px; color: var(--ink-soft); line-height: 1.45; margin-bottom: 26px; max-width: 540px; }
.hero .byline { font-size: 14px; color: var(--ink-faint); letter-spacing: .02em; }
.hero .byline b { color: var(--ink-soft); }

/* ---------- Bandeau "porteur d'idée" ---------- */
.thesis-strip {
  background: var(--ink); color: #f4f1ea; border-radius: 13px;
  padding: 16px 22px; font-size: 15.5px; line-height: 1.45;
  display: flex; gap: 14px; align-items: center;
}
.thesis-strip .mark { font-family: var(--serif); font-size: 26px; color: var(--accent); line-height: 1; }
.thesis-strip b { color: #fff; }
.thesis-strip .em { color: var(--amber); font-style: italic; font-family: var(--serif); }

/* badge brouillon */
.draft-badge {
  position: absolute; top: 16px; right: 18px; z-index: 6;
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); background: rgba(255,255,255,.7);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
}

/* ---------- Notes d'oratrice (écran seulement, jamais imprimées) ---------- */
.speaker-notes {
  width: var(--slide-w);
  max-width: var(--slide-w);
  flex: 0 0 auto;
  margin: -18px auto 0;
  background: #fffdf8;
  border: 1px dashed #d8cfb8;
  border-top: none;
  border-radius: 0 0 14px 14px;
  padding: 16px 30px 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  box-shadow: 0 14px 36px -28px rgba(20,30,45,.4);
}
.speaker-notes b { color: var(--ink); font-weight: 700; }
.speaker-notes .sn-tag {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brain-deep); background: var(--brain-tint); border-radius: 999px;
  padding: 3px 10px; margin-right: 8px; vertical-align: 1px;
}
.speaker-notes .sn-trans {
  display: block; margin-top: 10px; padding-top: 9px;
  border-top: 1px solid #eee3cf; color: var(--accent-deep); font-size: 13px;
}
.speaker-notes .sn-trans b { color: var(--accent-deep); }

/* ---------- Navigation écran ---------- */
.deck-nav {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 9px; z-index: 50;
}
.deck-nav a { width: 11px; height: 11px; border-radius: 50%; background: #c9c2b2; transition: all .2s; }
.deck-nav a:hover { background: var(--brain); transform: scale(1.25); }

/* ---------- Garde-fou de mise en page (gate QA visuelle) ----------
   Invariant : le corps d'une diapo ne peut JAMAIS peindre par-dessus le
   pied (biblio) ni le liseré. Les colonnes partagent la même hauteur ;
   une figure rétrécit pour tenir, sans jamais être coupée. */
.slide-body { overflow: hidden; min-height: 0; }
.slide-body > .cols { height: 100%; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.cols > .stack { min-height: 0; }
/* Une figure dans une pile occupe l'espace restant et s'y adapte. */
.stack > .fig-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.stack > .fig-wrap > .fig {
  flex: 0 1 auto;   /* ne grossit pas, mais rétrécit si la pile manque de place */
  min-height: 0;
  object-fit: contain;
}

/* ---------- Impression ---------- */
@page { size: 1280px 720px; margin: 0; }
@media print {
  body { background: #fff; }
  .deck { display: block; padding: 0; gap: 0; }
  .deck-nav { display: none !important; }
  .speaker-notes { display: none !important; }
  .slide {
    width: 1280px; height: 720px;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    break-after: page;
    page-break-after: always;
  }
  .slide:last-child { break-after: auto; page-break-after: auto; }
  .draft-badge { background: transparent; }
}

/* Diapo 1 — hero image full-bleed dans la carte */
#s1 .fig-wrap{ padding:0; overflow:hidden; }
#s1 .fig-wrap .fig{ display:block; width:100%; border-radius:12px 12px 0 0; }
#s1 .fig-wrap .fig-cap{ padding:9px 16px 12px; margin-top:0; }
