/**
 * Print stylesheet — acceptance criterion 5.
 *
 * "Detail pages need a print stylesheet. Architects print them. A4, section drawing
 *  plus schedule table on one page, URL and revision date in the footer." (§5)
 *
 * A printed detail leaves the building and gets pinned to a wall or filed with a
 * package. It has to say which detail it is, which revision, and where it came from —
 * otherwise it is an undated drawing of unknown provenance, which is worse than none.
 */

@media print {
  @page {
    size: A4 portrait;
    margin: 14mm 14mm 18mm;
  }

  :root {
    --section-pad-y: 0;
    --layout-gutter: 0;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
    line-height: 1.45;
    padding-bottom: 0;
  }

  /* Chrome that carries no information on paper. */
  .print-hide,
  header nav,
  [data-print='hide'] {
    display: none !important;
  }

  /* The drawing and the schedule must land on the same sheet. */
  .print-primary {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-break-before {
    break-before: page;
  }

  h1 {
    font-size: 18pt;
    line-height: 1.2;
  }

  h2 {
    font-size: 13pt;
    line-height: 1.25;
  }

  h3 {
    font-size: 11pt;
  }

  /* Table headers repeat when a schedule runs over a page. */
  thead {
    display: table-header-group;
  }

  tr,
  img,
  figure,
  svg {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
  }

  th,
  td {
    border: 0.5pt solid #999;
    padding: 3pt 5pt;
  }

  /* Held figures must stay visibly held on paper too — the gate does not stop at the screen. */
  [data-status='test_pending'] {
    color: #666;
    font-style: italic;
  }

  /* Where a link goes matters once the page is on paper. */
  a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 8pt;
    color: #555;
  }

  a[href^='/']::after,
  a[href^='#']::after {
    content: '';
  }

  /* Provenance, on every printed sheet. */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 8pt;
    color: #444;
    border-top: 0.5pt solid #999;
    padding-top: 3pt;
  }
}

/* The footer exists only on paper. */
.print-footer {
  display: none;
}
