/* ==========================================================================
   Impression (et export PDF via le navigateur).
   Objectif : une fiche de révision A4 lisible en noir et blanc, sans
   navigation ni contrôles. Les interactions sont remplacées par leur
   contenu utile : questions avec la bonne réponse et l'explication,
   arborescence dépliée, terminaux réduits à l'objectif et à la solution.
   ========================================================================== */

@page {
  size: A4;
  margin: 16mm 15mm 18mm;
}

:root {
  --fs-base: 10.5pt;
  --fs-sm: 9.5pt;
  --fs-xs: 8pt;
  --fs-code: 9pt;
  --fs-md: 12pt;
  --fs-lg: 14pt;
  --fs-xl: 20pt;
  --fs-display: 34pt;
  --fs-numeral: 34pt;
  --paper: #fff;
  --sheet: #fff;
  --paper-2: #f1f1f1;
}

html {
  scroll-behavior: auto;
}

body {
  background: #fff;
  color: #000;
  line-height: 1.45;
}

/* Éléments inutiles sur papier */
.skip-link,
.progress,
.fiche-head__actions,
.site-header,
.site-footer,
.toc,
.pager,
.copy,
.btn,
.actions,
.ix__toolbar,
.feedback,
.term__disclaimer,
.term__screen,
.term__help > .btn,
.term__hints,
.term__supported,
.tree__panel,
.tree__legend,
.option input,
.option__mark,
#announcer {
  display: none !important;
}

.page {
  max-width: none;
  padding: 0;
}

.grid {
  display: block;
}

/* En-tête de fiche -------------------------------------------------------- */

.fiche-head {
  padding: 0 0 6mm;
  border-top: 0;
}

.fiche-head > * + * {
  margin-top: 3mm;
}

.fiche-head__num {
  line-height: 1;
}

.fiche-head__title {
  letter-spacing: -0.03em;
}

.fiche-head__subtitle {
  max-width: none;
}

.fiche-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4mm 6mm;
  margin-top: 5mm;
}

/* Sections ---------------------------------------------------------------- */

.fiche-section + .fiche-section {
  margin-top: 9mm;
}

.section-head {
  margin-bottom: 4mm;
  break-after: avoid;
}

.section-head__title {
  max-width: none;
}

.section-body > * + *,
.section-body > :is(.ix, .example, .flow, .anatomy, .table-wrap, .error-case, .more),
.section-body > :is(.ix, .example, .flow, .anatomy, .table-wrap, .error-case, .more) + * {
  margin-top: 4mm;
}

.section-body > .block-heading {
  margin-top: 6mm;
}

h2,
h3,
.block-heading,
.error-case__title,
.example__head,
.ix__label,
.question__prompt {
  break-after: avoid;
}

/* Blocs à ne jamais couper */
.example,
.console,
.callout,
.error-case,
.flow,
.anatomy,
.definitions__row,
.keypoints li,
.table tr,
.option,
.question__context,
.question__answer,
.term__brief,
.more__body > .console {
  break-inside: avoid;
}

p,
li {
  orphans: 3;
  widows: 3;
}

.console {
  border: 0.5pt solid #999;
  background: #f4f4f4;
  overflow: visible;
}

.console__out {
  white-space: pre-wrap;
}

.console__prompt {
  color: #555;
}

.console__out--err {
  color: #000;
}

.console--error {
  border-left: 3pt solid #000;
}

.console--fix {
  border-left: 3pt double #000;
}

.callout--danger {
  background: none;
  border-left-width: 3pt;
}

.table-wrap {
  overflow: visible;
}

/* Liens : l'adresse des liens externes est imprimée */
a {
  text-decoration: none;
}

a[href^='http']::after {
  content: ' (' attr(href) ')';
  font-size: 0.85em;
  color: #444;
}

/* Compléments repliables (ouverts par JavaScript avant l'impression) */
.more > summary::after {
  display: none;
}

.more {
  border-bottom: 0;
}

/* Interactions ----------------------------------------------------------- */

.ix {
  padding: 4mm 0 0;
  background: none;
  border-top: 1.5pt solid #000;
}

.ix > * + * {
  margin-top: 3mm;
}

.ix__label::before {
  background: #000;
}

/* Questions : propositions, bonne réponse signalée, explication visible */
.option {
  min-height: 0;
  padding: 1mm 0;
  background: none !important;
  box-shadow: none !important;
}

.option.is-wrong .option__text {
  text-decoration: none;
  color: #000;
}

.option[data-correct='true'] .option__text {
  font-weight: 700;
}

.option[data-correct='true'] .option__text::after {
  content: '  ← bonne réponse';
  font-family: var(--font-text);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.question__answer,
.question__answer[hidden] {
  display: block !important;
  padding-top: 2mm;
  border-top: 0.5pt solid #000;
}

/* Arborescence : imprimée telle qu'elle est affichée (dossiers ouverts) */
.tree__node {
  min-height: 0;
  padding: 0;
  background: none !important;
  color: #000 !important;
}

.tree__node[aria-current='true'] .tree__name {
  color: #000 !important;
}

.tree__twisty {
  display: none;
}

.tree__node.is-file {
  padding-left: 0;
}

.tree__here {
  background: none;
  color: #000;
  border: 0.75pt solid #000;
}

.tree__layout {
  display: block;
}

/* Terminal simulé : bandeau, objectif et solution */
.ix--terminal {
  border: 1.5pt solid #000;
  padding-bottom: 3mm;
}

.term__bar {
  background: none;
  color: #000;
  border-bottom: 0.75pt solid #000;
  padding: 2mm 4mm;
}

.term__badge::before {
  background: #000;
}

.term__badge::after {
  content: ' — rien n’est exécuté, système de fichiers fictif';
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.ix--terminal > :not(.term__bar, .term__screen) {
  padding-inline: 4mm;
}

.term__goal {
  border-left: 3pt solid #000;
}

.more--solution {
  border-top: 0.5pt solid #000;
}

.more--solution > summary {
  min-height: 0;
  padding-block: 2mm;
}

/* Divers */
.home-hero,
.home-index {
  border-top: 0;
}

.index-row:has(a):hover {
  background: none;
}
