/* 基础重置与变量 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #D4AF37;       /* 主色（金色） */
    --primary-dark: #B8860B;  /* 主色深 */
    --primary-light: #F0E68C; /* 主色浅 */
    --secondary: #4A4A4A;     /* 次要色 */
    --dark: #0A0A0A;          /* 深色（暗黑模式背景） */
    --darker: #050505;        /* 更深色 */
    --light: #F5F5F5;         /* 浅色（亮色模式背景） */
    --gray: #666666;          /* 中灰 */
    --light-gray: #333333;    /* 浅灰（卡片背景暗） */
    --border: #222222;        /* 边框色 */
    --card-bg: #121212;       /* 卡片背景（暗黑） */
    --body-bg: #0A0A0A;       /* 主体背景（暗黑） */
    --text-color: #F5F5F5;    /* 文字颜色（暗黑） */
    --navbar-bg: rgba(10, 10, 10, 0.95); /* 导航栏背景 */
    --footer-bg: #050505;     /* 页脚背景 */
    --glow: 0 0 15px var(--primary); /* 发光效果 */
    --glow-soft: 0 0 5px rgba(212, 175, 55, 0.3); /* 柔和发光 */
    --transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* 自定义缓动 */
}

[data-theme="light"] {
    --primary: #D4AF37;
    --primary-dark: #B8860B;
    --primary-light: #F0E68C;
    --secondary: #F0F0F0;
    --dark: #FFFFFF;
    --darker: #F5F5F5;
    --light: #333333;
    --gray: #666666;
    --light-gray: #EEEEEE;
    --border: #DDDDDD;
    --card-bg: #FFFFFF;
    --body-bg: #F9F9F9;
    --text-color: #333333;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --footer-bg: #FFFFFF;
    --glow: 0 0 15px var(--primary);
    --glow-soft: 0 0 5px rgba(212, 175, 55, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--body-bg);
    color: var(--text-color);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden; /* 防止横向滚动 */
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
    text-decoration: none;
}

.btn {
    display: inline-block;
    padding: 10px 25px;
    border-radius: 50px;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid var(--primary);
    font-weight: 600;
    background: transparent;
    color: var(--primary);
    will-change: transform;
}

.btn-primary {
    background: var(--primary);
    color: var(--dark);
}

.btn:hover {
    box-shadow: var(--glow-soft);
    transform: translateY(-2px);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 30px;
}

/* 导航栏 */
.navbar {
    background: var(--navbar-bg);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.navbar-brand {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 25px;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-color);
    padding: 8px 0;
    font-size: 1rem;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.theme-toggle {
    background: var(--light-gray);
    border: none;
    width: 50px;
    height: 26px;
    border-radius: 50px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 5px;
    transition: var(--transition);
}

.theme-toggle i {
    font-size: 14px;
    transition: transform 0.3s ease;
    position: absolute;
    color: var(--text-color);
}

.theme-toggle .fa-sun {
    left: 5px;
}

.theme-toggle .fa-moon {
    right: 5px;
}

.theme-toggle.active .fa-sun {
    transform: translateX(24px);
}

.theme-toggle.active .fa-moon {
    transform: translateX(-24px);
}

/* 特色文章容器 */
.featured-container {
    display: flex; /* Flex 布局强制居中 */
    justify-content: center; /* 子元素水平居中 */
    align-items: flex-start; /* 子元素顶部对齐 */
    max-width: 1200px; /* 最大宽度限制 */
    margin: 0 auto; /* 父容器在 <main> 中居中 */
    padding: 0 20px; /* 左右内边距 */
}

/* 特色文章主体 */
.featured-post {
    display: grid; /* 改为 Grid 布局 */
    grid-template-rows: 1fr auto; /* 图片占满剩余空间，内容自适应 */
    width: 100%;
    max-width: 1200px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin: 0 auto;
}

.featured-image {
    width: 100%;
    height: 100%; /* 占满 Grid 行空间 */
    object-fit: cover;
}

/* 特色文章图片 */
.featured-post img {
    height: 100%; /* 填满容器高度 */
    object-fit: cover; /* 裁剪填充 */
    object-position: center center; /* 图片中心对齐 */
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 内容区域（保持原有样式，调整定位） */
.featured-content {
    gap: 30px;
    display: flex;
    width: 100%; /* 占满容器宽度 */
    flex-direction: row; /* 子元素水平排列 */
    align-items: center; /* 垂直居中对齐 */
    padding: 10px; /* 内边距 */
    z-index: 2; /* 确保内容在图片上方 */
    transform: translateZ(30px); /* 3D 效果 */
    max-width: 800px; /* 内容最大宽度 */
    border-radius: 0 0 15px 15px; /* 底部圆角 */
    flex-grow: 1; /* 新增：占据剩余空间 */
    justify-content: flex-end; /* 内容底部对齐（可选） */
}

.featured-meta {
    display: flex;
    gap: 30px;
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #FFD700;
}

.featured-title {
    color: #FFFFFF;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-color);
    background: linear-gradient(45deg, #D4AF37, #FFA500);
    -webkit-background-clip: text;
    background-clip: text;
    margin: 0; /* 移除默认的margin，避免布局偏移 */
    flex-shrink: 1; /* 允许标题缩小以适应空间 */
    min-width: 0; /* 防止内容过长导致溢出 */
}

/* 文章分类和热点文章（严格保留原始框架结构） */
.main-content {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

/* 文章列表区域 */
.post-list-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--card-shadow);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.post-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--light-gray);
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.post-image {
    height: 300px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-card:hover .post-image img {
    transform: scale(1.05);
}

.post-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 15px;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-color);
}

.post-excerpt {
    color: var(--light);
    margin-bottom: 20px;
    flex-grow: 1;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.read-more {
    background: var(--primary);
    color: var(--dark);
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.post-views {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--gray);
    font-size: 0.85rem;
}

/* 侧边栏 */
.sidebar {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--card-shadow);
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-gray);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
}

