/* =============================================
   中华历史网 - 仿古深色主题样式表
   古典风格 · 龙纹 · 鎏金 · 卷轴
   ============================================= */

/* ===== 古典字体导入 ===== */
@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=ZCOOL+XiaoWei&family=Noto+Serif+SC:wght@300;400;500;600;700;900&display=swap');

/* ===== CSS 变量：配色体系 ===== */
:root {
    --bg-deep: #0d0d1a;
    --bg-main: #14142b;
    --bg-card: #1b1b38;
    --bg-card-hover: #232350;
    --gold: #d4a017;
    --gold-light: #e8c547;
    --gold-dark: #b8860b;
    --bronze: #c9a96e;
    --bronze-light: #dfc18a;
    --text-primary: #e8ddcb;
    --text-secondary: #b0a48b;
    --text-muted: #7a725a;
    --accent-red: #c23a2b;
    --accent-green: #5a8a5c;
    --border-dark: #2a2a45;
    --border-gold: rgba(212, 160, 23, 0.3);
    --shadow-gold: 0 0 30px rgba(212, 160, 23, 0.08);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-heading: 'Ma Shan Zheng', 'ZCOOL XiaoWei', 'KaiTi', 'STKaiti', serif;
    --font-sub: 'ZCOOL XiaoWei', 'Noto Serif SC', 'KaiTi', 'SimSun', serif;
    --font-body: 'Noto Serif SC', 'STSong', 'SimSun', 'KaiTi', serif;
}

/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(212, 160, 23, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(139, 90, 43, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(201, 169, 110, 0.02) 0%, transparent 40%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    color: var(--text-primary);
    line-height: 1.9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ===== 滚动条仿古 ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--bronze); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ===== 顶部龙纹装饰 ===== */
.main-header {
    text-align: center;
    padding: 140px 20px 50px;
    position: relative;
    background:
        linear-gradient(to bottom,
            rgba(212, 160, 23, 0.05) 0%,
            rgba(212, 160, 23, 0.01) 60%,
            transparent 100%);
    overflow: hidden;
}

/* 顶部中央龙纹徽章 */
.main-header::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 110px;
    background: url('../images/dragon-emblem.png') no-repeat center / contain;
    opacity: 0.9;
    filter: drop-shadow(0 0 16px rgba(212, 160, 23, 0.35));
}

/* 底部金色分隔线 */
.main-header::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: min(500px, 85%);
    height: 20px;
    background: url('../images/gold-divider.png') no-repeat center / contain;
    opacity: 0.5;
}

/* 顶部 subtle 祥云装饰：CSS 绘制 */
.main-header .header-deco {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 130px;
    background:
        radial-gradient(ellipse 400px 60px at 30% 80%, rgba(212, 160, 23, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 400px 60px at 70% 80%, rgba(212, 160, 23, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.site-title {
    font-family: var(--font-heading);
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 700;
    color: var(--gold);
    text-shadow:
        0 0 40px rgba(212, 160, 23, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.15em;
    margin-top: 30px;
    position: relative;
    display: inline-block;
}

/* 标题两侧装饰点 */
.site-title::before,
.site-title::after {
    content: '◆';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.3em;
    color: var(--bronze);
    opacity: 0.7;
}
.site-title::before { left: -1.6em; }
.site-title::after { right: -1.6em; }

.site-subtitle {
    font-family: var(--font-sub);
    font-size: 1.05rem;
    color: var(--bronze);
    letter-spacing: 0.25em;
    margin-top: 6px;
    opacity: 0.8;
}

/* ===== 主导航：竖排栏目（仿古卷轴风格） ===== */
.main-nav {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 30px 50px;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
}

/* 每个栏目卡片 = 一卷竹简 */
.nav-column {
    flex: 1 1 200px;
    min-width: 180px;
    max-width: 230px;
    background:
        linear-gradient(180deg,
            rgba(27, 27, 56, 0.95) 0%,
            rgba(20, 20, 43, 0.98) 100%);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-lg);
    padding: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1.2);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

/* 卡片顶部金色装饰条 */
.nav-column::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent, var(--gold-dark), var(--gold), var(--gold-dark), transparent);
    opacity: 0.8;
}

/* 卡片底部装饰 */
.nav-column::after {
    content: '';
    position: absolute;
    bottom: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--bronze), transparent);
    opacity: 0.4;
}

