/* 仅在打印时加载；保留正文，让纸面布局脱离屏幕的网格、裁剪与亮暗配色。 */
@page { margin: 16mm; }

@media print {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    html, html.dark, body {
        color-scheme: light;
        background: #fff !important;
        color: #111 !important;
        font-size: 11pt;
        line-height: 1.6;
        overflow: visible !important;
    }

    .site-header, .site-footer, .hero, .site-background,
    .layout__sidebar, .post-nav, .about-author,
    .waxy-drawer, .waxy-drawer-overlay,
    .waxy-toc-float-btn, .waxy-toc-float-panel,
    .navigation-progress, .pagination, .post__featured,
    .post-more, .post-content .toolbar, .alert__close,
    #back-to-top, #loading, #waxy-lightbox {
        display: none !important;
    }

    .content-wrap, .layout, .layout__main, .post {
        display: block !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .post {
        margin-bottom: 14pt !important;
        background: #fff !important;
        border: 0 !important;
        border-radius: 0 !important;
        break-inside: auto;
    }

    .post__head, .post__head--has-bg {
        display: block !important;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 0 12pt !important;
        padding: 0 0 8pt !important;
        text-align: left;
        break-after: avoid-page;
    }

    .post__head::before, .post__title::after,
    .post-content :is(h1, h2, h3, h4, h5, h6)::before,
    .post-content :is(h1, h2, h3)::after,
    .post-content.post__content--clamped::after {
        display: none !important;
    }

    .post__title { font-size: 22pt !important; }
    .post__title, .post-meta, .post-meta *, .post__footer, .post__footer *,
    .post-content, .post-content * {
        color: #111 !important;
        background: transparent !important;
        filter: none !important;
    }
    .post-meta { font-size: 9pt; }
    .post__footer { border-top: 1px solid #aaa; margin-top: 12pt; }

    .post-content, .post-content.post__content--clamped {
        display: block !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        overflow: visible !important;
        -webkit-line-clamp: unset !important;
    }

    .post-content :is(h1, h2, h3, h4, h5, h6) {
        break-after: avoid-page;
        margin: 16pt 0 7pt;
        padding: 0;
    }
    .post-content p { orphans: 3; widows: 3; }
    .post-content a { text-decoration: underline; }
    .post__content a:is([href^="https://"], [href^="http://"]):not([data-lightbox]):not(:has(img))::after {
        content: " (" attr(href) ")";
        font-size: 8pt;
        font-weight: normal;
        overflow-wrap: anywhere;
    }

    .post-content pre, .post-content pre[class*="language-"],
    .post-content pre code, .post-content pre code[class*="language-"] {
        white-space: pre-wrap !important;
        overflow-wrap: anywhere !important;
        word-break: normal;
        font-size: 9pt !important;
        line-height: 1.5 !important;
        tab-size: 4;
    }
    .post-content pre {
        padding: 8pt !important;
        border: 1px solid #aaa;
        border-radius: 0;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        break-inside: auto;
    }
    .post-content .line-numbers-rows { display: none !important; }
    .post-content :is(img, svg) { max-width: 100% !important; }
    .post-content img {
        width: auto;
        height: auto !important;
        max-height: 230mm;
        object-fit: contain;
        break-inside: avoid;
    }
    .post-content figure { margin: 10pt 0; }
    .post-content table { width: 100%; table-layout: auto; font-size: 9pt; }
    .post-content th, .post-content td { border-color: #aaa !important; overflow-wrap: anywhere; }
    .post-content thead { display: table-header-group; }
    .post-content tr { break-inside: avoid; }

    /* 收缩框在纸上展开；不依赖读者先点击或运行打印脚本。 */
    .shrink-box__body, .shrink-box__body-inner, .shrink-box__body-content {
        display: block !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        visibility: visible !important;
    }
    .shrink-box__title::after { display: none !important; }
    details::details-content { content-visibility: visible !important; }
    details > :not(summary) { display: block !important; }
    .hint, .alert, .shrink-box, .post-content blockquote {
        border: 1px solid #aaa !important;
        border-left-width: 3px !important;
        border-radius: 0;
    }
}
