/* 唐朝风格主题样式 */

/* 字体优化方案 - 使用 Google Fonts 的 Noto Serif SC + 本地 Ma Shan Zheng 字体 */
/* 
 * 优化策略：
 * 1. 优先使用 Google Fonts 的 Noto Serif SC（约 200-500KB），作为主要字体
 * 2. 保留 Ma Shan Zheng 字体作为回退，但使用延迟加载和字体子集化
 * 3. 使用 font-display: swap 确保文字始终可见，不阻塞渲染
 * 4. 通过 unicode-range 限制字符范围，减小文件大小
 * 
 * 字体特点：
 * - Noto Serif SC：优雅的衬线字体，适合中文阅读，跨平台一致性好
 * - Ma Shan Zheng：传统毛笔字体，用于特殊标题和书法效果
 */
@font-face {
    font-family: 'Ma Shan Zheng';
    font-style: normal;
    font-weight: 400;
    /* 优化：使用 swap 确保文字始终可见，不阻塞渲染 */
    font-display: swap;
    /* 优化：限制字符范围，只包含常用中文字符，减小文件大小 */
    unicode-range: U+4E00-9FFF, U+3400-4DBF, U+3000-303F;
    /* 只使用 woff2 格式，文件最小 */
    src: url('/themes/tang_dynasty/assets/fonts/MaShanZheng-Regular.woff2') format('woff2');
}

/* 色彩定义 - 唐朝经典配色 */
:root {
    /* 主色调 - 朱红色 */
    --tang-red: #C8102E;
    --tang-red-light: #E63946;
    --tang-red-dark: #A01D2E;
    
    /* 金色 */
    --tang-gold: #D4AF37;
    --tang-gold-light: #F4D03F;
    --tang-gold-dark: #B8941A;
    
    /* 深蓝色 */
    --tang-blue: #1E3A5F;
    --tang-blue-light: #2E5984;
    --tang-blue-dark: #0F1F2F;
    
    /* 米白色（纸张色） */
    --tang-cream: #F5F1E8;
    --tang-cream-light: #FAF8F3;
    --tang-cream-dark: #E8E0D0;
    
    /* 墨色（文字色） */
    --tang-ink: #2C2C2C;
    --tang-ink-light: #4A4A4A;
    --tang-ink-dark: #1A1A1A;
    
    /* 青绿色（山水色） */
    --tang-teal: #4A7C7E;
    --tang-teal-light: #6B9FA2;
    --tang-teal-dark: #2E4F51;
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'STKaiti', 'KaiTi', '楷体', 'SimKai', serif;
    background: linear-gradient(135deg, var(--tang-cream) 0%, var(--tang-cream-light) 100%);
    color: var(--tang-ink);
    line-height: 1.8;
    min-height: 100vh;
    /* 添加团窠纹背景 */
    background-image: url('/themes/tang_dynasty/assets/images/tuanke-pattern.svg');
    background-size: 240px 240px;
    background-repeat: repeat;
    background-position: 0 0;
    /* Flexbox布局，确保footer固定在底部 */
    display: flex;
    flex-direction: column;
    /* 优化PC端滚动体验 */
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 改善文字渲染 */
    text-rendering: optimizeLegibility;
}

/* 背景装饰图案 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(200, 16, 46, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(212, 175, 55, 0.03) 0%, transparent 50%);
    background-size: 100% 100%;
    pointer-events: none;
    z-index: 0;
    /* PC端优化 */
    transition: opacity 0.3s ease;
}

/* PC端滚动时的背景效果 */
body.scrolled::before {
    opacity: 0.8;
}

/* 主内容区域 - 自动填充剩余空间 */
main {
    flex: 1;
    position: relative;
    z-index: 1;
    /* PC端优化 */
    padding: 1.2em 0 2em 0;
    animation: fadeIn 0.6s ease-in-out;
}

/* 页面淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* PC端大屏幕优化主内容区域 */
@media (min-width: 1024px) {
    main {
        padding: 1.5em 0 3em 0;
    }
}

@media (min-width: 1400px) {
    main {
        padding: 2em 0 4em 0;
    }
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    width: 100%;
}

