/* ==========================================================================
   1. 基础全局样式与人文色调 (黛青、宣纸灰、深焦茶)
   ========================================================================== */
:root {
    --color-bg-main: #f9f8f6;       /* 宣纸感淡白底色 */
    --color-text-main: #2b2b2b;     /* 深焦茶色文字 */
    --color-text-muted: #666666;    /* 次要灰色文字 */
    --color-primary: #1e3d59;       /* 标志性学术深蓝色/黛青 */
    --color-sidebar-bg: #ffffff;    /* 侧边栏纯白背景 */
    --color-card-bg: #f0f2f5;       /* 浅灰色卡片底色 */
    --color-border: #e1e4e8;        /* 淡淡的分割线 */
    --font-serif: "Georgia", "Times New Roman", "Noto Serif CJK SC", "SimSun", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    padding-bottom: 40px;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==========================================================================
   2. 顶部 Header & 横向导航栏
   ========================================================================== */
.site-header {
    background-color: var(--color-primary);
    color: #ffffff;
    /* 你可以在 static/images 中放一张大图，在这里通过 url() 引入 */
    background-image: linear-gradient(rgba(30,61,89,0.8), rgba(30,61,89,0.8)), url('../images/academic_banner.jpg');
    background-size: cover;
    background-position: center;
    text-align: center;
    padding: 50px 20px;
}

.site-title {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: 2px;
}

.site-subtitle {
    font-size: 1rem;
    margin-top: 10px;
    opacity: 0.8;
    letter-spacing: 1px;
}

/* 横向次级导航 */
.sub-nav {
    background-color: #ffffff;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10%;
    height: 50px;
}

.nav-links a {
    display: inline-block;
    padding: 0 20px;
    line-height: 50px;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active, .nav-links a.back-home {
    color: var(--color-primary);
    font-weight: 600;
}

.search-box input {
    padding: 5px 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.85rem;
    outline: none;
    width: 200px;
    transition: width 0.3s;
}

.search-box input:focus {
    width: 240px;
    border-color: var(--color-primary);
}

/* ==========================================================================
   3. 主体布局与面包屑
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: flex;
    gap: 30px; /* 左右两栏间距 */
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 10px;
}

.breadcrumb a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ==========================================================================
   4. 左侧侧边栏 Sidebar (现代 Flex 弹性设计)
   ========================================================================== */
.sidebar {
    flex: 0 0 260px; /* 固定宽度 */
    background-color: var(--color-sidebar-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 20px;
    height: fit-content;
}

.sidebar-title {
    background-color: var(--color-primary);
    color: #ffffff;
    padding: 10px 15px;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 15px;
    border-radius: 2px;
}

.sidebar-title-sub {
    color: var(--color-primary);
    font-size: 1.05rem;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--color-primary);
}

.category-list, .quick-switch-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 5px;
}

