@media print {
    * {
        background-color: #fff !important;
        color: #222;
        font-size: 12pt !important;
        font-family: Georgia, "New Times Roman", serif !important;
    }

    @page {
        margin: 0.5in;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid !important;
    }

    p, li, blockquote, figure, img {
        page-break-inside: avoid !important;
    }

    figure {
        margin: 1rem 0;
    }

    figcaption {
        text-align: left;
        margin: 0 auto;
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    figure img {
        display: block;
        max-height: 35vh;
        max-width: 90vw;
        outline: none;
        width: none;
        height: auto;
        margin: 0 auto;
        padding: 0;
    }

    code, pre {
        max-width: 96%;
        border: none;
        color: #222;
        word-break: break-all;
        word-wrap: break-word;
        white-space: pre-wrap;
        overflow: initial;
        page-break-inside: enabled;
        font-family: monospace !important;
    }

    pre {
        border: 1pt dotted #666;
        padding: 0.6rem;
    }

    pre code {
        border: none;
    }

    a::after {
        content: "(" attr(href) ") ";
        font-size: 90%;
    }
}