/* PC端大屏幕优化 */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
        padding: 0 40px;
    }
}

@media (min-width: 1600px) {
    .container {
        max-width: 1500px;
        padding: 0 60px;
    }
}

/* 标题样式 - 书法风格（优先使用 Noto Serif SC，Ma Shan Zheng 作为回退） */
h1, h2, h3, h4, h5, h6 {
    /* 优先使用 Noto Serif SC，然后是 Ma Shan Zheng，最后是系统字体 */
    font-family: 'Noto Serif SC', 'Ma Shan Zheng', 'STKaiti', 'KaiTi', '楷体', 'SimKai', 'Georgia', 'Times New Roman', serif;
    font-weight: 700; /* 使用粗体字重 */
    color: var(--tang-red);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 1em;
    /* 处理长文本换行 */
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
}

h1 {
    font-size: 2.5em;
    border-bottom: 3px solid var(--tang-gold);
    padding-bottom: 0.5em;
    position: relative;
    /* 确保长标题可以换行 */
    white-space: normal;
    max-width: 100%;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100px;
    height: 3px;
    background: var(--tang-red);
}

h2 {
    font-size: 2em;
    border-bottom: 2px solid var(--tang-gold);
    padding-bottom: 0.4em;
    white-space: normal;
    max-width: 100%;
}

h3 {
    font-size: 1.5em;
    white-space: normal;
    max-width: 100%;
}

/* 书法字体类（优先使用 Ma Shan Zheng，然后是 Noto Serif SC） */
.calligraphy {
    /* 优先使用 Ma Shan Zheng 毛笔字体，然后是 Noto Serif SC，最后是系统字体 */
    font-family: 'Ma Shan Zheng', 'Noto Serif SC', 'STKaiti', 'KaiTi', '楷体', 'SimKai', 'Georgia', 'Times New Roman', serif;
    font-weight: 400; /* Ma Shan Zheng 使用常规字重 */
}

/* 文章卡片样式 - 卷轴效果 */
.article-card {
    background: var(--tang-cream-light);
    border: 2px solid var(--tang-gold);
    border-radius: 12px;
    padding: 2em;
    margin-bottom: 2em;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12),
                0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    /* 增强文字对比度 */
    color: var(--tang-ink-dark);
    /* 确保内容在背景之上 */
    z-index: 1;
    /* PC端优化 */
    overflow: visible; /* 改为 visible，允许内容溢出显示 */
}

/* 文章卡片内的标题和链接文本换行处理 */
.article-card h3,
.article-card h3 a {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

/* PC端大屏幕优化卡片 */
@media (min-width: 1024px) {
    .article-card {
        padding: 2.5em;
        border-radius: 16px;
    }
}

.article-card > * {
    position: relative;
    z-index: 1;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--tang-red), var(--tang-gold), var(--tang-blue));
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 8px;
    z-index: 0; /* 改为0，确保在decorative-corner伪元素之下，但在内容之上 */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* 不影响鼠标事件 */
}

/* 移除文章卡片的hover动画效果 */

/* 按钮样式 - 印章效果 */
.btn {
    display: inline-block;
    padding: 0.8em 2em;
    background: var(--tang-red);
    color: var(--tang-cream-light);
    border: none;
    border-radius: 4px;
    font-family: 'STKaiti', 'KaiTi', '楷体', serif;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    background: var(--tang-red-dark);
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    color: var(--tang-cream-light);
}

/* 导航栏样式 - 宫门效果 */
.navbar {
    background: linear-gradient(135deg, var(--tang-blue-dark) 0%, var(--tang-blue) 100%);
    padding: 1.2em 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), 
                0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    /* 优化移动端滚动性能 */
    -webkit-overflow-scrolling: touch;
    will-change: transform;
    /* PC端优化 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: box-shadow 0.3s ease, padding 0.3s ease;
}

/* PC端滚动时的导航栏效果 */
.navbar.scrolled {
    padding: 0.8em 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 
                0 2px 6px rgba(0, 0, 0, 0.15);
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--tang-red), var(--tang-gold), var(--tang-red));
}

