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

:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-tertiary: #18181b;
  --bg-card: #141416;
  --bg-card-hover: #1a1a1d;
  --border: #27272a;
  --border-subtle: #1e1e21;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent-red: #dc2626;
  --accent-red-glow: rgba(220, 38, 38, 0.15);
  --accent-red-bright: #ef4444;
  --accent-slate: #94a3b8;
  --accent-cream: #f5f0e8;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;
  --font-serif: 'Instrument Serif', serif;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ─── Navigation ─── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}
nav.scrolled { background: rgba(10, 10, 11, 0.95); border-bottom-color: var(--border); }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}
.nav-logo img { height: 36px; filter: drop-shadow(0 0 8px rgba(220,38,38,0.2)); }
.nav-logo span { font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }

.nav-links { display: flex; align-items: center; gap: 2rem; list-style: none; }
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
  letter-spacing: 0.01em;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a.active { color: var(--text-primary); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent-red);
  color: white !important;
  border-radius: 6px;
  font-size: 0.8rem !important;
  font-family: var(--font-mono);
  font-weight: 600;
  transition: all 0.2s;
}
.nav-cta:hover { background: var(--accent-red-bright); transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-red-glow); }

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

/* ─── Terminal ─── */
.terminal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03) inset;
}
.terminal-header {
  display: flex;
  align-items: center;
  padding: 0;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.terminal-dots {
  display: flex;
  align-items: stretch;
  margin-left: auto;
  height: 100%;
}
.terminal-btn {
  width: 46px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: default;
  transition: background 0.15s;
}
.terminal-btn svg { width: 10px; height: 10px; stroke: var(--text-muted); stroke-width: 1.5; fill: none; }
.terminal-btn.minimize:hover { background: rgba(255,255,255,0.06); }
.terminal-btn.maximize:hover { background: rgba(255,255,255,0.06); }
.terminal-btn.close:hover { background: #c42b1c; }
.terminal-btn.close:hover svg { stroke: white; }
.terminal-title {
  flex: 1;
  text-align: left;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.terminal-body {
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.8;
  overflow-x: auto;
}
.terminal-body .prompt { color: var(--accent-red-bright); }
.terminal-body .cmd { color: var(--text-primary); }
.terminal-body .comment { color: var(--text-muted); }
.terminal-body .output { color: var(--accent-slate); }
.terminal-body .success { color: #22c55e; }
.terminal-body .flag { color: #facc15; }

/* ─── Page Content ─── */
.page-content {
  padding: 7rem 2rem 5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page-hero {
  padding: 8rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.page-hero .subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  line-height: 1.7;
}

section {
  padding: 4rem 0;
  max-width: 1200px;
  margin: 0 auto;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-red-bright);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}
.section-label::before { content: ''; width: 20px; height: 1px; background: var(--accent-red); }

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.divider {
  max-width: 1200px;
  margin: 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--accent-red);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary:hover { background: var(--accent-red-bright); transform: translateY(-2px); box-shadow: 0 8px 30px var(--accent-red-glow); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg-tertiary); border-color: var(--text-muted); transform: translateY(-2px); }

/* ─── Prose ─── */
.prose { max-width: 760px; }
.prose h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 400;
  margin: 3rem 0 1rem;
  letter-spacing: -0.02em;
}
.prose h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}
.prose p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.25rem;
}
.prose ul, .prose ol {
  color: var(--text-secondary);
  margin: 0 0 1.25rem 1.5rem;
  line-height: 1.8;
}
.prose li { margin-bottom: 0.5rem; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-red-bright);
}
.prose pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.prose a { color: var(--accent-red-bright); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-red); }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.prose th, .prose td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}
.prose th {
  background: var(--bg-tertiary);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.prose td { color: var(--text-secondary); }
.prose blockquote {
  border-left: 3px solid var(--accent-red);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: rgba(220,38,38,0.03);
  border-radius: 0 8px 8px 0;
}
.prose blockquote p { color: var(--text-secondary); margin-bottom: 0; }

/* ─── Docs Sidebar ─── */
.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  padding-top: 1rem;
}
.docs-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.docs-sidebar h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 1.5rem 0 0.5rem;
}
.docs-sidebar h4:first-child { margin-top: 0; }
.docs-sidebar a {
  display: block;
  padding: 6px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 6px;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}
.docs-sidebar a:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.docs-sidebar a.active { color: var(--accent-red-bright); border-left-color: var(--accent-red); background: rgba(220,38,38,0.04); }

/* ─── Blog Cards ─── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}
.blog-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.3s;
  text-decoration: none;
  display: block;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: 0 16px 48px rgba(0,0,0,0.3); border-color: rgba(220,38,38,0.2); }
.blog-card-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}
.blog-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.blog-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}
.blog-card-tag {
  display: inline-block;
  margin-top: 1rem;
  padding: 3px 10px;
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-red-bright);
}

/* ─── Footer ─── */
footer {
  border-top: 1px solid var(--border-subtle);
  padding: 3rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}
.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand img { height: 28px; }
.footer-brand span { font-family: var(--font-mono); font-weight: 600; font-size: 0.9rem; color: var(--text-secondary); }
.footer-links { display: flex; gap: 2rem; list-style: none; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--text-primary); }
.footer-copy {
  width: 100%;
  text-align: center;
  padding-top: 2rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ─── Animations ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; max-height: none; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  nav { padding: 0 1rem; }
  .page-content, .page-hero { padding-left: 1.5rem; padding-right: 1.5rem; }
  .blog-grid { grid-template-columns: 1fr; }
  .nav-links.show {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10,10,11,0.98);
    backdrop-filter: blur(20px);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
  }
}
