/* --- 1. 字体定义 (本地化) --- */
/* 定义 Noto Sans SC (思源黑体)
   浏览器会优先加载 local() 本地有的字体，如果没有则加载 url() 里的文件 
*/
@font-face {
    font-family: 'Noto Sans SC';
    font-style: normal;
    font-weight: 400;
    src: local('Noto Sans SC Regular'), local('NotoSansSC-Regular'),
         url('fonts/NotoSansSC-Regular.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Noto Sans SC';
    font-style: normal;
    font-weight: 700;
    src: local('Noto Sans SC Bold'), local('NotoSansSC-Bold'),
         url('fonts/NotoSansSC-Bold.ttf') format('truetype');
    font-display: swap;
}

/* --- 2. 变量定义 --- */
:root {
    --bg-color: #f0f4f9;           /* 整体背景 */
    --surface-color: #ffffff;      /* 卡片背景 */
    --sidebar-bg: #f0f4f9;         /* 侧边栏背景 (与整体一致) */
    --text-primary: #1f1f1f;
    --text-secondary: #444746;
    --accent-color: #0b57d0;       /* 选中态蓝色 */
    --accent-bg: #d3e3fd;          /* 选中态浅蓝背景 */
    --border-radius: 16px;
    
    /* 侧边栏宽度 */
    --sidebar-width: 260px;
    --header-height: 64px;
}

/* --- 3. 全局重置 --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    /* 优先使用自定义的本地字体 */
    font-family: 'Noto Sans SC', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; }

/* --- 4. 顶部 Header --- */
.site-header {
    height: var(--header-height);
    background-color: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 100%;
    max-width: 1600px; /* 宽屏限制 */
    margin: 0 auto;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.top-nav { margin-left: auto; }
.top-nav a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 20px;
}

/* --- 5. App 布局 (Sidebar + Main) --- */
.app-layout {
    display: flex;
    flex: 1; /* 占满剩余高度 */
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden; /* 防止双滚动条 */
}

/* 左侧边栏 */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    overflow-y: auto; /* 侧边栏独立滚动 */
    padding: 10px 16px;
    flex-shrink: 0;
}

.sidebar-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 20px 12px 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 24px; /* 胶囊形状 */
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item .icon { margin-right: 12px; opacity: 0.7; }

.nav-item:hover {
    background-color: rgba(0,0,0,0.04);
}

.nav-item.active {
    background-color: var(--accent-bg);
    color: #001d35;
    font-weight: 500;
}

/* 右侧主内容区 */
.app-main {
    flex: 1;
    overflow-y: auto; /* 主内容独立滚动 */
    padding: 20px 40px;
    position: relative;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    background: var(--surface-color); /* 主内容区是白色的 */
    margin-top: 10px; /* 稍微留点空隙，制造层次感 */
    margin-right: 20px; /* 右边留空 */
    box-shadow: 0 0 10px rgba(0,0,0,0.02);
}

/* --- 6. 文章内容样式 --- */
.article-bg {
    /* 详情页背景图逻辑 */
    position: absolute;
    top: 0; left: 0; right: 0; 
    height: 300px; /* 仅作为顶部 Banner 背景 */
    background-size: cover;
    background-position: center;
    opacity: 0.15; /* 淡淡的背景 */
    mask-image: linear-gradient(to bottom, black, transparent); /* 渐变消失 */
    -webkit-mask-image: linear-gradient(to bottom, black, transparent);
    z-index: 0;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.post-card {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 0;
}

.post-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.post-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
}
.post-content p { margin-bottom: 24px; }
.post-content h2 { margin-top: 40px; margin-bottom: 16px; font-size: 1.5rem; color: var(--accent-color); }
.post-content img { max-width: 100%; border-radius: 8px; margin: 20px 0; }
.post-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 16px;
    color: var(--text-secondary);
    margin: 20px 0;
}

/* --- 7. 首页文章列表 --- */
.post-list .post-item {
    display: block;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}
.post-list .post-item:last-child { border-bottom: none; }
.post-list .post-item-title { font-size: 1.4rem; font-weight: 500; margin-bottom: 8px; }
.post-list .post-item-meta { font-size: 0.85rem; color: #666; }

.site-footer {
    display: none; /* 在左右布局中，Footer可以简化或隐藏，或者放在侧边栏底部 */
}

/* --- 8. 响应式 (手机端) --- */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .app-sidebar { 
        width: 100%; 
        height: auto; 
        max-height: 200px; 
        border-bottom: 1px solid #eee;
    }
    .app-main { margin: 0; border-radius: 0; }
    .nav-item { padding: 8px 12px; font-size: 0.9rem; }
}