.navbar .container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar ul {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

/* PC端大屏幕优化菜单间距 */
@media (min-width: 1024px) {
    .navbar ul {
        gap: 1em;
    }
}

@media (min-width: 1200px) {
    .navbar ul {
        gap: 1.5em;
    }
}

.navbar a {
    color: var(--tang-cream-light);
    text-decoration: none;
    font-size: 1.1em;
    padding: 0.6em 1.2em;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: block;
    font-weight: 500;
    /* 改善PC端交互体验 */
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* 导航链接下划线效果 */
.navbar a::after {
    content: '';
    position: absolute;
    bottom: 0.3em;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--tang-gold), transparent);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    border-radius: 2px;
}

/* 添加背景光晕效果 */
.navbar a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}

.navbar a:hover::after {
    width: 70%;
    height: 2.5px;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
}

.navbar a:hover::before {
    width: 120%;
    height: 120%;
    opacity: 1;
}

.navbar a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--tang-gold-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.navbar a:active {
    transform: translateY(0);
    transition: all 0.15s ease;
}

/* 当前页面导航项高亮 */
.navbar a.active {
    background: rgba(212, 175, 55, 0.2);
    color: var(--tang-gold-light);
}

.navbar a.active::after {
    width: 70%;
    height: 2.5px;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
}

/* 移动端菜单按钮 */
.navbar-toggle {
    display: none;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    min-width: 44px; /* 符合移动端触摸目标最小尺寸 */
    min-height: 44px;
    padding: 0.6em 0.8em;
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.35) 0%, rgba(200, 16, 46, 0.3) 100%);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* 确保按钮可见 */
    visibility: visible;
    opacity: 1;
    /* 改善触摸反馈 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.navbar-toggle:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.45) 0%, rgba(200, 16, 46, 0.4) 100%);
    border-color: rgba(212, 175, 55, 0.7);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.navbar-toggle:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.navbar-toggle:focus {
    outline: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2), 
                0 0 0 3px rgba(212, 175, 55, 0.3);
}

.navbar-toggle.active {
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.4) 0%, rgba(212, 175, 55, 0.35) 100%);
    border-color: rgba(200, 16, 46, 0.6);
    box-shadow: 0 3px 10px rgba(200, 16, 46, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.navbar-toggle.active:hover {
    background: linear-gradient(135deg, rgba(200, 16, 46, 0.5) 0%, rgba(212, 175, 55, 0.4) 100%);
    border-color: rgba(200, 16, 46, 0.8);
    box-shadow: 0 4px 12px rgba(200, 16, 46, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 移动端菜单图标 */
.navbar-toggle-icon {
    display: block;
    width: 24px;
    height: 20px;
    position: relative;
}

.navbar-toggle-icon span {
    position: absolute;
    left: 0;
    height: 3px;
    background: var(--tang-cream-light);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.navbar-toggle-icon span:nth-child(1) {
    top: 0;
    width: 100%;
}

.navbar-toggle-icon span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
    width: 85%;
    left: auto;
    right: 0;
}

.navbar-toggle-icon span:nth-child(3) {
    bottom: 0;
    width: 70%;
    left: auto;
    right: 0;
}

/* 悬停时图标效果 */
.navbar-toggle:hover .navbar-toggle-icon span {
    background: var(--tang-gold-light);
    width: 100%;
    left: 0;
    right: auto;
}

/* 菜单展开时的图标动画 */
.navbar-toggle.active .navbar-toggle-icon span {
    background: var(--tang-red-light);
    left: 0;
    right: auto;
    width: 100%;
}

.navbar-toggle.active .navbar-toggle-icon span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.navbar-toggle.active .navbar-toggle-icon span:nth-child(2) {
    opacity: 0;
    transform: translateY(-50%) scale(0);
}

.navbar-toggle.active .navbar-toggle-icon span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* 页脚样式 - 印章效果 */
.footer {
    background: var(--tang-blue-dark);
    color: var(--tang-cream-light);
    padding: 2em 0;
    text-align: center;
    margin-top: auto; /* 自动推到底部 */
    border-top: 3px solid var(--tang-gold);
    position: relative;
    z-index: 1;
}

