/* ===== Reset & Variables ===== */
:root {
  --bg: #fafaf9;
  --card-bg: #ffffff;
  --text: #1c1917;
  --text-muted: #78716c;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e7e5e4;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --max-w: 720px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.85);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
}
.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo:hover { color: var(--accent); }
nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}
nav a:hover { color: var(--accent); }

/* ===== Main Container ===== */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  width: 100%;
  flex: 1;
}

/* ===== Page Title ===== */
.page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}
.page-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

/* ===== Post Cards Grid ===== */
.posts-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}
.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--accent);
}
.post-card-link {
  display: block;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
}
.post-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}
.post-card time {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}
.post-card .excerpt {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===== Single Post ===== */
.single-post { margin-top: 0.5rem; }
.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent-hover); }
.single-post > time {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}
.post-body {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.post-body h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.75rem; letter-spacing: -0.02em; }
.post-body h2 { font-size: 1.35rem; font-weight: 700; margin: 1.8rem 0 0.5rem; }
.post-body h3 { font-size: 1.1rem; font-weight: 700; margin: 1.3rem 0 0.4rem; }
.post-body p { margin-bottom: 1rem; }
.post-body ul, .post-body ol { margin: 0.5rem 0 1rem 1.5rem; }
.post-body li { margin-bottom: 0.35rem; }
.post-body a { color: var(--accent); text-decoration: underline; }
.post-body a:hover { color: var(--accent-hover); }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-style: italic;
}
.post-body code {
  background: #f5f5f4;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}
.post-body pre {
  background: #1c1917;
  color: #e7e5e4;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
}
.post-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.post-body img { max-width: 100%; border-radius: 8px; margin: 1rem 0; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.empty-state h2 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.empty-state p { color: var(--text-muted); margin-bottom: 0.75rem; }
.empty-state pre { display: inline-block; text-align: left; }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--accent); text-decoration: none; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .container { padding: 1.25rem 1rem 2.5rem; }
  .page-title { font-size: 1.5rem; }
  .post-card-link { padding: 1.25rem; }
  .post-card h2 { font-size: 1.1rem; }
  .post-body { padding: 1.25rem; }
}
