/* Print-only rules. Linked explicitly on a page that prints a CV. This is what
   makes the exported PDF real selectable text rather than a rasterised image. */
@media print {
  @page {
    size: A4;
    margin: 18mm 16mm;
  }

  /* display:none, not visibility:hidden — a hidden element keeps its layout
     box, and the form's step cards paginated into blank sheets after the CV. */
  .app-header,
  .form-column,
  .preview-toolbar,
  .skip-link,
  .cv-ghost,
  .ledger,
  /* Sits outside .form-column, so without this line the guide links print. */
  .site-footer {
    display: none;
  }

  body {
    background: #fff;
  }

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

  .app-main {
    display: block;
    gap: 0;
  }

  .preview-panel {
    position: static;
  }

  /* TRAP: A4 is ~794px of CSS width, which is BELOW the 840px phone
     breakpoint — so the phone layout applies while printing, including the
     rule that hides the sheet whenever the toggle is not showing the preview.
     On desktop `.showing-preview` is never set, so that rule matches every
     desktop print, hides the entire document, and exports a blank page.

     Restated at equal specificity (0,3,0), and print.css is linked after
     app.css so source order settles it. Do NOT "simplify" this to
     `.preview-paper` — that is (0,1,0) and loses to the very rule it exists
     to override. Deleting this line is exactly how the blank-PDF bug shipped. */
  .app-main:not(.showing-preview) .preview-paper {
    display: block;
  }

  /* A4 leaves ~673px of content, above every stacking threshold in the
     document rules, so the wide layout would resolve anyway — but containment
     is dropped here so print never depends on that maths. */
  .preview-paper {
    padding: 0;
    min-height: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    container-type: normal;
  }

  /* The document is Georgian, so the print font has to cover Georgian —
     'Times New Roman' does not. Sylfaen is the Windows fallback.

     (Font choice is a legibility decision, not an ATS one: an ATS reads the
     PDF's text layer, which is font-independent. What matters for parsing is
     that print-to-PDF keeps real selectable text — see export/print.js.) */
  .cv-document {
    font-family: 'Noto Serif Georgian', 'Sylfaen', Georgia, serif;
    color: #000;
    font-size: 11pt;
    max-width: none;
  }

  .cv-name {
    font-family: 'Noto Serif Georgian', 'Sylfaen', Georgia, serif;
    font-size: 18pt;
  }

  .cv-rank {
    color: #000;
  }

  .cv-section-title {
    font-family: 'Noto Sans Georgian', 'Sylfaen', Arial, sans-serif;
    color: #000;
    font-size: 9pt;
  }

  .cv-section-rule {
    background: #000;
  }

  .cv-entry-dates {
    font-family: 'Noto Sans Georgian', 'Sylfaen', Arial, sans-serif;
    color: #000;
    text-align: right;
  }

  .cv-entry-row {
    grid-template-columns: 1fr minmax(var(--doc-dates), max-content);
  }

  .cv-details {
    grid-template-columns: max-content 1fr max-content 1fr;
  }

  /* The jump target is an interface affordance; on paper it must leave no
     trace. */
  .cv-jump {
    border-color: transparent;
    background: none;
    padding: 0;
    margin: 0;
  }

  /* TRAP: these must be restated even though A4 clears the thresholds,
     because a narrower paper size or a scaled print would re-trigger the
     stacked layout. */
  .cv-table { display: table; width: 100%; }
  .cv-table thead { display: table-header-group; }
  .cv-table tbody { display: table-row-group; }
  .cv-table tr { display: table-row; padding: 0; border-top: none; }
  .cv-table th,
  .cv-table td {
    display: table-cell;
    padding: 3px 6px 3px 0;
    border-top: 1px solid #999;
  }
  .cv-table td::before { content: none; }
  .cv-table th { color: #000; font-size: 8pt; }
  .cv-table td { font-size: 8.5pt; }
  .cv-table .num { text-align: right; }

  /* A multi-page sea service history is normal for this document, so the
     column headers have to reappear on each page — that is the entire reason
     this is a real <table> rather than a grid. */
  .cv-table thead th {
    break-inside: avoid;
  }

  .cv-table-wrap {
    overflow-x: visible;
  }

  .cv-photo {
    width: 28mm;
    height: 36mm;
  }

  /* Advice to the author, never content for the reader — and stale the moment
     the PDF is sent. .field-note is where expiry warnings live now. */
  .save-warning,
  .field-note {
    display: none;
  }

  /* Keep an entry whole, and never strand a heading at the foot of a page. */
  .cv-entry,
  .cv-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cv-header,
  .cv-header-maritime,
  .cv-section-head,
  .cv-section-title {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* The only rule in this file that *adds* rather than hides, and the paywall
     depends on it. On screen the mark is a tiled background, which covers a
     document of any height evenly — a fixed-length string could not, and left
     a 480px band through a long seafarer CV unmarked.

     A background is the wrong mechanism here, though: Chrome's print dialog has
     a "Background graphics" checkbox, and unticking it would strip the mark
     from the PDF entirely. So print goes back to text in `content`, which is
     foreground and prints either way, and `fixed` so it repeats on every sheet
     rather than marking page one and leaving the rest clean.

     Never hidden in this file. An unpaid PDF carrying the mark is the whole
     mechanism — see docs/PAYWALL.md. */
  .paywall .cv-document:not([data-paid="true"])::before {
    content: "CV.ge · გადაუხდელი ნიმუში · CV.ge · გადაუხდელი ნიმუში · "
             "CV.ge · გადაუხდელი ნიმუში · CV.ge · გადაუხდელი ნიმუში · "
             "CV.ge · გადაუხდელი ნიმუში · CV.ge · გადაუხდელი ნიმუში · "
             "CV.ge · გადაუხდელი ნიმუში · CV.ge · გადაუხდელი ნიმუში · "
             "CV.ge · გადაუხდელი ნიმუში · CV.ge · გადაუხდელი ნიმუში · "
             "CV.ge · გადაუხდელი ნიმუში · CV.ge · გადაუხდელი ნიმუში";
    position: fixed;
    inset: -25%;
    background-image: none;
    transform: rotate(-30deg);
    font-family: var(--font-body);
    font-size: 28px;
    line-height: 3.2;
    font-weight: 600;
    letter-spacing: 0.12em;
    word-spacing: 0.4em;
    color: rgba(47, 111, 94, 0.16);
    overflow: hidden;
  }
}
