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

:root {
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-muted: #888;
  --text-dim: #555;
  --accent: #7c6af7;
  --accent-soft: #3d3566;
  --tag-bg: #1e1e2e;
  --tag-text: #a78bfa;
  --code-bg: #1e1e1e;
  --radius: 12px;
  --radius-sm: 6px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Layout === */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}

/* === Header / Nav === */
header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.nav {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-title:hover {
  color: var(--accent);
}

.site-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* === Home === */
.home-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.home-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

/* === Post Cards === */
.posts {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.post-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-soft);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.post-card-meta time {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.post-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.post-card h2 a {
  color: var(--text);
  text-decoration: none;
}

.post-card h2 a:hover {
  color: var(--accent);
}

.post-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.empty {
  color: var(--text-muted);
  font-style: italic;
}

/* === Tags === */
.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* === Single Post === */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.post-meta time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.post-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

/* === Post Content Typography === */
.post-content {
  font-size: 1rem;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.02em;
}

.post-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.post-content p {
  margin-bottom: 1.2rem;
  color: #d0d0d0;
}

.post-content ul, .post-content ol {
  margin: 0.75rem 0 1.2rem 1.5rem;
}

.post-content li {
  margin-bottom: 0.4rem;
  color: #d0d0d0;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-content a:hover {
  opacity: 0.8;
}

.post-content strong {
  color: var(--text);
  font-weight: 600;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--bg-card);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  color: #a78bfa;
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}

.post-content pre code {
  background: none;
  color: #e8e8e8;
  padding: 0;
  font-size: 0.875rem;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.post-content th, .post-content td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

.post-content th {
  background: var(--bg-card);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === Post Footer === */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--accent);
}

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

/* === Responsive === */
@media (max-width: 640px) {
  .home-header h1 {
    font-size: 1.5rem;
  }

  .post-header h1 {
    font-size: 1.4rem;
  }

  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}
