/* =========================================================
   Formation GitHub VHM — thème inspiré de l'interface GitHub
   ========================================================= */

/* ---------- Couleurs (sombre par défaut) ---------- */
:root {
  color-scheme: dark;
  --bg-header: #010409;
  --bg-sidebar: #0d1117;
  --bg-main: #010409;
  --bg-subtle: #151b23;
  --bg-control: #212830;
  --bg-control-hover: #262c36;
  --bg-hover: rgba(101, 108, 118, 0.2);
  --bg-active: rgba(101, 108, 118, 0.25);
  --bg-overlay: #151b23;
  --border: #3d444d;
  --border-muted: rgba(61, 68, 77, 0.7);
  --fg: #f0f6fc;
  --fg-muted: #9198a1;
  --accent: #4493f8;
  --accent-emphasis: #1f6feb;
  --code-bg: rgba(101, 108, 118, 0.2);
  --pre-bg: #151b23;
  --backdrop: rgba(1, 4, 9, 0.7);
  --shadow: 0 8px 24px rgba(1, 4, 9, 0.75);
  --alert-note: #4493f8;
  --alert-tip: #3fb950;
  --alert-important: #ab7df8;
  --alert-warning: #d29922;
  --alert-caution: #f85149;
  --show-sun: inline-block;
  --show-moon: none;
}

/* Thème clair : préférence système (sauf choix explicite) ou choix explicite */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg-header: #f6f8fa;
    --bg-sidebar: #ffffff;
    --bg-main: #ffffff;
    --bg-subtle: #f6f8fa;
    --bg-control: #f6f8fa;
    --bg-control-hover: #eff2f5;
    --bg-hover: rgba(129, 139, 152, 0.15);
    --bg-active: rgba(129, 139, 152, 0.2);
    --bg-overlay: #ffffff;
    --border: #d1d9e0;
    --border-muted: rgba(209, 217, 224, 0.7);
    --fg: #1f2328;
    --fg-muted: #59636e;
    --accent: #0969da;
    --accent-emphasis: #0969da;
    --code-bg: rgba(129, 139, 152, 0.12);
    --pre-bg: #f6f8fa;
    --backdrop: rgba(31, 35, 40, 0.5);
    --shadow: 0 8px 24px rgba(66, 74, 83, 0.12);
    --alert-note: #0969da;
    --alert-tip: #1a7f37;
    --alert-important: #8250df;
    --alert-warning: #9a6700;
    --alert-caution: #d1242f;
    --show-sun: none;
    --show-moon: inline-block;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg-header: #f6f8fa;
  --bg-sidebar: #ffffff;
  --bg-main: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-control: #f6f8fa;
  --bg-control-hover: #eff2f5;
  --bg-hover: rgba(129, 139, 152, 0.15);
  --bg-active: rgba(129, 139, 152, 0.2);
  --bg-overlay: #ffffff;
  --border: #d1d9e0;
  --border-muted: rgba(209, 217, 224, 0.7);
  --fg: #1f2328;
  --fg-muted: #59636e;
  --accent: #0969da;
  --accent-emphasis: #0969da;
  --code-bg: rgba(129, 139, 152, 0.12);
  --pre-bg: #f6f8fa;
  --backdrop: rgba(31, 35, 40, 0.5);
  --shadow: 0 8px 24px rgba(66, 74, 83, 0.12);
  --alert-note: #0969da;
  --alert-tip: #1a7f37;
  --alert-important: #8250df;
  --alert-warning: #9a6700;
  --alert-caution: #d1242f;
  --show-sun: none;
  --show-moon: inline-block;
}

/* ---------- Dimensions ---------- */
:root {
  --header-height: 64px;
  --sidebar-width: 300px;
  --radius: 6px;
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono",
    monospace;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  background: var(--bg-main);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 2px solid var(--accent-emphasis);
  outline-offset: -2px;
  border-radius: var(--radius);
}

