@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&family=Orbitron:wght@600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
  --bg:         oklch(0 0 0);
  --card:       oklch(0.13 0 0);
  --border:     oklch(0.22 0 0);
  --border-sub: oklch(0.13 0 0);
  --fg:         oklch(0.93 0 0);
  --fg-muted:   oklch(0.55 0 0);
  --fg-faint:   oklch(0.38 0 0);
  --ring:       oklch(0.72 0 0);
  --ring-dim:   oklch(0.58 0 0);
  --primary:    oklch(0.88 0 0);
  --radius:     1.3rem;
}

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
svg { display: inline-block; flex-shrink: 0; }

/* ── Site Header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in oklch, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid oklch(0.18 0 0);
}
.site-nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 1.5rem; max-width: 1200px; margin: 0 auto;
}
.nav-logo { display: flex; align-items: center; }
.nav-links {
  display: flex; align-items: center; gap: 0.25rem; list-style: none;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.nav-links a {
  font-size: 0.85rem; font-weight: 500; color: var(--fg-muted);
  padding: 0.4rem 0.75rem; border-radius: 6px;
  transition: color 0.12s, background 0.12s;
  font-family: 'Poppins', system-ui, sans-serif;
  display: flex; align-items: center; gap: 0.3rem;
}
.nav-links a:hover { color: var(--fg); background: oklch(0.12 0 0); }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.5rem 1rem; border-radius: 10px;
  font-family: 'Poppins', sans-serif; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s ease;
  border: none; outline: none; white-space: nowrap;
}
.btn-ghost {
  background: transparent; color: var(--fg-muted);
  border: 1px solid oklch(0.25 0 0);
}
.btn-ghost:hover { color: var(--fg); border-color: oklch(0.38 0 0); background: oklch(0.1 0 0); }
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { background: var(--ring-dim); color: #000; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .btn-ghost  { display: none; }
}

/* ── Site Footer ── */
.site-footer {
  border-top: 1px solid oklch(0.22 0 0);
  padding: 4rem 0 3rem;
  background: #000;
  margin-top: 5rem;
  position: relative;
  overflow: hidden;
}
.site-footer::before,
.site-footer::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 320px;
  background-image: radial-gradient(circle, oklch(0.72 0 0 / 0.2) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
}
.site-footer::before {
  left: 0;
  mask-image: linear-gradient(to right, transparent, rgba(255,255,255,0.55) 35%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, rgba(255,255,255,0.55) 35%, transparent);
}
.site-footer::after {
  right: 0;
  mask-image: linear-gradient(to left, transparent, rgba(255,255,255,0.55) 35%, transparent);
  -webkit-mask-image: linear-gradient(to left, transparent, rgba(255,255,255,0.55) 35%, transparent);
}
.site-footer .wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}
.footer-brand { display: flex; flex-direction: column; gap: 1rem; }
.footer-desc  { font-size: 0.82rem; color: var(--fg-muted); line-height: 1.7; max-width: 260px; }
.footer-col h4 {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--fg-faint); margin-bottom: 0.75rem;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.footer-col a  { font-size: 0.84rem; color: var(--fg-muted); transition: color 0.12s; }
.footer-col a:hover { color: var(--fg); }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 1.5rem; border-top: 1px solid var(--border-sub);
  font-size: 0.78rem; color: var(--fg-faint);
  font-family: 'JetBrains Mono', monospace;
}
.footer-bottom a { color: var(--fg-faint); }
.footer-bottom a:hover { color: var(--fg-muted); }
.footer-bottom-links { display: flex; gap: 1.5rem; }

@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) {
  .footer-brand { grid-column: 1 / -1; }
  .footer-desc  { max-width: 100%; }
  .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; color: var(--fg-muted);
  margin-bottom: 2rem;
}
.breadcrumb a { color: var(--ring); font-weight: 600; }
.breadcrumb span { color: var(--border); }

