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

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --border: #e2e8f0;
  --radius: 12px;
}

html, body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}

/* ── Header ─────────────────────────────────────────── */
.blog-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 100;
}
.blog-header-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.blog-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.blog-logo-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex; align-items: center; justify-content: center;
}
.blog-logo-text {
  font-size: 18px; font-weight: 800; letter-spacing: -0.3px;
}
.blog-logo-text em { font-style: normal; color: var(--brand); font-weight: 400; }
.blog-nav { display: flex; align-items: center; gap: 20px; }
.blog-nav a {
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  text-decoration: none; transition: color .15s;
}
.blog-nav a:hover { color: var(--text); }
.blog-nav .nav-cta {
  background: var(--brand); color: #fff; padding: 7px 16px;
  border-radius: 8px; font-weight: 600; font-size: 13px;
}
.blog-nav .nav-cta:hover { background: var(--brand-dark); color: #fff; }

/* ── Blog Index ─────────────────────────────────────── */
.blog-hero {
  max-width: 800px; margin: 0 auto;
  padding: 60px 24px 40px; text-align: center;
}
.blog-hero h1 {
  font-size: 36px; font-weight: 800; letter-spacing: -1px;
  margin-bottom: 12px;
}
.blog-hero p {
  font-size: 16px; color: var(--text-muted); max-width: 500px; margin: 0 auto;
}

.blog-grid {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px 60px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.blog-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
}
.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.blog-card-img {
  height: 180px; background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: var(--brand); opacity: .3;
}
.blog-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.blog-card-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--brand);
  margin-bottom: 8px;
}
.blog-card-title {
  font-size: 18px; font-weight: 700; line-height: 1.3;
  margin-bottom: 8px; letter-spacing: -0.3px;
}
.blog-card-desc {
  font-size: 13px; color: var(--text-muted); line-height: 1.6;
  flex: 1; margin-bottom: 12px;
}
.blog-card-meta {
  font-size: 11px; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
}

/* ── Article ────────────────────────────────────────── */
.article-header {
  max-width: 720px; margin: 0 auto;
  padding: 48px 24px 24px; text-align: center;
}
.article-tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--brand); background: rgba(37,99,235,.08);
  padding: 4px 12px; border-radius: 20px; margin-bottom: 16px;
}
.article-header h1 {
  font-size: 34px; font-weight: 800; letter-spacing: -1px;
  line-height: 1.2; margin-bottom: 16px;
}
.article-meta {
  font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 16px;
}
.article-meta time { font-weight: 500; }

.article-body {
  max-width: 720px; margin: 0 auto;
  padding: 0 24px 60px;
  font-size: 16px; line-height: 1.8;
}
.article-body h2 {
  font-size: 22px; font-weight: 700; margin: 36px 0 12px;
  letter-spacing: -0.3px;
}
.article-body h3 {
  font-size: 18px; font-weight: 600; margin: 28px 0 8px;
}
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol {
  margin: 0 0 16px 24px;
}
.article-body li { margin-bottom: 6px; }
.article-body strong { font-weight: 600; }
.article-body code {
  background: var(--bg-alt); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 4px; font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
}
.article-body blockquote {
  border-left: 3px solid var(--brand);
  padding: 12px 16px; margin: 16px 0;
  background: var(--bg-alt); border-radius: 0 8px 8px 0;
  color: var(--text-muted); font-style: italic;
}
.article-body .tip {
  background: rgba(37,99,235,.06);
  border: 1px solid rgba(37,99,235,.15);
  border-radius: 8px; padding: 14px 16px; margin: 20px 0;
  font-size: 14px;
}
.article-body .tip strong { color: var(--brand); }
.article-body img {
  max-width: 100%; border-radius: 8px;
  border: 1px solid var(--border); margin: 20px 0;
}
.article-body table {
  width: 100%; border-collapse: collapse; margin: 20px 0;
  font-size: 14px;
}
.article-body th, .article-body td {
  padding: 8px 12px; border: 1px solid var(--border); text-align: left;
}
.article-body th { background: var(--bg-alt); font-weight: 600; }

/* ── Article Hero Image ────────────────────────────── */
.article-hero-img {
  max-width: 800px; margin: 0 auto;
  padding: 0 24px;
}
.article-hero-img svg {
  width: 100%; height: auto;
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

/* ── SVG Diagrams ──────────────────────────────────── */
.svg-diagram {
  margin: 24px 0;
  overflow-x: auto;
}
.svg-diagram svg {
  width: 100%; height: auto;
  min-width: 500px;
}

/* ── CTA Box ────────────────────────────────────────── */
.article-cta {
  max-width: 720px; margin: 0 auto 40px;
  padding: 24px; text-align: center;
  background: linear-gradient(135deg, rgba(37,99,235,.06), rgba(37,99,235,.02));
  border: 1px solid rgba(37,99,235,.15);
  border-radius: var(--radius);
}
.article-cta h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.article-cta p { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }
.article-cta a {
  display: inline-block; background: var(--brand); color: #fff;
  padding: 10px 24px; border-radius: 8px; font-weight: 700;
  font-size: 14px; text-decoration: none;
}
.article-cta a:hover { background: var(--brand-dark); }

/* ── Related Articles ───────────────────────────────── */
.related-section {
  max-width: 720px; margin: 0 auto;
  padding: 0 24px 60px;
}
.related-title {
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px;
  font-size: 12px;
}
.related-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.related-card {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 16px; text-decoration: none; color: inherit;
  transition: border-color .15s;
}
.related-card:hover { border-color: var(--brand); }
.related-card-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.related-card-desc { font-size: 12px; color: var(--text-muted); }

/* ── Footer ─────────────────────────────────────────── */
.blog-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 12px; color: var(--text-dim);
}
.blog-footer a { color: var(--text-muted); text-decoration: none; }
.blog-footer a:hover { color: var(--text); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 640px) {
  .blog-hero h1 { font-size: 26px; }
  .blog-grid { grid-template-columns: 1fr; }
  .article-header h1 { font-size: 26px; }
  .article-body { font-size: 15px; }
  .related-grid { grid-template-columns: 1fr; }
  .blog-nav a:not(.nav-cta) { display: none; }
}