.octicon {
  fill: currentColor;
  flex-shrink: 0;
  vertical-align: text-bottom;
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--fg-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn svg {
  fill: currentColor;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

#theme-toggle .icon-sun {
  display: var(--show-sun);
}
#theme-toggle .icon-moon {
  display: var(--show-moon);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--fg);
}
.brand:hover {
  text-decoration: none;
}

/* Emplacement du logo — remplacer par une <img> plus tard */
.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-control);
  border: 1px dashed var(--border);
  color: var(--fg-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.brand img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  flex: 1;
}

/* ---------- Recherche ---------- */
.search {
  position: relative;
  width: 272px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 8px;
  fill: var(--fg-muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 32px;
  padding: 0 32px 0 34px;
  color: var(--fg);
  font: inherit;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}
.search input::placeholder {
  color: var(--fg-muted);
}
.search input:focus {
  border-color: var(--accent-emphasis);
  box-shadow: inset 0 0 0 1px var(--accent-emphasis);
}
.search input::-webkit-search-cancel-button {
  display: none;
}

.search-kbd {
  position: absolute;
  right: 8px;
  top: 7px;
  padding: 0 5px;
  font: 11px/16px var(--font-mono);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  pointer-events: none;
}
.search input:focus ~ .search-kbd {
  display: none;
}

.search-results {
  position: absolute;
  top: 40px;
  right: 0;
  width: 100%;
  min-width: 300px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.search-results a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  color: var(--fg);
  border-radius: var(--radius);
}
.search-results a .octicon {
  fill: var(--fg-muted);
}
.search-results a:hover,
.search-results a.is-selected {
  background: var(--bg-hover);
  text-decoration: none;
}
.search-section {
  font-weight: 600;
}
.search-empty {
  padding: 6px 8px;
  color: var(--fg-muted);
}

/* ---------- Mise en page ---------- */
.layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  align-self: flex-start;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  padding: 16px;
  overflow-y: auto;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-heading {
  padding: 0 8px 8px;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
}

.main {
  flex: 1;
  min-width: 0;
}

/* ---------- Menu latéral ---------- */
#nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-section + .nav-section {
  margin-top: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-item:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.nav-section-toggle {
  font-weight: 600;
}
.nav-section-toggle > .octicon:first-child {
  fill: var(--fg-muted);
}
.nav-label {
  flex: 1;
}
.nav-chevron {
  fill: var(--fg-muted);
  transform: rotate(90deg);
  transition: transform 0.12s ease;
}
.is-collapsed .nav-chevron {
  transform: rotate(0deg);
}
.is-collapsed .nav-pages {
  display: none;
}

.nav-pages {
  padding-top: 2px !important;
}
.nav-pages li + li {
  margin-top: 2px;
}
.nav-link {
  padding-left: 32px;
  color: var(--fg-muted);
}
.nav-link:hover {
  color: var(--fg);
}

/* Élément actif : fond + barre bleue à gauche, comme sur GitHub */
.nav-link.is-active {
  color: var(--fg);
  font-weight: 600;
  background: var(--bg-active);
}
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: calc(50% - 12px);
  width: 4px;
  height: 24px;
  background: var(--accent-emphasis);
  border-radius: var(--radius);
}

.sidebar-backdrop {
  display: none;
}

/* ---------- Contenu ---------- */
.content-wrap {
  display: flex;
  gap: 48px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 40px 64px;
}

.content {
  flex: 1;
  min-width: 0;
  max-width: 880px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--fg-muted);
  font-size: 14px;
}
.breadcrumbs:empty {
  display: none;
}
.breadcrumbs .sep {
  color: var(--border);
}

/* Table des matières à droite */
.toc {
  position: sticky;
  top: calc(var(--header-height) + 32px);
  align-self: flex-start;
  width: 240px;
  max-height: calc(100vh - var(--header-height) - 64px);
  overflow-y: auto;
  flex-shrink: 0;
  font-size: 14px;
}
.toc:empty {
  display: none;
}
.toc-heading {
  margin-bottom: 8px;
  font-weight: 600;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}
