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

:root {
    --bg: #ffffff;
    --text: #222222;
    --muted: #666666;
    --border: #e5e5e5;
    --accent: #0066cc;
    --nav-bg: #1a1a2e;
    --code-bg: #f4f4f4;
    --max-content: 760px;
    --max-wide: 1140px;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
}

/* ── Nav ─────────────────────────────────────────────────────────────── */
.site-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0.9rem 2rem;
    background: var(--nav-bg);
}

.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.site-logo img {
    display: block;
    height: 38px;
    width: auto;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    margin-left: auto;
}

.nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s;
}

.nav-links a:hover { color: #ffffff; }

/* ── Layout ──────────────────────────────────────────────────────────── */
main { min-height: 70vh; }

.container {
    max-width: var(--max-wide);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
    background: var(--nav-bg);
    color: #fff;
    padding: 3rem 2rem;
}

.hero h1 { margin: 0 0 0.5rem; font-size: 2rem; }
.hero p  { margin: 0; color: rgba(255,255,255,0.7); font-size: 1.05rem; }

.page-header {
    background: #f7f8fa;
    border-bottom: 1px solid var(--border);
    padding: 2rem 1.5rem;
}

.page-header h1 { margin: 0 0 0.25rem; font-size: 1.6rem; }
.page-header p  { margin: 0; color: var(--muted); }

/* ── Blog grid ───────────────────────────────────────────────────────── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2.5rem 0;
}

.blog-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s;
}

.blog-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.09); }

.blog-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.blog-card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.blog-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    line-height: 1.4;
}

.blog-card-title a {
    color: var(--text);
    text-decoration: none;
}

.blog-card-title a:hover { color: var(--accent); }

.author-link {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
}

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

.blog-card-excerpt {
    font-size: 0.875rem;
    color: var(--muted);
    flex: 1;
    margin-bottom: 1rem;
}

.blog-card-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: auto;
}

/* ── Taxonomy pills ──────────────────────────────────────────────────── */
.pill {
    display: inline-block;
    background: #eef3fb;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.15s;
}

.pill:hover { background: #dce9f9; }

.pill-tag {
    background: #f0f0f0;
    color: #444;
}

.pill-tag:hover { background: #e0e0e0; }

/* ── Blog post content ───────────────────────────────────────────────── */
.post-header {
    background: var(--nav-bg);
    color: #fff;
    padding: 3rem 1.5rem 2.5rem;
}

.post-header .breadcrumb {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.75rem;
}

.post-header .breadcrumb a { color: rgba(255,255,255,0.5); text-decoration: none; }
.post-header .breadcrumb a:hover { color: rgba(255,255,255,0.8); }

.post-header h1 {
    font-size: 1.75rem;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.post-header .post-meta {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}

.post-featured-img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}

.post-body {
    padding: 2.5rem 0 4rem;
}

/* Prose styles */
.prose { max-width: var(--max-content); }
.prose h2, .prose h3, .prose h4 { margin-top: 2rem; line-height: 1.3; }
.prose h2 { font-size: 1.4rem; }
.prose h3 { font-size: 1.2rem; }
.prose a { color: var(--accent); }
.prose a:hover { text-decoration: none; }
.prose img { max-width: 100%; border-radius: 6px; margin: 1.5rem 0; }
.prose blockquote {
    border-left: 4px solid var(--accent);
    margin: 1.5rem 0;
    padding: 0.5rem 1.25rem;
    color: var(--muted);
    background: #f7f8fa;
    border-radius: 0 6px 6px 0;
}

/* Code */
.prose code {
    font-family: ui-monospace, "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 0.875em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.prose pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.prose pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* ── Taxonomy listing ────────────────────────────────────────────────── */
.taxonomy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 2rem 0;
}

.taxonomy-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.taxonomy-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,102,204,0.1);
}

.taxonomy-card-name { font-weight: 600; font-size: 0.95rem; }
.taxonomy-card-count { font-size: 0.8rem; color: var(--muted); }

/* ── Post list (category/tag pages) ─────────────────────────────────── */
.post-list { list-style: none; margin: 0; padding: 2rem 0 3rem; }
.post-list li {
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 0;
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
}
.post-list li:first-child { border-top: 1px solid var(--border); }
.post-list .post-date { font-size: 0.8rem; color: var(--muted); white-space: nowrap; min-width: 90px; }
.post-list .post-title { font-size: 0.95rem; font-weight: 500; }
.post-list .post-title a { color: var(--text); text-decoration: none; }
.post-list .post-title a:hover { color: var(--accent); }

/* ── Pagination ──────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    padding: 2rem 0;
    list-style: none;
    margin: 0;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text);
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

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

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .site-nav { flex-wrap: wrap; gap: 0.75rem; padding: 0.75rem 1rem; }
    .nav-links { margin-left: 0; gap: 1rem; }
    .blog-grid { grid-template-columns: 1fr; }
    .post-header h1 { font-size: 1.4rem; }
    .hero h1 { font-size: 1.5rem; }
}