.cat-item {
    display: block;
    padding: 10px 12px;
    font-size: 0.95rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.cat-item:hover {
    background-color: var(--color-bg-main);
    color: var(--color-primary);
    padding-left: 18px; /* 优雅的轻微右移效果 */
}

.cat-icon {
    color: var(--color-primary);
    margin-right: 8px;
    font-size: 0.8rem;
}

.cat-en {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.quick-switch-list li a {
    display: block;
    padding: 8px 5px;
    font-size: 0.95rem;
    color: var(--color-text-main);
}

.quick-switch-list li a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.sidebar-back-action {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px dashed var(--color-border);
}

.btn-back-all {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
.btn-back-all:hover {
    color: var(--color-primary);
}

/* ==========================================================================
   5. 右侧主内容区 Main & 卡片设计 (list-F 进化版)
   ========================================================================== */
.main-content {
    flex: 1; /* 自动撑满剩余宽度 */
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 核心卡片样式与柔和 Hover 动效 */
.knowledge-card {
    display: flex;
    background-color: var(--color-card-bg);
    border-radius: 4px;
    padding: 20px;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.knowledge-card:hover {
    transform: translateY(-2px); /* 微微上浮 */
    background-color: #ffffff;
    border-color: var(--color-border);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05); /* 极轻的呼吸感阴影 */
}

.card-avatar {
    flex: 0 0 80px;
    margin-right: 20px;
}

.card-avatar img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

/* 全格式支持的弹性头像容器 */
.avatar-placeholder {
    width: 80px;
    height: 80px;
    background-color: #d1d7de;
    color: #555;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
}

.card-body {
    flex: 1;
}

.card-header-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.scholar-name {
    font-size: 1.15rem;
    color: var(--color-primary);
    font-weight: 600;
}

.scholar-en {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: normal;
}

.card-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-family: var(--font-serif);
}

.card-excerpt {
    font-size: 0.95rem;
    color: #444444;
    text-align: justify;
}

.more-actions {
    text-align: center;
    margin-top: 30px;
}

.btn-view-all {
    display: inline-block;
    padding: 10px 30px;
    background-color: var(--color-primary);
    color: #ffffff;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: opacity 0.2s;
}

.btn-view-all:hover {
    opacity: 0.9;
}

/* ==========================================================================
   6. 二级正文页与 Markdown 渲染污染防范
   ========================================================================== */
.article-wrapper {
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 30px;
}

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

.article-title {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    color: var(--color-text-main);
    margin-bottom: 12px;
}

.article-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.article-meta span {
    margin: 0 10px;
}

/* 二级页学者图文块 */
.scholar-intro-block {
    display: flex;
    background-color: var(--color-bg-main);
    border-left: 4px solid var(--color-primary);
    padding: 15px;
    margin-bottom: 30px;
    gap: 15px;
}

.intro-avatar .avatar-placeholder {
    width: 70px;
    height: 70px;
}

.intro-avatar img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.intro-text h3 {
    font-size: 0.9rem;
    color: var(--color-primary);
    margin-bottom: 5px;
}

.intro-text p {
    font-size: 0.85rem;
    color: #555;
}

/* 严格限定 Markdown 渲染内容，防范样式污染 */
.article-content {
    font-size: 1.05rem;
    color: #333333;
    text-align: justify;
}

.article-content h3 {
    font-family: var(--font-serif);
    color: var(--color-primary);
    margin: 25px 0 12px 0;
    font-size: 1.3rem;
    border-bottom: 1px dashed var(--color-border);
    padding-bottom: 5px;
}

.article-content p {
    margin-bottom: 16px;
    text-indent: 2em; /* 标准学术段落缩进 */
}

/* ==========================================================================
   7. 留言与回响区域
   ========================================================================== */
.comment-section {
    margin-top: 40px;
    border-top: 2px solid var(--color-border);
    padding-top: 25px;
}

.comment-section-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 18px;
}

.comment-item {
    padding: 18px 0;
    border-bottom: 1px solid var(--color-border);
}

.comment-item:first-of-type {
    border-top: 1px solid var(--color-border);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.comment-number {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary);
}

.comment-text {
    font-size: 0.98rem;
    line-height: 1.75;
    color: #444444;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.comment-location {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.comment-empty {
    padding: 24px 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.comment-delete-form {
    margin: 0;
}

.comment-delete-button {
    border: none;
    background: transparent;
    color: #a55b5b;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 3px 0;
}

.comment-delete-button:hover {
    color: #d9534f;
    text-decoration: underline;
}

/* ==========================================================================
   8. 灵感捕捉组件设计
   ========================================================================== */
.inspiration-section {
    margin-top: 40px;
    border-top: 2px solid var(--color-border);
    padding-top: 25px;
}

.inspiration-title {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 15px;
}

.inspiration-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: var(--color-bg-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    resize: vertical;
}

.inspiration-form textarea:focus {
    background-color: #ffffff;
    border-color: var(--color-primary);
}

.form-action {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-submit-inspiration {
    background-color: #28a745; /* 稳重的生机绿 */
    color: #ffffff;
    border: none;
    padding: 8px 20px;
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-submit-inspiration:hover {
    opacity: 0.9;
}

.form-tip {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   9. 底部与响应式媒体查询 (手机端完美适配)
   ========================================================================== */
.site-footer {
    margin-top: 50px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
}

.copyright {
    margin-top: 5px;
}

/* 响应式断点：当屏幕小于 768px (手机端) 自动转换为垂直单栏流 */
@media (max-width: 768px) {
    .sub-nav {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 10px;
    }
    .nav-links a {
        line-height: 30px;
        padding: 0 10px;
    }
    .container {
        flex-direction: column;
        margin: 15px auto;
    }
    .sidebar {
        flex: none;
        width: 100%;
    }
    .knowledge-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .card-avatar {
        margin-right: 0;
        margin-bottom: 15px;
    }
    .card-header-info {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
    .scholar-intro-block {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* 手机端：头像和标题保持居中，简介正文改为左对齐 */
    .scholar-intro-block .intro-text p {
        text-align: justify;
        text-justify: inter-ideograph;
    }

    .comment-header {
        align-items: flex-start;
    }

    .comment-text {
        font-size: 0.95rem;
    }
}

/* 针对正文后追加的心得体会（Markdown 的 blockquote 语法）进行美化 */
.article-content blockquote {
    margin: 30px 0 20px 0;
    padding: 15px 20px;
    background-color: #fcfbfa; /* 比正文更淡一点的底色 */
    border-left: 3px solid #b5a686; /* 极有质感的古铜古风装饰边线 */
    border-top: 1px dashed var(--color-border); /* 顶部淡淡的虚线分割 */
    border-bottom: 1px dashed var(--color-border); /* 底部虚线分割 */
    color: #555555;
    font-size: 0.95rem;
}

/* 让段落开头的首行缩进在引用块里失效，保持排版整齐 */
.article-content blockquote p {
    text-indent: 0 !important; 
    margin-bottom: 0;
}

/* ==========================================================================
   学术谱系条目专用开头
   ========================================================================== */
/* ==========================================================================
   学术谱系条目专用开头
   ========================================================================== */

.genealogy-intro-block {
    margin-bottom: 34px;
    padding: 20px 24px 22px;
    background-color: #faf9f7;
    border-left: 3px solid var(--color-primary);
}

.genealogy-intro-title {
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.08em;
}

.genealogy-intro-divider {
    width: 54px;
    margin: 10px 0 14px;
    border-top: 1px dashed #aeb8c1;
}

.genealogy-intro-summary {
    margin: 0;
    color: #555555;
    font-size: 0.94rem;
    line-height: 1.85;
    text-indent: 0;
}


/* ==========================================================================
   学术谱系正文减重
   只影响 entry_type: genealogy 的条目
   ========================================================================== */

.article-content ol {
    margin: 14px 0 20px 1.6em;
    padding-left: 0.4em;
}

.article-content ol li {
    margin-bottom: 7px;
    padding-left: 3px;
    color: #444444;
    font-weight: 400;
    line-height: 1.75;
}

.article-content ol li strong {
    font-weight: 400;
}