/* =============================================================================
   Print stylesheet — "Export PDF" uses the browser's Save as PDF.
   ========================================================================== */

@page {
  size: A4 landscape;
  margin: 10mm;
}

@media print {
  html, body {
    background: #fff !important;
    height: auto !important;
    overflow: visible !important;
    color: #000 !important;
    font-size: 10pt;
  }

  /* the app shell is a fixed-height viewport on screen - release it */
  .app-shell,
  .app-shell > main,
  .app-col {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* hide all chrome */
  header,
  footer,
  #toolbar,
  .no-print,
  #searchResults,
  #treeControls,
  #personModal,
  .ft-sheet,
  .ft-hint-pill {
    display: none !important;
  }

  /* unclip the canvas so the whole tree can flow onto pages */
  #treeCanvas,
  .tree-canvas {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    background: none !important;
    cursor: auto;
  }

  .tree-stage {
    transform: none !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
  }

  /* cards become flat, outlined, ink-friendly */
  .ft-card {
    box-shadow: none !important;
    border: 1pt solid #555 !important;
    border-radius: 6pt;
    break-inside: avoid;
    page-break-inside: avoid;
    background: #fff !important;
    padding: 6pt !important;
  }

  .ft-name  { font-size: 8.5pt; color: #000 !important; }
  .ft-meta  { font-size: 7pt;   color: #333 !important; }
  .ft-occ   { font-size: 6.5pt; color: #000 !important; background: none !important; border: .5pt solid #999; }
  .ft-field { font-size: 6pt; }
  .ft-field dt { color: #555 !important; }
  .ft-field dd { color: #000 !important; }
  .ft-badge { font-size: 6pt; color: #000 !important; background: none !important; border: .5pt solid #999; }

  .ft-photo-btn {
    width: 42pt;
    height: 42pt;
    border: .5pt solid #999 !important;
    box-shadow: none !important;
  }
  .ft-photo-btn img { filter: grayscale(30%); }

  .ft-expand-hint,
  .ft-toggle,
  .ft-skeleton,
  .ft-marriage-mark svg { display: none !important; }

  /* force every collapsed branch open for the printed copy */
  .ft-node.is-collapsed > .ft-children { display: flex !important; }

  .ft-children { break-inside: avoid; }

  /* list view */
  .list-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none !important;
    border: .75pt solid #555 !important;
  }

  a[href]::after { content: ""; }   /* no URL spam in print */
}

/* Screen preview of what print will produce */
@media screen {
  .print-only { display: none; }
}
@media print {
  .print-only { display: block; }
}