/* 核心变量定义 */
:root {
    --bg-color: #f8fafc;
    --bg-surface: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-color: #0f172a;
    --text-light: #64748b;
    --primary-color: #2563eb;
    --nav-height: 64px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme='dark'] {
    --bg-color: #0d1117;
    --bg-surface: #161b22;
    --border-color: rgba(255, 255, 255, 0.1);
    --text-color: #e6edf3;
    --text-light: #8b949e;
    --primary-color: #58a6ff;
}

/* 滚动偏置：防止标题被遮挡 */
html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 30px);
}

/* 全局重置 */
* { box-sizing: border-box; margin: 0; padding: 0; }
a { text-decoration: none !important; color: inherit; transition: var(--transition); }
ul, li { list-style: none !important; }

body { 
    font-family: 'Inter', 'Noto Sans SC', sans-serif; 
    background: var(--bg-color); 
    color: var(--text-color);
    transition: background 0.4s ease, opacity 0.3s ease; /* 补回切换动画 */
    line-height: 1.5;
}

/* 导航栏三段式布局 */
.navbar {
    position: fixed; top: 0; left: 0; width: 100%; height: var(--nav-height);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 2rem; background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar-left { flex: 0 0 auto; display: flex; align-items: center; }
.site-logo { font-weight: 800; font-size: 1.25rem; color: var(--text-color); }

.navbar-center { flex: 1; display: flex; justify-content: center; gap: 2.5rem; }
.nav-link { font-weight: 500; color: var(--text-light); font-size: 0.95rem; }
.nav-link:hover, .nav-link.active { color: var(--primary-color); }

/* 修改: 修复右侧按钮堆叠问题 */
.navbar-right { 
    flex: 0 0 auto; 
    display: flex; 
    flex-direction: row; /* 强制横向 */
    align-items: center; 
    gap: 0.8rem; 
}

/* 顶栏搜索框 */
.nav-search { position: relative; display: flex; align-items: center; margin-right: 0.5rem; }
.nav-search input {
    background: var(--bg-color); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 0.5rem 1rem 0.5rem 2.2rem;
    color: var(--text-color); width: 180px; font-size: 0.85rem; transition: var(--transition);
}
.nav-search input:focus { width: 240px; border-color: var(--primary-color); outline: none; }
.nav-search .material-icons { position: absolute; left: 10px; font-size: 18px; color: var(--text-light); }

.icon-btn { 
    background: var(--bg-color); border: 1px solid var(--border-color); 
    cursor: pointer; color: var(--text-color); width: 36px; height: 36px;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.icon-btn:hover { border-color: var(--primary-color); transform: translateY(-2px); }

/* 切换动画的基础支持 */
[data-zh] { transition: opacity 0.2s ease; }