:root {
  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --text: #1f2329;
  --text-soft: #5b6470;
  --border: #e6e8eb;
  --primary: #e2483a;
  --primary-soft: #fdecea;
  --accent: #2f6df6;
  --shadow: 0 4px 20px rgba(20, 30, 50, 0.06);
  --radius: 14px;
  --maxw: 960px;
}

[data-theme="dark"] {
  --bg: #15171c;
  --bg-elev: #1e2128;
  --text: #e8eaed;
  --text-soft: #9aa3af;
  --border: #2c3038;
  --primary: #ff6a5a;
  --primary-soft: #3a2320;
  --accent: #6f9bff;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--primary); }
.site-nav { margin-left: auto; display: flex; gap: 4px; }
.nav-link {
  padding: 8px 14px; border-radius: 9px; color: var(--text-soft);
  text-decoration: none; font-size: 15px; transition: .15s;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.theme-toggle {
  margin-left: 8px; border: 1px solid var(--border); background: var(--bg-elev);
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer; font-size: 16px;
}
.nav-toggle, .nav-burger { display: none; }

/* ---------- Hero ---------- */
.site-main { padding: 36px 20px 64px; }
.hero {
  text-align: center; padding: 48px 16px 40px;
  background: linear-gradient(160deg, var(--primary-soft), transparent 70%);
  border-radius: var(--radius); margin-bottom: 12px;
}
.hero-avatar {
  width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center; font-size: 32px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--primary), #ff8a3d);
  box-shadow: var(--shadow);
}
.hero-name { font-size: 30px; margin: 0 0 8px; }
.hero-desc { color: var(--text-soft); margin: 0 auto 22px; max-width: 560px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 10px; text-decoration: none;
  border: 1px solid var(--border); color: var(--text); background: var(--bg-elev); transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { filter: brightness(1.05); color: #fff; }

/* ---------- Sections ---------- */
.section { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-head h1, .section-head h2 { font-size: 22px; margin: 0; }
.more { color: var(--accent); text-decoration: none; font-size: 14px; }
.lead { color: var(--text-soft); margin-top: -6px; }

/* ---------- Grid / Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: .18s;
}
.card:hover { transform: translateY(-3px); border-color: var(--primary); }
.card-link { display: block; padding: 20px; color: inherit; text-decoration: none; height: 100%; }
.card-meta { font-size: 12.5px; color: var(--text-soft); display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.card-title { margin: 0 0 8px; font-size: 18px; }
.card-desc { margin: 0; color: var(--text-soft); font-size: 14.5px; }
.card-tags { margin-top: 12px; }
.tag {
  display: inline-block; font-size: 12px; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px; padding: 2px 10px; margin: 0 6px 6px 0;
}

/* ---------- Post ---------- */
.post-header { margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 18px; }
.post-title { font-size: 30px; margin: 10px 0 0; line-height: 1.3; }
.post-meta { font-size: 13px; color: var(--text-soft); display: flex; gap: 10px; align-items: center; }
.post-body { font-size: 16.5px; }
.post-body h2 { font-size: 23px; margin-top: 34px; border-left: 4px solid var(--primary); padding-left: 12px; }
.post-body h3 { font-size: 19px; margin-top: 26px; }
.post-body p { margin: 14px 0; }
.post-body ul, .post-body ol { padding-left: 22px; }
.post-body li { margin: 6px 0; }
.post-body blockquote {
  margin: 18px 0; padding: 12px 18px; border-left: 4px solid var(--accent);
  background: var(--bg-elev); border-radius: 0 10px 10px 0; color: var(--text-soft);
}
.post-body code {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 1px 6px; font-size: 14px; font-family: "SFMono-Regular", Consolas, monospace;
}
.post-body pre.code-block {
  background: #1b1f27; color: #e6e6e6; padding: 16px 18px; border-radius: 12px;
  overflow-x: auto; line-height: 1.6;
}
.post-body pre.code-block code { background: none; border: none; color: inherit; padding: 0; }
.post-body a { color: var(--accent); }
.post-body img { max-width: 100%; border-radius: 10px; }
.post-footer { margin-top: 36px; }

/* ---------- About ---------- */
.about-inner { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 30px; box-shadow: var(--shadow); }
.about-inner h2 { font-size: 22px; margin-top: 24px; border-left: 4px solid var(--primary); padding-left: 12px; }
.about-inner h2:first-child { margin-top: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; color: var(--text-soft); font-size: 14px; text-align: center; }
.site-footer a { color: var(--accent); text-decoration: none; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .nav-burger { display: inline-block; cursor: pointer; font-size: 22px; margin-left: auto; user-select: none; }
  .theme-toggle { margin-left: 0; order: 3; }
  .site-nav {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; background: var(--bg-elev); border-bottom: 1px solid var(--border); padding: 8px;
  }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .nav-link { padding: 12px 14px; }
  .hero-name { font-size: 26px; }
  .post-title { font-size: 25px; }
}