.toc a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 12px;
  color: var(--fg-muted);
  border-left: 2px solid transparent;
}
.toc a:hover {
  color: var(--fg);
  text-decoration: none;
}
.toc a.is-active {
  color: var(--fg);
  border-left-color: var(--accent-emphasis);
}
.toc .toc-h3 a {
  padding-left: 24px;
}

/* Précédent / Suivant */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.pager:empty {
  display: none;
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pager-link:hover {
  border-color: var(--accent-emphasis);
  text-decoration: none;
}
.pager-next {
  text-align: right;
}
.pager-dir {
  color: var(--fg-muted);
  font-size: 12px;
}
.pager-title {
  font-weight: 600;
  font-size: 16px;
}

/* Message (page introuvable, serveur requis…) */
.blankslate {
  padding: 32px;
  text-align: center;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.blankslate > .octicon {
  width: 24px;
  height: 24px;
  fill: var(--fg-muted);
}
.blankslate h2 {
  margin: 12px 0 4px !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: 20px !important;
}
.blankslate p {
  margin: 0 auto !important;
  max-width: 520px;
  color: var(--fg-muted);
}

/* ---------- Rendu Markdown (style GitHub) ---------- */
.markdown-body {
  font-size: 16px;
  line-height: 1.5;
  word-wrap: break-word;
}
.markdown-body > *:first-child {
  margin-top: 0 !important;
}
.markdown-body > *:last-child {
  margin-bottom: 0 !important;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 24px 0 16px;
  font-weight: 600;
  line-height: 1.25;
}
.markdown-body h1 {
  font-size: 2em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-muted);
}
.markdown-body h2 {
  font-size: 1.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border-muted);
}
.markdown-body h3 {
  font-size: 1.25em;
}
.markdown-body h4 {
  font-size: 1em;
}
.markdown-body h5 {
  font-size: 0.875em;
}
.markdown-body h6 {
  font-size: 0.85em;
  color: var(--fg-muted);
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre,
.markdown-body blockquote,
.markdown-body details,
.markdown-body .table-wrap,
.markdown-body .markdown-alert {
  margin-top: 0;
  margin-bottom: 16px;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 2em;
}
.markdown-body li + li {
  margin-top: 0.25em;
}
.markdown-body li > p {
  margin-top: 16px;
}
.markdown-body ul ul,
.markdown-body ol ol,
.markdown-body ul ol,
.markdown-body ol ul {
  margin-bottom: 0;
}
.markdown-body input[type="checkbox"] {
  margin: 0 0.4em 0.25em -1.4em;
  vertical-align: middle;
}
.markdown-body li:has(> input[type="checkbox"]) {
  list-style: none;
}

.markdown-body a {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.markdown-body strong {
  font-weight: 600;
}

.markdown-body hr {
  height: 0.25em;
  margin: 24px 0;
  padding: 0;
  background: var(--border);
  border: 0;
}

.markdown-body blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 0 1em;
  color: var(--fg-muted);
  border-left: 0.25em solid var(--border);
}

.markdown-body code,
.markdown-body kbd,
.markdown-body pre {
  font-family: var(--font-mono);
}

.markdown-body code {
  padding: 0.2em 0.4em;
  font-size: 85%;
  white-space: break-spaces;
  background: var(--code-bg);
  border-radius: var(--radius);
}

.markdown-body pre {
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background: var(--pre-bg);
  border-radius: var(--radius);
}
.markdown-body pre code {
  padding: 0;
  font-size: 100%;
  white-space: pre;
  background: transparent;
  border-radius: 0;
}

.markdown-body kbd {
  display: inline-block;
  padding: 3px 5px;
  font-size: 11px;
  line-height: 10px;
  color: var(--fg);
  vertical-align: middle;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius);
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius);
}

