/* 全局样式重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

*:before,
*:after {
  box-sizing: border-box;
}

/* 基础样式 */
html, body {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  transition: all 0.3s ease;
}

body {
  color: #333;
  background-color: #f5f7fa;
}

/* 深色模式 */
body.dark-mode {
  color: #e0e0e0;
  background-color: #1a1a1a;
}

/* 链接样式 */
a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #2980b9;
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
  margin: 1.5rem 0 1rem;
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

/* 段落样式 */
p {
  margin-bottom: 1rem;
}

/* 列表样式 */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

/* 代码样式 */
pre, code {
  font-family: 'Fira Code', 'Source Code Pro', monospace;
  background-color: #f1f1f1;
  border-radius: 4px;
}

body.dark-mode pre, body.dark-mode code {
  background-color: #2d2d2d;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

code {
  padding: 0.2rem 0.4rem;
  font-size: 0.9em;
}

/* 引用样式 */
blockquote {
  padding: 1rem;
  margin: 1rem 0;
  border-left: 4px solid #3498db;
  background-color: #f8f9fa;
  border-radius: 0 4px 4px 0;
}

body.dark-mode blockquote {
  background-color: #2d2d2d;
}

/* 表格样式 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

body.dark-mode th, body.dark-mode td {
  border-bottom-color: #444;
}

th {
  background-color: #f8f9fa;
  font-weight: 600;
}

body.dark-mode th {
  background-color: #2d2d2d;
}

/* 导航栏样式 */
.nav-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

body.dark-mode .nav-container {
  background-color: #2d2d2d;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nav-container .home-menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem 1rem;
}

.nav-container .home-menu .pure-menu-heading {
  display: flex;
  align-items: center;
  font-size: 1.4rem;
  font-weight: 600;
  color: #3498db;
  margin: 0;
}

.nav-container .home-menu .pure-menu-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-container .home-menu .pure-menu-item {
  margin-left: 1.2rem;
}

.nav-container .home-menu .pure-menu-link {
  color: inherit;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.5rem 0;
  transition: all 0.3s ease;
  position: relative;
  text-decoration: none;
}

.nav-container .home-menu .pure-menu-link:hover {
  color: #3498db;
}

.nav-container .home-menu .pure-menu-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #3498db;
  transition: width 0.3s ease;
}

.nav-container .home-menu .pure-menu-link:hover::after {
  width: 100%;
}

.nav-container .home-menu .pure-menu-item.actived .pure-menu-link {
  color: #3498db;
}

.nav-container .home-menu .pure-menu-item.actived .pure-menu-link::after {
  width: 100%;
}

/* 主容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 70px 2rem 0;
  min-height: calc(100vh - 70px);
}

/* 卡片样式 */
.card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

body.dark-mode .card {
  background-color: #2d2d2d;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 主页导航 */
.home-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.home-nav .category {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #3498db;
}

.home-nav .items {
  list-style: none;
  margin-left: 0;
}

.home-nav .items li {
  margin-bottom: 0.75rem;
}

.home-nav .items a {
  display: block;
  padding: 0.75rem 1rem;
  background-color: #f8f9fa;
  border-radius: 6px;
  transition: all 0.3s ease;
}

body.dark-mode .home-nav .items a {
  background-color: #2d2d2d;
}

.home-nav .items a:hover {
  background-color: #e3f2fd;
  transform: translateX(5px);
}

body.dark-mode .home-nav .items a:hover {
  background-color: #3a3a3a;
}

/* 最近文章 */
.recent-posts {
  margin-bottom: 2rem;
}

.recent-post-item {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

body.dark-mode .recent-post-item {
  background-color: #2d2d2d;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.recent-post-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.recent-post-item .title h2 {
  margin-top: 0;
  font-size: 1.5rem;
  transition: color 0.3s ease;
}

.recent-post-item .title:hover h2 {
  color: #3498db;
}

.recent-post-item .post-excerpt {
  color: #666;
  margin: 1rem 0;
}

body.dark-mode .recent-post-item .post-excerpt {
  color: #aaa;
}

.recent-post-item .post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: #999;
}

/* 标签样式 */
.tag-button {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background-color: #f1f1f1;
  border-radius: 20px;
  font-size: 0.85rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
}

body.dark-mode .tag-button {
  background-color: #3a3a3a;
}

.tag-button:hover {
  background-color: #e3f2fd;
  color: #3498db;
}

body.dark-mode .tag-button:hover {
  background-color: #4a4a4a;
}

/* 标签页面样式 */
.tag-page {
  padding: 2rem;
}

.tag-posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .tag-posts {
    grid-template-columns: 1fr;
  }
}

