/* ===== 基础变量 ===== */
:root {
  --bg: #fafbfc;
  --card-bg: #fff;
  --text: #2d3436;
  --text-light: #636e72;
  --primary: #0984e3;
  --primary-dark: #0767b3;
  --accent: #6c5ce7;
  --border: #e9ecef;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 8px;
  --radius-sm: 4px;
  --code-bg: #f4f6f8;
  --tag-bg: #e8f4fd;
  --tag-color: #0767b3;
  --max-width: 780px;
  --header-height: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

/* ===== Header ===== */
.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  padding-top: 20px;
  padding-bottom: 16px;
}
.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-right: 16px;
}
.site-title a {
  color: var(--text);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.site-subtitle {
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 400;
  margin-right: auto;
}
.site-nav {
  display: flex;
  gap: 4px;
  margin-top: 12px;
  width: 100%;
}
.site-nav a {
  color: var(--text-light);
  font-size: 0.88rem;
  padding: 6px 16px;
  border-radius: 20px;
  transition: all 0.2s;
}
.site-nav a:hover {
  color: var(--primary);
  background: var(--tag-bg);
  text-decoration: none;
}

/* ===== Post Card ===== */
.post-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin: 20px 0;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid var(--border);
}
.post-item:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.post-item .post-title {
  font-size: 1.25rem;
  margin-bottom: 8px;
  line-height: 1.4;
}
.post-item .post-title a { color: var(--text); }
.post-item .post-title a:hover { color: var(--primary); text-decoration: none; }
.post-meta {
  color: var(--text-light);
  font-size: 0.82rem;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.post-meta .post-category a {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-color);
  padding: 1px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  transition: all 0.2s;
}
.post-meta .post-category a:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}
.post-excerpt {
  margin-top: 12px;
  color: var(--text-light);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* ===== 首页标题与间距 ===== */
.site-main { padding: 32px 0; }

/* ===== Post Full ===== */
.post-full {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}
.post-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.post-header .post-title {
  font-size: 1.8rem;
  margin-bottom: 12px;
  line-height: 1.3;
}
.post-categories, .post-tags {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.post-categories a, .post-tags a {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-color);
  padding: 3px 14px;
  border-radius: 14px;
  font-size: 0.8rem;
  transition: all 0.2s;
}
.post-categories a:hover, .post-tags a:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

/* ===== 文章内容排版 ===== */
.post-content h2 {
  font-size: 1.4rem;
  margin: 40px 0 16px;
  padding-left: 12px;
  border-left: 4px solid var(--primary);
  line-height: 1.4;
}
.post-content h3 {
  font-size: 1.15rem;
  margin: 32px 0 12px;
  color: var(--text);
}
.post-content h4 {
  font-size: 1.02rem;
  margin: 24px 0 8px;
  color: var(--text-light);
}
.post-content p { margin: 0 0 18px; }
.post-content ul, .post-content ol {
  margin: 0 0 18px;
  padding-left: 24px;
}
.post-content li {
  margin: 6px 0;
  line-height: 1.7;
}
.post-content li::marker { color: var(--primary); }
.post-content a { border-bottom: 1px solid transparent; }
.post-content a:hover { border-bottom-color: var(--primary); text-decoration: none; }
.post-content blockquote {
  margin: 20px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--primary);
  background: #f8f9fb;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-light);
  font-style: italic;
}
.post-content blockquote p { margin: 0; }

/* 表格 */
.post-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 20px 0;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.post-content th {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
}
.post-content td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}
.post-content tr:last-child td { border-bottom: none; }
.post-content tr:hover td { background: #f8f9fb; }
.post-content strong { font-weight: 600; color: var(--text); }
.post-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
  margin: 36px 0;
}

/* ===== 代码块 ===== */
code {
  background: #f0f0f5;
  color: #e84393;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: "JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 20px 24px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 20px 0;
  line-height: 1.6;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
}
pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* ===== 分页 ===== */
.pagination {
  text-align: center;
  padding: 36px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}
.pagination a {
  display: inline-block;
  padding: 8px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.9rem;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.pagination a:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  text-decoration: none;
}
.page-number {
  color: var(--text-light);
  font-size: 0.88rem;
  padding: 8px 4px;
}

/* ===== 文章上下导航 ===== */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 48px;
  font-size: 0.9rem;
}
.post-nav a {
  flex: 1;
  padding: 12px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.2s;
  color: var(--text);
}
.post-nav a:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}
.post-nav .next { text-align: right; margin-left: auto; }

/* ===== 归档 ===== */
.site-main h1 {
  font-size: 1.8rem;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--primary);
  display: inline-block;
}
.archive-year {
  margin: 32px 0 14px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}
.archive-item {
  padding: 10px 16px;
  display: flex;
  gap: 20px;
  align-items: baseline;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  margin: 4px 0;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.archive-item:hover {
  background: #f0f4ff;
  border-color: var(--border);
}
.archive-date {
  color: var(--text-light);
  font-size: 0.85rem;
  min-width: 50px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
}

/* ===== 分类 & 标签列表 ===== */
.category-list, .post-list { list-style: none; padding: 0; }
.category-list li, .post-list li {
  padding: 10px 16px;
  margin: 4px 0;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.category-list li:hover, .post-list li:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.post-list li .post-date {
  color: var(--text-light);
  font-size: 0.82rem;
  margin-right: 12px;
}
.count {
  color: var(--text-light);
  font-size: 0.82rem;
  margin-left: 6px;
}

/* 标签云 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.tag-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.88rem;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  color: var(--text);
}
.tag-item:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 36px 0;
  color: var(--text-light);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 60px;
  background: var(--card-bg);
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .site-nav { gap: 2px; }
  .site-nav a { font-size: 0.82rem; padding: 4px 10px; }
  .post-item { padding: 18px 20px; margin: 14px 0; }
  .post-full { padding: 24px 18px; }
  .post-header .post-title { font-size: 1.4rem; }
  .post-nav { flex-direction: column; }
  .post-nav a { text-align: center; }
  .post-nav .next { text-align: center; }
  .pagination { flex-wrap: wrap; }
}