.markdown-body .table-wrap {
  overflow-x: auto;
}
.markdown-body table {
  border-collapse: collapse;
  border-spacing: 0;
  margin-bottom: 0;
}
.markdown-body th,
.markdown-body td {
  padding: 6px 13px;
  border: 1px solid var(--border);
}
.markdown-body th {
  font-weight: 600;
}
.markdown-body tr {
  background: var(--bg-main);
  border-top: 1px solid var(--border-muted);
}
.markdown-body tr:nth-child(2n) {
  background: var(--bg-subtle);
}

.markdown-body details summary {
  cursor: pointer;
  font-weight: 600;
}

/* Diagramme d'historique git (<figure class="git-graph"><svg>…) */
.markdown-body .git-graph {
  margin: 0 0 16px;
  padding: 16px;
  overflow-x: auto;
  background: var(--pre-bg);
  border-radius: var(--radius);
}
.git-graph svg {
  display: block;
  width: 100%;
  min-width: 480px;
  max-width: 640px;
  height: auto;
}
.git-graph path {
  fill: none;
  stroke-width: 3;
}
.git-graph .line-main {
  stroke: var(--alert-note);
}
.git-graph .line-feature {
  stroke: var(--alert-tip);
}
.git-graph circle {
  fill: var(--pre-bg);
  stroke-width: 3;
}
.git-graph .commit-main circle {
  stroke: var(--alert-note);
}
.git-graph .commit-feature circle {
  stroke: var(--alert-tip);
}
.git-graph text {
  fill: var(--fg);
  font: 600 14px var(--font-mono);
  text-anchor: middle;
}
.git-graph text.label {
  fill: var(--fg-muted);
  font-weight: 400;
  text-anchor: start;
}
.git-graph .zone {
  fill: var(--bg-main);
  stroke: var(--border);
  stroke-width: 1.5;
}
.git-graph text.zone-label {
  font: 600 15px var(--font);
}
.git-graph .arrow {
  stroke: var(--alert-note);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.git-graph text.arrow-label {
  fill: var(--alert-note);
  font: 500 12px var(--font-mono);
}

/* Encadrés > [!NOTE] etc. */
.markdown-alert {
  padding: 8px 16px;
  color: inherit;
  border-left: 0.25em solid var(--alert-color);
}
.markdown-alert > :last-child {
  margin-bottom: 0;
}
.markdown-alert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px !important;
  color: var(--alert-color);
  font-weight: 500;
  line-height: 1;
}
.markdown-alert-title .octicon {
  fill: var(--alert-color);
}
.markdown-alert-note {
  --alert-color: var(--alert-note);
}
.markdown-alert-tip {
  --alert-color: var(--alert-tip);
}
.markdown-alert-important {
  --alert-color: var(--alert-important);
}
.markdown-alert-warning {
  --alert-color: var(--alert-warning);
}
.markdown-alert-caution {
  --alert-color: var(--alert-caution);
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 16px;
  font: 500 14px/20px var(--font);
  color: var(--fg);
  background: var(--bg-control);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.btn:hover {
  background: var(--bg-control-hover);
}

/* ---------- Quiz ---------- */
.markdown-body .quiz-questions {
  list-style: none;
  padding: 0;
  counter-reset: quiz;
}
.markdown-body .quiz-question {
  margin: 0 0 16px;
  padding: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  counter-increment: quiz;
}
.quiz-question fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.quiz-question legend {
  margin-bottom: 8px;
  padding: 0;
  font-weight: 600;
}
.quiz-question legend::before {
  content: counter(quiz) ". ";
  color: var(--fg-muted);
}

.quiz-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.quiz-choice input {
  margin: 3px 0 0;
  accent-color: var(--accent-emphasis);
  flex-shrink: 0;
}
.quiz-choice:hover {
  border-color: var(--accent-emphasis);
}
.quiz-choice:has(input:checked) {
  border-color: var(--accent-emphasis);
  box-shadow: inset 0 0 0 1px var(--accent-emphasis);
}

.is-answered .quiz-choice {
  cursor: default;
}
.is-answered .quiz-choice:hover {
  border-color: var(--border);
}
.is-answered .quiz-choice:not(.is-answer):not(.is-wrong) {
  opacity: 0.6;
}
.quiz .quiz-choice.is-answer {
  border-color: var(--alert-tip);
  box-shadow: inset 0 0 0 1px var(--alert-tip);
  background: color-mix(in srgb, var(--alert-tip) 12%, var(--bg-main));
}
.quiz .quiz-choice.is-wrong {
  border-color: var(--alert-caution);
  box-shadow: inset 0 0 0 1px var(--alert-caution);
  background: color-mix(in srgb, var(--alert-caution) 12%, var(--bg-main));
}

.quiz-feedback {
  margin-top: 12px;
}
.markdown-body .quiz-feedback p {
  margin-bottom: 4px;
}
.quiz-verdict {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.is-correct .quiz-verdict {
  color: var(--alert-tip);
}
.is-wrong .quiz-verdict {
  color: var(--alert-caution);
}

.markdown-body .quiz-progress {
  margin: 0;
  color: var(--fg-muted);
}

.quiz-result {
  padding: 16px;
  text-align: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.markdown-body .quiz-result p {
  margin-bottom: 8px;
}
.markdown-body .quiz-score {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
}

/* Bouton flottant « Retour au quiz » (quiz commencé, pas terminé) */
.quiz-resume {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: #ffffff;
  font-weight: 600;
  background: var(--accent-emphasis);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.quiz-resume[hidden] {
  display: none;
}
.quiz-resume:hover {
  color: #ffffff;
  text-decoration: none;
  filter: brightness(1.1);
}
.quiz-resume .octicon {
  fill: currentColor;
}
.quiz-resume-count {
  font-weight: 400;
  opacity: 0.85;
}

/* ---------- Présentation ---------- */
.btn-primary {
  color: #ffffff;
  background: var(--accent-emphasis);
  border-color: transparent;
}
.btn-primary:hover {
  background: var(--accent-emphasis);
  filter: brightness(1.1);
}

.icon-flip {
  transform: scaleX(-1);
}

body.is-presenting {
  overflow: hidden;
}

.presenter {
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --slide-duration: 0.55s;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-main);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.presenter.is-open {
  opacity: 1;
}
.presenter:focus {
  outline: none;
}
.presenter.is-idle {
  cursor: none;
}

/* Scène de 1280 × 720, mise à l'échelle de l'écran par app.js (--scale) */
.presenter-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1280px;
  height: 720px;
  overflow: hidden;
  background: var(--bg-main);
  transform: translate(-50%, -50%) scale(var(--scale, 1));
}

/* Transition entre diapositives : glissement + fondu, dans le sens du parcours */
.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 56px 96px 0;
  opacity: 0;
  visibility: hidden;
  /* Sortie : le fondu est plus court que le glissement, pour limiter le chevauchement */
  transition:
    transform var(--slide-duration) var(--ease),
    opacity 0.25s ease,
    visibility 0s linear var(--slide-duration);
}
.slide.is-before {
  transform: translateX(-120px);
}
.slide.is-after {
  transform: translateX(120px);
}
.slide.is-current {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    transform var(--slide-duration) var(--ease),
    opacity 0.4s ease 0.1s,
    visibility 0s;
}
.no-transition .slide {
  transition: none;
}

/* Le contenu de la diapositive courante apparaît en cascade */
.slide.is-current .slide-content > * {
  animation: slide-rise 0.6s var(--ease) both;
  animation-delay: calc(0.15s + var(--i, 0) * 70ms);
}
@keyframes slide-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.slide-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.slide-content.markdown-body {
  font-size: 26px;
  line-height: 1.45;
}
.slide-content h2 {
  margin: 0 0 0.9em;
  padding-bottom: 0;
  font-size: 1.75em;
  border-bottom: 0;
}
.slide-content h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 0.35em;
  background: var(--accent);
  border-radius: 2px;
}
.slide-content p,
.slide-content ul,
.slide-content ol,
.slide-content pre,
.slide-content .table-wrap,
.slide-content table,
.slide-content .markdown-alert,
.slide-content .git-graph {
  margin-bottom: 0.8em;
}
.slide-content li + li {
  margin-top: 0.4em;
}
.slide-content table {
  width: 100%;
  font-size: 0.8em;
}
.slide-content th,
.slide-content td {
  padding: 0.45em 0.9em;
}
.slide-content pre {
  padding: 20px 24px;
  font-size: 0.72em;
}
.slide-content .markdown-alert {
  padding: 0.5em 0.9em;
  font-size: 0.85em;
  background: var(--bg-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.slide-content .git-graph {
  padding: 24px;
}
.slide-content .git-graph svg {
  max-width: 900px;
  margin: 0 auto;
}

/* Page de titre */
.slide-cover h1 {
  margin: 0 0 0.3em;
  padding: 0;
  font-size: 3.2em;
  letter-spacing: -0.02em;
  border-bottom: 0;
}
.slide-cover h1::before {
  content: "";
  display: block;
  width: 80px;
  height: 6px;
  margin-bottom: 0.45em;
  background: var(--accent);
  border-radius: 3px;
}
.slide-cover .slide-content p {
  font-size: 1.3em;
  color: var(--fg-muted);
}

.slide-footer {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 72px;
  font-size: 16px;
  color: var(--fg-muted);
}
.slide-footer a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
}
.slide-footer a:hover {
  color: var(--accent);
}

.presenter-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--border-muted);
}
.presenter-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width var(--slide-duration) var(--ease);
}