/* ── Page wrapper ── */
.blog-page { max-width: 1200px; margin: 0 auto; padding: 3.5rem 1.5rem 5rem; }
.post-page  { max-width: 1200px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }

/* ── Post 2-column layout ── */
.post-columns {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 3rem;
  align-items: start;
  margin-top: 2.5rem;
}
.post-article { min-width: 0; }

/* ── Inline TOC (hidden on desktop, shown on mobile) ── */
.toc { display: none; }
@media (max-width: 1024px) {
  .post-columns { grid-template-columns: 1fr; }
  .blog-sidebar { display: none; }
  .toc {
    display: block;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 14px; padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
  }
  .toc strong { display: block; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-muted); margin-bottom: 0.85rem; }
  .toc ol { padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.4rem; list-style: decimal; }
  .toc li a { font-size: 0.82rem; color: var(--fg-muted); }
  .toc li a:hover { color: var(--ring); }
}

/* ── Page title block ── */
.page-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ring); margin-bottom: 0.6rem;
}
.page-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900; letter-spacing: -0.03em;
  color: var(--fg); line-height: 1.15;
  margin-bottom: 0.75rem;
}
.page-desc {
  font-size: 0.88rem; color: var(--fg-muted);
  line-height: 1.7; max-width: 500px;
}

/* ── Category tabs ── */
.cat-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 2rem 0 2.5rem; }
.cat-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; font-weight: 700;
  padding: 0.38rem 1rem; border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--fg-muted); background: transparent;
  transition: border-color 0.14s, color 0.14s;
}
.cat-tab:hover, .cat-tab.active { border-color: var(--ring); color: var(--ring); }

/* ── Section header ── */
.section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.1rem; gap: 1rem;
}
.section-title { font-size: 0.82rem; font-weight: 800; color: var(--fg); letter-spacing: -0.01em; }
.section-desc  { font-size: 0.7rem; color: var(--fg-muted); margin-top: 0.15rem; }
.section-link  {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; color: var(--ring); font-weight: 600; white-space: nowrap;
}
.section-link:hover { text-decoration: underline; }

/* ── Post grid ── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.1rem;
  margin-bottom: 3.5rem;
}

/* ── Post card ── */
.post-card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
  text-decoration: none; color: inherit;
  transition: border-color 0.18s, transform 0.18s;
}
.post-card:hover {
  border-color: color-mix(in oklch, var(--ring) 45%, transparent);
  transform: translateY(-2px);
}
.post-card-cover { width: 100%; height: 160px; object-fit: cover; flex-shrink: 0; }
.post-card-body { padding: 1.1rem 1.3rem 1.3rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.post-card-title { font-size: 0.9rem; font-weight: 800; letter-spacing: -0.01em; color: var(--fg); line-height: 1.4; }
.post-card-excerpt {
  font-size: 0.76rem; color: var(--fg-muted); line-height: 1.65; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.4rem; margin-top: auto;
}
.post-card-date { font-size: 0.68rem; color: var(--fg-muted); font-family: 'JetBrains Mono', monospace; }
.post-card-read { font-size: 0.7rem; color: var(--ring); font-weight: 600; }

/* ── Post list (category page) ── */
.post-list { display: flex; flex-direction: column; gap: 0.85rem; }
.post-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.25rem 1.4rem;
  text-decoration: none; color: inherit;
  transition: border-color 0.16s, transform 0.16s;
}
.post-row:hover {
  border-color: color-mix(in oklch, var(--ring) 45%, transparent);
  transform: translateX(2px);
}
.post-row-title   { font-size: 0.92rem; font-weight: 800; color: var(--fg); margin-bottom: 0.4rem; line-height: 1.35; letter-spacing: -0.01em; }
.post-row-excerpt { font-size: 0.78rem; color: var(--fg-muted); line-height: 1.65; margin-bottom: 0.6rem; }
.post-row-date    { font-size: 0.68rem; color: var(--fg-muted); font-family: 'JetBrains Mono', monospace; }
.post-row-arrow   { font-size: 0.75rem; color: var(--ring); font-weight: 700; white-space: nowrap; }

