@media print {
    /* 1. 基础布局：回归 2 页黄金比例 */
    html, body {
        margin: 0 !important;
        padding-top: 0.25in !important; /* 顶部留白 */
        padding-bottom: 0.25in !important;
        background-color: white !important;
        color: #1a1a1a !important;
        font-size: 10.2pt !important; /* 微调字号以适配 2 页 */
        font-family: 'Georgia', 'Times New Roman', serif !important;
        line-height: 1.32 !important; /* 紧凑行高 */
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        position: relative !important; /* 为二维码提供定位基准 */
    }

    /* 2. 容器优化：增加横向宽度 */
    .container, .container-fluid {
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0.5in !important;
        padding-right: 0.5in !important;
        margin: 0 !important;
    }

    .row {
        display: block !important;
        margin: 0 !important;
    }

    /* 强制单栏以最大化利用空间 */
    .col-md-7, .col-lg-8, .col-lg-4, .col-md-5.order-md-2,
    div[style*="border-left"], .border-start {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        display: block !important;
        border: none !important;
    }

    /* 3. 姓名：精致且避开二维码 */
    h1.display-4 {
        margin-top: 0 !important;
        margin-bottom: 0.8rem !important;
        font-size: 24pt !important;
        color: #8B4513 !important;
        font-weight: bold !important;
        padding-right: 90px !important; /* 关键：为右侧二维码留出空间 */
    }

    /* 4. 隐藏不必要的 Web 元素 */
    nav, .navbar, .skills-sidebar, .download-btn, .top-bar,
    .b-example-divider, img:not(#print-qrcode img), .d-print-none, .tooltip {
        display: none !important;
    }

    /* 5. 个人简介：书卷气引用样式 */
    .col-md-5.order-md-2 p.small {
        display: block !important;
        max-width: 90% !important;
        margin: 8px 0 12px 0 !important;
        font-size: 9.5pt !important;
        line-height: 1.4 !important;
        color: #444 !important;
        font-style: italic !important;
        border-left: 3px solid #eee5d8 !important;
        padding-left: 15px !important;
    }

    /* 6. 章节标题：脱水压缩 */
    section h3, .d-print-block h3, h3.text-custom-brown {
        color: #8B4513 !important;
        border-bottom: 1.5pt solid #eee5d8 !important;
        margin-top: 1.0rem !important;
        margin-bottom: 0.6rem !important;
        padding-bottom: 3px !important;
        font-size: 13pt !important;
        text-transform: uppercase !important;
        font-weight: bold !important;
    }

    /* 7. 项目/经历条目：极致间距优化 */
    .card, .project-card {
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        margin-bottom: 0.6rem !important;
        border-left: 2px solid #8B4513 !important;
        padding: 0 !important;
        break-inside: avoid; /* 防止跨页切断项目 */
    }

    .card-body {
        padding: 12px 12px 4px 12px !important;
    }

    /* 8. 列表与细节 */
    .custom-list {
        padding-left: 0 !important;
        margin-left: 15px !important;
    }

    .custom-list li {
        margin-bottom: 1px !important;
    }

    .text-secondary {
        color: #555 !important;
        font-size: 9pt !important;
    }

    .fw-bold {
        color: #000 !important;
        font-size: 11pt !important;
    }

    /* 强制日期与标题同行以节省行数 */
    .d-flex.justify-content-between {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: baseline !important;
    }

    /* 9. 二维码：稳定定位修复 */
    #print-qrcode {
        position: absolute !important;
        top: 0.25in !important;
        right: 0.5in !important;
        width: 70px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        z-index: 9999 !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    #print-qrcode img {
        width: 70px !important;
        height: 70px !important;
        display: block !important;
        border: 0.5pt solid #eee5d8 !important;
    }

    #print-qrcode p {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 6pt !important;
        color: #8B4513 !important;
        margin-top: 3px !important;
        text-transform: uppercase !important;
    }

    @page {
        margin-bottom: 0.6in;
    }


    /* 1. 为页面底部留出空间，防止内容覆盖脚注 */
    @page {
        margin-bottom: 0.6in;
    }

    /* 2. 定义固定脚注 */
    .site-footer-print {
        position: fixed;
        bottom: 0;
        left: 0.5in; /* 与 container 的 padding 对齐 */
        right: 0.5in;
        display: block !important;
        visibility: visible !important;
        border-top: 0.5pt solid #eee5d8 !important; /* 优雅的浅棕色细线 */
        padding-top: 5px;
        background-color: white; /* 确保背景不透明 */
        z-index: 9999;
    }

    /* 3. 脚注内部文字样式 */
    .footer-content-print {
        display: flex;
        justify-content: space-between;
        font-family: 'JetBrains Mono', monospace;
        font-size: 7pt;
        color: #a69685;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .site-footer-print:last-child {
        break-after: avoid;
    }
}