/* print.css — what the printer (and "Save as PDF") sees.
 * The page is the letter: no browser margins, no app chrome. */

/* A4 by default. The paper selector swaps this rule at runtime (app.js)
 * because @page cannot be switched with a class. */
@page {
  size: A4;
  margin: 0;
}

@media print {
  html, body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  /* The green header and the grey rules are content, not decoration. */
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* App chrome never prints. Anything that is not a letter is chrome:
   * the panel, the toolbar, the hint line and every alert. */
  .app-panel,
  .app-main__bar,
  .app-main__hint,
  .app-alert,
  .app-screen-only {
    display: none !important;
  }

  .app-shell { display: block; }
  .app-main { width: 100%; }

  .app-preview {
    display: block;
    gap: 0;
    padding: 0;
  }

  /* One letter, one page — and no trailing blank page after the last. */
  .app-preview .letter {
    box-shadow: none;
    outline: none;
    margin: 0;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: page;
    page-break-after: always;
  }
  .app-preview .letter:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  /* The phone-width scale transform must not follow the letter to paper. */
  .app-preview .letter {
    transform: none !important;
    margin-bottom: 0 !important;
  }
}
