/* ── Design Tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --border: #e2e8f0;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::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.6; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container { max-width: 860px; margin: 0 auto; padding: 0 24px; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.blog-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.blog-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.blog-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem; font-weight: 500;
  color: var(--text); letter-spacing: -0.5px;
}
.blog-logo::before { content: '> '; color: var(--accent); }
.admin-link {
  font-size: .8rem; font-family: var(--font-mono);
  color: var(--text-muted); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 100px;
  transition: all .15s;
}
.admin-link:hover { border-color: var(--accent); color: var(--accent); }

/* ── Post Grid ─────────────────────────────────────────────────────────────── */
main.container { padding-top: 48px; padding-bottom: 80px; }

.post-grid { display: grid; gap: 24px; margin-top: 8px; }

@media (min-width: 640px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
}
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.post-card-cover { width: 100%; height: 180px; object-fit: cover; }

.post-card-body { padding: 20px; }

.post-meta {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.post-meta time { font-size: .8rem; color: var(--text-muted); font-family: var(--font-mono); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: .75rem; font-family: var(--font-mono);
  color: var(--accent); background: rgba(14,165,233,.08);
  padding: 2px 8px; border-radius: 100px;
  transition: background .15s;
}
.tag:hover { background: rgba(14,165,233,.18); color: var(--accent); }

.post-card-title { font-size: 1.15rem; font-weight: 600; line-height: 1.3; margin-bottom: 8px; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt { font-size: .9rem; color: var(--text-muted); margin-bottom: 16px; }

.read-more { font-size: .85rem; font-weight: 500; color: var(--accent); }

/* ── Tag filter ────────────────────────────────────────────────────────────── */
.tag-filter {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px; font-size: .9rem; color: var(--text-muted);
}
.clear-tag { font-size: .8rem; color: var(--text-muted); text-decoration: underline; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 48px;
}
.page-btn {
  padding: 8px 16px; border: 1px solid var(--border);
  border-radius: 6px; font-size: .875rem; color: var(--text);
  transition: border-color .15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-info { font-size: .875rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ── Single Post ─────────────────────────────────────────────────────────── */
.post-container { max-width: 720px; }

.post-full { padding: 48px 0; }

.post-header { margin-bottom: 40px; }
.post-header .tag-list { margin-bottom: 16px; }

.post-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600; line-height: 1.2; letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.post-header .post-meta time {
  font-size: .85rem; color: var(--text-muted); font-family: var(--font-mono);
}

.post-cover-image {
  width: 100%; border-radius: var(--radius);
  margin-top: 24px; max-height: 400px; object-fit: cover;
}

/* ── Post Content (Markdown) ────────────────────────────────────────────── */
.post-content { font-size: 1.0625rem; line-height: 1.8; }
.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
  font-weight: 600; letter-spacing: -0.3px; margin: 1.8em 0 0.6em;
  line-height: 1.3;
}
.post-content h1 { font-size: 1.75rem; }
.post-content h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.post-content h3 { font-size: 1.15rem; }
.post-content p { margin: 0 0 1.2em; }
.post-content ul, .post-content ol { margin: 0 0 1.2em 1.5em; }
.post-content li { margin-bottom: 4px; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5em 0; padding: 12px 20px;
  background: rgba(14,165,233,.05);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
}
.post-content code {
  font-family: var(--font-mono);
  font-size: .875em; background: #f1f5f9;
  padding: 2px 6px; border-radius: 4px;
}
.post-content pre {
  background: #0f172a; color: #e2e8f0;
  padding: 20px; border-radius: var(--radius);
  overflow-x: auto; margin: 1.5em 0;
}
.post-content pre code { background: none; padding: 0; color: inherit; font-size: .875rem; }
.post-content a { text-decoration: underline; text-underline-offset: 3px; }
.post-content img { border-radius: var(--radius); margin: 1.5em 0; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.post-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; }
.post-content th, .post-content td {
  padding: 10px 14px; border: 1px solid var(--border); text-align: left;
}
.post-content th { background: #f1f5f9; font-weight: 600; }

.post-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.back-link { font-size: .9rem; color: var(--text-muted); }
.back-link:hover { color: var(--accent); }

/* ── Error Page ───────────────────────────────────────────────────────────── */
.error-page-bg {
  min-height: 60vh;
  background: url('https://storage.googleapis.com/blog-cms-media/media/688d70e0-14f3-4ba8-b007-9293f93149da.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin: 40px 0;
}
.error-page {
  text-align: center;
  padding: 60px 40px;
  background: rgba(0,0,0,0.55);
  border-radius: 12px;
  backdrop-filter: blur(4px);
}
.error-page .error-code,
.error-page h1,
.error-page p { color: #fff; }
.error-code {
  display: block; font-size: 5rem; font-family: var(--font-mono);
  font-weight: 500; line-height: 1; margin-bottom: 16px;
}
.error-page h1 { font-size: 1.5rem; margin-bottom: 8px; }
.error-page p { margin-bottom: 24px; opacity: 0.85; }
.btn-primary {
  display: inline-block; padding: 10px 20px;
  background: var(--accent); color: #fff;
  border-radius: 6px; font-weight: 500;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 0; color: var(--text-muted); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.blog-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0; text-align: center;
}
.blog-footer p { font-size: .85rem; color: var(--text-muted); font-family: var(--font-mono); }