.nav-column:hover {
    transform: translateY(-6px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(212, 160, 23, 0.1);
    border-color: var(--gold);
}

.nav-column h2 {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    color: var(--gold);
    text-align: center;
    padding: 24px 16px 18px;
    letter-spacing: 0.12em;
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg,
        rgba(212, 160, 23, 0.08) 0%,
        transparent 100%);
}

/* h2 下方小装饰线 */
.nav-column h2::after {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    background: var(--bronze);
    margin: 10px auto 0;
    opacity: 0.6;
}

.nav-column ul {
    list-style: none;
    padding: 0 12px 20px;
    position: relative;
    z-index: 1;
}

.nav-column li {
    margin: 2px 0;
}

.nav-column a {
    display: block;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-sub);
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    position: relative;
    padding-left: 24px;
}

/* 链接前的菱形标记 */
.nav-column a::before {
    content: '◇';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.45rem;
    color: var(--bronze);
    opacity: 0;
    transition: all 0.3s;
}

.nav-column a:hover {
    color: var(--gold-light);
    background: rgba(212, 160, 23, 0.06);
    padding-left: 28px;
}

.nav-column a:hover::before {
    opacity: 1;
    left: 12px;
}

/* ===== 文章列表页 · 卷轴效果 ===== */
.content-header {
    text-align: center;
    padding: 50px 20px 20px;
    position: relative;
}

.content-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.2rem);
    color: var(--gold);
    letter-spacing: 0.12em;
    text-shadow: 0 0 20px rgba(212, 160, 23, 0.2);
}

.content-header .breadcrumb {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.content-header .breadcrumb a {
    color: var(--bronze);
    text-decoration: none;
    transition: color 0.3s;
}

.content-header .breadcrumb a:hover { color: var(--gold-light); }

.content-header::after {
    content: '';
    display: block;
    width: min(500px, 80%);
    height: 20px;
    background: url('../images/gold-divider.png') no-repeat center / contain;
    margin: 16px auto 0;
    opacity: 0.5;
}

/* 文章列表容器 */
.article-list-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 20px 60px;
}

/* 朝代分区标题 */
.dynasty-section-title {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    color: var(--bronze-light);
    text-align: center;
    padding: 30px 0 16px;
    letter-spacing: 0.1em;
    position: relative;
    margin-top: 10px;
}

/* 朝代标题左右装饰 */
.dynasty-section-title::before,
.dynasty-section-title::after {
    content: '';
    display: inline-block;
    width: 50px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--bronze));
    vertical-align: middle;
    margin: 0 16px;
    opacity: 0.5;
}
.dynasty-section-title::after {
    background: linear-gradient(90deg, var(--bronze), transparent);
}

/* 文章列表卡片 */
.article-list {
    list-style: none;
}

.article-item {
    background:
        linear-gradient(180deg,
            rgba(27, 27, 56, 0.8) 0%,
            rgba(20, 20, 43, 0.9) 100%);
    border: 1px solid var(--border-dark);
    border-left: 3px solid var(--gold-dark);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: 12px;
    padding: 18px 22px;
    transition: all 0.35s ease;
    position: relative;
}

