/* Simple8 — pages de documentation : sommaire à gauche, chapitre à droite */

.doc-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  max-width: 1320px;
  margin: 0 auto;
  min-height: calc(100vh - 60px);
}

/* ---- Sommaire ---- */

.toc {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 28px 16px 40px 24px;
  border-right: 1px solid var(--border);
  font-size: 14.5px;
}

.toc-title {
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--sun);
  text-transform: uppercase;
  margin: 0 0 16px 8px;
}

.toc-tools {
  display: flex;
  gap: 6px;
  margin: 0 0 14px 8px;
}

.toc-tools button {
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.toc-tools button:hover {
  color: var(--text);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-part {
  margin: 18px 0 6px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8f83a3;
}

.toc-chapter > .toc-row {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

.toc-toggle {
  flex: none;
  width: 22px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
}


.toc-toggle:hover {
  color: var(--text);
}

.toc a,
.toc .toc-soon {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-dim);
  line-height: 1.45;
}

.toc a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.toc-chapter > .toc-row a {
  flex: 1;
  color: var(--text);
  font-weight: 600;
}

.toc-chapter.current > .toc-row a {
  color: var(--teal-hi);
}

.toc-sections {
  display: none;
  margin: 2px 0 8px 22px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.toc-chapter.open > .toc-sections {
  display: block;
}

.toc-sections a {
  font-size: 14px;
}

.toc-sections a.active {
  color: var(--teal-hi);
  background: rgba(47, 181, 148, 0.1);
}

.toc .toc-soon {
  color: #6f6482;
  cursor: default;
}

.toc .toc-soon em {
  font-style: normal;
  font-size: 11px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
}

/* Bouton du sommaire sur écran étroit */
.toc-open {
  display: none;
}

/* ---- Contenu ---- */

.content {
  padding: 40px 56px 96px;
  max-width: 900px;
}

.content .breadcrumb {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.content .breadcrumb a {
  color: var(--text-dim);
}

.content h1 {
  margin-bottom: 12px;
}

.content > .lead {
  margin-bottom: 8px;
}

.content h2 {
  margin-top: 64px;
  padding-top: 8px;
  scroll-margin-top: 76px;
  font-size: 27px;
}

.content h2 .num {
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--sun);
  margin-right: 12px;
  vertical-align: 3px;
}

.content h3 {
  margin-top: 36px;
  font-size: 19px;
  scroll-margin-top: 76px;
}

.content p,
.content li {
  color: #ddd3e6;
}

.content ul,
.content ol {
  padding-left: 22px;
}

.content li {
  margin-bottom: 6px;
}

.content pre {
  margin: 18px 0 22px;
  padding: 16px 20px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: auto;
}

.content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.content pre .c { color: #7d7290; }
.content pre .k { color: var(--sun); }
.content pre .t { color: var(--sky); }
.content pre .s { color: var(--teal-hi); }

/* Tableaux */
.table-wrap {
  overflow-x: auto;
  margin: 18px 0 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.content th,
.content td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.content th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.content tr:last-child td {
  border-bottom: 0;
}

.content td code {
  white-space: nowrap;
}

/* Encadrés */
.note {
  margin: 22px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--sky);
  background: rgba(111, 166, 216, 0.08);
  border-radius: 0 8px 8px 0;
}

.note.tip {
  border-left-color: var(--teal);
  background: rgba(47, 181, 148, 0.08);
}

.note.warn {
  border-left-color: var(--sun);
  background: rgba(242, 162, 74, 0.08);
}

.note > :first-child {
  margin-top: 0;
}

.note > :last-child {
  margin-bottom: 0;
}

.note strong:first-child {
  color: var(--text);
}

/* Chaîne de compilation */
.pipeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 28px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.pipeline li {
  position: relative;
  margin: 0;
  padding: 14px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--teal);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
  counter-increment: step;
}

.pipeline li::before {
  content: counter(step);
  display: block;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--sun);
  margin-bottom: 6px;
}

.pipeline li strong {
  display: block;
  color: var(--text);
  font-size: 14.5px;
  margin-bottom: 4px;
}

.pipeline li:last-child {
  border-top-color: var(--red);
}

/* Étapes numérotées */
.steps {
  counter-reset: s;
  list-style: none;
  padding-left: 0 !important;
}

.steps > li {
  position: relative;
  padding-left: 42px;
  margin-bottom: 18px;
  counter-increment: s;
}

.steps > li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 1px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--teal-hi);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 26px;
}