/* ── Category badge ── */
.badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  border-radius: 6px; padding: 0.18rem 0.5rem; border: 1px solid;
}
.badge-tutorial, .badge-comparison, .badge-use-case {
  color: var(--ring);
  background: color-mix(in oklch, var(--ring) 10%, transparent);
  border-color: color-mix(in oklch, var(--ring) 20%, transparent);
}

/* ── Post header ── */
.post-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.post-meta-dot  { color: var(--border); font-size: 0.6rem; }
.post-meta-item { font-size: 0.7rem; color: var(--fg-muted); font-family: 'JetBrains Mono', monospace; }
.post-title {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 900; letter-spacing: -0.03em;
  color: var(--fg); line-height: 1.2; margin-bottom: 0.9rem;
}
.post-excerpt { font-size: 1rem; color: var(--fg-muted); line-height: 1.65; margin-bottom: 2.5rem; }

/* ── Post body ── */
.post-body { font-size: 0.93rem; line-height: 1.85; color: var(--fg-muted); }
.post-body h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; color: var(--fg); margin: 2rem 0 0.75rem; line-height: 1.3; }
.post-body h3 { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; color: var(--fg); margin: 1.75rem 0 0.6rem; }
.post-body h4 { font-size: 0.9rem; font-weight: 700; color: var(--fg); margin: 1.5rem 0 0.5rem; }
.post-body p  { margin: 0 0 1rem; }
.post-body strong { color: var(--fg); font-weight: 700; }
.post-body em { font-style: italic; }
.post-body a  { color: var(--ring); text-decoration: underline; text-underline-offset: 3px; }
.post-body a:hover { opacity: 0.8; }
.post-body ul, .post-body ol { padding-left: 1.4rem; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.3rem; }
.post-body li { margin-bottom: 0.1rem; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.post-body blockquote {
  border-left: 3px solid var(--ring); padding-left: 1.25rem;
  margin: 1.25rem 0; color: var(--fg-muted); font-style: italic;
}
.post-body code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.82em;
  background: color-mix(in oklch, var(--ring) 10%, transparent);
  color: var(--ring); padding: 0.1em 0.4em; border-radius: 4px;
}
.post-body pre {
  background: color-mix(in oklch, var(--ring) 6%, #050505);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1.25rem 1.5rem; overflow-x: auto; margin: 1.5rem 0;
}
.post-body pre code { background: none; color: var(--fg); font-size: 0.8rem; line-height: 1.7; padding: 0; border-radius: 0; }
.post-body table {
  width: 100%; border-collapse: collapse;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; margin: 1.5rem 0; font-size: 0.82rem;
}
.post-body th {
  text-align: left; padding: 0.5rem 0.75rem;
  font-size: 0.65rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ring); font-weight: 700; border-bottom: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
}
.post-body td { padding: 0.55rem 0.75rem; border-bottom: 1px solid color-mix(in oklch, var(--border) 50%, transparent); }
.post-body tr:last-child td { border-bottom: none; }

/* ── Post footer nav ── */
.post-footer-nav {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  border-top: 1px solid var(--border); margin-top: 3rem; padding-top: 1.5rem;
}
.post-footer-nav a.back { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--ring); font-weight: 600; }
.post-footer-nav a.cta {
  font-size: 0.8rem; font-weight: 700; color: #000;
  background: var(--ring); padding: 0.5rem 1.1rem; border-radius: 8px;
}
.post-footer-nav a.cta:hover { opacity: 0.88; }

