/* ========================================
   基础变量和重置
   ======================================== */
:root {
  /* 主色调 */
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #dbeafe;
  
  /* 文字颜色 */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  
  /* 背景颜色 */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  
  /* 边框颜色 */
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* 间距 */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", Monaco, Inconsolata, "Fira Code", monospace;
  
  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  
  /* 头部高度 */
  --header-height: 64px;
}

/* 暗色主题 */
[data-theme="dark"] {
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  
  --border-color: #374151;
  --border-light: #4b5563;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* 重置样式 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Smooth Scroll & Offset for Fixed Header */
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height); /* For modern browsers */
}

h1, h2, h3, h4, h5, h6 {
  scroll-margin-top: 66px; /* Offset for anchor links */
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

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

img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   头部导航
   ======================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-container {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.site-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.site-logo:hover {
  color: var(--primary-color);
}

/* 导航菜单 */
.site-nav {
  display: flex;
  align-items: center;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--space-xl);
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: var(--space-sm) 0;
  position: relative;
}

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

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
}

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

/* 移动端菜单按钮 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  transition: var(--transition-normal);
}

/* 工具栏 */
.header-tools {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background-color: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tool-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--primary-color);
}

/* 主题切换图标 */
.theme-toggle .moon-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: block;
}

/* ========================================
   搜索框
   ======================================== */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}

.search-overlay.active {
  display: flex;
}

.search-container {
  width: 90%;
  max-width: 600px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-box {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.search-close:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-md);
}

.search-result-item {
  display: block;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.search-result-item:hover {
  background-color: var(--bg-tertiary);
}

.search-result-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.search-result-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ========================================
   主内容区
   ======================================== */
.main-content {
  min-height: calc(100vh - var(--header-height) - 200px);
  padding-top: var(--header-height);
}

/* ========================================
   首页布局
   ======================================== */
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-2xl);
}

/* 欢迎区域 */
.hero-section {
  text-align: center;
  padding: var(--space-2xl) 0;
  margin-bottom: var(--space-2xl);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* 文章列表 */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-color);
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* 文章卡片 */
.post-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.post-card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

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

.post-card-content {
  padding: var(--space-lg);
}

.post-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

.post-card-title a {
  color: var(--text-primary);
}

.post-card-title a:hover {
  color: var(--primary-color);
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.post-card-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.icon {
  flex-shrink: 0;
}

.post-card-excerpt {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.tag {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

[data-theme="dark"] .tag {
  background-color: rgba(59, 130, 246, 0.2);
}

.view-more {
  text-align: center;
  margin-top: var(--space-2xl);
}

.btn {
  display: inline-block;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

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

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

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
  color: white;
}

/* Modal System */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  display: flex;
}

.modal-content {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.modal-footer button {
  flex: 1;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
  background-color: var(--bg-primary);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}

/* ========================================
   侧边栏
   ======================================== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.widget {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

/* 作者组件 */
.author-widget {
  text-align: center;
}

.author-avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto var(--space-md);
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary-light);
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.author-bio {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.author-social {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
}

.author-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.author-social a:hover {
  background-color: var(--primary-color);
  color: white;
}

/* 统计组件 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* 标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.tag-item {
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.tag-item:hover {
  background-color: var(--primary-color);
  color: white;
}

/* ========================================
   文章详情页
   ======================================== */
.post-container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

.post-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.post-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: var(--space-lg);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-lg);
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
}

.post-cover {
  width: 100%;
  height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-2xl);
}

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

/* 目录 */
.toc-container {
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.toc-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.toc-nav ul {
  list-style: none;
}

.toc-nav li {
  margin-bottom: var(--space-sm);
}

.toc-nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.toc-nav a:hover {
  color: var(--primary-color);
}

/* 文章内容 */
.post-content {
  font-size: 1.0625rem;
  line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  font-weight: 700;
  line-height: 1.3;
}

.post-content h2 {
  font-size: 1.75rem;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.post-content h3 {
  font-size: 1.375rem;
}

.post-content p {
  margin-bottom: var(--space-lg);
}

.post-content a {
  color: var(--primary-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content ul,
.post-content ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
}

.post-content li {
  margin-bottom: var(--space-sm);
}

.post-content blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: var(--space-lg);
  margin: var(--space-xl) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.post-content pre {
  background-color: #1f2937;
  color: #f9fafb;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-lg);
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.post-content img {
  border-radius: var(--radius-md);
  margin: var(--space-xl) 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-lg);
}

.post-content th,
.post-content td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-color);
  text-align: left;
}

.post-content th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
}

/* 文章底部 */
.post-footer {
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border-color);
}

