/* modern-article.css - Modern, Elegant Reading Experience */
:root {
    --bg-color: #fcfaf7;
    --text-main: #34495e;
    --text-light: #7f8c8d;
    --accent-green: #b4f8c8;
    --accent-pink: #f9c5d1;
    --accent-blue: #ade7e6;
    --border-color: #e0e0e0;
    --clear-accent-blue: #a0e7e52e;
    --pixel-font-latin: 'Press Start 2P', cursive;
    --pixel-font-cjk: 'SimSun', '宋体', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Georgia', 'Times New Roman', "PingFang SC", "Hiragino Sans GB", serif;
    line-height: 1.8;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* --- Banner Header --- */
.modern-header {
    background-color: var(--clear-accent-blue);
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.modern-header .container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.modern-logo {
    font-family: var(--pixel-font-latin);
    font-size: 20px;
    text-decoration: none;
    color: #333;
    text-shadow: 
        1px 1px 0px var(--accent-green),
        -1px -1px 0px var(--accent-pink);
    transition: transform 0.3s ease;
}

.modern-logo:hover {
    transform: scale(1.05);
}

.modern-nav a {
    font-family: var(--pixel-font-latin), var(--pixel-font-cjk);
    font-size: 11px;
    text-decoration: none;
    color: var(--text-light);
    margin-left: 20px;
    transition: color 0.2s;
}

.modern-nav a:hover {
    color: var(--text-main);
}

/* --- Article Layout with Sidebar --- */
.article-wrapper {
    max-width: 1100px;
    margin: 60px auto 100px;
    display: flex;
    gap: 40px;
    padding: 0 25px;
    position: relative;
}

.article-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.article-main {
    flex-grow: 1;
    max-width: 760px;
}

/* --- Floating TOC --- */
.toc-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    font-family: var(--pixel-font-cjk);
    border-left: 2px solid var(--accent-blue);
    padding-left: 20px;
}

.toc-sidebar h4 {
    font-size: 14px;
    margin-bottom: 15px;
    color: var(--text-main);
    letter-spacing: 1px;
}

.toc-sidebar ul {
    list-style: none;
    padding: 0;
}

.toc-sidebar li {
    margin-bottom: 10px;
    font-size: 11px;
    line-height: 1.4;
}

.toc-sidebar a {
    text-decoration: none;
    color: var(--text-light);
    transition: color 0.2s, padding-left 0.2s;
    display: block;
}

.toc-sidebar a:hover {
    color: var(--text-main);
    padding-left: 5px;
}

/* --- Article Content --- */
.article-container {
    max-width: 760px;
    margin: 0 auto;
}

.article-header {
    text-align: center;
    margin-bottom: 50px;
}

.article-header h1 {
    font-family: 'Georgia', "PingFang SC", "Hiragino Sans GB", sans-serif;
    font-size: 36px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    line-height: 1.3;
}

.article-meta {
    font-family: var(--pixel-font-cjk);
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
}

.article-meta .tag {
    background-color: var(--accent-blue);
    padding: 2px 8px;
    border-radius: 4px;
    color: #444;
}

/* Stealth Tag - Hidden but selectable */
.stealth-tag {
    background-color: transparent !important;
    color: transparent !important;
    user-select: text; /* Ensure it remains selectable */
    transition: color 0.2s;
}

.stealth-tag::selection {
    background-color: var(--accent-blue);
    color: #444;
}

.stealth-tag span::selection {
    background-color: var(--accent-blue);
    color: #444;
}

.article-content {
    font-size: 18px;
    letter-spacing: 0.01em;
}

.article-content p {
    margin-bottom: 30px;
}

.article-content h2, .article-content h3 {
    font-family: 'Georgia', "PingFang SC", sans-serif;
    margin-top: 50px;
    margin-bottom: 20px;
    color: #2c3e50;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin: 40px 0;
}

/* --- Code Blocks & Math --- */
.article-content code {
    font-family: 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    background: #eaeff2;
    padding: 2px 5px;
    border-radius: 4px;
    color: #445566;
    margin: 0 2px;
}

.article-content pre {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid #edf2f7;
    margin: 30px 0;
    line-height: 1.5;
}

.article-content pre code {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 15px;
    color: inherit;
    border-radius: 0;
}

/* --- Blockquotes --- */
.article-content blockquote {
    margin: 40px 0;
    padding: 10px 20px 30px;
    background-color: var(--clear-accent-blue);
    border-left: 5px solid var(--accent-blue);
    border-radius: 4px;
    font-style: italic;
    position: relative;
    color: #5d6d7e;
}

.article-content blockquote p {
    margin-bottom: 0;
    line-height: 1.7;
}

.article-content blockquote p + p {
    margin-top: 15px;
}

/* MathJax Display Optimization */
mjx-container[display="true"] {
    overflow: visible !important; /* 允许溢出 */
    max-width: 100%;
    padding: 15px 0;
    font-size: 0.9em; /* 进一步调小字号 */
    transition: font-size 0.3s ease;
}

/* 侧边栏基础透明度逻辑 */
.article-sidebar {
    width: 220px;
    flex-shrink: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* 当检测到公式重叠时激活的类 */
.article-sidebar.is-overlapping {
    opacity: 0.15; /* 变得很淡 */
}

.article-sidebar.is-overlapping:hover {
    opacity: 1; /* 鼠标悬停时恢复，方便查看目录 */
}

/* --- Footer --- */
.modern-footer {
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    text-align: center;
    background: var(--clear-accent-blue);
    font-size: 13px;
    color: var(--text-light);
}

/* --- Mobile Adjustments --- */
@media (max-width: 1000px) {
    .article-sidebar {
        display: none;
    }
    .article-wrapper {
        display: block;
        max-width: 760px;
    }
}

@media (max-width: 600px) {
    .article-header h1 {
        font-size: 28px;
    }
    .article-content {
        font-size: 16px;
    }
    .modern-nav {
        display: none;
    }
}
