
/* 全局样式设置 */
:root {
    /* 主色调 */
    --primary-dark-blue: #0D1B2A;
    --primary-purple: #3F72AF;

    /* 辅助色 */
    --secondary-white: rgba(255, 255, 255, 0.8);
    --secondary-grey: rgba(200, 200, 200, 0.5);

    /* 点缀色 */
    --accent-orange: #F72585;
    --accent-green: #23FF8C;

    /* 字体设置 */
    --font-main: 'Roboto', sans-serif;
    --font-secondary: 'Lato', sans-serif;

    /* 响应式断点 */
    --breakpoint-mobile: 480px;
    --breakpoint-tablet: 768px;
    --breakpoint-desktop: 1024px;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* body背景与字体 */
body {
    font-family: var(--font-main);
    color: #fff;
    background: linear-gradient(135deg, var(--primary-dark-blue), var(--primary-purple));
    background-size: cover;
    background-attachment: fixed;
    line-height: 1.6;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(13, 27, 42, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar a {
    color: #fff;
    margin: 0 15px;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar a:hover {
    color: var(--accent-orange);
}

/* 语言切换器样式 */
.language-switcher button {
    background: none;
    border: none;
    color: #fff;
    margin-left: 10px;
    cursor: pointer;
    font-size: 16px;
}

.language-switcher button:hover {
    color: var(--accent-green);
}

/* 主容器布局 */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 100px 40px 40px 40px;
}

/* 章节导航样式 */
.chapter-nav {
    position: sticky;
    top: 80px;
    background: rgba(13, 27, 42, 0.7);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.chapter-nav a {
    display: block;
    color: #fff;
    margin-bottom: 10px;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

.chapter-nav a:hover {
    color: var(--accent-green);
}

/* 文章内容样式 */
article {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

article h2, article h3 {
    font-family: var(--font-secondary);
    margin-bottom: 15px;
}

article h2 {
    font-size: 24px;
    color: var(--accent-green);
}

article h3 {
    font-size: 20px;
    color: var(--accent-orange);
}

article p {
    font-size: 16px;
    margin-bottom: 15px;
    color: #fff;
}

article pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 15px;
}

article code {
    font-family: 'Courier New', Courier, monospace;
    color: var(--accent-orange);
}

/* 图片样式 */
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.image-gallery img {
    width: 100%;
    max-width: 320px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-gallery img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.5);
}

/* 按钮样式 */
.button {
    background: var(--accent-green);
    border: none;
    padding: 15px 30px;
    color: #fff;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.button:hover {
    background: var(--accent-orange);
}

.button:active {
    transform: scale(0.98);
}

/* 模态弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--secondary-white);
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    color: #000;
}

.modal-content h3 {
    color: var(--primary-dark-blue);
}

.modal-content p {
    margin-top: 10px;
    color: #333;
}

/* 响应式设计 */
@media (max-width: var(--breakpoint-tablet)) {
    .navbar {
        flex-direction: column;
        padding: 15px 20px;
    }

    .container {
        padding: 100px 20px 20px 20px;
    }

    .chapter-nav {
        position: static;
        margin-bottom: 20px;
    }
}

@media (max-width: var(--breakpoint-mobile)) {
    .navbar {
        padding: 10px 15px;
    }

    .chapter-nav a {
        font-size: 14px;
    }

    article h2 {
        font-size: 20px;
    }

    article h3 {
        font-size: 18px;
    }

    article p, article code {
        font-size: 14px;
    }
}

/* 关键帧动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 动画应用 */
.section {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease-out;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 代码示例样式 */
.code-sample {
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.code-sample code {
    color: #00FF00;
    font-family: 'Courier New', Courier, monospace;
    display: block;
    white-space: pre-wrap;
}

