* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --text: #1d1d1f;
  --text-soft: #86868b;
  --text-faint: #a1a1a6;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --radius: 12px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Consolas, "PingFang SC", "Microsoft YaHei", monospace;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-hover); }
::selection { background: rgba(0, 113, 227, .15); }

.container { max-width: 980px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 720px; }
.page-pad { padding-top: 56px; padding-bottom: 80px; }

/* ---------- 阅读进度条 ---------- */
.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--line); z-index: 60;
  transition: width .1s linear;
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: 980px; margin: 0 auto; padding: 0 24px;
  height: 48px; display: flex; align-items: center; justify-content: space-between;
}
.logo { font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.logo:hover { color: var(--text); }
.nav-links { display: flex; gap: 32px; }
.nav-links a { font-size: 14px; color: var(--text); font-weight: 400; }
.nav-links a:hover { color: var(--accent); }
.nav-links a.active { color: var(--accent); }

/* ---------- 主体 ---------- */
main { flex: 1 0 auto; }

/* ---------- 首页 Hero（纯白） ---------- */
.hero { padding: 72px 0 64px; }
.hero-kicker {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-soft); letter-spacing: .14em; margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 3.4rem);
  font-weight: 700; line-height: 1.1; letter-spacing: -.02em;
}
.hero-sub { margin-top: 16px; font-size: 17px; color: var(--text-soft); max-width: 30em; line-height: 1.6; }
.hero-meta { margin-top: 16px; font-size: 13px; color: var(--text-faint); }

/* ---------- 文章列表区（浅灰带） ---------- */
.list-section { background: var(--bg-soft); padding: 56px 0 72px; }
.list-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 32px;
}
.section-title { font-size: 13px; font-weight: 600; color: var(--text-soft); letter-spacing: .08em; }
.page-info { font-size: 13px; color: var(--text-faint); }

