:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --ink: #0f172a;
  --text: #1e293b;
  --muted: #475569;
  --border: #e2e8f0;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #f0fdfa;
  --accent-border: #99f6e4;
  --code-bg: #0f172a;
  --code-bar: #1e293b;
  --code-text: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.72;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  color: var(--ink);
  line-height: 1.28;
  letter-spacing: -0.02em;
  font-weight: 700;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 22px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.025em;
}

.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--ink);
  color: #5eead4;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 14.5px;
  font-weight: 600;
}

.main-nav a { color: var(--muted); }
.main-nav a:hover, .main-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: none;
}
.main-nav a[aria-current="page"] {
  color: var(--accent);
}

.main-nav a.nav-cta {
  background: var(--ink);
  color: #ffffff;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13.5px;
}
.main-nav a.nav-cta:hover {
  background: var(--accent);
  color: #ffffff;
}

/* Main */
.main-content {
  padding: 36px 22px 72px;
}

/* Hero */
.hero-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 38px 40px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero-panel h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.18;
}

.hero-lead {
  margin: 0 0 20px;
  font-size: 16.5px;
  color: var(--muted);
  max-width: 65ch;
}

.hero-lead a { font-weight: 600; }

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

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface-subtle);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--ink);
  text-decoration: none;
}

.hero-portrait {
  width: 144px;
  height: 186px;
  object-fit: cover;
  object-position: center top;
  border-radius: 14px;
  border: 3px solid var(--surface);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
  display: block;
}

/* Topic Bar */
.topic-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.topic-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 4px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

.tag-pill:hover, .tag-pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-hover);
  text-decoration: none;
}

/* Section Heading */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
}

.section-count {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 500;
}

/* Post Grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.post-card-thumb {
  display: block;
  background: #0f172a;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #115e59 100%);
  color: #5eead4;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 20px;
  font-weight: 600;
}

.post-card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.post-card-body h2, .post-card-body h3 {
  font-size: 18.5px;
  margin: 8px 0 10px;
  line-height: 1.32;
}

.post-card-body h2 a, .post-card-body h3 a {
  color: var(--ink);
}

.post-card-body h2 a:hover, .post-card-body h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-excerpt {
  margin: 0 0 16px;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.card-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-hover);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 999px;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 18px;
}

.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }

/* Article Shell */
.article-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 42px 48px;
  box-shadow: var(--shadow-sm);
  max-width: 860px;
  margin: 0 auto;
}

.article-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 22px;
  margin-bottom: 28px;
}

.article-shell h1 {
  margin: 10px 0 14px;
  font-size: clamp(27px, 3.8vw, 36px);
  line-height: 1.2;
}

.article-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 17px;
}

.featured-hero {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin: 0 0 30px;
  border: 1px solid var(--border);
  display: block;
}

/* Article Typography */
.article-body {
  font-size: 16.5px;
  color: var(--text);
}

.article-body h2 {
  font-size: 25px;
  margin: 38px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  font-size: 20.5px;
  margin: 30px 0 12px;
}

.article-body h4 {
  font-size: 17.5px;
  margin: 24px 0 10px;
}

.article-body p { margin: 0 0 16px; }

.article-body ul, .article-body ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

.article-body li { margin-bottom: 6px; }

.article-body :not(pre) > code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.87em;
  background: var(--surface-subtle);
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 18px auto;
  display: block;
}

.article-body figure {
  margin: 26px 0;
  max-width: 100%;
}

.article-body figcaption {
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

.article-body .toc-card,
.article-body .wp-block-group.has-background {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 22px 0 28px;
}

.article-body .toc-card h2,
.article-body .toc-card h3 {
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
  font-size: 18px;
}

.article-body blockquote {
  margin: 22px 0;
  padding: 14px 20px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* IDE-grade Code Windows */
.code-window {
  margin: 24px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid #1e293b;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
}

.code-window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--code-bar);
  border-bottom: 1px solid #334155;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: #94a3b8;
}

.code-window-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.code-dots {
  display: inline-flex;
  gap: 5px;
}

.code-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #475569;
}

.code-lang {
  color: #cbd5e1;
  font-weight: 500;
}

.copy-code-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 3px 10px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.copy-code-btn.is-copied {
  background: #0f766e;
  border-color: #14b8a6;
  color: #ffffff;
}

.code-pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--code-text);
  tab-size: 4;
}

.code-pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.tok-kw { color: #c084fc; font-weight: 500; }
.tok-type { color: #38bdf8; }
.tok-ann { color: #fbbf24; }
.tok-str { color: #4ade80; }
.tok-num { color: #fb923c; }
.tok-cm { color: #64748b; font-style: italic; }
.tok-tag { color: #38bdf8; }
.tok-attr { color: #facc15; }

/* Related / Series Box */
.related-posts {
  margin-top: 38px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.related-posts h2 {
  font-size: 19px;
  margin: 0 0 14px;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-list a {
  display: block;
  padding: 14px 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.4;
}

.related-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* Author Bio Card */
.author-bio-card {
  margin-top: 36px;
  padding: 26px 28px;
  background: linear-gradient(135deg, #f8fafc 0%, #f0fdfa 100%);
  border: 1px solid var(--accent-border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  gap: 22px;
  align-items: center;
}

.author-avatar {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  flex-shrink: 0;
  display: block;
}

.author-bio-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 3px;
}

.author-bio-content h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.author-bio-content p {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text);
}

.author-bio-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
}

/* About Page Layout */
.about-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 28px;
}

.about-photo {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: block;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.stack-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.stack-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.stack-card ul {
  margin: 0;
  padding-left: 18px;
}

/* Archive Header */
.archive-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.archive-header h1 {
  margin: 6px 0 10px;
  font-size: 32px;
}

.archive-header p {
  margin: 0;
  color: var(--muted);
  max-width: 68ch;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 0;
  font-size: 14px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-brand { color: var(--text); }
.footer-colophon { margin-top: 6px; font-size: 13.5px; max-width: 68ch; }

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-weight: 600;
}

@media (max-width: 760px) {
  .hero-panel {
    grid-template-columns: 1fr;
    padding: 26px 24px;
  }
  .hero-portrait { width: 112px; height: 144px; }
  .article-shell { padding: 26px 22px; }
  .about-grid { grid-template-columns: 1fr; }
  .author-bio-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
