/* print inverts: black on white, whatever the screen was set to. the reversed
   table header is the one thing that keeps its ink, because it is the element
   the whole layout is built around and a hollow header reads as a mistake. */

@page {
  size: letter;
  margin: 16mm 14mm 15mm 18mm;
}

@media print {
  :root {
    --paper: #FFFFFF;
    --ink:   #000000;
    --mid:   #333333;
    --faint: #666666;
    --hair:  #BBBBBB;
    --rule:  #000000;
    --flag:  #000000;
    --tint:  transparent;
  }

  html { font-size: 10pt; background: #fff; color: #000; }
  body { padding: 0; border-top: 3pt solid #000; }

  /* the apparatus of the screen has no job on paper */
  .masthead,
  #welcome,
  #smallgate,
  .colophon-contrib,
  .stale-note,
  .coursebar,
  nav.tabs,
  .rail,
  #review,
  #tools,
  #accuracy,
  #data-tools,
  #queue,
  #unmatched,
  button,
  .drop,
  input.note,
  .no-print {
    display: none !important;
  }

  .sheet { display: block; }
  #view { padding-left: 0; }

  .record { border-bottom: 3pt solid #000; padding-top: 0; }
  .record-code { font-size: 30pt; }

  table.ledger thead th {
    background: #000 !important;
    color: #fff !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    position: static;
  }

  /* a heading row repeats when the ledger runs over a page, so a column of
     dates on sheet three is still labelled */
  thead { display: table-header-group; }

  /* no record and no week heading may be split across two sheets */
  tr.sep, tr.rec, .entry, li { break-inside: avoid; page-break-inside: avoid; }
  tr.sep > td { border-top: 1.5pt solid #000; }
  table.ledger td { border-bottom: 0.25pt solid #999; }

  /* status carries no colour on paper, so it carries weight instead */
  .c-stat { font-weight: 700; }
  /* the keyboard cursor is a screen thing and prints as a stray grey band */
  tr.rec.is-cursor > td { background: transparent !important; box-shadow: none !important; }
  tr.struck .c-stat, tr.struck .c-title, tr.struck .c-src { color: #666; font-weight: 400; }
  .cwarn { color: #000; font-weight: 700; }

  p, li, td { orphans: 2; widows: 2; }
  h2, h3 { break-after: avoid; page-break-after: avoid; }

  /* a link is useless underlined on paper, so the address is printed */
  a { color: #000; text-decoration: none; }
  a[href^="http"]::after {
    content: " " attr(href);
    font-family: var(--mono);
    font-size: 7.5pt;
    overflow-wrap: anywhere;
  }

  ol.bibliography li { padding-left: 1.4em; text-indent: -1.4em; margin-bottom: 4pt; }

  .colophon {
    border-top: 3pt solid #000;
    margin-top: 12pt;
    padding-bottom: 0;
  }

  input[type="checkbox"] {
    border: 1pt solid #000;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  input[type="checkbox"]:checked { background: #000 !important; }

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