/* Minimalist & Gentle Blog Design System */
:root {
    /* --- Light Theme (Default) --- */
    /* Backgrounds */
    --bg-body: #f9fafb;
    /* Soft Off-White */
    --bg-card: #ffffff;
    /* Pure White */
    --bg-header: rgba(255, 255, 255, 0.85);

    /* Text */
    --text-primary: #1f2937;
    /* Soft Charcoal */
    --text-secondary: #6b7280;
    /* Cool Grey */
    --text-tertiary: #9ca3af;
    /* Lighter Grey */

    /* Accents */
    --accent-primary: #6366f1;
    /* Soft Indigo */
    --accent-hover: #4f46e5;
    --accent-light: #e0e7ff;
    /* Very light indigo for tags/backgrounds */

    /* Borders & Shadows */
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
    /* Premium soft shadow */

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --header-height: 70px;
    --container-width: 1200px;

    /* Transitions */
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Background Image */
    --bg-image: url('../img/blog_bg_light.png');
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-body: #0f172a;
    /* Deep Blue-Grey (Slate 900) */
    --bg-card: #1e293b;
    /* Slate 800 */
    --bg-header: rgba(15, 23, 42, 0.85);

    /* Text */
    --text-primary: #f1f5f9;
    /* Slate 100 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --text-tertiary: #64748b;
    /* Slate 500 */

    /* Accents */
    --accent-primary: #818cf8;
    /* Light Indigo */
    --accent-hover: #6366f1;
    --accent-light: rgba(99, 102, 241, 0.15);

    /* Borders & Shadows */
    --border-color: #334155;
    /* Slate 700 */
    --shadow-sm: none;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);

    /* Background Image */
    --bg-image: url('../img/blog_bg_dark.png');
}

/* Global Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    background-image: var(--bg-image);
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    margin: 0;
    line-height: 1.6;
    font-size: 16px;
    transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out), background-image 0.3s var(--ease-out);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-primary);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-top: 0;
    color: var(--text-primary);
}

img {
    max-width: 100%;
    display: block;
    border-radius: var(--radius-md);
}

/* Utility */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

.text-accent {
    color: var(--accent-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

/* --- Header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    transition: border-color 0.3s, background-color 0.3s;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    padding: 4px 0;
}

.brand img {
    display: block;
    transition: transform 0.2s;
}

.brand:hover img {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-item {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
    padding: 4px 0;
}

.nav-item:hover {
    color: var(--text-primary);
}

.nav-item.active {
    color: var(--text-primary);
}

/* Theme Toggle Button */
#theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 999px;
    /* Pill shape */
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: 0.2s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#theme-toggle:hover {
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

/* --- Hero Section (Minimal) --- */
.hero-section {
    padding: 100px 0 60px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Blog Grid --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 40px;
    padding-bottom: 80px;
}

.blog-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 32px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
    border-color: var(--accent-primary);
}

.blog-card.featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .blog-card.featured {
        grid-template-columns: 1.5fr 1fr;
        align-items: center;
        padding: 48px;
    }
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 12px;
    line-height: 1.3;
}

.card-title a {
    color: var(--text-primary);
}

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

.card-excerpt {
    color: var(--text-secondary);
    margin-bottom: 24px;
    flex-grow: 1;
    font-size: 1rem;
}

.card-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.read-more {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.read-more:hover {
    gap: 8px;
    /* subtle slide effect */
}

/* Tags */
.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: var(--accent-light);
    padding: 4px 10px;
    border-radius: 99px;
    letter-spacing: 0.02em;
}

/* --- Article Page --- */
.article-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 60px 0 100px;
}

.article-header {
    margin-bottom: 48px;
    text-align: center;
}

.article-title {
    font-size: 2.75rem;
    line-height: 1.2;
    margin: 16px 0 24px;
}

.article-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.article-content {
    font-size: 1.125rem;
    /* 18px reading size */
    line-height: 1.8;
    color: var(--text-primary);
}

.article-content p {
    margin-bottom: 1.8em;
}

.article-content h2 {
    font-size: 1.75rem;
    margin-top: 2em;
    margin-bottom: 0.8em;
}

.article-content h3 {
    font-size: 1.4rem;
    margin-top: 1.5em;
    margin-bottom: 0.8em;
}

.article-content blockquote {
    border-left: 4px solid var(--accent-primary);
    margin: 2em 0;
    padding: 8px 0 8px 24px;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--text-secondary);
    background: transparent;
}

.article-content pre {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 0.9rem;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    line-height: 1.5;
    margin: 2em 0;
}

.article-content code {
    font-family: "JetBrains Mono", monospace;
    background: var(--accent-light);
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: 40px;
    background: var(--bg-card);
}

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

.footer-col h4 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 20px;
}

.footer-col p,
.footer-col a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 12px;
    display: block;
}

.footer-col a:hover {
    color: var(--accent-primary);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.25rem;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    .blog-card.featured {
        grid-template-columns: 1fr;
    }

    .article-title {
        font-size: 2rem;
    }

    .nav-links {
        display: none;
        /* Simplification for this task, ideally a burger menu */
    }

    /* Mobile nav fix for this specific task scope */
    .header-inner {
        flex-wrap: wrap;
    }

    .nav-links.mobile-visible {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding-top: 20px;
    }
}