/* ---------- 标签筛选 ---------- */
.filter-bar {
  display: none; align-items: baseline; gap: 12px;
  margin-bottom: 10px; font-size: 14px; color: var(--text-soft);
}
.filter-bar.show { display: flex; }
.filter-bar button {
  border: none; background: none; padding: 0;
  font-size: 14px; color: var(--accent); cursor: pointer; font-weight: 500;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.tag {
  font-size: 13px; color: var(--text-soft); background: none;
  border: none; padding: 0; cursor: pointer; font-family: var(--font); line-height: 1.6;
}
.tag::before { content: "\00b7 "; color: var(--line); }
.tag:hover { color: var(--accent); }
.tag.active { color: var(--text); font-weight: 600; }
.tags-filter { margin-bottom: 36px; }

/* ---------- 卡片网格 ---------- */
.post-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }
.card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-cover { display: block; aspect-ratio: 16 / 9; background: var(--bg-soft); overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.card:hover .card-cover img { transform: scale(1.03); }
.card-body { padding: 22px 24px 24px; display: flex; flex-direction: column; flex: 1; }
.card-meta { font-size: 13px; color: var(--text-soft); }
.card-title { font-size: 20px; font-weight: 700; line-height: 1.35; color: var(--text); margin-top: 10px; }
.card-title a { color: inherit; }
.card-title a:hover { color: var(--accent); }
.card-summary {
  font-size: 15px; color: var(--text-soft); line-height: 1.5; margin-top: 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-body .tags { margin-top: auto; padding-top: 18px; }
.empty { color: var(--text-faint); font-size: 15px; padding: 32px 0; }

/* ---------- 分页（文字链接） ---------- */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; margin-top: 56px; flex-wrap: wrap;
}
.page-btn {
  font-family: var(--font); font-size: 14px; color: var(--accent);
  background: none; border: none; padding: 0; cursor: pointer;
}
.page-btn:hover:not(:disabled) { color: var(--accent-hover); }
.page-btn:disabled { color: var(--line); cursor: default; }
.page-numbers { display: flex; align-items: center; }
.page-num {
  font-family: var(--font); font-size: 14px; color: var(--text-soft);
  background: none; border: none; padding: 4px 6px; cursor: pointer;
}
.page-num:hover { color: var(--accent); }
.page-num.active { color: var(--text); font-weight: 700; }
.page-gap { color: var(--text-faint); padding: 0 2px; }

/* ---------- 文章详情 ---------- */
.article-head { padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.back-link { display: inline-block; font-size: 14px; color: var(--text-soft); margin-bottom: 28px; }
.back-link:hover { color: var(--accent); }
.article-head h1 { font-size: 32px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.article-meta {
  margin-top: 16px; font-size: 13px; color: var(--text-soft);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.article-meta .sep { opacity: .5; }
.cover {
  margin-top: 36px; width: 100%; aspect-ratio: 16 / 9;
  background: var(--bg-soft); border-radius: var(--radius); overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-body { padding-top: 40px; font-size: 17px; line-height: 1.7; color: var(--text); }
.article-body > * + * { margin-top: 1.2em; }
.article-body h2 { font-size: 24px; font-weight: 700; line-height: 1.3; margin-top: 2em; }
.article-body p { line-height: 1.7; }
.article-body strong { font-weight: 600; }
.article-body ul, .article-body ol { padding-left: 1.5em; }
.article-body li { margin: .4em 0; }
.article-body blockquote {
  margin: 1.6em 0; padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent);
  background: transparent; color: var(--text-soft); font-size: 16px;
}
.article-body blockquote p { margin: 0; }

.article-body .img_demo {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}
code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--bg-soft); padding: .15em .45em;
  border-radius: 6px; color: var(--text);
}
pre { position: relative; background: var(--bg-soft); border-radius: var(--radius); overflow: hidden; margin: 1.6em 0; }
pre .code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; font-size: 12px; color: var(--text-faint);
  border-bottom: 1px solid var(--line-soft); letter-spacing: .06em;
}
.copy-btn {
  font-family: var(--font); font-size: 13px; color: var(--accent);
  background: none; border: none; cursor: pointer; padding: 0;
}
.copy-btn:hover { color: var(--accent-hover); }
pre code {
  display: block; padding: 18px 20px; font-size: 14px; line-height: 1.7;
  overflow-x: auto; background: transparent; color: var(--text);
}

/* ---------- 上一篇 / 下一篇 ---------- */
.article-foot { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.pn { display: block; padding: 18px 20px; border-radius: var(--radius); background: var(--bg-soft); transition: background .15s ease; }
a.pn:hover { background: var(--line-soft); }
.pn .pn-label { font-size: 12px; color: var(--text-faint); }
.pn .pn-title { font-size: 15px; color: var(--text); margin-top: 4px; font-weight: 600; }
.pn.next { text-align: right; }

/* ---------- 关于页 ---------- */
.about h1 { font-size: 32px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; margin-top: 8px; }
.about-section { margin-top: 8px; }
.about-section h2 { font-size: 20px; font-weight: 700; margin-top: 2em; }
.about-section p { margin-top: 1em; line-height: 1.7; }
.about-section ul { margin-top: 1em; padding-left: 1.5em; }
.about-section li { margin: .4em 0; }
.about-card { background: var(--bg-soft); border-radius: var(--radius); padding: 24px 28px; margin-top: 2.4em; }
.about-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.about-card ul { list-style: none; padding: 0; }
.about-card li {
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.about-card li:last-child { border-bottom: none; }
.about-card .tool { font-weight: 600; }
.about-card .desc { color: var(--text-soft); font-size: 14px; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 80px 0; }
.notfound .big { font-size: 48px; font-weight: 700; color: var(--line); }
.notfound p { color: var(--text-soft); margin-top: 10px; }
.notfound a { margin-top: 18px; display: inline-block; font-size: 14px; }

/* ---------- 页脚 ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--line); padding: 28px 0 36px; }
.footer-inner {
  max-width: 980px; margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-faint);
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-faint); font-size: 12px; }
.footer-links a:hover { color: var(--accent); }

/* ---------- 动画 ---------- */
.fade { animation: fadeUp .45s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 响应式 ---------- */
@media (min-width: 1100px) {
  .post-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .hero { padding: 48px 0 44px; }
  .list-section { padding: 40px 0 56px; }
  .page-pad { padding-top: 40px; padding-bottom: 60px; }
  .post-grid { grid-template-columns: 1fr; gap: 20px; }
  .card-body { padding: 18px 20px 20px; }
  .card-title { font-size: 18px; }
  .card-summary { font-size: 14px; }
  .article-head h1 { font-size: 26px; }
  .article-body { font-size: 16px; }
  .prevnext { grid-template-columns: 1fr; }
  .pn.next { text-align: left; }
  .site-footer .footer-inner { justify-content: center; text-align: center; }
}

/* ---------- 返回首页 ---------- */
.back-home {
  display: block; text-align: center;
  margin-top: 36px; font-size: 15px; font-weight: 500;
}