.presenter-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: opacity 0.3s ease;
}
.presenter-controls .icon-btn {
  border-color: transparent;
  border-radius: 50%;
}
.presenter-controls .icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}
.presenter-counter {
  min-width: 64px;
  font: 500 13px var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--fg-muted);
}
.presenter.is-idle .presenter-controls {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .slide.is-before,
  .slide.is-after {
    transform: none;
  }
  .slide.is-current .slide-content > * {
    animation: none;
  }
}

/* Page « Présentation » : liste des diapositives */
.markdown-body .slide-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 0;
  list-style: none;
}
.markdown-body .slide-list li + li {
  margin-top: 0;
}
.slide-list-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 10px 12px;
  font: 14px/1.4 var(--font);
  text-align: left;
  color: var(--fg);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.slide-list-item:hover {
  border-color: var(--accent);
}
.slide-list-item.is-cover {
  font-weight: 600;
}
.slide-list-num {
  min-width: 1.5em;
  font: 12px var(--font-mono);
  color: var(--fg-muted);
}

/* ---------- Responsive ---------- */

/* Bureau : le bouton menu masque / affiche la barre latérale */
@media (min-width: 1012px) {
  body.sidebar-hidden .sidebar {
    display: none;
  }
}

@media (max-width: 1279px) {
  .toc {
    display: none;
  }
}

/* Tablette et mobile : barre latérale en tiroir */
@media (max-width: 1011px) {
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 25;
    height: auto;
    max-width: calc(100vw - 48px);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  body.sidebar-open .sidebar {
    transform: none;
    box-shadow: var(--shadow);
  }
  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    z-index: 20;
    background: var(--backdrop);
  }
  .content-wrap {
    padding: 24px 24px 48px;
  }
}

@media (max-width: 767px) {
  .search {
    width: 200px;
  }
  .search-kbd {
    display: none;
  }
}

@media (max-width: 599px) {
  .topbar {
    gap: 8px;
  }
  .search {
    display: none;
  }
  .content-wrap {
    padding: 16px 16px 40px;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager-next {
    text-align: left;
  }
  .quiz-resume {
    right: 16px;
    bottom: 16px;
  }
  .markdown-body h1 {
    font-size: 1.6em;
  }
}
