/* ==========================================================================
   1. 颜色系统
   ========================================================================== */

:root {
    /* 基础颜色 - 这些可能已在全局CSS中定义 */
    /* --primary-color: #333;
    --accent-color: #0066cc;
    --accent-color-hover: #0052a3;
    --text-light: #666;
    --border-color: #eaeaea; */
    --text-light: #666;


    /* 背景颜色 */
    --bg-light-shade: #f8f9fa;
    --bg-code: #f5f5f5;

    /* 代码块颜色 */
    --code-text-color: #495057;
    --code-border-color: #e9ecef;

    /* 文章特定颜色 */
    --blockquote-border: var(--border-color);
    --heading-color: var(--primary-color);
    --link-color: #85655c;
    --link-hover-color: var(--accent-color-hover);
    --link-border-hover: var(--accent-color);
    --table-header-bg: var(--bg-light-shade);

}

/* 深色模式颜色覆盖 */
body.dark-mode {
    --bg-light-shade: #2d3748;
    --bg-code: #2a2e3a;
    --code-text-color: #e2e8f0;
    --code-border-color: #4a5568;
}

/* ==========================================================================
   2. 基础布局
   ========================================================================== */

/* 文章容器 */
.single-article {
    width: 95%;
    margin: 0 auto;
    padding: 1rem 0rem 0rem 0rem;
}

/* ==========================================================================
   3. 文章头部
   ========================================================================== */

/* 头部容器 */
.article-header {
    margin-bottom: 0rem;
}

/* 文章标题 */
.article-title {
    font-family: "sans-serif";
    font-size: 2rem;
    font-weight: normal;
    margin-bottom: 0.2rem;
    line-height: 1.3;
    color: var(--heading-color);
}

/* 文章元数据 */
.article-meta {
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--color-light-gray);
    /* 添加分隔线 */
}

.article-date,
.article-tags {
    display: block;
    margin-bottom: 0.2em;
}

.article-date {
    font-weight: 300;
}


/* 标签区域 */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.article-tag {
    color: var(--link-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

.article-tag:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

/* ==========================================================================
   4. 文章内容
   ========================================================================== */

/* 内容容器 */
.article-content {
    line-height: 1.8;
    margin-bottom: 0rem;
}

/* 基础文本元素 */
.article-content p {
    margin: 0rem 0rem 1rem;
    font-weight: 400;
}

/* 标题层级 */
.article-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.7rem 0 0.5rem;
    /* 原来是2rem 0 1rem */
    color: var(--heading-color);
}

.article-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0.7rem 0 0.5rem;
    /* 原来是1.5rem 0 1rem */
    color: var(--heading-color);
}

.article-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.7rem 0 0.5rem;
    /* 原来是1.2rem 0 0.8rem */
    color: var(--heading-color);
}

/* 列表样式 */
.article-content ul,
.article-content ol {
    margin: 0rem 0rem 0rem;
    padding: 0rem 0rem 0.5rem 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

/* 媒体元素 */
.article-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 10px;
}

/* 支持HTML align属性 */
.article-content p[align="left"] { text-align: left; }
.article-content p[align="center"] { text-align: center; }
.article-content p[align="right"] { text-align: right; }

/* neodb卡片高度优化 */
.article-content .db-card-subject {
    min-height: 150px !important;
    align-items: center !important;
}

.article-content .db-card-post {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.article-content .db-card-post img {
    margin: 0 !important;
    max-width: none !important;
    width: 100px !important;
    height: 150px !important;
    border-radius: 4px !important;
    object-fit: cover !important;
}

.article-content .db-card-content {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-height: 150px !important;
}

/* 引用块 */
.article-content blockquote {
    border-left: 4px solid var(--blockquote-border);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-light);
}

/* 代码显示 */
.article-content pre {
    background-color: var(--bg-light-shade);
    border: 1px solid var(--code-border-color);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    color: var(--code-text-color);
    font-size: 0.9em;
    line-height: 1.5;
}

