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

:root {
    --bg: #f5f7fa;
    --card-bg: #fff;
    --text: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --primary: #0f3460;
    --primary-light: #1a508b;
    --accent: #533483;
    --border: #e8ecf1;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 24px rgba(0,0,0,0.1);
    --radius: 10px;
    --sidebar-width: 280px;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    padding: 50px 20px 44px;
    text-align: center;
}

.header h1 { font-size: 2.6em; font-weight: 700; letter-spacing: 6px; }
.header p { font-size: 1.05em; opacity: 0.75; margin-top: 8px; letter-spacing: 2px; }

/* ===== Layout ===== */
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    min-height: calc(100vh - 300px);
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 28px 0 40px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-section {
    padding: 0 24px;
    margin-bottom: 22px;
}

.sidebar-section h3 {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.sidebar-section ul {
    list-style: none;
}

.sidebar-section li {
    margin-bottom: 2px;
}

.sidebar-section a {
    display: block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.92em;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.sidebar-section a:hover,
.sidebar-section a.active {
    background: #f0f3f8;
    color: var(--primary);
}

.sidebar-badge {
    float: right;
    font-size: 0.78em;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 8px;
    border-radius: 10px;
    margin-top: 2px;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 32px 36px 60px;
}

/* ===== Hero ===== */
.hero {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 36px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 18px;
}

.avatar {
    width: 68px; height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8em; color: #fff; flex-shrink: 0;
}

.profile-text h3 { font-size: 1.2em; color: #1a1a2e; }
.profile-text span { font-size: 0.9em; color: var(--text-muted); }

.hero > p { color: var(--text-secondary); font-size: 1.02em; }

/* ===== Section Title ===== */
.section-title {
    font-size: 1.35em;
    color: #1a1a2e;
    margin-bottom: 22px;
    padding-left: 14px;
    border-left: 4px solid var(--primary);
}

/* ===== Post Cards ===== */
.post-list { display: grid; gap: 16px; }

.post-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 28px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.tag {
    display: inline-block;
    font-size: 0.75em; padding: 3px 12px; border-radius: 20px;
    color: #fff; margin-bottom: 8px; letter-spacing: 1px;
}

.tag-python { background: #3776AB; }
.tag-javascript { background: #F7DF1E; color: #333; }
.tag-go { background: #00ADD8; }
.tag-rust { background: #DEA584; }
.tag-redis { background: #DC382D; }
.tag-mysql { background: #4479A1; }
.tag-docker { background: #2496ED; }
.tag-api { background: #6C63FF; }
.tag-db { background: #E67E22; }
.tag-microservice { background: #16A085; }
.tag-general { background: #6C63FF; }

.post-card h3 { font-size: 1.12em; color: #1a1a2e; margin-bottom: 6px; }
.post-card h3 a { color: inherit; }
.post-card h3 a:hover { color: var(--primary); }
.post-card .meta { font-size: 0.85em; color: var(--text-muted); margin-bottom: 8px; }
.post-card .excerpt { color: var(--text-secondary); font-size: 0.95em; }

/* ===== About Section ===== */
.about-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 36px;
    margin-top: 32px;
    box-shadow: var(--shadow);
}

.about-section h2 {
    font-size: 1.35em; color: #1a1a2e;
    margin-bottom: 16px; padding-left: 14px;
    border-left: 4px solid var(--primary);
}

.about-section p { color: var(--text-secondary); margin-bottom: 12px; }

/* ===== Article Page ===== */
.article-header {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px 36px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.article-header .tag { margin-bottom: 12px; }
.article-header h1 { font-size: 1.7em; color: #1a1a2e; line-height: 1.4; margin-bottom: 10px; }
.article-header .meta { color: var(--text-muted); font-size: 0.9em; }

.article-body {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow);
    font-size: 1.02em;
    color: var(--text);
}

.article-body h2 {
    font-size: 1.32em; color: #1a1a2e;
    margin: 34px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.article-body h2:first-child { margin-top: 0; }

.article-body h3 {
    font-size: 1.1em; color: #1a1a2e;
    margin: 24px 0 10px;
}

.article-body p { margin-bottom: 16px; color: var(--text-secondary); }

.article-body ul, .article-body ol {
    margin: 0 0 16px 22px; color: var(--text-secondary);
}

.article-body li { margin-bottom: 6px; }

.article-body strong { color: var(--text); }

/* Code blocks */
.article-body pre {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 8px;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 16px 0 20px;
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    font-size: 0.88em;
    line-height: 1.7;
}

.article-body code {
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    font-size: 0.9em;
}

.article-body :not(pre) > code {
    background: #f0f0f5;
    color: #e03c6d;
    padding: 2px 7px;
    border-radius: 4px;
}

/* Tables */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.95em;
}

.article-body thead th {
    background: #f5f7fa;
    text-align: left;
    padding: 10px 14px;
    border: 1px solid var(--border);
    color: var(--text);
}

.article-body tbody td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Inline note */
.article-body .note {
    background: #f0f7ff;
    border-left: 4px solid var(--primary);
    padding: 14px 18px;
    margin: 16px 0 20px;
    border-radius: 0 6px 6px 0;
    color: var(--text-secondary);
}
.article-body .note strong { color: var(--primary); }

/* Back link */
.back-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 0.95em;
    color: var(--primary);
}
.back-link:hover { text-decoration: underline; }

/* ===== Breadcrumb ===== */
.breadcrumb { font-size: 0.9em; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ===== Footer ===== */
.footer {
    background: #1a1a2e;
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 28px 20px;
    font-size: 0.88em;
    line-height: 2;
}

.footer a { color: rgba(255,255,255,0.9); }
.footer a:hover { text-decoration: underline; color: #fff; }
.footer .beian { display: inline-flex; align-items: center; gap: 4px; }
.footer .beian img { height: 14px; vertical-align: middle; }
.footer .sep { color: rgba(255,255,255,0.4); margin: 0 8px; }

/* ===== Sidebar Mobile Toggle ===== */
.sidebar-toggle {
    display: none;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    font-size: 0.9em;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 800px) {
    .page-wrapper { flex-direction: column; }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px 20px;
        display: none;
    }
    .sidebar.open { display: block; }

    .sidebar-toggle { display: inline-block; }

    .main-content { padding: 20px 16px 40px; }

    .header h1 { font-size: 1.8em; letter-spacing: 4px; }
    .hero, .about-section, .article-header, .article-body { padding: 22px 18px; }
    .post-card { padding: 18px 20px; }
    .profile-summary { flex-direction: column; text-align: center; }
    .article-body pre { padding: 14px 16px; font-size: 0.8em; }
}
