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

:root {
  --bg:          #09090B;
  --bg-raised:   #111113;
  --bg-hover:    #18181B;
  --surface:     #1C1C1F;
  --border:      #27272A;
  --border-light:#3F3F46;
  --text:        #FAFAFA;
  --text-2:      #A1A1AA;
  --text-3:      #71717A;
  --accent:      #818CF8;
  --accent-dim:  rgba(129, 140, 248, 0.12);
  --green:       #34D399;
  --green-dim:   rgba(52, 211, 153, 0.12);
  --sans:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:        'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --max-w:       720px;
  --wide:        1120px;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Top Nav ─────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topnav-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  font-size: 0.85rem;
  color: var(--text-2);
  font-weight: 500;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }

/* ── Hero (homepage) ─────────────────────────────────────── */
.hero {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 3.5rem 2rem 0.5rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  max-width: 700px;
  margin: 0 auto 1.2rem;
}

.hero h1 .gradient {
  background: linear-gradient(135deg, var(--accent) 0%, var(--green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-2);
  font-size: 1.1rem;
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.65;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  transition: opacity 0.15s;
}

.hero-cta:hover { opacity: 0.88; }

/* ── Section headers ─────────────────────────────────────── */
.section-header {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.5rem 2rem 0.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.section-header a {
  font-size: 0.82rem;
  color: var(--text-3);
  font-weight: 500;
  transition: color 0.15s;
}

.section-header a:hover { color: var(--accent); }

/* ── Blog Grid ───────────────────────────────────────────── */
.blog-grid {
  max-width: 760px;
  margin: 0 auto;
  padding: 0.5rem 2rem 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.post-card {
  background: var(--bg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: background 0.15s;
}

.post-card:hover { background: var(--bg-hover); }

.post-card .tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.post-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

.post-card p {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.55;
  flex: 1;
}

.post-card .read-more {
  margin-top: 0.8rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.15s;
}

.post-card:hover .read-more { color: var(--accent); }

/* ── Category filter pills ───────────────────────────────── */
.filter-bar {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 2rem 1.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-pill {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--sans);
}

.filter-pill:hover { border-color: var(--border-light); color: var(--text-2); }
.filter-pill.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ── Blog Index (list view) ──────────────────────────────── */
.blog-list {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.blog-list-section {
  margin-bottom: 2.5rem;
}

.blog-list-section h3 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.blog-list-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 6px;
  border-bottom: none;
}

.blog-list-item:hover { background: var(--bg-hover); }

.blog-list-item .num {
  font-size: 0.75rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-width: 2rem;
  font-family: var(--mono);
}

.blog-list-item .title {
  font-size: 0.9rem;
  font-weight: 500;
  flex: 1;
}

.blog-list-item .arrow {
  color: var(--text-3);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.blog-list-item:hover .arrow { opacity: 1; }

.blog-list-item.coming-soon {
  cursor: default;
  opacity: 0.4;
}

.blog-list-item.coming-soon:hover { background: transparent; }

.blog-list-item.coming-soon .title {
  font-weight: 400;
}

/* ── Article ─────────────────────────────────────────────── */
.article-header {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 4rem 2rem 0;
}

.article-header .breadcrumb {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 1rem;
}

.article-header .breadcrumb a { color: var(--text-2); }
.article-header .breadcrumb a:hover { color: var(--accent); }
.article-header .breadcrumb span { margin: 0 0.4rem; }

.article-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  max-width: var(--max-w);
}

.article-header .meta {
  color: var(--text-3);
  font-size: 0.82rem;
  margin-top: 0.8rem;
}

.article-body {
  max-width: var(--max-w);
  margin: 2.5rem auto 0;
  padding: 0 2rem 4rem;
}

.article-body p {
  margin-bottom: 1.2rem;
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.75;
}

.article-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
  letter-spacing: -0.02em;
}

.article-body h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
}

.article-body strong { color: var(--text); font-weight: 600; }
.article-body em { color: var(--text); font-weight: 600; }

.article-body code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.article-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.4rem;
  overflow-x: hidden;
  margin: 1.2rem 0 1.4rem;
}

.article-body pre:not(:has(code)) {
  text-align: center;
  white-space: normal;
}

.article-body pre:has(code) {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-2);
  font-size: 0.8rem;
  line-height: 1.7;
}

.article-body .callout {
  border-left: 2px solid var(--accent);
  background: var(--accent-dim);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  color: var(--text-2);
}

.article-body .callout strong { color: var(--accent); }

/* ── Post nav ────────────────────────────────────────────── */
.post-nav {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem 4rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.post-nav a {
  display: block;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.15s;
}

.post-nav a:hover { border-color: var(--border-light); background: var(--bg-hover); }

.post-nav .dir {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

.post-nav .label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

.post-nav .next { text-align: right; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-3);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a { color: var(--text-3); transition: color 0.15s; }
.footer-links a:hover { color: var(--text-2); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .topnav-inner { padding: 0 1rem; }
  .hero { padding: 4rem 1rem 3rem; }
  .section-header, .filter-bar, .blog-grid, .blog-list { padding-left: 1rem; padding-right: 1rem; }
  .blog-grid { grid-template-columns: 1fr; }
  .article-header, .article-body, .post-nav { padding-left: 1rem; padding-right: 1rem; }
  .nav-links { gap: 1rem; }
  .site-footer { flex-direction: column; gap: 1rem; text-align: center; }
  .post-nav { grid-template-columns: 1fr; }
}