.article-content code {
    font-family: var(--font-code);
    background-color: var(--bg-code);
    color: var(--code-text-color);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.88em;
    border: 1px solid var(--code-border-color);
}

.article-content pre code {
    background-color: transparent;
    border: none;
    padding: 0;
    color: inherit;
}

/* 链接样式 */
.article-content a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition-fast);
}



/* 表格样式 */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.article-content th,
.article-content td {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
}

.article-content th {
    background-color: var(--table-header-bg);
}

/* 分隔线 */
.article-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}


/* 脚注区域样式 */
.footnotes {
    margin-top: 0rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* 分隔线样式 */
.footnotes hr {
    margin: 1rem 0;
    border-top: 1px solid var(--border-color);
}

/* 列表样式 */
.footnotes ol {
    padding-left: 1.5rem;
    margin: 0.8rem 0;
}

.footnotes li {
    margin-bottom: 0.5rem;
}

/* 脚注内容段落 */
.footnotes p {
    margin-bottom: 0.5rem;
    display: inline;
    /* 让返回链接和内容在同一行 */
}

/* 脚注链接样式 */
.footnotes a {
    color: var(--link-color);
    text-decoration: none;
}

/* 返回链接样式 */
.footnote-backref {
    margin-left: 0.3rem;
    font-size: 0.8rem;
    vertical-align: super;
}

/* ==========================================================================
   5. 文章页脚
   ========================================================================== */

/* 页脚容器 */
.article-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* 导航链接 */
.article-nav-prev,
.article-nav-next {
    max-width: 45%;
}

.article-nav-prev span,
.article-nav-next span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.article-nav-prev a,
.article-nav-next a {
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.article-nav-prev a:hover,
.article-nav-next a:hover {
    color: var(--link-hover-color);
}

.article-nav-next {
    text-align: right;
}

/* ==========================================================================
   6. 响应式调整
   ========================================================================== */

@media (max-width: 768px) {

    /* 标题调整 */
    .article-title {
        font-size: 1.75rem;
    }

    /* 元数据调整 */
    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* 导航调整 */
    .article-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .article-nav-prev,
    .article-nav-next {
        max-width: 100%;
    }

    .article-nav-next {
        text-align: left;
    }
}

/* ==========================================================================
   图片增强样式系统
   ========================================================================== */

/* 基础figcaption样式 */
.article-content figure figcaption {
    font-style: italic !important;
    font-size: 0.9rem !important;
    color: #666 !important;
    margin-top: 0.5rem !important;
    text-align: center !important;
    line-height: 1.4 !important;
    font-weight: 300 !important;
}

/* 图片大小控制 */
.article-content figure.image-tiny img   { max-width: 15% !important; width: 15% !important; height: auto; }
.article-content figure.image-small img  { max-width: 25% !important; width: 25% !important; height: auto; }
.article-content figure.image-medium img { max-width: 50% !important; width: 50% !important; height: auto; }
.article-content figure.image-large img  { max-width: 75% !important; width: 75% !important; height: auto; }

/* 图片对齐样式 */
.article-content figure.center-image {
    text-align: center;
    margin: 0rem;
    display: block;
}

.article-content figure.center-image img {
    display: block;
    margin: 0 auto;
}

.article-content figure.left-image {
    text-align: left;
    margin: 1.5rem 0;
}

.article-content figure.right-image {
    text-align: right;
    margin: 1.5rem 0;
}

/* 文字环绕样式 */
.article-content figure.float-left {
    float: left;
    margin: 0;
    max-width: 50%;
}

.article-content figure.float-left img {
    margin: 0;
    display: block;
}

.article-content figure.float-right {
    float: right;
    margin: 0;
    max-width: 50%;
}

.article-content figure.float-right img {
    margin: 0 auto;
    display: block;
}

/* 浮动图片caption调整 */
.article-content figure.float-left figcaption,
.article-content figure.float-right figcaption {
    width: 100% !important;
    max-width: none !important;
    margin-top: 0rem !important;
}