:root {
  --ink: #1D2433;
  --muted: #5B6475;
  --accent: #1F7A5C;
  --accent-soft: #E6F2EC;
  --paper: #FFFFFF;
  --surface: #F4F6F8;
  --line: #DDE2E8;
  --font: "Public Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: #2A3142;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Scène ---------- */

.deck { position: fixed; inset: 0; display: grid; place-items: center; }

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1280px;
  height: 720px;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  transform-origin: center;
  flex: none;
}

.slide {
  position: absolute;
  inset: 0;
  padding: 64px 88px 84px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  transition: opacity 200ms ease;
  overflow: hidden;
}
.slide.is-active { visibility: visible; opacity: 1; }

@media (prefers-reduced-motion: reduce) { .slide { transition: none; } }

.slide::after {
  content: attr(data-deck);
  position: absolute;
  left: 88px;
  bottom: 32px;
  font-size: 15px;
  color: var(--muted);
}

/* Slide de titre / conclusion */
.slide .home { position: absolute; right: 88px; top: 24px; font-size: 15px; color: var(--muted); text-decoration: none; }
.slide .home:hover { color: var(--accent); text-decoration: underline; }
.slide .home:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.slide--accent .home, .slide--accent .home:hover { color: rgba(255,255,255,.85); }
.slide--accent { background: var(--accent); color: #fff; }
.slide--accent::after { color: rgba(255,255,255,.75); }
.slide--accent .muted { color: rgba(255,255,255,.85); }

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

.display { font-weight: 800; font-size: 96px; line-height: 1; letter-spacing: -.025em; }
h2 { font-weight: 750; font-size: 52px; line-height: 1.08; letter-spacing: -.015em; max-width: 24ch; margin-bottom: 36px; }
h3 { font-weight: 700; font-size: 27px; line-height: 1.2; margin-bottom: 10px; }
p, li { font-size: 23px; line-height: 1.5; }
.lead { font-size: 29px; line-height: 1.45; max-width: 36ch; }
.muted { color: var(--muted); }
.small p, .small li, .small { font-size: 20px; }
strong { font-weight: 700; }

ul.plain { list-style: none; }
ul.plain li { padding: 12px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

ul.ticks { list-style: none; }
ul.ticks li { position: relative; padding-left: 34px; margin-bottom: 14px; }
ul.ticks li::before {
  content: "";
  position: absolute; left: 2px; top: .42em;
  width: 9px; height: 15px;
  border: solid var(--accent);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.slide--accent ul.ticks li::before { border-color: #fff; }

/* ---------- Mise en page ---------- */

.body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.bottom { margin-top: auto; }

.cols { display: grid; gap: 48px; align-items: start; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); gap: 28px; }
.cols-wide { grid-template-columns: 1.4fr 1fr; }

.panel { background: var(--surface); border-radius: 10px; padding: 26px 28px; }
.panel--accent { background: var(--accent-soft); }

/* ---------- Chiffres clés ---------- */

.figures { display: flex; gap: 72px; align-items: flex-start; }
.figure .value { font-weight: 800; font-size: 150px; line-height: 1; letter-spacing: -.04em; }
.figure .value small { font-size: .4em; font-weight: 700; margin-left: 4px; }
.figure .label { font-size: 23px; margin-top: 12px; max-width: 17ch; }
.slide--accent .figure .label { color: rgba(255,255,255,.9); }

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

table { border-collapse: collapse; width: 100%; font-size: 21px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--muted); font-size: 18px; border-bottom: 2px solid var(--ink); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; }
tr.hl td { background: var(--accent-soft); }

/* ---------- Barres de répartition ---------- */

.split { margin-bottom: 34px; }
.split h3 { display: flex; justify-content: space-between; }
.split-bar { display: flex; height: 58px; border-radius: 8px; overflow: hidden; }
.split-bar span { display: flex; align-items: center; padding: 0 14px; font-size: 17px; font-weight: 600; white-space: nowrap; }
.seg-org { background: var(--accent); color: #fff; }
.seg-tva { background: #C9D0DA; color: var(--ink); }
.seg-fee { background: #E3E7ED; color: var(--ink); }
.seg-rest { background: var(--ink); color: #fff; }
.legend { display: flex; gap: 28px; font-size: 17px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 8px; vertical-align: -2px; }

/* ---------- Chronologie ---------- */

.timeline .months { display: grid; grid-template-columns: repeat(12, 1fr); font-size: 16px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 18px; }
.timeline .row { display: grid; grid-template-columns: repeat(12, 1fr); align-items: center; height: 50px; margin-bottom: 8px; }
.timeline .bar { height: 38px; border-radius: 6px; display: flex; align-items: center; padding: 0 12px; font-size: 16px; font-weight: 600; white-space: nowrap; }
.timeline .bar--shop { background: var(--ink); color: #fff; }
.timeline .bar--camp { background: var(--accent); color: #fff; }

/* ---------- Exemples ---------- */

.example .amount { font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: -.03em; color: var(--accent); margin: 8px 0 10px; }
.note { font-size: 16px; color: var(--muted); margin-top: 22px; }
.slide--accent .note { color: rgba(255,255,255,.75); }

/* ---------- Mermaid ---------- */

.diagram { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.diagram .mermaid { width: 100%; display: flex; justify-content: center; }
.diagram .mermaid svg { max-width: 100%; max-height: 460px; height: auto; }
.mermaid p, .mermaid li, .mermaid span { font-size: inherit; line-height: inherit; margin: 0; }

/* ---------- Contrôles ---------- */

.controls { position: fixed; right: 18px; bottom: 14px; display: flex; align-items: center; gap: 6px; z-index: 10; color: #fff; font-size: 14px; background: rgba(29,36,51,.78); border-radius: 10px; padding: 4px; }
.controls button { font: inherit; color: inherit; background: transparent; border: 0; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.controls button:hover { background: rgba(255,255,255,.18); }
.controls :focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.controls .count { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Téléphone ---------- */

.rotate { display: none; }
@media (orientation: portrait) and (max-width: 820px) {
  .deck, .controls, .progress { display: none; }
  .rotate { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px; text-align: center; background: var(--ink); color: #fff; }
  .rotate p { font-size: 22px; font-weight: 700; line-height: 1.3; max-width: 16em; }
  .rotate button { font: inherit; font-weight: 600; font-size: 17px; color: var(--ink); background: #fff; border: 0; border-radius: 8px; padding: 12px 22px; }
  .rotate a { color: rgba(255,255,255,.8); font-size: 16px; }
}
@media (max-height: 500px) {
  .controls { right: 8px; bottom: 6px; font-size: 13px; padding: 2px; gap: 2px; }
  .controls button { padding: 5px 9px; }
  .controls .count { min-width: 52px; }
}

.progress { position: fixed; left: 0; top: 0; height: 3px; background: var(--accent); z-index: 10; transition: width 200ms ease; }

/* ---------- Impression ---------- */

@page { size: 1280px 720px; margin: 0; }
@media print {
  body { overflow: visible; background: none; }
  .deck { position: static; display: block; }
  .stage { position: static; transform: none; width: auto; height: auto; }
  .slide { position: relative; width: 1280px; height: 720px; visibility: visible; opacity: 1; break-after: page; }
  .controls, .progress, .rotate, .slide .home { display: none; }
}
