/**
 * Dark Mode Initialization CSS
 * 
 * 此文件包含防止暗色主题闪白的关键 CSS，必须在 <head> 中阻塞式加载。
 * 体积控制在 1KB 以内，只包含最关键的变量和背景色定义。
 */

/* 页面加载期间禁止所有过渡动画，防止闪烁 */
html.no-transitions,
html.no-transitions *,
html.no-transitions *::before,
html.no-transitions *::after {
    transition: none !important;
}

/* 暗色主题关键变量和背景色 */
html[data-theme='dark'] {
    color-scheme: dark;

    --body-bg-color: #1e1e1e;
    --content-bg-color: #252525;
    --text-color: #c9d1d9;
    --nav-bg-color: #000;
    --sidebar-bg-color: #2d2d2d;
    --border-color: #30363d;
}

html[data-theme='dark'],
html[data-theme='dark'] body {
    background-color: var(--body-bg-color);
    color: var(--text-color);
}

/* 关键容器背景 - 防止闪白 */
html[data-theme='dark'] .content-wrap,
html[data-theme='dark'] .sidebar,
html[data-theme='dark'] .sidebar-left,
html[data-theme='dark'] .sidebar-right {
    background-color: var(--content-bg-color);
}

/* 导航栏背景 */
html[data-theme='dark'] .m-nav,
html[data-theme='dark'] .m-header {
    background-color: var(--nav-bg-color);
}