.kbd {
  display: inline-block;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 0.85em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
}

/* Navigation entre chapitres */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pager a,
.pager span {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}

.pager span {
  color: #6f6482;
}

.pager small {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---- Écrans étroits ---- */

@media (max-width: 960px) {
  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: fixed;
    top: 60px;
    left: 0;
    z-index: 20;
    width: min(320px, 88vw);
    background: var(--bg);
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.5);
    transform: translateX(-105%);
    transition: transform 0.2s;
  }

  .toc.shown {
    transform: none;
  }

  .toc-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font: inherit;
    font-size: 14px;
    padding: 7px 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
  }

  .content {
    padding: 28px 24px 72px;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 24px 16px 64px;
  }

  .content h2 {
    font-size: 23px;
  }

  .pager {
    flex-direction: column;
  }

  .pipeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* L'en-tête suit la largeur des pages de documentation */
body[data-chapter] .topbar .wrap {
  max-width: 1320px;
}

/* La chaîne de compilation n'a pas le retrait des listes */
.content .pipeline {
  padding-left: 0;
}

/* ---- Sommaire : numéros et sous-titres (niveau 3) ---- */

.toc a {
  display: flex;
  gap: 8px;
}

.toc-num {
  flex: none;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45rem;
  color: #8f83a3;
}

.toc-chapter > .toc-row .toc-num {
  color: var(--sun);
}

.toc a.active .toc-num {
  color: var(--teal-hi);
}

.toc ul.toc-sections {
  margin: 2px 0 8px 14px;
}

.toc-group > .toc-row {
  display: flex;
  align-items: flex-start;
}

.toc-group > .toc-row a {
  flex: 1;
  min-width: 0;
}

.toc-group > .toc-row .toc-toggle {
  width: 18px;
  height: 27px;
  font-size: 12px;
  line-height: 27px;
}


.toc ul.toc-sub {
  display: none;
  margin: 0 0 4px 26px;
}

.toc .toc-group.open > ul.toc-sub {
  display: block;
}

.toc-sub a {
  font-size: 13.5px;
  padding-top: 3px;
  padding-bottom: 3px;
}

/* Numéro des sous-titres dans la page */
.content h3 .num {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--sun);
  margin-right: 10px;
  vertical-align: 2px;
}

/* Flèches : ▸ replié, ▾ déplié */
button.toc-toggle::before {
  content: "▸";
}

.toc-chapter.open > .toc-row button.toc-toggle::before,
.toc-group.open > .toc-row button.toc-toggle::before {
  content: "▾";
}

/* ---- Schéma de la chaîne de compilation ---- */

.flow-figure {
  margin: 26px 0 30px;
  padding: 20px 16px 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.flow-scroll {
  overflow-x: auto;
}

.flow {
  display: block;
  width: 100%;
  min-width: 680px;
  height: auto;
}

.flow .fl-box,
.flow .fl-src,
.flow .fl-out {
  fill: var(--surface);
  stroke: #6d5a92;
  stroke-width: 1.5;
}

.flow .fl-src {
  stroke: var(--sun);
}

.flow .fl-out {
  fill: rgba(47, 181, 148, 0.14);
  stroke: var(--teal);
}

.flow .fl-rom {
  fill: rgba(184, 68, 58, 0.18);
  stroke: var(--red);
  stroke-width: 1.5;
}

.flow .fl-rom-top {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.5;
}

.flow .fl-t {
  fill: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  text-anchor: middle;
}

.flow .fl-mono {
  font-family: var(--mono);
  font-size: 12.5px;
  fill: var(--sun);
}

.flow .fl-dim {
  fill: var(--text-dim);
  font-size: 13px;
}

.flow .fl-line {
  stroke: var(--text-dim);
  stroke-width: 1.5;
}

.flow .fl-head {
  fill: var(--text-dim);
}

.flow-figure figcaption {
  margin-top: 10px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-dim);
}

/* ---- Captures d'écran ---- */

.shot {
  margin: 22px 0 26px;
  text-align: center;
}

