/* ===== 基础变量 ===== */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f8f9;
  --text: #1b1f24;
  --text-sub: #5c6470;
  --text-muted: #98a0ac;
  --border: #e8eaed;
  --border-strong: #d7dbe0;
  --accent: #2563eb;
  --accent-soft: #eef3ff;
  --radius: 10px;
  --maxw: 1080px;
  --shadow: 0 10px 40px rgba(20, 30, 50, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }

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

/* ===== 顶部导航 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}

.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }

.nav { display: flex; gap: 30px; }

.nav-link {
  font-size: 14px;
  color: var(--text-sub);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s;
}

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

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ===== 首屏 ===== */
.hero { border-bottom: 1px solid var(--border); }

.hero-inner { padding: 92px 24px 84px; max-width: 760px; }

.hero-eyebrow {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  margin: 0 0 14px;
}

.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -1px;
  margin: 0 0 22px;
}

.hero-desc {
  color: var(--text-sub);
  font-size: 17px;
  max-width: 600px;
  margin: 0 0 34px;
}

.hero-links { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--text-sub); }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* ===== 主体布局 ===== */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 64px;
  padding-top: 64px;
  padding-bottom: 96px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}

.section-title { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -0.3px; }
.section-count { color: var(--text-muted); font-size: 13px; }

/* 标签筛选按钮 */
.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 26px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-sub);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s;
}

.filter-btn:hover { border-color: var(--text-muted); color: var(--text); }

.filter-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

/* 文章列表 */
.post-list { display: flex; flex-direction: column; }

.post-item {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.2s;
}

.post-item:first-child { padding-top: 20px; }
.post-item:hover .post-title { color: var(--accent); }

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.post-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }

.post-title {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 10px;
  letter-spacing: -0.3px;
  transition: color 0.2s;
}

.post-excerpt {
  color: var(--text-sub);
  font-size: 15px;
  margin: 0 0 14px;
}

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.post-tag {
  font-size: 12px;
  color: var(--text-sub);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 5px;
}

.post-tag::before { content: "# "; color: var(--text-muted); }

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 600;
}

.read-more .arrow { transition: transform 0.2s; }
.post-item:hover .read-more .arrow { transform: translateX(4px); color: var(--accent); }

.empty-state { text-align: center; color: var(--text-muted); padding: 60px 0; }

/* ===== 侧边栏 ===== */
.sidebar { display: flex; flex-direction: column; gap: 36px; }

.widget-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text);
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.cloud-tag {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.18s;
}

.cloud-tag:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.cloud-tag .count { color: var(--text-muted); margin-left: 4px; font-size: 11px; }

.about-text { color: var(--text-sub); font-size: 14px; line-height: 1.8; margin: 0 0 16px; }

.about-links { display: flex; gap: 16px; }

.about-links a {
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.about-links a:hover { color: var(--accent); border-color: var(--accent); }

.archive-list { list-style: none; margin: 0; padding: 0; }

.archive-list li {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 8px 0;
  color: var(--text-sub);
  border-bottom: 1px dashed var(--border);
}

.archive-list li span:last-child { color: var(--text-muted); font-size: 12px; }

/* ===== 页脚 ===== */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-inner { padding: 32px 24px; text-align: center; }
.footer-inner p { margin: 0; color: var(--text-muted); font-size: 13px; }

/* ===== 文章弹窗 ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 26, 38, 0.5);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease;
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: rise 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 34px;
  height: 34px;
  border: none;
  background: var(--bg-soft);
  color: var(--text-sub);
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 48px 52px 56px; }

.article-cover {
  height: 160px;
  border-radius: 10px;
  margin-bottom: 30px;
  display: grid;
  place-items: center;
  font-size: 44px;
}

.article-title { font-size: 30px; line-height: 1.35; font-weight: 800; margin: 0 0 16px; letter-spacing: -0.5px; }

.article-meta { color: var(--text-muted); font-size: 13px; margin-bottom: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }

.article-content { color: var(--text); font-size: 16px; line-height: 1.9; }
.article-content h3 { font-size: 19px; margin: 32px 0 12px; }
.article-content p { color: var(--text-sub); margin: 0 0 18px; }
.article-content ul, .article-content ol { color: var(--text-sub); padding-left: 22px; margin: 0 0 18px; }
.article-content li { margin-bottom: 8px; }
.article-content code {
  font-family: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.9em;
  color: #b5306b;
}
.article-content pre {
  background: #1b1f24;
  color: #e6e9ee;
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
}
.article-content pre code { background: none; border: none; padding: 0; color: inherit; }
.article-content blockquote {
  margin: 0 0 18px;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--accent);
  color: var(--text-sub);
  font-style: italic;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

body.modal-open { overflow: hidden; }

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  .main-layout { grid-template-columns: 1fr; gap: 56px; }
  .sidebar { display: grid; grid-template-columns: repeat(2, 1fr); }
  .hero-inner { padding: 68px 24px 60px; }
}

@media (max-width: 560px) {
  .nav { gap: 18px; }
  .nav-link { font-size: 13px; }
  .brand-name { display: none; }
  .main-layout { padding-top: 44px; }
  .sidebar { grid-template-columns: 1fr; }
  .modal-panel { max-height: 92vh; }
  .modal-body { padding: 44px 24px 40px; }
  .article-title { font-size: 25px; }
  .post-title { font-size: 19px; }
}
