/* Print stylesheet for the depot PDF (#1870).
 *
 * Everything below @media print is scoped to it. mdBook's print.html is the
 * whole book on one page; this paginates it and stamps a cover.
 *
 * The persistent chapter-nav band (spike #1717 §7, stolen from Diva) is NOT
 * here. The obvious `position: fixed` footer does repeat on every printed
 * page, but Chromium then re-emits the whole document's link annotations on
 * every page — a 200 MB file whose body links land on the wrong pages. The
 * band is printed separately and stamped into the reserved bottom margin by
 * scripts/manual-pdf.py; @page's bottom margin below is what reserves it, so
 * the two have to move together.
 */

#pdf-cover {
  display: none;
}

@media print {
  @page {
    size: A4;
    /* Bottom margin = text gap + the 14mm chapter band manual-pdf.py stamps. */
    margin: 16mm 15mm 26mm;
  }

  /* mdBook sizes body text as 1.6rem, so the page's measure is set from the
     root and everything downstream follows. */
  :root {
    font-size: 6.6pt;
  }

  html,
  body,
  #body-container,
  #page-wrapper,
  #page,
  #content,
  main {
    background: #fff;
    color: #16161d;
  }

  #menu-bar,
  #sidebar,
  .nav-wrapper,
  .mobile-nav-chapters,
  .nav-chapters,
  #search-wrapper,
  .sidebar-scrollbox {
    display: none;
  }

  #content main {
    max-width: none;
    padding: 0;
    margin: 0;
  }

  /* ── Cover ──────────────────────────────────────────────────────────── */

  #pdf-cover {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 245mm;
    break-after: page;
  }

  #pdf-cover .wordmark {
    font-size: 40pt;
    font-weight: 700;
    letter-spacing: 0.18em;
    margin: 0 0 0 0.18em;
    text-transform: uppercase;
  }

  #pdf-cover .kind {
    font-size: 15pt;
    letter-spacing: 0.3em;
    margin: 24mm 0 0 0.3em;
    text-transform: uppercase;
  }

  #pdf-cover .stamp {
    font-size: 10pt;
    margin: 4mm 0 0;
    font-variant-numeric: tabular-nums;
  }

  #pdf-cover .foot {
    font-size: 9pt;
    margin-top: 55mm;
  }

  /* ── Body ───────────────────────────────────────────────────────────── */

  h1,
  h2,
  h3,
  h4 {
    color: #16161d;
    break-after: avoid;
  }

  h1 {
    font-size: 19pt;
    padding-top: 2mm;
  }

  h2 {
    font-size: 13.5pt;
  }

  h3 {
    font-size: 11pt;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }

  table {
    break-inside: auto;
    font-size: 8.5pt;
    width: 100%;
  }

  thead {
    display: table-header-group;
  }

  tr,
  blockquote,
  pre {
    break-inside: avoid;
  }

  .content blockquote {
    background: #f4f5f7;
    border-inline-start: 2pt solid #8a94a6;
    color: #16161d;
  }

  /* The manual's code blocks are ASCII signal-path diagrams and hex tables,
     not syntax-coloured source, so a highlight theme only costs contrast on
     paper. */
  pre,
  code,
  pre code,
  pre code span {
    background: #f4f5f7;
    color: #16161d;
    font-size: 8.5pt;
  }

  main a[href^="#"] {
    color: #123a5e;
  }

  main a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 7.5pt;
    color: #555;
  }
}
