/* ==========================================================================
   Impression (et export PDF via le navigateur).
   Objectif : une fiche de révision A4 lisible en noir et blanc, sans
   navigation ni boutons. Les interactions sont remplacées par leur contenu
   utile : questions avec la bonne réponse, traceurs réduits à l'algorithme
   et au tableau de trace complet, exercices suivis de leur correction.
   (fiche.js déplie les compléments et les corrections avant l'impression.)
   ========================================================================== */

@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: 19pt;
  --fs-display: 32pt;
  --paper: #fff;
  --paper-2: #f3f3f3;
  --code-pseudo-bg: #f3f3f3;
  --code-php-bg: #f3f3f3;
}

html {
  scroll-behavior: auto;
}

body {
  background: #fff;
  color: #000;
  line-height: 1.45;
}

/* Éléments inutiles sur papier */
.skip-link,
.progress,
.site-header,
.site-footer,
.toc,
.pager,
.copy,
.btn,
.actions,
.feedback,
.tracer__layout,
.tracer__step,
.tracer__controls,
.predict__fields,
.option input,
.option__mark,
.option__why,
.exercise__reveal,
.loader,
#announcer {
  display: none !important;
}

.page {
  max-width: none;
  padding: 0;
}

.grid {
  display: block;
}

/* En-tête de fiche -------------------------------------------------------- */

.fiche-head {
  padding: 0 0 6mm;
}

.fiche-head > * + * {
  margin-top: 3mm;
}

.fiche-head__num {
  color: #000;
}

.fiche-head__subtitle {
  max-width: none;
}

.fiche-facts {
  grid-template-columns: 1fr 1fr;
  gap: 3mm 6mm;
  margin-top: 5mm;
  padding: 0;
  background: none;
}

/* Sections ---------------------------------------------------------------- */

.fiche-section {
  padding-top: 4mm;
}

.fiche-section + .fiche-section {
  margin-top: 9mm;
}

.section-head {
  margin-bottom: 4mm;
  break-after: avoid;
}

.section-head__num {
  color: #000;
}

.section-body > * + *,
.section-body > :is(.ix, .code, .code-run, .compare, .flow, .table-wrap, .error-case, .more, .exercise, .callout),
.section-body > :is(.ix, .code, .code-run, .compare, .flow, .table-wrap, .error-case, .more, .exercise, .callout) + * {
  margin-top: 4mm;
}

.section-body > .block-heading,
.section-body > .exercise + .exercise,
.section-body > .error-case + .error-case {
  margin-top: 6mm;
}

h2,
h3,
h4,
.block-heading,
.error-case__title,
.ix__label,
.exercise__head,
.code__head {
  break-after: avoid;
}

/* Blocs à ne jamais couper */
.code,
.callout,
.flow,
.definitions__row,
.keypoints li,
.table tr,
.option,
.predict__values,
.exercise__facts {
  break-inside: avoid;
}

/* Aplats remplacés par des contours fins -------------------------------- */

.code,
.code--php,
.ix,
.callout,
.flow__step,
.fiche-facts,
.home-method__list li {
  background: none !important;
  box-shadow: inset 0 0 0 0.5pt #999;
}

.callout--remember {
  box-shadow: none;
  border-top: 1pt solid #000;
}

.ix {
  padding: 4mm;
}

.code__line.is-marked {
  background: none;
}

.ix__label,
.exercise__num,
.flow__num,
.keypoints li::before,
.code__ref {
  color: #000;
}

/* Interactions --------------------------------------------------------- */

/* Traceur : le tableau de trace complet remplace les panneaux */
.tracer__table-full > summary {
  font-size: var(--fs-sm);
}

.tracer--embedded {
  padding: 0;
  box-shadow: none;
}

/* Question à choix : la bonne réponse est cochée */
.option {
  min-height: 0;
  padding: 1mm 3mm;
  box-shadow: none !important;
  background: none !important;
}

.option[data-correct='true'] .option__text::after {
  content: '  ✓ bonne réponse';
  font-weight: 600;
}

.quiz__explanation[hidden] {
  display: block !important;
}

/* Prédiction et exercices : la réponse est imprimée */
.predict__answer,
.exercise__solution {
  box-shadow: none;
  padding: 3mm 0 0;
  border-top: 0.75pt solid #000;
}

/* Liens : on garde le texte, pas l'adresse */
a {
  text-decoration: none;
}
