/* Print stylesheet: when the user picks "Print or save as PDF", strip
   the UI chrome and present the draft as a clean letter on A4. */

@page {
  size: A4;
  margin: 25mm;
}

@media print {
  body {
    background: white;
    color: black;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11pt;
    line-height: 1.45;
  }

  /* Hide everything that isn't the letter body. */
  .site-header,
  .site-footer,
  .breadcrumb,
  .hero,
  .sidebar,
  .form-block,
  .recipient-block,
  .step-list,
  .info-box,
  .success-box,
  .warning-box,
  .send-block,
  .send-fallback,
  .draft-actions,
  .route-feedback,
  #print-prep,
  #regen-btn,
  #invariant-warning,
  .draft-frame-tab,
  #draft-section > h2,
  #draft-section > p,
  #submit-section > h2,
  #submit-section > p,
  main > .page-inner > .layout > div > h2,
  main > .page-inner > .layout > div > p,
  main > .page-inner > .layout > div > h1 {
    display: none !important;
  }

  main {
    background: white;
    padding: 0;
    margin: 0;
  }
  .page-inner, .layout {
    max-width: none;
    padding: 0;
    margin: 0;
    display: block;
  }

  /* Optional return address, top-right, postal-letter style. Populated
     by submit.js from the print-prep textarea before window.print(). */
  .print-letterhead-right {
    text-align: right;
    white-space: pre-line;
    margin: 0 0 2em;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11pt;
  }
  .print-letterhead-right:empty { display: none; }

  /* Draft body, presented as the letter */
  .draft-frame {
    border: none;
    background: white;
    overflow: visible;
  }
  .draft-output {
    border: none;
    padding: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11pt;
    background: white;
    white-space: pre-wrap;
    page-break-inside: auto;
    min-height: 0;
  }

  /* Hyperlink URLs printed inline (defensive in case any sneak in via
     the contenteditable). */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
}