.footer::before {
    content: '❋';
    display: block;
    font-size: 2em;
    color: var(--tang-gold);
    margin-bottom: 0.5em;
}

/* 文章标题链接hover效果 */
.article-card h3 a:hover {
    color: var(--tang-red-dark) !important;
    text-decoration: underline;
}

/* 文章摘要样式 - 使用书法字体（优先 Noto Serif SC） */
.article-card p,span,time,a {
    /* 优先使用 Noto Serif SC，然后是 Ma Shan Zheng，最后是系统字体 */
    font-family: 'Noto Serif SC', 'Ma Shan Zheng', 'STKaiti', 'KaiTi', '楷体', 'SimKai', 'Georgia', 'Times New Roman', serif;
}

/* 文章内容样式 */
.article-content {
    font-size: 1.1em;
    line-height: 2;
    color: var(--tang-ink-dark);
}

.article-content p {
    margin: 1em 0;
    text-indent: 2em; /* 首行缩进 */
}

.article-content blockquote {
    border-left: 4px solid var(--tang-red);
    padding-left: 1.5em;
    margin: 1.5em 0;
    font-style: italic;
    background: var(--tang-cream);
    padding: 1em 1.5em;
    border-radius: 4px;
}

/* 行内代码样式 */
.article-content code {
    background: var(--tang-cream-dark);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', 'Consolas', 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    color: var(--tang-red-dark);
    font-weight: 500;
}

/* 代码块样式 */
.article-content pre {
    background: var(--tang-blue-dark);
    color: var(--tang-cream-light);
    padding: 1.2em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5em 0;
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    line-height: 1.6;
}

/* 代码块内的代码样式 */
.article-content pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-size: 0.9em;
    font-family: 'Courier New', 'Consolas', 'Monaco', 'Menlo', monospace;
    line-height: 1.6;
    display: block;
    white-space: pre;
    word-wrap: normal;
    overflow-x: auto;
}

/* 确保代码块内的行内代码样式正确 */
.article-content pre code code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
}

/* 代码块滚动条样式 */
.article-content pre::-webkit-scrollbar {
    height: 8px;
}

.article-content pre::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.article-content pre::-webkit-scrollbar-thumb {
    background: var(--tang-gold);
    border-radius: 4px;
}

.article-content pre::-webkit-scrollbar-thumb:hover {
    background: var(--tang-gold-light);
}

/* 列表样式 */
.article-content ul,
.article-content ol {
    margin: 1.5em 0;
    padding-left: 2em;
    line-height: 2;
}

.article-content ul {
    list-style: none; /* 移除默认样式，使用自定义 */
}

.article-content ul > li {
    position: relative;
    padding-left: 1.5em;
    margin: 0.8em 0;
    color: var(--tang-ink-dark);
}

/* 自定义无序列表标记 - 使用唐代风格的装饰点 */
.article-content ul > li::before {
    content: '◆'; /* 使用菱形符号，符合唐代装饰风格 */
    position: absolute;
    left: 0;
    top: 0;
    color: var(--tang-gold);
    font-size: 0.8em;
    line-height: 2;
    font-weight: bold;
}

/* 有序列表样式 */
.article-content ol {
    list-style: none;
    counter-reset: list-counter;
}

.article-content ol > li {
    position: relative;
    padding-left: 2em;
    margin: 0.8em 0;
    counter-increment: list-counter;
    color: var(--tang-ink-dark);
}

.article-content ol > li::before {
    content: counter(list-counter) '.';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--tang-red);
    font-weight: bold;
    font-size: 1em;
    line-height: 2;
    min-width: 1.5em;
}

