:root {
    --bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --text: #1a1a2e;
    --text-secondary: #6c757d;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --border: #e9ecef;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.06);
    --nav-bg: rgba(255, 255, 255, 0.85);
    --tag-bg: #eef2ff;
    --tag-text: #4f46e5;
    --code-bg: #f1f3f5;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --border: #334155;
    --card-bg: #1e293b;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --nav-bg: rgba(15, 23, 42, 0.85);
    --tag-bg: #312e81;
    --tag-text: #c7d2fe;
    --code-bg: #1e293b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

.container {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.logo-dot {
    color: var(--accent);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.25rem 0;
    position: relative;
}

.nav-links a.active,
.nav-links a:hover {
    color: var(--text);
}

.nav-links a.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.4rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
}

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: inline; }

.menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
}

.menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: 0.3s;
}

/* ===== Hero ===== */
.hero {
    padding: 8rem 0 3rem;
    text-align: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ===== Posts ===== */
.posts {
    padding: 3rem 0;
}

.post-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.3s, transform 0.2s;
}

.post-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.post-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.post-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: var(--tag-bg);
    color: var(--tag-text);
}

.post-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    line-height: 1.4;
}

.post-title a {
    color: var(--text);
}

.post-title a:hover {
    color: var(--accent);
}

.post-excerpt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.read-more {
    font-size: 0.9rem;
    font-weight: 600;
}

/* ===== Article Page ===== */
.article {
    padding: 7rem 0 3rem;
}

.article-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.article-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.article-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.article-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

.article-content p {
    margin-bottom: 1.2rem;
    color: var(--text-secondary);
}

.article-content ul,
.article-content ol {
    margin: 1rem 0 1.2rem 1.5rem;
    color: var(--text-secondary);
}

.article-content li {
    margin-bottom: 0.4rem;
}

.article-content code {
    background: var(--code-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.88rem;
    font-family: "Fira Code", "JetBrains Mono", Consolas, monospace;
}

.article-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem 1.5rem;
    overflow-x: auto;
    margin: 1.2rem 0;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.8rem 1.2rem;
    margin: 1.2rem 0;
    background: var(--bg-secondary);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.back-link {
    display: inline-block;
    margin-top: 2rem;
    font-weight: 600;
}

/* ===== About Page ===== */
.about-content {
    padding: 7rem 0 3rem;
}

.about-content h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.about-content p {
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

.about-content ul {
    margin: 1rem 0 1.2rem 1.5rem;
    color: var(--text-secondary);
}

.about-content li {
    margin-bottom: 0.4rem;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.footer p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--nav-bg);
        backdrop-filter: blur(12px);
        flex-direction: column;
        padding: 1rem 1.5rem;
        gap: 0;
        border-bottom: 1px solid var(--border);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li a {
        display: block;
        padding: 0.6rem 0;
    }

    .menu-btn {
        display: flex;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .post-card {
        padding: 1.5rem;
    }

    .article-header h1 {
        font-size: 1.5rem;
    }
}
