/* Mise en page imprimée (A4).
   Sert deux fois : impression directe de la page (Ctrl+P, chargé avec media="print")
   et aperçu en pages A4 (Paged.js, dans preview.html), où il s’applique tel quel.
   N’utilise aucun sélecteur « + » : Paged.js les réécrit mal. */

@page {
  size: A4 portrait;
  margin: 13mm 13mm 16mm 13mm;

  @bottom-left {
    content: "Trame d’entretien clinique et d’évaluation · Ergothérapie pédiatrique (MCPO)";
    font-family: 'Figtree', sans-serif;
    font-size: 7.5pt;
    color: #46585f;
  }
  @bottom-right {
    content: "Page " counter(page) " / " counter(pages);
    font-family: 'Figtree', sans-serif;
    font-size: 7.5pt;
    color: #46585f;
  }
}

* {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
html, body {
  background: var(--background) !important;
  font-size: 10pt;
  line-height: 1.4;
}

.topbar,
.no-print,
.screen-only,
.export-preview,
.doc-meta,
.toc,
.preview-overlay,
.toast {
  display: none !important;
}

.sheet {
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.doc-header {
  padding-bottom: 8pt;
  border-bottom: 2pt solid var(--primary);
}
.title { font-size: 18pt; }
.lede { font-size: 10pt; }

.section { margin-top: 14pt; }
.section-head { padding: 6pt 9pt; }
.section-title { font-size: 13.5pt; }
.section-lede { font-size: 8.5pt; }
.subsection { margin-top: 11pt; }
.sub-title { font-size: 10.5pt; padding-bottom: 3pt; }
.test-title { margin-top: 9pt; font-size: 7.5pt; }
.q { margin-top: 6pt; }
.q-label { font-size: 9.5pt; margin-bottom: 2pt; }
.hint { font-size: 8pt; }

/* Ce qui ne doit pas être coupé ou séparé de ce qui suit */
.section-head,
.sub-title,
.test-title,
.q-label {
  break-after: avoid;
}
.section-head,
.q,
.matrix,
.grid tr,
.keep-together {
  break-inside: avoid;
}

.answer {
  min-height: 20pt;
  padding: 3pt 6pt;
  border-color: var(--data-context);
  font-size: 9.5pt;
}
.choice { min-height: 18pt; padding: 1pt 10pt 1pt 0; font-size: 9pt; }
.choice input,
.cell-check input { width: 11pt; height: 11pt; }
.matrix th,
.matrix td,
.grid th,
.grid td { padding: 3pt 5pt; font-size: 8.5pt; }
.matrix thead th,
.grid thead th { font-size: 7.5pt; }
.cell-check { min-height: 14pt; }
.cell-input { min-height: 14pt; padding: 1pt 2pt; border: 0; font-size: 8.5pt; }
.doc-footer { margin-top: 14pt; font-size: 7.5pt; }

/* Impression directe : zones de texte remplacées par leur copie intégrale */
textarea.answer,
textarea.cell-input {
  display: none !important;
}
.print-mirror {
  display: block !important;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.print-mirror.answer { min-height: calc(var(--lines, 3) * 1.45em + 6pt); }

/* Aperçu A4 : les champs y sont remplacés par du texte */
.print-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  resize: none;
}
.answer.print-value { display: block; }
.answer--short.print-value { max-width: 62mm; }
.answer--tiny.print-value { display: inline-block; width: 16mm; text-align: center; }
.answer.print-value.is-multiline { min-height: calc(var(--lines, 3) * 1.45em + 6pt); }
.cell-input.print-value { display: block; }
