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

:root {
  --bg: #0f0f0f;
  --bg-card: #161616;
  --bg-hover: #1e1e1e;
  --border: #2a2a2a;
  --accent: #7c6af7;
  --accent-light: #9d8fff;
  --text: #e8e8e8;
  --text-muted: #888;
  --text-dim: #555;
  --tag-bg: #1a1830;
  --tag-text: #9d8fff;
  --radius: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; transition: color .2s; }
a:hover { color: #fff; }
img { max-width: 100%; border-radius: var(--radius); }

/* ===== Layout ===== */
.container { max-width: 760px; margin: 0 auto; padding: 0 24px; }
.container--wide { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ===== Nav ===== */
nav {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: rgba(15,15,15,.9);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -.02em;
}
.nav-logo span { color: var(--accent); }

.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--text-muted); font-size: .9rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); }

/* ===== Hero (Homepage) ===== */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.15;
  margin-bottom: 16px;
}
.hero h1 .gradient {
  background: linear-gradient(135deg, var(--accent), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ===== Post Grid ===== */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
}
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.section-line { flex: 1; height: 1px; background: var(--border); }

.posts-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 80px;
}

/* Featured card (first post) */
.card--featured {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: border-color .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.card--featured::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #c084fc);
}
.card--featured:hover { border-color: var(--accent); transform: translateY(-2px); }

.card--featured .card-meta {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.badge-new {
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.card--featured .card-date { color: var(--text-dim); font-size: .85rem; }
.card--featured h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 10px; }
.card--featured h2 a { color: var(--text); }
.card--featured h2 a:hover { color: var(--accent-light); }
.card--featured .card-excerpt { color: var(--text-muted); font-size: .95rem; margin-bottom: 16px; }
.card--featured .card-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: .75rem;
  padding: 3px 10px;
  border-radius: 99px;
  font-weight: 500;
}

/* Regular cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color .2s, background .2s;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.card:hover { border-color: var(--border); background: var(--bg-hover); }

.card-number {
  color: var(--text-dim);
  font-size: .8rem;
  font-family: var(--font-mono);
  min-width: 28px;
  padding-top: 4px;
}
.card-body { flex: 1; min-width: 0; }
.card-body .card-date { color: var(--text-dim); font-size: .8rem; margin-bottom: 6px; }
.card-body h3 { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 4px; }
.card-body h3 a { color: var(--text); }
.card-body h3 a:hover { color: var(--accent-light); }
.card-body .card-excerpt { color: var(--text-muted); font-size: .88rem; line-height: 1.6; }
.card-body .card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ===== Post Page ===== */
.post-header { padding: 64px 0 40px; border-bottom: 1px solid var(--border); margin-bottom: 48px; }
.post-header .post-tags { display: flex; gap: 8px; margin-bottom: 20px; }
.post-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.2;
  margin-bottom: 16px;
}
.post-meta { display: flex; gap: 20px; color: var(--text-muted); font-size: .9rem; }
.post-meta span::before { content: '·'; margin-right: 8px; color: var(--text-dim); }
.post-meta span:first-child::before { display: none; }

/* ===== Prose ===== */
.prose {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #d4d4d4;
}
.prose h2 { font-size: 1.5rem; font-weight: 700; margin: 40px 0 16px; letter-spacing: -.02em; color: var(--text); }
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 32px 0 12px; color: var(--text); }
.prose p { margin-bottom: 20px; }
.prose ul, .prose ol { margin: 0 0 20px 24px; }
.prose li { margin-bottom: 8px; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 24px;
  margin: 24px 0;
  background: var(--bg-card);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}
.prose code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: #c084fc;
}
.prose pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin: 24px 0;
}
.prose pre code { background: none; border: none; padding: 0; font-size: .9rem; color: var(--text); }
.prose a { color: var(--accent-light); border-bottom: 1px solid transparent; }
.prose a:hover { border-bottom-color: var(--accent-light); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }
.prose strong { color: var(--text); font-weight: 600; }
.prose img { display: block; margin: 32px auto; box-shadow: 0 8px 32px rgba(0,0,0,.4); }

/* Source link */
.source-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 32px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
}
.source-box .source-label { color: var(--text-muted); white-space: nowrap; }
.source-box a { color: var(--accent-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Back button */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: 60px;
  margin-bottom: 60px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all .2s;
}
.back-link:hover { color: var(--text); border-color: var(--text-dim); }

/* ===== Footer ===== */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: .85rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .card { flex-direction: column; gap: 8px; }
  .card-number { display: none; }
  .hero { padding: 48px 0 40px; }
  .nav-links { gap: 16px; }
}