/* 文章分类 */
.category-list {
    list-style: none;
}

.category-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--light-gray);
    transition: var(--transition);
}

.category-item:last-child {
    border-bottom: none;
}

.category-link {
    display: flex;
    justify-content: space-between;
    color: var(--text-color);
    transition: var(--transition);
    font-weight: 500;
}

.category-link:hover {
    color: var(--primary);
}

.category-count {
    background: var(--light-gray);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* 热点文章 */
.popular-post {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--light-gray);
}

.popular-post:last-child {
    border-bottom: none;
}

.popular-image {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.popular-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popular-content {
    flex-grow: 1;
}

.popular-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.4;
}

.popular-meta {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--gray);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
}

.page-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    color: var(--text-color);
    font-weight: 600;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border: 1px solid var(--light-gray);
}

.page-link:hover, .page-link.active {
    background: var(--primary);
    color: var(--dark);
    border-color: var(--primary);
}

/* 文章网格布局 - 3列 */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .featured-post {
        width: 100%;
        aspect-ratio: 16/9;
    }
    .featured-content {
        padding: 25px;
    }
    .featured-title {
        font-size: 2rem;
    }
    .featured-image {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .featured-post {
        height: 100px;
    }
    .featured-content {
        padding: 20px;
    }
    .featured-title {
        font-size: 1.8rem;
    }
    .featured-meta {
        flex-direction: column;
        gap: 8px;
    }
}

@media (max-width: 576px) {
    .featured-post {
        height: 350px;
    }
    .featured-content {
        padding: 15px;
    }
    .featured-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
}

/* 确保所有卡片高度一致 */
.post-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 调整文章图片高度 */
.post-image {
    height: 200px;
}


/* 页脚 */
.footer {
    background: var(--footer-bg);
    color: var(--light);
    padding: 60px 0 30px;
    margin-top: 60px;
    position: relative;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 15px;
    color: var(--text-color);
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--gray);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-links a i {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

.footer-about p {
    color: var(--light);
    line-height: 1.8;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.footer-social {
    display: flex;
    gap: 15px;
}

.hidden { display: none; }
.error-message {
    padding: 2rem;
    text-align: center;
    color: var(--primary);
    border: 2px dashed var(--primary);
    border-radius: 15px;
}
.copyright {
    text-align: center;
    padding-top: 30px;
    margin-top: 50px;
    border-top: 1px solid rgba(245, 245, 245, 0.1);
    color: var(--gray);
    font-size: 0.9rem;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--card-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary), #FFA500);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(var(--primary-dark), #FF8C00);
}

/* 粒子背景专用样式（新增，不影响原有框架） */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* 置于所有内容下方 */
    pointer-events: none; /* 不阻挡用户交互 */
}

#particles-canvas {
    width: 100%;
    height: 100%;
}