/* ============================================
   文章页：阅读版心 + 正文排版
   ============================================ */

.post-container {
    width: min(100%, var(--site-content-width));
    margin: 0 auto;
}

/* ---------- 文章头 ---------- */
.post-header {
    margin-bottom: 44px;
    padding-bottom: 26px;
    border-bottom: 1px solid var(--accent-subtle);
}

.post-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4.6vw, 2.7rem);
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin-top: 20px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---------- 正文排版 ---------- */
.post-content {
    font-size: 1.02rem;
    line-height: 1.92;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-content > *:first-child {
    margin-top: 0;
}

.post-content p {
    margin: 1.15em 0;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    line-height: 1.4;
}

.post-content h2 {
    margin: 2.4em 0 0.9em;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
}

.post-content h3 {
    margin: 2em 0 0.7em;
    font-size: 1.18rem;
}

.post-content h4 {
    margin: 1.8em 0 0.6em;
    font-size: 1.04rem;
    color: var(--text-secondary);
}

.post-content a {
    color: var(--accent-strong);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent-subtle);
    transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

.post-content a:hover {
    text-decoration-color: var(--accent-color);
}

.post-content strong {
    font-weight: 600;
}

.post-content ul,
.post-content ol {
    margin: 1.1em 0;
    padding-left: 1.4em;
}

.post-content li {
    margin: 0.4em 0;
}

.post-content li::marker {
    color: var(--accent-color);
}

.post-content blockquote {
    margin: 1.7em 0;
    padding: 4px 0 4px 20px;
    border-left: 1px solid var(--accent-subtle);
    color: var(--text-secondary);
}

.post-content blockquote p {
    margin: 0.4em 0;
}

.post-content blockquote p:first-child {
    margin-top: 0;
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content hr {
    height: 0;
    margin: 2.6em 0;
    border: 0;
    border-top: 1px solid var(--accent-subtle);
}

.post-content img {
    margin: 1.8em auto;
    border-radius: 2px;
    border: 1px solid var(--accent-subtle);
}

.post-content figure {
    margin: 1.8em 0;
}

.post-content figcaption {
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-align: center;
    color: var(--text-secondary);
}

.post-content table {
    display: block;
    width: 100%;
    margin: 1.8em 0;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.post-content th,
.post-content td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--accent-subtle);
    text-align: left;
    white-space: nowrap;
}

.post-content th {
    border-bottom: 1px solid var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.post-content tbody tr:hover {
    background-color: transparent;
}

/* ---------- 脚注 ---------- */
.post-content .footnotes {
    margin-top: 3em;
    padding-top: 1.6em;
    border-top: 1px solid var(--accent-subtle);
    font-size: 0.86rem;
    color: var(--text-secondary);
}

.post-content .footnotes ol {
    padding-left: 1.2em;
}

.post-content .footnote-ref a {
    padding: 0 3px;
    font-family: var(--font-mono);
    font-size: 0.72em;
    font-weight: 600;
    text-decoration: none;
    color: var(--accent-strong);
}

.post-content .footnote-backref {
    text-decoration: none;
    color: var(--accent-color);
}

/* ---------- 邮件 / 返回顶部：右下角悬浮 ---------- */
.post-to-mail {
    position: fixed;
    right: 28px;
    bottom: 80px;
    z-index: 120;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent-subtle);
    border-radius: 2px;
    background-color: var(--bg-color);
    color: var(--text-secondary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease,
        color 0.2s ease, border-color 0.2s ease;
}

.post-to-mail.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.post-to-mail:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.email-toast {
    position: fixed;
    right: 28px;
    bottom: 134px;
    z-index: 130;
    padding: 8px 14px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    color: var(--bg-color);
    background-color: var(--text-primary);
    border-radius: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
}

.email-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.post-to-top {
    position: fixed;
    right: 28px;
    bottom: 28px;    z-index: 120;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent-subtle);
    border-radius: 2px;
    background-color: var(--bg-color);
    color: var(--text-secondary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease,
        color 0.2s ease, border-color 0.2s ease;
}

.post-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.post-to-top:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* ---------- 图片灯箱 ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgba(0, 0, 0, 0.92);
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: min(92vw, 1400px);
    max-height: 86vh;
    margin: 0;
    border: 0;
    border-radius: 2px;
    transition: transform 0.22s ease;
    cursor: zoom-in;
}

.lightbox img.is-zoomed {
    cursor: zoom-out;
}

.lightbox-close,
.lightbox-action {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 2px;
    background-color: rgba(18, 18, 17, 0.6);
    color: #FFFFFF;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.lightbox-close:hover,
.lightbox-action:hover {
    border-color: rgba(255, 255, 255, 0.75);
    background-color: rgba(255, 255, 255, 0.12);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-actions {
    position: absolute;
    bottom: 22px;
    left: 50%;
    display: flex;
    gap: 8px;
    transform: translateX(-50%);
}

body.lightbox-open {
    overflow: hidden;
}

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
    .post-header {
        margin-bottom: 32px;
        padding-bottom: 20px;
    }

    .post-title {
        font-size: clamp(1.7rem, 7.4vw, 2.2rem);
    }

    .post-meta {
        margin-top: 16px;
        font-size: 0.62rem;
        gap: 8px 14px;
    }

    .post-content {
        font-size: 0.98rem;
        line-height: 1.88;
    }

    .post-content h2 {
        font-size: 1.32rem;
        margin-top: 2em;
    }

    .post-content h3 {
        font-size: 1.1rem;
    }

    .post-content blockquote {
        padding: 12px 16px;
    }

    .post-to-top {
        right: 16px;
        bottom: 20px;
    }

    .post-to-mail {
        right: 16px;
        bottom: 72px;
    }

    .email-toast {
        right: 16px;
        bottom: 126px;
    }
}