.shot img {
  display: inline-block;
  width: 100%;
  max-width: 480px;
  height: auto;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.shot figcaption {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.content td[colspan] {
  text-align: center;
}

.pager a:last-child {
  text-align: right;
}

/* Tableau dont le code peut passer à la ligne */
.content table.wrap td code {
  white-space: normal;
}

/* La première colonne (machine, catégorie) ne passe pas à la ligne */
.content table.wrap td:first-child {
  white-space: nowrap;
}

/* ---- Comparaison de code généré ---- */

.cost {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}

.cost > div {
  min-width: 0;
}

.cost p {
  margin: 0 0 6px;
  font-size: 13.5px;
}

.cost p span {
  display: block;
  color: var(--sun);
  font-size: 12.5px;
}

.cost pre {
  margin: 0;
  font-size: 12.5px;
}

@media (max-width: 760px) {
  .cost {
    grid-template-columns: 1fr;
  }
}

/* ---- Variante dépliable (autre machine) ---- */

details.variant {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
}

details.variant > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--teal-hi);
}

details.variant[open] > summary {
  border-bottom: 1px solid var(--border);
}

details.variant > :not(summary) {
  margin-left: 16px;
  margin-right: 16px;
}

/* ---- Schémas binaires ---- */

.content pre.bits {
  margin: 10px 0 18px;
  padding: 12px 16px;
  line-height: 1.75;
  color: var(--text-dim);
}

.bits .b1 {
  color: var(--teal-hi);
  font-weight: 600;
}

.bits .bv {
  color: var(--sun);
}

.bits .br {
  color: var(--text);
}

.bit-ops {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 20px;
  margin: 18px 0;
}

.bit-ops > div {
  min-width: 0;
}

.bit-ops p {
  margin: 0;
  font-size: 14.5px;
}

.bit-ops pre.bits {
  margin-top: 6px;
}

@media (max-width: 760px) {
  .bit-ops {
    grid-template-columns: 1fr;
  }
}

/* Poids des bits d'un octet */
.bit-weights-wrap {
  display: inline-block;
  max-width: 100%;
}

.content table.bit-weights {
  width: auto;
  font-family: var(--mono);
  font-size: 13.5px;
}

.content table.bit-weights th,
.content table.bit-weights td {
  padding: 6px 12px;
  text-align: center;
}

.content table.bit-weights th {
  text-align: left;
  font-family: var(--sans);
}

.content table.bit-weights tr:nth-child(2) td {
  color: var(--sun);
}

.content table.bit-weights td.b1 {
  color: var(--teal-hi);
  font-weight: 600;
}

/* Nom du fichier au-dessus d'un bloc de code */
.content p.file-name {
  margin: 22px 0 -12px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--sun);
}

/* Tableau situation / conséquence : deux colonnes de texte */
.content table.cases td:first-child {
  width: 40%;
}

.content table.cases td code {
  white-space: normal;
}

/* Deux captures côte à côte */
.shots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.shots .shot {
  margin: 0;
}

@media (max-width: 640px) {
  .shots {
    grid-template-columns: 1fr;
  }
}

/* ---- Diagramme du projet, comme dans Simple8 IDE ---- */

.ut-scroll {
  overflow-x: auto;
  margin: 18px 0 26px;
  padding: 22px 16px 12px;
  background: #2b2f38;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.unit-tree {
  min-width: 760px;
  font-size: 13px;
  color: #e6e8ee;
}

.ut-card {
  background: #363b46;
  border: 1px solid #454b58;
  border-top: 3px solid var(--teal);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: left;
}

.ut-title {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--teal-hi);
}

.ut-main .ut-title,
.ut-ctx .ut-title {
  color: #f2c062;
}

.ut-libs .ut-title,
.ut-lib b,
.ut-lib > span:first-child {
  color: #d1a3e8;
}

.ut-main,
.ut-ctx {
  border-top-color: #f2c062;
}

.ut-libs {
  border-top-color: #c695e0;
}

.ut-file {
  color: #b8bdc8;
  margin: 3px 0;
}

.ut-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 4px;
}

.ut-sizes .zero {
  color: #7d8391;
}

.ut-sizes .zero b {
  font-weight: 400;
}

.ut-sep {
  border-top: 1px solid #4c5260;
  margin: 8px 0 6px;
}

.ut-gauge {
  display: grid;
  grid-template-columns: 34px 1fr auto 46px;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 12.5px;
}

.ut-glabel {
  color: #b8bdc8;
}

.ut-bar {
  height: 7px;
  border-radius: 4px;
  background: #4c5260;
  overflow: hidden;
}

