:root {
    color-scheme: light;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --accent: #f97316;
    --border: #e2e8f0;
    --code: #1e293b;
    --shadow: 0 15px 65px rgba(15, 23, 42, 0.12);
}

body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #05070d;
    --surface: #101625;
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #f97316;
    --border: rgba(148, 163, 184, 0.25);
    --shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
}

.blog-body {
    font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
}

.blog-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 5vw;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(245, 245, 247, 0.8);
    backdrop-filter: blur(18px);
}

body[data-theme="dark"] .blog-navbar {
    background: rgba(5, 7, 13, 0.8);
}

.blog-navbar__brand .logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.blog-navbar__brand .tagline {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
}

.blog-navbar__links a {
    margin-right: 1rem;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
}

.blog-navbar__links a.active,
.blog-navbar__links a:hover {
    color: var(--text);
}

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.blog-main {
    padding: 4rem 5vw 5rem;
}

.blog-hero {
    max-width: 960px;
    margin: 0 auto 3rem;
    text-align: left;
}

.blog-hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.8rem);
    margin-bottom: 1rem;
}

.blog-hero .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-size: 0.75rem;
    color: var(--muted);
}

.blog-search {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.blog-search input {
    flex: 1;
    padding: 0.9rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.blog-search button {
    padding: 0.9rem 1.6rem;
    border-radius: 999px;
    border: none;
    background: var(--text);
    color: var(--bg);
    cursor: pointer;
}

.blog-chips {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.chip {
    border: 1px solid var(--border);
    padding: 0.45rem 1rem;
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.85rem;
}

.chip.active {
    color: var(--bg);
    background: var(--text);
}

.featured-post {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    background: var(--surface);
    border-radius: 32px;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 3rem;
}

.featured-post__media {
    min-height: 320px;
    background-size: cover;
    background-position: center;
}

.featured-post__body {
    padding: 2.5rem;
}

.featured-meta {
    display: flex;
    gap: 0.6rem;
    color: var(--muted);
    margin-bottom: 1.2rem;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.8rem;
}

.post-card {
    background: var(--surface);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.post-card__image {
    padding-top: 55%;
    background-size: cover;
    background-position: center;
}

.post-card__body {
    padding: 1.8rem;
}

.post-card__body h3 {
    margin-top: 0.6rem;
}

.post-card__body h3 a {
    text-decoration: none;
    color: var(--text);
}

.post-card__meta {
    display: flex;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.blog-footer {
    padding: 3rem 5vw;
    text-align: center;
    border-top: 1px solid var(--border);
}

/* Detail page */
.article-hero {
    position: relative;
    min-height: 420px;
    border-radius: 36px;
    overflow: hidden;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

.article-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.75));
}

.article-hero__content {
    position: relative;
    z-index: 1;
    padding: 3rem;
    color: #fff;
}

.article-hero .subtitle {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.85);
}

.hero-meta {
    display: flex;
    gap: 0.5rem;
    color: rgba(255,255,255,0.75);
}

.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.like-button {
    border: none;
    background: var(--text);
    color: var(--bg);
    border-radius: 999px;
    padding: 0.8rem 1.6rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.like-button.liked {
    opacity: 0.6;
    cursor: not-allowed;
}

.share-buttons {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.share-buttons a,
.copy-link {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.65rem 1.2rem;
    text-decoration: none;
    color: var(--text);
    background: transparent;
}

.post-content {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 32px;
    box-shadow: var(--shadow);
    line-height: 1.8;
}

.post-content img,
.post-content iframe,
.post-content video {
    max-width: 100%;
    border-radius: 24px;
    margin: 1.5rem 0;
}

.post-content pre {
    background: #0f172a;
    color: #f8fafc;
    padding: 1rem;
    border-radius: 16px;
    overflow-x: auto;
}

.related-posts {
    margin-top: 3rem;
}

.comments {
    margin-top: 4rem;
    background: var(--surface);
    padding: 2.5rem;
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.comment-list {
    list-style: none;
    padding: 0;
}

.comment-list li {
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
}

.comment-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 0.9rem 1.1rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.9);
    color: var(--text);
}

body[data-theme="dark"] .comment-form input,
body[data-theme="dark"] .comment-form textarea {
    background: rgba(15, 23, 42, 0.6);
}

.comment-form button {
    margin-top: 1rem;
    padding: 0.9rem 1.8rem;
    border-radius: 999px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.form-errors,
.error {
    color: #ef4444;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .blog-navbar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .blog-navbar__links {
        display: flex;
        flex-wrap: wrap;
    }

    .article-hero__content {
        padding: 2rem;
    }

    .post-content,
    .comments {
        padding: 1.5rem;
    }
}