.tag-item {
  transition: all 0.3s ease;
}

.tag-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.tag-item-content {
  padding: 1.5rem;
}

.tag-item-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  transition: color 0.3s ease;
}

.tag-item-title:hover {
  color: #3498db;
}

.tag-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #666;
}

body.dark-mode .tag-item-meta {
  color: #aaa;
}

.tag-item-tags {
  margin-top: 0.5rem;
}

/* 归档页面样式 */
.archive-page {
  padding: 2rem;
}

.archive-year-section {
  margin-bottom: 3rem;
}

.archive-year-heading {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #3498db;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e3f2fd;
}

body.dark-mode .archive-year-heading {
  border-bottom-color: #3a3a3a;
}

/* 归档文章列表 */
.archive-posts-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 归档文章项 */
.archive-post-item {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  transition: all 0.3s ease;
  border-left: 4px solid #3498db;
}

body.dark-mode .archive-post-item {
  background-color: #2d2d2d;
  border-left-color: #2196f3;
}

.archive-post-item:hover {
  transform: translateX(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode .archive-post-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 归档文章链接 */
.archive-post-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* 归档文章内容 */
.archive-post-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* 归档文章元信息 */
.archive-post-meta {
  font-size: 0.9rem;
  color: #666;
}

body.dark-mode .archive-post-meta {
  color: #aaa;
}

/* 归档文章日期 */
.archive-post-date {
  font-size: 0.9rem;
  color: #3498db;
  font-weight: 500;
  white-space: nowrap;
}

body.dark-mode .archive-post-date {
  color: #64b5f6;
}

/* 归档文章标题 */
.archive-post-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  transition: color 0.3s ease;
  flex: 1;
  min-width: 200px;
}

.archive-post-link:hover .archive-post-title {
  color: #3498db;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .archive-post-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .archive-post-item {
    padding: 1.25rem;
  }
  
  .archive-year-heading {
    font-size: 1.5rem;
  }
  
  .archive-post-title {
    font-size: 1rem;
    min-width: 100%;
  }
}

/* 标签页面样式 */
.tags-page {
  padding: 2rem;
}

.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .tags-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

.tag-card {
  text-align: center;
  transition: all 0.3s ease;
}

.tag-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  background-color: #f8f9fa;
}

body.dark-mode .tag-card:hover {
  background-color: #3a3a3a;
}

.tag-card-content {
  padding: 2rem 1.5rem;
}

.tag-card-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

.tag-card:hover .tag-card-name {
  color: #3498db;
}

.tag-card-count {
  font-size: 0.9rem;
  color: #666;
}

body.dark-mode .tag-card-count {
  color: #aaa;
}