.ut-bar span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: #7cc47a;
}

.ut-gval {
  color: #b8bdc8;
  white-space: nowrap;
}

.ut-gval b,
.ut-gpct {
  color: #f0f2f6;
  font-weight: 700;
  text-align: right;
}

.ut-lib {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.ut-lib.ut-sub {
  padding-left: 14px;
  color: #d4d7de;
}

.ut-lib.ut-sub > span:first-child {
  color: #d4d7de;
}

/* Arbre : la racine, une ligne d'enfants reliés par des traits */
.ut-root {
  display: flex;
  justify-content: center;
  position: relative;
  padding-bottom: 22px;
}

.ut-root .ut-card {
  width: 330px;
}

.ut-root::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  height: 22px;
  border-left: 2px solid #6b7180;
}

.ut-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.ut-col {
  position: relative;
  padding-top: 20px;
}

/* trait vertical vers chaque enfant, et trait horizontal qui les relie */
.ut-col::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  height: 20px;
  border-left: 2px solid #6b7180;
}

.ut-col::after {
  content: "";
  position: absolute;
  top: 0;
  left: -7px;
  right: -7px;
  border-top: 2px solid #6b7180;
}

.ut-col:first-child::after {
  left: 50%;
}

.ut-col:last-child::after {
  right: 50%;
}

.ut-child {
  position: relative;
  margin-top: 22px;
}

.ut-child::before {
  content: "";
  position: absolute;
  top: -22px;
  left: 50%;
  height: 22px;
  border-left: 2px solid #6b7180;
}

.ut-foot {
  margin: 18px 0 4px;
  text-align: center;
  color: #b8bdc8;
  font-size: 12.5px;
}

/* colonnes étroites : jauge de contexte compacte, ligne de bibliothèque sur une ligne */
.ut-ctx .ut-gauge {
  grid-template-columns: auto minmax(16px, 1fr) auto auto;
  gap: 6px;
  font-size: 11.5px;
}

.ut-lib,
.ut-lib > span {
  white-space: nowrap;
}

.ut-lib.ut-sub {
  font-size: 12px;
}

.ut-row {
  gap: 10px;
}

.ut-col::after {
  left: -5px;
  right: -5px;
}

.ut-gpct {
  white-space: nowrap;
}

.ut-ctx {
  padding-left: 10px;
  padding-right: 10px;
}

/* Cartes mémoire côte à côte */
.mem-maps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
  align-items: start;
}

.mem-maps .table-wrap {
  margin: 10px 0;
}

.content table.mem-map {
  font-size: 13.5px;
}

.content table.mem-map td:first-child {
  width: 1%;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .mem-maps {
    grid-template-columns: 1fr;
  }
}

.cost.cost-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---- Galerie des machines (chapitre 14) ---- */

.arcade {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: 26px 0 30px;
}

