/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 根元素样式 */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  font-weight: 400;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* 亮色主题变量 */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --border-color: #e5e7eb;
  --accent-color: #d97706;
  --accent-hover: #b45309;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* 暗色主题变量 */
.dark {
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --border-color: #374151;
  --accent-color: #fbbf24;
  --accent-hover: #f59e0b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

/* 全局样式 */
body {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: background-color 0.3s, color 0.3s;
}

/* 容器样式 */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* 通用间距工具类 */
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }

/* 通用布局工具类 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.text-center { text-align: center; }
.flex-grow { flex-grow: 1; }

/* 通用文本样式 */
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* 通用颜色工具类 */
.text-gray-500 { color: var(--text-secondary); }
.text-gray-600 { color: var(--text-secondary); }
.text-gray-700 { color: var(--text-primary); }
.text-gray-800 { color: var(--text-primary); }
.text-gray-900 { color: var(--text-primary); }
.text-amber-600 { color: var(--accent-color); }
.text-amber-500 { color: var(--accent-color); }
.bg-white { background-color: var(--bg-primary); }
.bg-gray-50 { background-color: var(--bg-secondary); }
.bg-gray-800 { background-color: var(--bg-secondary); }
.bg-gray-900 { background-color: var(--bg-primary); }
.bg-amber-600 { background-color: var(--accent-color); }
.border-gray-200 { border-color: var(--border-color); }
.border-gray-700 { border-color: var(--border-color); }
.border-gray-800 { border-color: var(--border-color); }

/* 链接样式 */
a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* 卡片样式 */
.card {
  background-color: var(--bg-primary);
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: box-shadow 0.3s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* 按钮样式 */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* 图片样式 */
img {
  max-width: 100%;
  height: auto;
  transition: transform 0.7s;
}

img:hover {
  transform: scale(1.1);
}

/* 导航栏样式 */
#navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background-color: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s;
}

.dark #navbar {
  background-color: rgba(17, 24, 39, 0.8);
}

/* 博客头部样式 */
.blog-header {
  padding: 4rem 1rem;
  text-align: center;
  transition: all 0.5s;
  background: linear-gradient(to bottom, #fffbeb, #f9fafb);
}

.dark .blog-header {
  background: linear-gradient(to bottom, #1f2937, #111827);
}

.blog-header.scrolled {
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  padding: 2rem 1rem;
  box-shadow: var(--shadow-sm);
}

.dark .blog-header.scrolled {
  background-color: rgba(17, 24, 39, 0.8);
}

/* 渐变文本 */
.gradient-text {
  background: linear-gradient(to right, var(--accent-color), #b91c1c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 网格布局 */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.gap-8 {
  gap: 2rem;
}

/* 文章样式 */
.article-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

.article-content p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* 标签样式 */
.tag {
  display: inline-block;
  background-color: var(--accent-color);
  color: white;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

/* 图片容器 */
.img-container {
  position: relative;
  height: 14rem;
  overflow: hidden;
}

.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 文章详情图片容器 */
.article-img-container {
  position: relative;
  height: 16rem;
  overflow: hidden;
}

@media (min-width: 768px) {
  .article-img-container {
    height: 20rem;
  }
}

.article-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 图片遮罩 */
.img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  display: flex;
  align-items: flex-end;
}

/* 响应式断点 */
@media (min-width: 768px) {
  .md\\:flex-row {
    flex-direction: row;
  }
  
  .md\\:hidden {
    display: none;
  }
  
  .md\\:inline-block {
    display: inline-block;
  }
  
  .md\\:text-3xl {
    font-size: 1.875rem;
  }
  
  .md\\:text-5xl {
    font-size: 3rem;
  }
  
  .md\\:py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  .md\\:py-24 {
    padding-top: 6rem;
    padding-bottom: 6rem;
  }
  
  .md\\:px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  .md\\:mb-0 {
    margin-bottom: 0;
  }
  
  .md\\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .lg\\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 行高限制 */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 过渡效果 */
.transition-colors {
  transition: color 0.3s, background-color 0.3s, border-color 0.3s;
}

.transition-transform {
  transition: transform 0.3s;
}

/* 圆角 */
.rounded-full {
  border-radius: 9999px;
}

.rounded-2xl {
  border-radius: 1rem;
}

/* 阴影 */
.shadow-lg {
  box-shadow: var(--shadow-lg);
}

/* 分割线 */
.border-t {
  border-top: 1px solid var(--border-color);
}

/* 显示/隐藏 */
.hidden {
  display: none;
}

.inline {
  display: inline;
}

/* 最小高度 */
.min-h-screen {
  min-height: 100vh;
}