.article-item:hover {
    border-left-color: var(--gold);
    background:
        linear-gradient(180deg,
            rgba(35, 35, 70, 0.9) 0%,
            rgba(27, 27, 56, 0.95) 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateX(4px);
}

.article-item a {
    font-family: var(--font-sub);
    font-size: 1.15rem;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    transition: color 0.3s;
}

.article-item a:hover { color: var(--gold-light); }

.article-meta-small {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.article-meta-small span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ===== 文章详情页 · 古籍书页风格 ===== */
.article-page {
    max-width: 860px;
    margin: 0 auto;
    padding: 30px 24px 60px;
    /* 仿古籍纸张质感 */
    background:
        linear-gradient(180deg,
            rgba(20, 20, 43, 0.7) 0%,
            rgba(27, 27, 56, 0.85) 100%);
    border-left: 1px solid var(--border-gold);
    border-right: 1px solid var(--border-gold);
    min-height: 70vh;
    box-shadow:
        inset 0 0 100px rgba(212, 160, 23, 0.02),
        var(--shadow-gold);
}

.article-header {
    text-align: center;
    padding: 10px 0 20px;
    position: relative;
}

.article-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4.5vw, 2.8rem);
    color: var(--gold);
    letter-spacing: 0.1em;
    line-height: 1.5;
    text-shadow: 0 0 15px rgba(212, 160, 23, 0.15);
}

.article-tag {
    display: inline-block;
    font-family: var(--font-sub);
    font-size: 0.82rem;
    color: var(--bronze);
    border: 1px solid var(--border-gold);
    padding: 3px 14px;
    border-radius: 20px;
    margin: 8px 4px;
    background: rgba(212, 160, 23, 0.04);
}

.article-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 18px 0;
    color: var(--bronze);
    opacity: 0.6;
}

.article-divider::before,
.article-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--bronze), transparent);
}

.article-divider span {
    font-size: 0.7rem;
    white-space: nowrap;
}

/* 文章信息栏 */
.article-info-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    padding: 12px 0;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.article-info-bar .info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-info-bar .info-value {
    color: var(--bronze);
    font-weight: 500;
}

/* 阅读量跳动动画 */
.reading-count {
    display: inline-block;
    transition: all 0.3s;
}
.reading-count.updated {
    animation: countPulse 0.6s ease-out;
}
@keyframes countPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: var(--gold); }
    100% { transform: scale(1); }
}

/* 正文分隔线 */
.content-divider {
    width: min(400px, 70%);
    height: 28px;
    background: url('../images/gold-divider.png') no-repeat center / contain;
    margin: 20px auto;
    opacity: 0.5;
}

/* 正文排版 */
.article-content {
    font-family: var(--font-body);
    font-size: 1.08rem;
    line-height: 2.1;
    color: var(--text-primary);
    text-align: justify;
}

.article-content p {
    text-indent: 2em;
    margin-bottom: 1.2em;
}

.article-content h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--bronze-light);
    margin: 2em 0 0.8em;
    text-align: center;
    text-indent: 0;
    letter-spacing: 0.08em;
}

.article-content h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--bronze);
    margin: 1.8em 0 0.6em;
    text-indent: 0;
}

.article-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5em auto;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-dark);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.article-content blockquote {
    border-left: 3px solid var(--gold-dark);
    margin: 1.5em 0;
    padding: 12px 20px;
    background: rgba(212, 160, 23, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* 文章底部导航 */
.article-footer-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-dark);
}

.article-footer-nav a {
    font-family: var(--font-sub);
    color: var(--bronze);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    font-size: 0.9rem;
}

.article-footer-nav a:hover {
    border-color: var(--gold);
    color: var(--gold-light);
    background: rgba(212, 160, 23, 0.05);
}

/* ===== 二级分类页 · hover 展开朝代 ===== */
.category-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}

.subcat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    padding: 10px 0;
}

.subcat-item {
    flex: 1 1 280px;
    max-width: 320px;
    background:
        linear-gradient(180deg,
            rgba(27, 27, 56, 0.9) 0%,
            rgba(20, 20, 43, 0.95) 100%);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 0;
    transition: all 0.35s ease;
    position: relative;
    overflow: visible;
}

