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

:root {
  --bg:         #0d0f14;
  --surface:    #13161d;
  --card:       #181c25;
  --border:     #252a36;
  --border-hi:  #2f3647;
  --accent:     #00e5a0;
  --accent-dim: #00b07a;
  --danger:     #ff4d6d;
  --warn:       #ffb627;
  --text:       #e2e8f0;
  --muted:      #64748b;
  --mono:       'JetBrains Mono', monospace;
  --sans:       'Syne', sans-serif;
}

html, body { height: 100%; }

body {
  font-family: var(--mono);
  background: var(--bg); color: var(--text);
  min-height: 100vh; display: flex; flex-direction: column;
  position: relative; overflow-x: hidden;
}

body::before {
  content: ''; position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(0,229,160,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,160,.025) 1px, transparent 1px);
  background-size: 44px 44px; pointer-events: none; z-index: 0;
}

body::after {
  content: ''; position: fixed; width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, rgba(96,165,250,.04) 0%, transparent 70%);
  top: -150px; right: -200px; pointer-events: none; z-index: 0;
}

.page {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; min-height: 100vh; gap: 1.5rem;
  padding: 1.75rem 1.5rem 3rem;
  max-width: 1400px; margin: 0 auto; width: 100%;
}

/* ── Blog Index ── */
.blog-header { margin-bottom: .25rem; }
.blog-header .tag { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: .35rem; display: flex; align-items: center; gap: .4rem; }
.blog-header .tag::before { content: '>'; }
.blog-header h1 { font-family: var(--sans); font-size: 1.9rem; font-weight: 700; letter-spacing: -.015em; line-height: 1; }
.blog-header h1 span { color: var(--accent); }
.blog-header p { font-size: .8rem; color: var(--muted); margin-top: .6rem; line-height: 1.7; max-width: 560px; }

.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }

.post-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.4rem; display: flex; flex-direction: column; gap: .7rem;
  text-decoration: none; color: inherit;
  transition: border-color .15s, transform .15s; position: relative; overflow: hidden;
}
.post-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at top left, rgba(0,229,160,.06), transparent 60%);
  opacity: 0; transition: opacity .2s;
}
.post-card:hover { border-color: var(--border-hi); transform: translateY(-2px); }
.post-card:hover::before { opacity: 1; }