@media (max-width: 600px) {
  .nav-links { display: none; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

/* ── Post hero image ── */
.post-hero-image { width: 100%; height: 340px; object-fit: cover; border-radius: 16px; margin-bottom: 2rem; }
.post-inline-image { width: 100%; border-radius: 12px; margin: 1.5rem 0; object-fit: cover; max-height: 340px; }

/* ══════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════ */

.blog-sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: none;
  padding-right: 2px;
}
.blog-sidebar::-webkit-scrollbar { display: none; }

/* ── Sidebar widget card ── */
.sb-widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
}
.sb-widget-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--fg-muted);
  margin-bottom: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.sb-widget-title svg { color: var(--ring); flex-shrink: 0; }

/* ── TOC widget ── */
.sb-toc-list { list-style: none; display: flex; flex-direction: column; gap: 0; }
.sb-toc-h2 { padding: 0; }
.sb-toc-h3 { padding-left: 0.85rem; }
.sb-toc-link {
  display: block;
  font-size: 0.78rem; color: var(--fg-muted);
  padding: 0.3rem 0.5rem;
  border-left: 2px solid transparent;
  margin-left: -1px;
  border-radius: 0 4px 4px 0;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  line-height: 1.45;
}
.sb-toc-link:hover { color: var(--fg); background: oklch(0.12 0 0); }
.sb-toc-link.active {
  color: var(--ring);
  border-left-color: var(--ring);
  background: color-mix(in oklch, var(--ring) 8%, transparent);
  font-weight: 600;
}
.sb-toc-h3 .sb-toc-link { font-size: 0.73rem; }

/* ── Categories widget ── */
.sb-cats { list-style: none; display: flex; flex-direction: column; gap: 0.15rem; }
.sb-cat-all, .sb-cat-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.42rem 0.55rem; border-radius: 8px;
  font-size: 0.8rem; color: var(--fg-muted);
  transition: background 0.12s, color 0.12s;
}
.sb-cat-all:hover, .sb-cat-link:hover { background: oklch(0.12 0 0); color: var(--fg); }
.sb-cat-all { font-weight: 600; color: var(--fg); }
.sb-cat-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sb-cat-count {
  margin-left: auto;
  font-size: 0.65rem; font-family: 'JetBrains Mono', monospace;
  background: oklch(0.16 0 0); color: var(--fg-muted);
  padding: 0.1rem 0.45rem; border-radius: 20px;
  font-weight: 700;
}

/* ── Recent posts widget ── */
.sb-recent { display: flex; flex-direction: column; gap: 0.75rem; }
.sb-recent-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.5rem; border-radius: 8px;
  transition: background 0.12s;
}
.sb-recent-item:hover { background: oklch(0.12 0 0); }
.sb-recent-thumb {
  width: 52px; height: 52px; object-fit: cover;
  border-radius: 8px; flex-shrink: 0;
}
.sb-recent-info { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.sb-recent-title {
  font-size: 0.75rem; font-weight: 700; color: var(--fg);
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sb-recent-date { font-size: 0.65rem; color: var(--fg-muted); font-family: 'JetBrains Mono', monospace; }

/* ── CTA widget ── */
.sb-cta {
  background: color-mix(in oklch, var(--ring) 8%, var(--card));
  border-color: color-mix(in oklch, var(--ring) 22%, var(--border));
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
}
.sb-cta-icon { font-size: 1.8rem; }
.sb-cta-title { font-size: 0.88rem; font-weight: 800; color: var(--fg); letter-spacing: -0.01em; }
.sb-cta-desc { font-size: 0.72rem; color: var(--fg-muted); line-height: 1.6; }
.sb-cta-btn {
  display: block; width: 100%;
  background: var(--ring); color: #000;
  font-size: 0.8rem; font-weight: 700;
  padding: 0.6rem 1rem; border-radius: 10px;
  text-align: center; transition: opacity 0.15s;
}
.sb-cta-btn:hover { opacity: 0.88; }
.sb-cta-link { font-size: 0.72rem; color: var(--ring); font-weight: 600; }
.sb-cta-link:hover { text-decoration: underline; }
