@media print {
    html, body { margin: 0; }
    :root {
        --bg-color: #fff !important;
        --text-color: #000 !important;
        --link-color: #000 !important;
        --code-bg-color: #e2e2e2 !important;
        --code-text-color: #000 !important;
        --font-size: 12pt !important;
        --font-family: 'Arial', sans-serif !important;
    }
    /* Narrow page margins */
    @page {
        size: A4;
        margin: 5mm;

        /* Page number that overlaps the content area */
        @top-right {
            content: "Page " counter(page) " of " counter(pages);
            font-size: calc(0.6 * var(--font-size));
            font-family: var(--font-family);
            color: var(--text-color);
            text-align: right;

            /* Move it down into the content area */
            /* margin-top: -10mm;     choose how far to overlap */
            /* padding-top: 0;  keep zero so the overlap is exact */
        }
    }


    html,
    body {
        font-size: var(--font-size);
        color: var(--text-color);
        background: var(--bg-color);
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a {
        color: #000 !important;
        text-decoration: none;
    }

    p code,
    ol code,
    ul code,
    .alpha-list ul code,
    .alpha-list ol code,
    figcaption code,
    caption code {
        color: var(--text-color) !important;
        font-size: var(--font-size) !important;
        background: var(--code-bg-color) !important;
    }

    figcaption,
    caption {
        color: var(--text-color);
        font-size: calc(0.9 * var(--font-size));
    }

    .questions h1::before,
    .questions h2::before {
        counter-increment: question-counter 1;
        content: "Question " counter(question-counter) ") ";
    }

    h1, h2, h3 {
        break-after: avoid;
        page-break-after: avoid;
        font-size: calc(1.3 * var(--font-size)) !important;
        border-bottom: 2px solid var(--text-color);
        padding-bottom: 0.5rem;
    }

    .questions h1,
    .questions h2{
        break-before: page;
        page-break-before: always;
    }

    h1, h2, h3 {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .sourceCode {
        background: var(--code-bg-color) !important;
        color: var(--code-text-color) !important;
        font-size: var(--font-size) !important;
        font-family: 'Consolas', monospace !important;
        font-size: calc(0.85 * var(--font-size)) !important;
    }

    /* Source code blocks have small left margin (works up to 99 lines) */
    .sourceCode pre.numberSource{
        margin-left: 2em !important;
    }

    table, figure, pre, blockquote, .callout {
        break-inside: avoid !important;
    }

    .alpha-list, .question-statement {
        break-inside: avoid;
        margin-top: 0.8rem;
    }

    

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

    nodeLabel p {
        font-size: var(--font-size);
    }

    edgeLabel p {
        font-size: var(--font-size);
    }

    
    .mermaid {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .questions table {
        font-size: 0.8em !important;
        width: auto !important;
        margin-left: auto;
        margin-right: auto;
    }

    .callout .huge .callout-body,
    .callout .huge .callout-title-container {
        font-size: calc(1.5 * var(--font-size)) !important;
    }

}