/* 全局样式重置：清除默认内外边距，统一盒模型 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 弹性布局容器：让页面自适应高度，底部固定在页面底部 */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 头部样式：深色背景，白色文字，居中对齐 */
header {
    background-color: #333;
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin-bottom: 0.5rem;
}

/* 导航栏容器样式：顶部间距 */
nav {
    margin-top: 1rem;
}

/* 导航列表样式：横向排列，居中对齐，清除列表默认样式，支持换行 */
nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
}

/* 导航列表项样式：横向间距 */
nav ul li {
    margin: 0 1rem;
}

/* 导航链接基础样式：白色文字，无下划线，内边距，背景过渡效果，圆角 */
nav ul li a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    transition: background-color 0.3s; /* 鼠标悬浮时背景色过渡，更平滑 */
    border-radius: 4px;
}

/* 导航链接鼠标悬浮样式：深色背景（非当前页） */
nav ul li a:hover {
    background-color: #555;
}

/* ———— 新增：当前页面导航高亮样式 ———— */
/* 作用：给当前所在页面的导航链接添加特殊样式，让用户明确位置 */
nav ul li a.active {
    background-color: #0066cc; /* 高亮背景色（与侧边栏标题下划线颜色一致，保持风格统一） */
    color: white; /* 文字颜色（保持白色，确保可读性） */
    font-weight: bold; /* 可选：文字加粗，进一步突出 */
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.3); /* 可选：添加淡蓝色阴影，增强视觉层次 */
}

/* ———— 新增：当前页面导航 hover 样式（可选，避免高亮后 hover 效果冲突） ———— */
nav ul li a.active:hover {
    background-color: #004c99; /* 高亮状态下 hover，背景色加深一点，保持交互反馈 */
}

/* 主要内容区域：弹性布局，占满剩余高度，固定最大宽度，居中对齐，内边距和间距 */
main {
    flex: 1;
    display: flex;
    padding: 2rem;
    gap: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* 博客文章列表：占比 3（主内容），纵向排列，文章间距 */
.blog-posts {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 单篇文章样式：白色背景，内边距，圆角，阴影，hover 效果 */
.post {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s; /*  hover 时的位移和阴影过渡 */
}

.post:hover {
    transform: translateY(-5px); /* 轻微上移 */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); /* 阴影加深 */
}

/* 文章头部：底部间距 */
.post-header {
    margin-bottom: 1rem;
}

/* 文章标题：深色文字，无下划线，字体大小，底部间距，块级显示 */
.post-title {
    color: #333;
    text-decoration: none;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.post-title:hover {
    color: #0066cc; /* hover 时变蓝色，与导航高亮色一致 */
}

/* 文章元信息：灰色文字，小号字体 */
.post-meta {
    color: #666;
    font-size: 0.9rem;
}

/* 文章摘要：底部间距 */
.post-excerpt {
    margin-bottom: 1rem;
}

/* 阅读更多按钮：蓝色文字，加粗，无下划线，颜色过渡 */
.read-more {
    color: #0066cc;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}

.read-more:hover {
    color: #004c99; /* hover 时颜色加深 */
    text-decoration: underline; /*  hover 时下划线，明确可点击 */
}

/* 侧边栏：占比 1（辅助内容），纵向排列，区块间距 */
aside {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 侧边栏区块：白色背景，内边距，圆角，阴影 */
.sidebar-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 侧边栏标题：字体大小，底部间距，底部蓝色下划线 */
.sidebar-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #0066cc;
}

/* 关于我区块：文字居中 */
.about-me {
    text-align: center;
}

/* 博主头像：固定大小，圆形，底部间距 */
.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 1rem;
}

/* 社交链接容器：横向排列，居中对齐，间距 */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* 社交链接图标：灰色文字，字体大小，颜色过渡 */
.social-icon {
    color: #666;
    font-size: 1.5rem;
    transition: color 0.3s;
}

.social-icon:hover {
    color: #0066cc; /* hover 时变蓝色 */
}

/* 分类列表和最新文章列表：清除默认列表样式 */
.categories-list,
.recent-posts-list {
    list-style: none;
}

/* 列表项：底部间距 */
.categories-list li,
.recent-posts-list li {
    margin-bottom: 0.5rem;
}

/* 列表链接：深色文字，无下划线，颜色过渡 */
.categories-list a,
.recent-posts-list a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

/* 列表链接 hover：变蓝色，左侧内边距（轻微位移，增强交互） */
.categories-list a:hover,
.recent-posts-list a:hover {
    color: #0066cc;
    padding-left: 5px;
}

/* 标签云：弹性换行，间距 */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 单个标签：浅灰背景，内边距，圆角，无下划线，灰色文字，全属性过渡 */
.tag {
    background-color: #f0f0f0;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.tag:hover {
    background-color: #0066cc; /* hover 时蓝色背景 */
    color: white; /* hover 时白色文字 */
}

/* 底部样式：深色背景，白色文字，居中对齐，内边距，顶部间距 */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

/* 底部内容容器：固定最大宽度，居中对齐，纵向排列，子元素居中 */
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 版权信息：顶部间距，小号字体，浅灰色文字 */
.copyright {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #999;
}

/* 响应式设计：屏幕宽度 ≤768px 时生效 */
@media (max-width: 768px) {
    main {
        flex-direction: column; /* 主要内容改为纵向排列（文章在上，侧边栏在下） */
        padding: 1rem; /* 减小内边距 */
    }

    nav ul {
        flex-direction: column; /* 导航改为纵向排列 */
        align-items: center; /* 导航项居中 */
    }

    nav ul li {
        margin: 0.5rem 0; /* 纵向间距，取消横向间距 */
    }

    .blog-posts,
    aside {
        flex: 1; /* 取消主次占比，各占满宽度 */
    }
}