.subcat-item:hover {
    border-color: var(--gold);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.subcat-item .subcat-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--bronze-light);
    text-align: center;
    padding: 18px 16px 14px;
    cursor: pointer;
    letter-spacing: 0.08em;
    position: relative;
}

.subcat-item .subcat-title::after {
    content: '▾';
    margin-left: 8px;
    font-size: 0.7rem;
    transition: transform 0.3s;
    display: inline-block;
}

.subcat-item:hover .subcat-title::after {
    transform: rotate(180deg);
}

/* 朝代列表（默认隐藏，hover 展开） */
.subcat-dynasty-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease;
    padding: 0 16px;
}

.subcat-item:hover .subcat-dynasty-list {
    max-height: 500px;
    padding: 4px 16px 14px;
}

.subcat-dynasty-list a {
    display: block;
    padding: 7px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-family: var(--font-sub);
    border-radius: var(--radius-sm);
    transition: all 0.25s;
    text-align: center;
}

.subcat-dynasty-list a:hover {
    color: var(--gold-light);
    background: rgba(212, 160, 23, 0.06);
}

/* ===== 页脚 ===== */
.site-footer {
    background: rgba(10, 10, 26, 0.95);
    border-top: 2px solid var(--border-gold);
    text-align: center;
    padding: 28px 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    position: relative;
    margin-top: auto;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: var(--gold);
    opacity: 0.5;
}

.site-footer .footer-brand {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--bronze);
    margin-bottom: 8px;
    letter-spacing: 0.08em;
}

.site-footer a {
    color: var(--bronze);
    text-decoration: none;
    transition: color 0.3s;
}

.site-footer a:hover { color: var(--gold-light); }

.site-footer .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 10px 0;
}

.site-footer .icp-info {
    margin-top: 6px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* ===== 回到顶部按钮 ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: rgba(27, 27, 56, 0.9);
    border: 1px solid var(--border-gold);
    border-radius: 50%;
    color: var(--bronze);
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.35s;
    pointer-events: none;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    background: rgba(212, 160, 23, 0.15);
    border-color: var(--gold);
    color: var(--gold-light);
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* ===== 动画 ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.nav-column {
    animation: fadeInUp 0.6s ease backwards;
}
.nav-column:nth-child(1) { animation-delay: 0.1s; }
.nav-column:nth-child(2) { animation-delay: 0.2s; }
.nav-column:nth-child(3) { animation-delay: 0.3s; }
.nav-column:nth-child(4) { animation-delay: 0.4s; }
.nav-column:nth-child(5) { animation-delay: 0.5s; }

.article-item {
    animation: fadeInUp 0.5s ease backwards;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .main-header {
        padding: 40px 16px 28px;
    }
    .main-header::before {
        width: 60px;
        height: 60px;
        top: 8px;
    }
    .site-title {
        font-size: 2rem;
    }
    .main-nav {
        padding: 12px 10px 30px;
        gap: 12px;
    }
    .nav-column {
        flex: 1 1 140px;
        min-width: 140px;
        max-width: none;
    }
    .nav-column h2 {
        font-size: 1.2rem;
        padding: 16px 8px 12px;
    }
    .nav-column a {
        font-size: 0.85rem;
        padding: 8px 10px;
    }
    .article-page {
        padding: 20px 14px 40px;
        border-left: none;
        border-right: none;
    }
    .article-content {
        font-size: 1rem;
        line-height: 1.9;
    }
    .article-info-bar {
        gap: 12px;
        font-size: 0.82rem;
    }
    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 38px;
        height: 38px;
    }
    .subcat-item {
        flex: 1 1 100%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .nav-column {
        flex: 1 1 100%;
        min-width: 100%;
    }
    .site-title {
        font-size: 1.6rem;
    }
    .article-header h1 {
        font-size: 1.4rem;
    }
}