/* 分类页面样式 */
.categories-page {
  padding: 2rem;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

.category-card {
  text-align: center;
  transition: all 0.3s ease;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  background-color: #f8f9fa;
}

body.dark-mode .category-card:hover {
  background-color: #3a3a3a;
}

.category-card-content {
  padding: 2rem 1.5rem;
}

.category-card-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

.category-card:hover .category-card-name {
  color: #3498db;
}

.category-card-count {
  font-size: 0.9rem;
  color: #666;
}

body.dark-mode .category-card-count {
  color: #aaa;
}

/* 文章内容 */
.post {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 2rem;
  margin-bottom: 2rem;
}

body.dark-mode .post {
  background-color: #2d2d2d;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.post .post-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #eee;
}

body.dark-mode .post .post-header {
  border-bottom-color: #444;
}

.post .post-header .title {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

/* 文章元信息容器 */
.post-meta-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #666;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 0.5rem 1rem;
  background-color: #f8f9fa;
  border-radius: 20px;
  transition: all 0.3s ease;
}

body.dark-mode .post-meta-container {
  color: #aaa;
  background-color: #3a3a3a;
}

/* 容器悬停效果 */
.post-meta-container:hover {
  background-color: #e3f2fd;
  transform: translateY(-2px);
}

body.dark-mode .post-meta-container:hover {
  background-color: #4a4a4a;
}

/* 元信息内容 */
.post-meta-content {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
}

/* 日期部分 */
.post-meta-date {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9rem;
  line-height: 1;
}

/* 标签部分 */
.post-meta-tags {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9rem;
  line-height: 1;
}

/* 元信息分隔符 */
.post-meta-separator {
  color: #999;
  margin: 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1;
  display: flex;
  align-items: baseline;
}

body.dark-mode .post-meta-separator {
  color: #666;
}

/* 图标样式 */
.post-meta-date i,
.post-meta-tags i {
  font-size: 0.9rem;
  color: #3498db;
  line-height: 1;
  display: flex;
  align-items: baseline;
}

/* 标签列表 */
.article-tag-list {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}

/* 标签项 */
.article-tag-list-item {
  font-size: 0.9rem;
  line-height: 1;
  display: flex;
  align-items: baseline;
}

/* 标签链接 */
.article-tag-list-item a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
  font-size: 0.9rem;
  line-height: 1;
  display: flex;
  align-items: baseline;
}

.article-tag-list-item a:hover {
  color: #3498db;
}

body.dark-mode .article-tag-list-item a {
  color: inherit;
}

body.dark-mode .article-tag-list-item a:hover {
  color: #64b5f6;
}

/* 标签样式 */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.article-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.article-tag-list-item {
  font-size: 0.9rem;
  margin-right: 0.5rem;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  height: 24px;
  vertical-align: middle;
}

.article-tag-list-item a {
  color: inherit;
  text-decoration: none;
  transition: all 0.3s ease;
}

.article-tag-list-item a:hover {
  color: #3498db;
}

body.dark-mode .article-tag-list-item a {
  color: inherit;
}

body.dark-mode .article-tag-list-item a:hover {
  color: #64b5f6;
}

.post .post-content {
  line-height: 1.8;
}

.post .post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 分页样式 */
.page-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2rem 0;
}

.page-nav .page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 0 0.5rem;
  transition: all 0.3s ease;
}

.page-nav .page-number:hover {
  background-color: #f1f1f1;
  color: #3498db;
}

body.dark-mode .page-nav .page-number:hover {
  background-color: #3a3a3a;
}

.page-nav .page-number.current {
  background-color: #3498db;
  color: #fff;
}

/* 页脚样式 */
footer {
  background-color: #f5f7fa;
  border-top: 1px solid #eee;
  padding: 1rem;
  text-align: center;
  margin-top: 0;
  box-shadow: none;
}

body.dark-mode footer {
  background-color: #1a1a1a;
  border-top-color: #444;
  box-shadow: none;
}

footer .bottom-item {
  margin: 0 0.5rem;
  color: #666;
  transition: color 0.3s ease;
}

body.dark-mode footer .bottom-item {
  color: #aaa;
}

footer .bottom-item:hover {
  color: #3498db;
}

/* 深色模式切换按钮 */
.theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #3498db;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 999;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-container .home-menu {
    padding: 1rem;
  }
  
  .nav-container .home-menu .pure-menu-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .nav-container .home-menu .pure-menu-item {
    margin-left: 0.5rem;
  }
  
  .nav-container .home-menu .pure-menu-link {
    font-size: 0.9rem;
    padding: 0.3rem 0;
  }
  
  .container {
    padding: 70px 1rem 1rem;
  }
  
  .home-nav {
    grid-template-columns: 1fr;
  }
  
  .post,
  .card {
    padding: 1.5rem;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease forwards;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

body.dark-mode ::-webkit-scrollbar-track {
  background: #2d2d2d;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
  transition: background 0.3s ease;
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: #555;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* 选择文本样式 */
::selection {
  background-color: #3498db;
  color: #fff;
}

body.dark-mode ::selection {
  background-color: #2980b9;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(52, 152, 219, 0.3);
  border-radius: 50%;
  border-top-color: #3498db;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}