/* 嵌套列表样式 */
.article-content ul ul,
.article-content ol ol,
.article-content ul ol,
.article-content ol ul {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.article-content ul ul > li::before {
    content: '◇'; /* 嵌套列表使用空心菱形 */
    color: var(--tang-gold-light);
}

.article-content ol ol > li::before {
    content: counter(list-counter, lower-alpha) '.'; /* 嵌套有序列表使用小写字母 */
    color: var(--tang-red-light);
}

/* 列表项内的段落和内容 */
.article-content li > p {
    margin: 0.5em 0;
    text-indent: 0; /* 列表项内的段落不缩进 */
}

.article-content li > p:first-child {
    margin-top: 0;
}

.article-content li > p:last-child {
    margin-bottom: 0;
}

/* 评论相关样式 */
.reply-button,
.like-button {
    background: none;
    border: none;
    color: var(--tang-red);
    cursor: pointer;
    font-size: 0.9em;
    padding: 0.3em 0.5em;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.reply-button:hover,
.like-button:hover {
    background: var(--tang-gold);
    color: var(--tang-red-dark);
    transform: translateY(-1px);
}

.like-button.liked {
    color: var(--tang-red-dark);
    font-weight: bold;
}

/* 装饰元素 */
.decorative-line {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--tang-gold), transparent);
    margin: 2em 0;
}


/* 标签样式 */
.tag {
    display: inline-block;
    margin: 0.3em;
    padding: 0.3em 0.8em;
    background: var(--tang-cream);
    border: 1px solid var(--tang-gold);
    border-radius: 4px;
    color: var(--tang-ink);
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--tang-gold);
    color: var(--tang-red-dark);
    transform: translateY(-2px);
}

/* 搜索框样式 */
.search-box {
    background: var(--tang-cream-light);
    border: 2px solid var(--tang-gold);
    border-radius: 4px;
    padding: 0.8em 1em;
    font-size: 1em;
    font-family: 'STKaiti', 'KaiTi', serif;
    width: 100%;
    transition: all 0.3s ease;
}

.search-box:focus {
    outline: none;
    border-color: var(--tang-red);
    box-shadow: 0 0 10px rgba(200, 16, 46, 0.3);
}

