:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-elev: #ffffff;
  --border: #e5e7eb;
  --text: #1f2328;
  --text-muted: #57606a;
  --text-subtle: #8b95a1;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff6ff;
  --accent: #f97316;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max: 1200px;
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --bg-elev: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #9da7b3;
    --text-subtle: #6e7681;
    --brand: #4f8cff;
    --brand-hover: #6ea0ff;
    --brand-soft: rgba(79, 140, 255, 0.12);
  }
}

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

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; display: block; }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(13, 17, 23, 0.85); }
}
.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.logo-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: var(--shadow-sm);
}
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  transition: all .15s ease;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.active { color: var(--brand); background: var(--brand-soft); }
.nav-cta {
  padding: 8px 16px !important;
  background: var(--text) !important;
  color: var(--bg) !important;
  border-radius: 8px;
}
.nav-cta:hover { background: var(--brand) !important; color: #fff !important; }

.menu-btn {
  display: none;
  background: none; border: 0; padding: 6px; cursor: pointer;
  color: var(--text);
}

@media (max-width: 820px) {
  .nav { display: none; }
  .menu-btn { display: block; }
  .nav.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 12px 24px; gap: 4px;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 80px 0 56px;
  text-align: center;
  background:
    radial-gradient(60% 60% at 50% 0%, var(--brand-soft) 0%, transparent 70%),
    var(--bg);
}
.hero .eyebrow {
  display: inline-block;
  font-size: 13px; font-weight: 600;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  margin: 0 0 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--brand), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 32px;
}
.hero-cta { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600; font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--bg-elev); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

/* ---------- Section ---------- */
.section { padding: 64px 0; }
.section-head { margin-bottom: 36px; }
.section-head h2 {
  font-size: 28px; font-weight: 700; margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.section-head p { color: var(--text-muted); margin: 0; font-size: 15.5px; }

/* ---------- Card grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all .18s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.card .icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid; place-items: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--text); }
.card p { margin: 0 0 16px; color: var(--text-muted); font-size: 14.5px; flex: 1; }
.card .more { font-size: 13.5px; color: var(--brand); font-weight: 600; }
.card .more::after { content: " →"; }

/* ---------- Post cards ---------- */
.post-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: all .18s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.post-card .cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 100%);
  display: grid; place-items: center;
  font-size: 42px;
  color: var(--brand);
}
.post-card .body { padding: 18px 20px 22px; }
.post-card .meta { font-size: 12.5px; color: var(--text-subtle); margin-bottom: 8px; }
.post-card .meta .tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600; margin-right: 8px;
}
.post-card h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.4; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--brand); }
.post-card .excerpt { color: var(--text-muted); font-size: 14px; margin: 0; line-height: 1.6; }

/* ---------- Article page ---------- */
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.article header { margin-bottom: 32px; }
.article .crumb { font-size: 13px; color: var(--text-subtle); margin-bottom: 16px; }
.article .crumb a { color: var(--text-muted); }
.article h1 {
  font-size: clamp(28px, 4vw, 40px); line-height: 1.2;
  margin: 0 0 16px; letter-spacing: -0.01em;
}
.article .meta {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-subtle); font-size: 14px;
}
.article-content { font-size: 16.5px; line-height: 1.85; color: var(--text); }
.article-content h2 { font-size: 24px; margin: 40px 0 14px; }
.article-content h3 { font-size: 19px; margin: 28px 0 10px; }
.article-content p { margin: 0 0 18px; }
.article-content ul, .article-content ol { padding-left: 24px; margin: 0 0 18px; }
.article-content li { margin-bottom: 6px; }
.article-content code {
  background: var(--bg-soft);
  padding: 2px 6px; border-radius: 4px;
  font-size: 0.9em;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.article-content pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-size: 13.5px;
}
.article-content pre code { background: none; padding: 0; }
.article-content blockquote {
  border-left: 3px solid var(--brand);
  margin: 0 0 18px;
  padding: 4px 0 4px 16px;
  color: var(--text-muted);
}
.article-content a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 48px 0 32px;
  margin-top: 64px;
  font-size: 14px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-subtle); margin: 0 0 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: var(--text-muted); }
.footer-grid a:hover { color: var(--brand); }
.footer-brand p { color: var(--text-muted); margin: 8px 0 0; max-width: 320px; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  color: var(--text-subtle); font-size: 13px;
}
