/* Print overrides for a browser printing this site.
 *
 * This is NOT what produces the downloadable PDFs. Those are rendered by
 * WeasyPrint from scripts/docs_pdf.css: docs_pdf.py lifts the article out of
 * the built print page and styles it from scratch, discarding this file along
 * with the rest of the theme's CSS. Nothing here reaches the PDF.
 *
 * What it covers is the other print path -- somebody hitting Ctrl+P on a page
 * of the site. Material's screen CSS leans on colour functions and layout that
 * print engines render unevenly, so the colours are resolved to plain values
 * and the pagination rules are stated explicitly.
 *
 * Rules that need to hold on both paths (where a page break falls, what counts
 * as screen furniture) are duplicated in scripts/docs_pdf.css. Change one and
 * check the other, or the PDF and the printed page drift apart.
 *
 * Screen rendering is unaffected: everything below sits inside @media print.
 */

@media print {
    :root {
        --md-default-fg-color: #1a1a1a;
        --md-default-fg-color--light: #4a4a4a;
        --md-default-fg-color--lighter: #767676;
        --md-default-bg-color: #ffffff;
        --md-primary-fg-color: #009D6C;
        --md-accent-fg-color: #009D6C;
        --md-typeset-color: #1a1a1a;
        /* Darkened from the brand green: links are body-sized text and the
         * brand value falls short of AA against white. */
        --md-typeset-a-color: #00734f;
        --md-code-bg-color: #f4f4f4;
        --md-code-fg-color: #1a1a1a;
    }

    @page {
        size: A4;
        margin: 20mm 18mm;
    }

    body {
        background: #ffffff;
        color: #1a1a1a;
    }

    /* Keep a heading with the text it introduces. */
    h1, h2, h3, h4 {
        break-after: avoid;
        page-break-after: avoid;
    }

    /* Each guide page opens a sheet. The break sits on the section, not on the
     * h1: the print-site plugin emits every nav group as a section whose only
     * content is its title, and breaking on the heading gave those a sheet of
     * their own. scripts/docs_pdf.css does the same, and docs_pdf.py folds
     * that title into the page below it -- which is markup surgery a
     * stylesheet cannot do, so here the title is simply not printed. */
    section.print-page {
        break-before: page;
        page-break-before: always;
    }

    .print-page.md-section > h1:first-child {
        display: none;
    }

    /* Never split these across a page boundary. */
    table, pre, blockquote, .admonition {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Admonitions lose their icon font in print, so they need a visible edge
     * to stay distinguishable from body text. */
    .admonition {
        border: 1pt solid #b0b0b0;
        border-left: 3pt solid #009D6C;
        padding: 8pt 10pt;
        background: #fafafa;
    }

    .md-typeset table:not([class]) {
        border: 1pt solid #d0d0d0;
        font-size: 9pt;
    }

    .md-typeset table:not([class]) th {
        background: #f0f0f0;
        color: #1a1a1a;
    }

    /* Offering a download of the document you are already holding. */
    .doc-download {
        display: none !important;
    }

    /* Interface furniture that means nothing on paper. */
    .md-header,
    .md-tabs,
    .md-sidebar,
    .md-footer,
    .md-search,
    .md-top,
    .md-content__button,
    .headerlink {
        display: none !important;
    }

    /* Grid cards are a navigation device; on paper they read as a plain list. */
    .md-typeset .grid.cards > ul > li {
        border: none;
        box-shadow: none;
        padding: 0 0 6pt 0;
    }
}