/* 分页样式 - 唐代风格 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.6em 1.2em;
    background: var(--tang-cream-light);
    border: 2px solid var(--tang-gold);
    border-radius: 4px;
    color: var(--tang-ink);
    text-decoration: none;
    font-family: 'STKaiti', 'KaiTi', serif;
    font-size: 0.95em;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pagination-btn:hover {
    background: var(--tang-gold);
    color: var(--tang-red-dark);
    border-color: var(--tang-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pagination-btn-disabled {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.6em 1.2em;
    background: var(--tang-cream-dark);
    border: 2px solid var(--tang-cream-dark);
    border-radius: 4px;
    color: var(--tang-ink-light);
    font-family: 'STKaiti', 'KaiTi', serif;
    font-size: 0.95em;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5em;
    height: 2.5em;
    padding: 0 0.5em;
    background: var(--tang-cream-light);
    border: 2px solid var(--tang-gold);
    border-radius: 4px;
    color: var(--tang-ink);
    text-decoration: none;
    font-family: 'STKaiti', 'KaiTi', serif;
    font-size: 0.95em;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pagination-number:hover {
    background: var(--tang-gold);
    color: var(--tang-red-dark);
    border-color: var(--tang-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pagination-number-active {
    background: var(--tang-red);
    color: var(--tang-cream-light);
    border-color: var(--tang-red);
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(200, 16, 46, 0.3);
}

.pagination-number-active:hover {
    background: var(--tang-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(200, 16, 46, 0.4);
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5em;
    height: 2.5em;
    color: var(--tang-ink-light);
    font-family: 'STKaiti', 'KaiTi', serif;
    font-size: 0.95em;
}

/* 响应式设计 */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
        /* 移动端确保长标题可以换行 */
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
        padding: 0 0.5em;
    }
    
    h2 {
        font-size: 1.5em;
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
    }
    
    h3 {
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.3;
    }
    
    .article-card {
        padding: 1.5em;
    }
    
    /* 移动端分类卡片文本换行 */
    .article-card h3 a {
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        line-height: 1.4;
    }
    
    /* 移动端文章内容列表 padding 优化，防止内容溢出 */
    .article-content ul,
    .article-content ol {
        padding-left: 1em;
    }
    
    .article-content ul > li {
        padding-left: 1em;
    }
    
    .article-content ol > li {
        padding-left: 1.2em;
    }
    
    .article-content ul ul,
    .article-content ol ol,
    .article-content ul ol,
    .article-content ol ul {
        padding-left: 0.8em;
    }
    
    /* 移动端导航栏样式 */
    .navbar {
        padding: 0.75em 0;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }
    
    .navbar .container {
        padding: 0 15px;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 50px; /* 确保有足够的高度 */
    }
    
    .navbar-toggle {
        display: flex !important;
        right: 15px;
        padding: 0.55em 0.75em;
        min-width: 44px;
        min-height: 44px;
        /* 确保在移动端可见 */
        visibility: visible !important;
        opacity: 1 !important;
        /* 优化触摸体验 */
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 隐藏桌面端菜单，显示移动端菜单 */
    .navbar ul {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, var(--tang-blue-dark) 0%, var(--tang-blue) 100%);
        flex-direction: column;
        gap: 0;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                    padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 0.3s ease;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
        border-top: 2px solid rgba(212, 175, 55, 0.4);
        opacity: 0;
        z-index: 1000;
    }
    
    .navbar ul.active {
        max-height: 600px;
        padding: 0.75em 0;
        opacity: 1;
    }
    
    .navbar ul li {
        width: 100%;
        margin: 0;
        opacity: 0;
        transform: translateX(-20px);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }
    
    .navbar ul.active li {
        opacity: 1;
        transform: translateX(0);
    }
    
    /* 为每个菜单项添加延迟动画（展开时） */
    .navbar ul.active li:nth-child(1) { transition-delay: 0.05s; }
    .navbar ul.active li:nth-child(2) { transition-delay: 0.1s; }
    .navbar ul.active li:nth-child(3) { transition-delay: 0.15s; }
    .navbar ul.active li:nth-child(4) { transition-delay: 0.2s; }
    .navbar ul.active li:nth-child(5) { transition-delay: 0.25s; }
    .navbar ul.active li:nth-child(6) { transition-delay: 0.3s; }
    
    /* 关闭时的反向动画 */
    .navbar ul:not(.active) li {
        transition-delay: 0s;
    }
    
    .navbar ul li a {
        display: flex;
        align-items: center;
        padding: 1em 1.5em;
        text-align: left;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        font-size: 1.05em;
        font-weight: 500;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        /* 优化触摸目标 */
        min-height: 48px;
        -webkit-tap-highlight-color: rgba(212, 175, 55, 0.2);
        /* 改善触摸反馈 */
        user-select: none;
        -webkit-user-select: none;
        position: relative;
    }
    
    .navbar ul li:last-child a {
        border-bottom: none;
    }
    
    .navbar ul li a::after {
        display: none;
    }
    
    /* 移动端左侧装饰线 - 重置桌面端的 ::before 样式 */
    .navbar ul li a::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 0;
        background: var(--tang-gold);
        transition: width 0.3s ease;
        z-index: 1;
        transform: translateZ(0);
        /* 重置桌面端的居中定位和背景光晕效果 */
        border-radius: 0;
        opacity: 1;
        pointer-events: auto;
    }
    
    .navbar ul li a:hover,
    .navbar ul li a:active,
    .navbar ul li a:focus {
        background: rgba(255, 255, 255, 0.15);
        color: var(--tang-gold-light);
        padding-left: 2em;
        transform: translateX(5px);
        outline: none;
    }
    
    .navbar ul li a:hover::before,
    .navbar ul li a:active::before,
    .navbar ul li a:focus::before {
        width: 4px;
    }
    
    /* 添加点击波纹效果 */
    .navbar ul li a:active {
        background: rgba(255, 255, 255, 0.2);
        transform: translateX(3px) scale(0.98);
    }
    
    .container {
        padding: 0 15px;
    }
}

