/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #faf8f5;
    --bg-alt: #f3efe7;
    --text: #2c2a26;
    --text-muted: #6b655b;
    --accent: #8b5a2b;
    --border: #d9d3c5;
    --sidebar-w: 240px;
    --tag-bg: #ede8e0;
    --tag-text: #6b655b;
}

html { font-size: 16px; }

body {
    font-family: Georgia, 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

/* Language Switcher */
.lang-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.2rem;
    z-index: 100;
}

.lang-switch button {
    font-family: Georgia, serif;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.lang-switch button:hover { color: var(--text); border-color: var(--text-muted); }
.lang-switch button.active { color: var(--text); border-color: var(--text); }

/* Two-column layout */
.layout {
    display: flex;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
    gap: 2.5rem;
}

/* Left sidebar */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    padding-top: 3rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sidebar .avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-alt);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.sidebar .site-name {
    font-size: 1.3rem;
    font-weight: normal;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}

.sidebar .site-name a {
    color: var(--text);
    text-decoration: none;
}

.sidebar .social {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.sidebar .social a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.sidebar .social a:hover { color: var(--accent); }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.sidebar-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.sidebar-nav a:hover { color: var(--text); }
.sidebar-nav a.active { color: var(--text); font-weight: bold; }

/* Right content */
.content {
    flex: 1;
    min-width: 0;
    padding-top: 3rem;
    padding-bottom: 4rem;
}

.content-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.content-header h2 {
    font-size: 0.95rem;
    font-weight: normal;
}

/* Article cards */
.post-card {
    display: flex;
    gap: 1.25rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.post-card:last-child { border-bottom: none; }

.post-thumb {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem;
}

.post-thumb.ai-badge {
    background: #e8dcc8;
    border: 1px solid #d4c4a8;
}

.post-thumb.ai-badge .thumb-label {
    font-size: 0.7rem;
    font-weight: bold;
    color: #8b5a2b;
    line-height: 1.2;
}

.post-card-body { flex: 1; min-width: 0; }

.post-card-body h3 {
    font-size: 1.1rem;
    font-weight: normal;
    margin-bottom: 0.3rem;
}

.post-card-body h3 a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.post-card-body h3 a:hover { color: var(--accent); }

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

.post-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

/* Tags */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag-pill {
    font-size: 0.72rem;
    font-family: 'Courier New', monospace;
    color: var(--tag-text);
    background: var(--tag-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.2s;
}

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

/* Tag cloud */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

/* About page */
.about-body p {
    margin-bottom: 1rem;
    color: var(--text);
}

.about-body .intro {
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.about-contact {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.about-contact li {
    list-style: none;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.about-contact a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.2s;
}

.about-contact a:hover { border-bottom-color: var(--accent); }

/* Projects */
.project-card {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.project-card:last-child { border-bottom: none; }

.project-card h3 {
    font-size: 1.15rem;
    font-weight: normal;
    margin-bottom: 0.4rem;
}

.project-card .project-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
}

/* Post detail page */
.post-detail {
    max-width: 640px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

.post-detail .post-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.post-detail .post-body h3 {
    font-size: 1.2rem;
    font-weight: normal;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.post-detail .post-body p {
    margin-bottom: 1rem;
}

.post-detail .post-body pre {
    background: var(--bg-alt);
    padding: 1rem 1.25rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.post-detail .post-body code {
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    color: var(--accent);
}

.post-detail .post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.post-detail .post-body th,
.post-detail .post-body td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.9rem;
}

.post-detail .post-body th {
    background: var(--bg-alt);
}

.back-link {
    display: inline-block;
    margin-top: 2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

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

/* Footer */
.site-footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.site-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Post detail nav (simple top nav) */
.detail-nav {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 0;
    display: flex;
    gap: 1.25rem;
}

.detail-nav a {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.detail-nav a:hover { color: var(--text); }

/* Responsive */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        padding: 0 1.25rem;
        gap: 0;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding-top: 2rem;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .sidebar .avatar {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
        margin-bottom: 0;
    }

    .sidebar .site-name {
        font-size: 1.1rem;
        margin-bottom: 0;
    }

    .sidebar .social { margin-bottom: 0; }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .content { padding-top: 1rem; }

    .post-card {
        flex-direction: column;
        gap: 0.75rem;
    }

    .post-thumb {
        width: 100%;
        height: 60px;
        flex-direction: row;
    }

    .lang-switch {
        top: 0.5rem;
        right: 0.5rem;
    }

    .lang-switch button {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}