.post-card-cats { display: flex; gap: .4rem; flex-wrap: wrap; position: relative; z-index: 1; }
.post-cat {
  font-size: .6rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: .18rem .45rem; border-radius: 4px;
  color: var(--accent); background: rgba(0,229,160,.1); border: 1px solid rgba(0,229,160,.25);
}
.post-cat.cat-django { color: #60a5fa; background: rgba(96,165,250,.1); border-color: rgba(96,165,250,.25); }
.post-cat.cat-python { color: #fbbf24; background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.25); }
.post-cat.cat-perf   { color: #fb7185; background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.25); }

.post-card-title { font-family: var(--sans); font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; color: var(--text); position: relative; z-index: 1; }
.post-card-excerpt { font-size: .75rem; color: var(--muted); line-height: 1.75; flex: 1; position: relative; z-index: 1; }
.post-card-meta { display: flex; align-items: center; gap: .4rem; font-size: .64rem; color: var(--muted); position: relative; z-index: 1; }
.post-card-meta .ms { color: var(--border-hi); }
.post-card-cta { display: flex; align-items: center; gap: .35rem; font-size: .7rem; color: var(--accent); position: relative; z-index: 1; }
.post-card-cta svg { transition: transform .15s; }
.post-card:hover .post-card-cta svg { transform: translateX(3px); }

/* ── Article ── */
.post { width: 100%; }

.post-breadcrumb {
  display: flex; align-items: center; gap: .4rem;
  font-size: .68rem; color: var(--muted); margin-bottom: 1.5rem;
}
.post-breadcrumb a { color: var(--accent-dim); text-decoration: none; }
.post-breadcrumb a:hover { color: var(--accent); }
.post-breadcrumb .sep { color: var(--border-hi); }

.post-header { margin-bottom: 2rem; }
.post-header-cats { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .9rem; }
.post-header h1 { font-family: var(--sans); font-size: 2.1rem; font-weight: 700; letter-spacing: -.018em; line-height: 1.15; margin-bottom: .85rem; }
.post-lead { font-size: .85rem; color: #94a3b8; line-height: 1.8; margin-bottom: 1rem; }
.post-meta { display: flex; align-items: center; gap: .45rem; font-size: .68rem; color: var(--muted); flex-wrap: wrap; }
.post-meta .ms { color: var(--border-hi); }
.post-meta-author { color: var(--accent-dim); }

/* Table of Contents */
.post-toc {
  background: var(--card); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 1rem 1.25rem; margin-bottom: 2.5rem; font-size: .76rem;
}
.toc-title { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: .6rem; }
.post-toc ol { padding-left: 1.1rem; color: var(--muted); display: flex; flex-direction: column; gap: .3rem; }
.post-toc a { color: var(--muted); text-decoration: none; transition: color .12s; }
.post-toc a:hover { color: var(--accent); }

/* Article body prose */
.post-body { font-size: .84rem; line-height: 1.85; color: #cbd5e1; }
.post-body h2 {
  font-family: var(--sans); font-size: 1.25rem; font-weight: 700;
  letter-spacing: -.01em; color: var(--text); margin: 2.5rem 0 .7rem; padding-top: .25rem;
}
.post-body h3 { font-size: .88rem; font-weight: 600; color: var(--text); margin: 1.75rem 0 .55rem; letter-spacing: .02em; }
.post-body p { margin-bottom: 1rem; }
.post-body ul, .post-body ol { padding-left: 1.4rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.post-body li { line-height: 1.75; }
.post-body strong { color: var(--text); font-weight: 600; }
.post-body a { color: var(--accent-dim); text-underline-offset: 3px; }
.post-body a:hover { color: var(--accent); }

.post-body code {
  font-family: var(--mono); font-size: .79em;
  background: rgba(0,229,160,.07); border: 1px solid rgba(0,229,160,.18);
  color: var(--accent); padding: .1em .35em; border-radius: 4px;
}

.pre-wrap { position: relative; margin: 1.25rem 0; }
.pre-wrap pre {
  background: #0a0d12; border: 1px solid var(--border); border-radius: 10px;
  padding: 1.1rem 1.25rem; overflow-x: auto;
}
.pre-wrap pre code {
  background: none; border: none; color: #cdd9e5; padding: 0;
  font-size: .78rem; line-height: 1.8;
}
.copy-btn {
  position: absolute; top: .6rem; right: .65rem;
  font-family: var(--mono); font-size: .6rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: .2rem .5rem; cursor: pointer; transition: all .12s;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-hi); }
.copy-btn.copied { color: var(--accent); border-color: rgba(0,229,160,.35); }

.post-body blockquote {
  border-left: 3px solid var(--accent-dim); padding: .75rem 1rem;
  background: rgba(0,229,160,.04); border-radius: 0 6px 6px 0;
  margin: 1.25rem 0; color: #94a3b8; font-style: italic;
}
.post-divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.post-footer {
  margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.post-footer-back { font-size: .75rem; color: var(--accent-dim); text-decoration: none; display: flex; align-items: center; gap: .35rem; }
.post-footer-back:hover { color: var(--accent); }
.post-footer-meta { font-size: .68rem; color: var(--muted); }

/* Footer note */
.footer-note { font-size: .63rem; color: var(--muted); text-align: center; letter-spacing: .04em; }
.footer-note a { color: var(--accent-dim); text-decoration: none; }
.footer-note a:hover { color: var(--accent); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 99px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.page { animation: fadeUp .35s ease both; }

@media (max-width: 860px) {
  .post-header h1 { font-size: 1.65rem; }
  .blog-grid { grid-template-columns: 1fr; }
}

/* ── Site Nav ── */
.site-nav { position: sticky; top: 0; z-index: 1000; background: rgba(13,15,20,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.site-nav-inner { display: flex; align-items: center; height: 56px; gap: 2rem; max-width: 1400px; margin: 0 auto; padding: 0 2rem; width: 100%; }
.nav-logo { font-family: var(--mono); font-size: .85rem; font-weight: 700; color: var(--accent); text-decoration: none; letter-spacing: -.01em; white-space: nowrap; display: flex; align-items: center; gap: .15rem; }
.nav-logo .brace { color: var(--muted); font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; flex: 1; }
.nav-links a { font-family: var(--mono); font-size: .78rem; color: var(--muted); text-decoration: none; letter-spacing: .03em; transition: color .14s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { display: inline-flex; align-items: center; gap: .35rem; background: none; border: none; cursor: pointer; font-family: var(--mono); font-size: .78rem; color: var(--accent); padding: 0; letter-spacing: .03em; transition: color .14s; }
.nav-dropdown-toggle:hover { color: #00ffb3; }
.nav-dropdown-toggle svg { transition: transform .2s ease; }
.nav-dropdown.open .nav-dropdown-toggle svg { transform: rotate(180deg); }
.nav-dropdown-menu { position: absolute; top: calc(100% + 1rem); left: 50%; transform: translateX(-50%); min-width: 220px; background: #181c25; border: 1px solid var(--border-hi); border-radius: 10px; padding: .4rem; display: none; flex-direction: column; gap: .15rem; box-shadow: 0 12px 32px rgba(0,0,0,.6); z-index: 999; }
.nav-dropdown.open .nav-dropdown-menu { display: flex; animation: dropIn .15s ease both; }
.nav-dropdown-menu a { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 7px; font-size: .75rem; color: #94a3b8; text-decoration: none; transition: background .12s, color .12s; white-space: nowrap; letter-spacing: .02em; }
.nav-dropdown-menu a:hover { background: rgba(0,229,160,.07); color: var(--accent); }
.nav-dropdown-menu a.active { background: rgba(0,229,160,.1); color: var(--accent); }
.nav-dropdown-menu a svg { opacity: .55; flex-shrink: 0; }
.nav-dropdown-menu a:hover svg, .nav-dropdown-menu a.active svg { opacity: 1; }
@keyframes dropIn { from { opacity: 0; transform: translateX(-50%) translateY(-6px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.nav-cv { font-family: var(--mono); font-size: .72rem; font-weight: 700; padding: .35rem .85rem; border-radius: 6px; background: var(--accent); color: #0d0f14; text-decoration: none; letter-spacing: .05em; transition: background .14s; white-space: nowrap; margin-left: auto; }
.nav-cv:hover { background: #00ffb3; }
@media (max-width: 640px) { .nav-links a:not(.nav-dropdown-toggle) { display: none; } }