/* 小屏幕设备优化 */
@media (max-width: 480px) {
    /* 导航栏优化 */
    .navbar {
        padding: 0.7em 0;
    }
    
    .navbar .container {
        padding: 0 12px;
        min-height: 48px;
    }
    
    .navbar-toggle {
        right: 12px;
        padding: 0.5em 0.7em;
        min-width: 44px; /* 保持最小触摸目标 */
        min-height: 44px;
    }
    
    .navbar-toggle-icon {
        width: 22px;
        height: 18px;
    }
    
    .navbar-toggle-icon span {
        height: 2.5px;
    }
    
    .navbar ul {
        border-top-width: 2px;
    }
    
    .navbar ul.active {
        padding: 0.6em 0;
    }
    
    .navbar ul li a {
        padding: 0.9em 1.2em;
        font-size: 1em;
        min-height: 46px;
    }
    
    .navbar ul li a:hover,
    .navbar ul li a:active {
        padding-left: 1.8em;
        transform: translateX(3px);
    }
    
    /* 小屏幕文章内容列表 padding 进一步优化 */
    .article-content ul,
    .article-content ol {
        padding-left: 0.8em;
    }
    
    .article-content ul > li {
        padding-left: 0.8em;
    }
    
    .article-content ol > li {
        padding-left: 1em;
    }
    
    .article-content ul ul,
    .article-content ol ol,
    .article-content ul ol,
    .article-content ol ul {
        padding-left: 0.6em;
    }
    
    /* 标题优化 */
    h1 {
        font-size: 1.6em;
    }
    
    h2 {
        font-size: 1.3em;
    }
    
    .article-card {
        padding: 1.2em;
    }
    
    .container {
        padding: 0 12px;
    }
}

/* PC端特定优化 */
@media (min-width: 769px) {
    /* 确保移动端菜单按钮在PC端隐藏 */
    .navbar-toggle {
        display: none !important;
    }
    
    /* PC端导航栏优化 */
    .navbar {
        padding: 1.2em 0;
    }
    
    .navbar ul {
        display: flex !important;
        position: static !important;
        max-height: none !important;
        opacity: 1 !important;
        flex-direction: row !important;
        background: transparent !important;
        box-shadow: none !important;
        border-top: none !important;
        padding: 0 !important;
    }
    
    .navbar ul li {
        opacity: 1 !important;
        transform: none !important;
        width: auto !important;
    }
    
    .navbar ul li a {
        display: block !important;
        padding: 0.6em 1.2em !important;
        text-align: center !important;
        border-radius: 6px !important;
        border-bottom: none !important;
        font-size: 1.1em !important;
        font-weight: 500 !important;
        min-height: auto !important;
        transform: none !important;
    }
    
    .navbar ul li a::before {
        display: none !important;
    }
    
    .navbar ul li a::after {
        display: block !important;
    }
    
    /* PC端滚动条优化 */
    ::-webkit-scrollbar {
        width: 12px;
        height: 12px;
    }
    
    ::-webkit-scrollbar-track {
        background: var(--tang-cream-dark);
        border-radius: 6px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, var(--tang-gold) 0%, var(--tang-red) 100%);
        border-radius: 6px;
        border: 2px solid var(--tang-cream-dark);
        transition: background 0.3s ease;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, var(--tang-gold-light) 0%, var(--tang-red-light) 100%);
    }
    
    /* Firefox滚动条优化 */
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--tang-gold) var(--tang-cream-dark);
    }
    
    /* PC端选择文本样式 */
    ::selection {
        background: rgba(212, 175, 55, 0.3);
        color: var(--tang-ink-dark);
    }
    
    ::-moz-selection {
        background: rgba(212, 175, 55, 0.3);
        color: var(--tang-ink-dark);
    }
}

/* 大屏幕PC端优化 */
@media (min-width: 1200px) {
    .navbar {
        padding: 1.3em 0;
    }
    
    .navbar a {
        font-size: 1.15em;
        padding: 0.7em 1.4em;
    }
    
    .article-card {
        padding: 3em;
    }
}

/* 超大屏幕优化 */
@media (min-width: 1600px) {
    .navbar {
        padding: 1.5em 0;
    }
    
    .navbar a {
        font-size: 1.2em;
        padding: 0.8em 1.6em;
    }
    
    h1 {
        font-size: 3em;
    }
    
    h2 {
        font-size: 2.5em;
    }
    
    .article-card {
        padding: 3.5em;
    }
}

