#article-modal-overlay {
    position: fixed;
    top: 110px;
    /* Below both logo bar (50px) and nav bar (60px) */
    left: 0;
    width: 100vw;
    height: calc(100vh - 110px);
    background-color: #fff;
    /* Solid white to look like page load */
    z-index: 1500;
    /* Lower than nav bar (2000) */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: none;
    /* No animation */
}

#article-modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#article-modal {
    background: #fff;
    width: 100%;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    /* Minimalist: no shadow */
    overflow: hidden;
    transform: none;
    /* No animation */
    transition: none;
}

#article-modal-overlay.visible #article-modal {
    transform: none;
}

.article-modal-header {
    display: flex;
    justify-content: flex-end;
    padding: 0 30px;
    background: #fff;
    border-bottom: none;
    /* Minimalist: no border */
}

#article-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #333;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#article-close-btn:hover {
    background: #f5f5f5;
}

#article-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10%;
    /* Reduced top padding to close gap with nav */
    color: #111;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

/* Base markdown styles overrides for better readability */
#article-content {
    max-width: 900px;
    margin: 0 auto;
}

#article-content h1 {
    font-size: 28px;
    /* Match settings-section-title */
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 24px;
    color: #333;
    line-height: 1.4;
}

.article-publish-date {
    display: block;
    font-size: 16px;
    /* Similar to body text */
    color: #888;
    /* Lighter color */
    margin-top: -12px;
    /* Pull closer to title */
    margin-bottom: 30px;
    font-weight: 400;
}

#article-content h2 {
    font-size: 20px;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

#article-content h3 {
    font-size: 18px;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-weight: 600;
    color: #444;
}

#article-content p {
    line-height: 1.8;
    margin-bottom: 1.2em;
    font-size: 16px;
    /* Match markdown-body */
    color: #444;
}

/* Default image styling: centered, max 800px */
#article-content img {
    display: block;
    margin: 20px auto;
    max-width: 800px;
    max-height: 800px;
    width: auto;
    height: auto;
}

/* Image Alignment Classes */
.align-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 30px 0;
}

.align-left {
    float: left;
    margin: 0 30px 20px 0;
    max-width: 50%;
}

.align-right {
    float: right;
    margin: 0 0 20px 30px;
    max-width: 50%;
}

/* Clearfix for floats */
#article-content::after {
    content: "";
    clear: both;
    display: table;
}

#article-content a {
    color: #1a365d;
    text-decoration: underline;
}

/* Article bottom navigation */
.article-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 60px auto 80px auto;
    /* Extra bottom space to clear copyright footer */
    padding-top: 20px;
    border-top: 0.5px solid #ececec;
}

.article-nav-link {
    color: #1a365d;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
    user-select: none;
    min-width: 80px;
}

.article-nav-link:first-child {
    text-align: left;
}

.article-nav-link:last-child {
    text-align: right;
}

.article-nav-back {
    text-align: center;
}

.article-nav-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

@media (max-width: 768px) {

    /* === 手機版文章 modal 滿版 === */
    #article-modal-overlay {
        top: 50px;
        /* 只保留 logo bar 高度 */
        height: calc(100vh - 50px);
        height: calc(100dvh - 50px);
        /* 適配動態視窗高度 */
    }

    .article-modal-header {
        padding: 0 12px;
    }

    #article-modal-body {
        padding: 16px 16px;
    }

    #article-content h1 {
        font-size: 24px;
    }

    /* 圖片寬度不超過頁寬 */
    #article-content img {
        max-width: 100%;
        height: auto;
    }

    .align-left,
    .align-right {
        float: none;
        margin: 20px 0;
        max-width: 100%;
    }

    .article-publish-date {
        margin-top: 4px;
        /* Reset negative margin to avoid overlapping with social share icons */
    }

    .article-nav {
        margin-top: 40px;
    }

    .article-nav-link {
        font-size: 14px;
        min-width: 60px;
    }
}