.arcade figure {
  flex: 0 1 calc(25% - 11px);
  min-width: 150px;
  margin: 0;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.arcade .screen {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}

.arcade img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.arcade figcaption {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.arcade figcaption strong {
  display: block;
  margin-bottom: 6px;
  font-family: var(--pixel);
  font-size: 9.5px;
  letter-spacing: 0.5px;
  color: var(--sun);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  padding: 1px 8px;
  font-size: 11.5px;
  border: 1px solid;
  border-radius: 20px;
  white-space: nowrap;
}

.tag.tuiles { color: var(--teal-hi); border-color: var(--teal); }
.tag.bitmap { color: var(--sun); border-color: var(--sun); }
.tag.sprites { color: var(--sky); border-color: var(--sky); }
.tag.logiciel { color: #e98a80; border-color: var(--red); }

/* ---- Fiche d'une machine : la capture et ses choix ---- */

.fiche {
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin: 18px 0 20px;
}

.fiche img {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.fiche dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 14px;
  font-size: 14.5px;
}

.fiche dt {
  color: var(--text-dim);
}

.fiche dd {
  margin: 0;
}

@media (max-width: 640px) {
  .fiche {
    grid-template-columns: minmax(0, 1fr);
  }
  .fiche img {
    max-width: 320px;
  }
}

/* ---- Agrandir une capture (js/zoom.js) ---- */

a.zoom {
  cursor: zoom-in;
}

.arcade a.screen {
  transition: outline-color 0.15s;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.arcade a.screen:hover,
.arcade a.screen:focus-visible {
  outline-color: var(--sun);
}

.zoom-box {
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.zoom-box::backdrop {
  background: rgba(10, 7, 14, 0.96);
}

.zoom-box figure {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.zoom-box img {
  max-width: 94vw;
  max-height: 84vh;
  image-rendering: pixelated;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #000;
}

.zoom-box figcaption {
  margin-top: 14px;
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--sun);
}

.zoom-box button {
  position: fixed;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  background: var(--surface);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.zoom-box button:hover {
  border-color: var(--sun);
  color: var(--sun);
}

.zoom-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.zoom-next { right: 16px; top: 50%; transform: translateY(-50%); }
.zoom-close { right: 16px; top: 16px; }

/* ---- Les sources d'un projet (js/sources.js) ---- */

.src-machines {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 24px;
}

.src-machines a {
  padding: 5px 12px;
  font-size: 13.5px;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 20px;
}

.src-machines a:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.src-machines a[aria-current="page"] {
  color: var(--bg);
  background: var(--sun);
  border-color: var(--sun);
  font-weight: 600;
}

.srcview {
  margin: 26px 0 30px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--code-bg);
  overflow: hidden;
}

.src-tabs {
  display: none;
  overflow-x: auto;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.srcview.tabbed .src-tabs {
  display: flex;
}

.src-tabs button {
  flex: 0 0 auto;
  padding: 11px 16px 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.src-tabs button:hover {
  color: var(--text);
}

.src-tabs button.active {
  color: var(--text);
  border-bottom-color: var(--sun);
  background: var(--code-bg);
}

.src-tabs .badge {
  margin-left: 7px;
  padding: 1px 6px;
  font-family: var(--sans);
  font-size: 10.5px;
  color: var(--teal-hi);
  border: 1px solid var(--teal);
  border-radius: 10px;
}

.srcview .src-panel {
  margin: 0;
  padding: 0;
}

.src-panel + .src-panel {
  border-top: 1px solid var(--border);
}

.srcview.tabbed .srcview .src-panel {
  margin: 0;
  padding: 0;
}

.src-panel + .src-panel {
  border-top: 0;
}

.src-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.src-head .path {
  flex: 1 0 100%;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--sun);
  word-break: break-all;
}

.src-head .about {
  flex: 1 1 260px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.src-head .meta {
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.src-copy {
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.src-copy:hover {
  border-color: var(--sun);
}

.content .srcview pre {
  margin: 0;
  border: 0;
  border-radius: 0;
}

/* Les numéros de ligne : une colonne à part, hors de la sélection et de la copie */
.src-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  max-height: 72vh;
  overflow-y: auto;
}

.content .src-body pre {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.content .src-body pre.gutter {
  padding-right: 10px;
  overflow: visible;
  text-align: right;
  color: #4d4360;
  user-select: none;
  border-right: 1px solid var(--border);
}

.src-binary {
  padding: 18px 16px 20px;
  font-size: 14px;
  color: var(--text-dim);
}

/* Le lien vers les sources, dans les cartes et les fiches du chapitre 14 */
.src-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-hi);
  text-decoration: none;
}

.arcade .src-link {
  margin-top: auto;
  padding-top: 10px;
}

.src-link:hover {
  text-decoration: underline;
}

/* ---- « Voir la solution » des exercices ---- */

details.solution {
  margin: 10px 0 16px;
}

details.solution > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 13px 4px 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-hi);
  border: 1px solid var(--teal);
  border-radius: 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s;
}

details.solution > summary::-webkit-details-marker {
  display: none;
}

details.solution > summary::before {
  content: "▸";
  font-size: 11px;
  transition: transform 0.15s;
}

details.solution[open] > summary::before {
  transform: rotate(90deg);
}

details.solution > summary:hover {
  background: rgba(47, 181, 148, 0.12);
}

details.solution > summary:focus-visible {
  outline: 2px solid var(--sun);
  outline-offset: 2px;
}

details.solution .when-open,
details.solution[open] .when-closed {
  display: none;
}

details.solution[open] .when-open {
  display: inline;
}

.solution-body {
  margin-top: 12px;
  padding: 4px 18px 6px;
  border-left: 3px solid var(--teal);
  background: rgba(47, 181, 148, 0.05);
  border-radius: 0 8px 8px 0;
}

.solution-body pre {
  margin: 12px 0 14px;
}
