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

:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --blue: #58a6ff;
  --green: #7ee787;
  --pink: #f778ba;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  border-top: 3px solid var(--blue);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/assets/img/matrix-rain.gif') center center / cover no-repeat;
  opacity: 0.045;
  pointer-events: none;
  z-index: 0;
}

header, main, footer { position: relative; z-index: 1; }

/* ── Nav ── */
header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
}
nav {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo::before { content: "~/"; color: var(--green); }
.logo::after  { content: "_"; animation: blink 1s step-end infinite; }
@keyframes blink { from,to{opacity:1} 50%{opacity:0} }
.nav-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--green);
  flex-shrink: 0;
  order: -1;
}
.nav-links { display: flex; gap: 0.75rem; }
.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: color 0.2s, border-color 0.2s;
}
.nav-links a:hover { color: var(--blue); border-color: var(--blue); }

/* ── Main ── */
main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
  flex: 1;
  width: 100%;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--mono);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--blue); }

/* ── Hero ── */
.hero {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3.5rem 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2358a6ff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  z-index: 0;
}
.hero-content { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; }
.hero h1 {
  font-family: var(--mono);
  font-size: 2.2rem;
  color: var(--blue);
  margin-bottom: 1rem;
  line-height: 1.2;
}
.hero h1::before { content: "function "; color: var(--green); font-size: 0.75em; }
.hero h1::after  { content: "() {"; color: var(--muted); font-size: 0.75em; }
.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 0;
}
.hero p::after {
  content: "}";
  display: block;
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--muted);
  margin-top: 1rem;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
  margin-bottom: 1.5rem;
}
.status-pill .dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Layout ── */
.content-wrapper {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}
@media (max-width: 768px) {
  .content-wrapper { grid-template-columns: 1fr; }
  main { padding: 1.5rem 1rem 3rem; }
  header { padding: 1rem; }
  .hero { padding: 2rem 1rem; }
  .hero h1 { font-size: 1.6rem; }
}

/* ── Post cards ── */
.posts-container { display: flex; flex-direction: column; gap: 1.5rem; }

.post-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}
.post-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--pink));
  opacity: 0;
  transition: opacity 0.3s;
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); border-color: var(--blue); }
.post-card:hover::before { opacity: 1; }

.post-card-content {
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.post-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.post-body { flex: 1; min-width: 0; }
.post-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--mono);
  margin-bottom: 0.5rem;
}
.post-meta::before { content: "// "; color: var(--green); }
.post-title { font-size: 1.1rem; font-family: var(--mono); margin-bottom: 0.5rem; line-height: 1.3; }
.post-title a { color: var(--blue); text-decoration: none; transition: color 0.2s; }
.post-title a:hover { color: var(--green); }
.post-excerpt { color: var(--muted); font-size: 0.9rem; margin-bottom: 1rem; border-left: 2px solid var(--border); padding-left: 0.75rem; }
.read-more { font-family: var(--mono); font-size: 0.85rem; color: var(--green); text-decoration: none; transition: color 0.2s; }
.read-more:hover { color: var(--blue); }

/* ── Sidebar ── */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.sidebar-card h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--blue);
  margin-bottom: 0.75rem;
}
.sidebar-card h3::before { content: "// "; color: var(--green); }
.sidebar-card p { color: var(--muted); font-size: 0.9rem; }
.sidebar-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
  margin: 0 auto 0.75rem;
}
.topics-list { list-style: none; }
.topics-list li {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.topics-list li::before { content: "import "; color: var(--green); }
.topics-list li:last-child { border-bottom: none; }

/* ── Single post ── */
.post-single {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
}
.post-single .post-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.post-single h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 0.5rem; }
.post-single .post-meta { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }
.post-single .post-meta::before { content: "// "; color: var(--green); }
.post-content { line-height: 1.8; }
.post-content p { margin-bottom: 1.25rem; }
.post-content h2, .post-content h3 { font-family: var(--mono); color: var(--blue); margin: 2rem 0 0.75rem; }
.post-content h2::before, .post-content h3::before { content: "# "; color: var(--green); }
.post-content a { color: var(--blue); }
.post-content a:hover { color: var(--green); }
.post-content ul, .post-content ol { margin: 0 0 1.25rem 1.5rem; }
.post-content li { margin-bottom: 0.3rem; }
.post-content blockquote { border-left: 3px solid var(--blue); padding: 0.5rem 1.25rem; color: var(--muted); margin: 1.5rem 0; font-style: italic; }
.post-content code { font-family: var(--mono); font-size: 0.85em; background: var(--bg); padding: 0.15em 0.4em; border-radius: 3px; color: var(--green); }
.post-content pre { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1.25rem; overflow-x: auto; margin-bottom: 1.25rem; }
.post-content pre code { background: none; padding: 0; }
.post-footer { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.post-footer a { font-family: var(--mono); color: var(--blue); text-decoration: none; }
.post-footer a:hover { color: var(--green); }

/* ── All posts page ── */
h1.page-title { font-family: var(--mono); color: var(--blue); font-size: 1.8rem; margin-bottom: 1.5rem; }
h1.page-title::before { content: "// "; color: var(--green); }

/* Tag chips */
.post-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0.75rem; }
.tag-chip {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--green);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.tag-chip:hover { border-color: var(--green); color: var(--blue); text-decoration: none; }

/* Topics list links */
.topics-list li a { color: var(--muted); text-decoration: none; }
.topics-list li a:hover { color: var(--green); }
