/* Print-only corrections for mkdocs-with-pdf.
 *
 * The plugin's print stylesheet sets
 *
 *     article, section + section { page-break-before: always; min-height: 100vh; }
 *
 * and the min-height is what silently truncates the manual. An element whose
 * minimum height is a whole page cannot fit inside a page box once its own
 * margins are added, so WeasyPrint fails to place it — and everything from that
 * point to the end of the document is dropped. Where it bites depends on where
 * the page boundary happens to fall, which is why the manual lost a different
 * set of chapters every time its contents changed, and why the ones it lost
 * rendered perfectly well on their own.
 *
 * page-break-before already starts each article on a fresh page. The min-height
 * only forced it to fill one.
 */
@media print {
  article,
  section + section {
    min-height: 0 !important;
  }
}

/* ---------------------------------------------------------------------------
 * The PDF in the house colours.
 *
 * mkdocs-with-pdf ships its own heading rules -- a 2px red rule under every h1
 * and a pink one under every h2 -- which are placeholders rather than a design,
 * and are the only red in a document that has none anywhere else. They are
 * replaced here with the brand blue. !important because the plugin's stylesheet
 * is injected after this one.
 * ------------------------------------------------------------------------- */
@media print {
  article h1 {
    border-bottom: 2px solid #1e88ff !important;
  }

  article h2 {
    border-bottom: 1px solid #cbd5e1 !important;
  }

  article h3 {
    border-bottom: 0.5px solid #e8edf5 !important;
  }

  /* The cover: no rule under the title, and the subtitle in the brand blue. */
  article#doc-cover h1 {
    border-bottom: none !important;
    color: #0b1220;
  }

  article#doc-cover h2 {
    border-bottom: none !important;
    color: #1e88ff;
    font-size: 14pt;
  }

  /* site_author has to be set -- the cover template prints "None" without it --
   * but with copyright set as well the cover ends on the same name twice. */
  article#doc-cover p#author {
    display: none;
  }

  /* The diagrams are drawn on white by scripts/mermaid_diagrams.py; on paper
   * they need the frame the site gives them, not the card. */
  img.mermaid-diagram {
    border: 1px solid #d7dde8;
    border-radius: 4px;
    padding: 4px;
  }
}
