/* ==========================================================================
   Print / "Save as PDF" layout.
   The client's copy is produced by the browser's own print pipeline rather
   than a JS PDF library: the browser shapes and joins Arabic correctly and
   emits selectable vector text, which jsPDF/canvas routes do not.
   ========================================================================== */

@media print {
  @page { size: A4; margin: 12mm 13mm 10mm; }

  html, body { background: #fff !important; }
  body::before, body::after { display: none !important; }

  /* Everything on screen goes away; only the generated summary prints. */
  .site-header, .form-intro, .card, .site-footer, .confirm, .form-error, .lang-switch {
    display: none !important;
  }

  .print-only { display: block !important; }

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

  #print-summary {
    color: #292759;
    font-size: 10.5pt;
    line-height: 1.5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* --- Masthead ---------------------------------------------------------- */
  .p-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12mm;
    padding-block-end: 4mm;
    border-block-end: 1.5pt solid #B99E47;
  }
  .p-head img { width: 62mm; height: auto; }
  .p-meta { text-align: end; font-size: 9pt; line-height: 1.7; }
  .p-meta .ref {
    font-weight: 700;
    font-size: 11pt;
    letter-spacing: .05em;
    direction: ltr;
    unicode-bidi: isolate;
  }
  .p-meta .lbl { color: #5F5D80; }

  .p-title {
    margin-block: 4mm 3.5mm;
    font-size: 15pt;
    font-weight: 700;
    text-align: center;
  }

  /* --- Sections ---------------------------------------------------------- */
  .p-section { margin-block-end: 3.5mm; break-inside: avoid; }
  .p-section > h3 {
    font-size: 10.5pt;
    font-weight: 700;
    color: #292759;
    padding-block-end: 1.2mm;
    margin-block-end: 2.5mm;
    border-block-end: .5pt solid #DEDEE4;
  }

  .p-row {
    display: flex;
    gap: 4mm;
    padding-block: 1.1mm;
    break-inside: avoid;
  }
  .p-row + .p-row { border-block-start: .3pt solid #F0F0F4; }
  .p-row .k { flex: 0 0 52mm; color: #5F5D80; font-size: 9.5pt; }
  .p-row .v { flex: 1; font-weight: 500; word-break: break-word; }
  .p-row .v.ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }

  /* --- Acknowledgement --------------------------------------------------- */
  .p-ack {
    margin-block-start: 3.5mm;
    padding: 3mm 4mm;
    background: #F0EFF6;
    border-inline-start: 2pt solid #B99E47;
    font-size: 9.5pt;
    line-height: 1.8;
    break-inside: avoid;
  }
  .p-ack .p-ack-ar { direction: rtl; text-align: right; font-family: 'Tajawal', sans-serif; }
  .p-ack .p-ack-confirm { margin-block-start: 2.5mm; font-weight: 700; }

  /* --- Footer ------------------------------------------------------------ */
  /* Keep the contact block whole — it must not straddle a page break. */
  .p-foot {
    break-inside: avoid;
    margin-block-start: 4mm;
    padding-block-start: 2.5mm;
    border-block-start: .5pt solid #DEDEE4;
    font-size: 8pt;
    color: #5F5D80;
    text-align: center;
    line-height: 1.7;
  }
  .p-foot .ltr { direction: ltr; unicode-bidi: isolate; }
}