.post-share {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.share-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* 上一篇/下一篇 */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.post-nav-prev,
.post-nav-next {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.post-nav-next {
  text-align: right;
  align-items: flex-end;
}

.post-nav-prev:hover,
.post-nav-next:hover {
  background-color: var(--border-color);
}

.post-nav-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.post-nav-title {
  font-weight: 600;
  color: var(--text-primary);
}

/* 相关文章 */
.related-posts {
  margin-bottom: var(--space-xl);
}

.related-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.related-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.related-item:hover {
  background-color: var(--border-color);
}

.related-item-title {
  font-weight: 500;
  color: var(--text-primary);
}

.related-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 评论区 */
.comments-section {
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border-color);
}

.comments-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

/* 本地评论系统 */
.local-comments-system {
  margin-top: var(--space-lg);
}

.comment-admin-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.comment-form {
  margin-top: var(--space-lg);
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 评论项动画 */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* ========================================
   页脚
   ======================================== */
.site-footer {
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: var(--space-2xl) 0;
  margin-top: var(--space-2xl);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.footer-copyright p {
  margin-bottom: var(--space-xs);
}

.footer-social {
  display: flex;
  gap: var(--space-md);
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.footer-social a:hover {
  background-color: var(--primary-color);
  color: white;
}

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
  z-index: 100;
}

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

.back-to-top:hover {
  background-color: var(--primary-hover);
  transform: translateY(-4px);
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
  .home-container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    order: -1;
  }
  
  .author-widget {
    display: flex;
    align-items: center;
    text-align: left;
    gap: var(--space-lg);
  }
  
  .author-avatar {
    margin: 0;
    flex-shrink: 0;
  }
  
  .author-info {
    flex: 1;
  }
  
  .author-social {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }
  
  .nav-toggle {
    display: flex;
  }
  
  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    flex-direction: column;
    padding: var(--space-lg);
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
  }
  
  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-item {
    border-bottom: 1px solid var(--border-light);
  }
  
  .nav-item:last-child {
    border-bottom: none;
  }
  
  .nav-link {
    display: block;
    padding: var(--space-md) 0;
  }
  
  .nav-link::after {
    display: none;
  }

  .header-tools {
    margin-right: 3rem; /* Make space for hamburger */
  }

  .nav-toggle {
    z-index: 1100; /* Above nav-menu */
  }
  
  .hero-title {
    font-size: 1.875rem;
  }
  
  .post-title {
    font-size: 1.5rem;
  }
  
  .post-cover {
    height: 200px;
  }
  
  .post-nav {
    grid-template-columns: 1fr;
  }
  
  .post-nav-next {
    text-align: left;
    align-items: flex-start;
  }
  
  .footer-container {
    flex-direction: column;
    gap: var(--space-lg);
    text-align: center;
  }
  
  .back-to-top {
    width: 40px;
    height: 40px;
    bottom: 20px;
    right: 20px;
  }
}

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

.post-card {
  animation: fadeIn 0.5s ease forwards;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }

/* ========================================
   Custom Visual Improvements
   ======================================== */

/* Hero Section Enhancement */
.hero-section {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 4rem 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
  opacity: 0.1;
  z-index: 0;
  animation: rotate 20s linear infinite;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(120deg, var(--primary-color), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  z-index: 1;
}

.hero-description {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

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

/* Card Hover Effects */
.post-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.post-card-image img {
  transition: transform 0.5s ease;
}

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

/* TOC Styling */
.toc-container {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

/* Sticky TOC for Desktop */
@media (min-width: 1025px) {
  .post-container {
    display: grid;
    grid-template-columns: 250px 1fr; /* Changed: TOC on left (250px), Content on right */
    gap: 3rem; /* Increased gap for better separation */
    align-items: start;
    position: relative;
    max-width: 1200px; /* Increased max-width to accommodate sidebar without squeezing content */
  }

  .post-header, .post-cover, .post-footer, .comments-section {
    grid-column: 2 / 3; /* Content area */
  }

  .post-content {
    grid-column: 2 / 3;
    min-width: 0; /* Prevent overflow */
  }

  .toc-container.sticky-toc {
    grid-column: 1 / 2; /* Left column */
    grid-row: 1 / 10; /* Span across multiple rows if needed */
    position: sticky;
    top: calc(var(--header-height) + 40px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    margin-bottom: 0;
    margin-right: 0;
    border: none; /* Remove border for cleaner look on side */
    box-shadow: none; /* Remove shadow for cleaner look */
    background: transparent; /* Transparent background */
    padding: 0; /* Remove padding */
  }
  
  .toc-container.sticky-toc .toc-title {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: none;
    margin-bottom: 1rem;
  }
  
  .toc-nav ul {
    border-left: 2px solid var(--border-color);
    padding-left: 0;
  }
  
  .toc-nav ul ul {
    border-left: none;
    padding-left: 1rem;
  }
  
  .toc-link {
    padding: 0.4rem 0 0.4rem 1rem;
    margin-left: -2px; /* Overlap border */
    border-left: 2px solid transparent;
    color: var(--text-secondary);
  }
  
  .toc-link:hover {
    color: var(--primary-color);
    border-left-color: var(--primary-light);
    transform: none;
  }
  
  .toc-link.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, transparent 100%);
  }
}

/* Hide TOC on smaller screens or style differently */
@media (max-width: 1024px) {
  .toc-container.sticky-toc {
    position: static;
    margin-bottom: 2rem;
    max-height: none;
  }
}

.toc-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-light);
  color: var(--text-primary);
}

.toc-nav ul {
  list-style: none;
  padding-left: 0;
}

.toc-nav ul ul {
  padding-left: 1.25rem;
  margin-top: 0.25rem;
  border-left: 1px solid var(--border-color);
}

.toc-nav li {
  margin-bottom: 0.5rem;
}

.toc-link {
  display: block;
  color: var(--text-secondary);
  font-size: 0.95rem;
  padding: 0.25rem 0;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
}

.toc-link:hover {
  color: var(--primary-color);
  transform: translateX(4px);
}

.toc-link.active {
  color: var(--primary-color);
  font-weight: 600;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Category & Tag Pills */
.post-category, .tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.post-category {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.post-category:hover {
  background-color: var(--primary-color);
  color: white;
}

.tag {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

.tag:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

/* Code Blocks */
pre {
  background: #1e1e1e !important;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

code {
  font-family: var(--font-mono);
}
