
/* 主色调变量定义 */
:root {
    --primary-color: #1E3A8A; /* 深蓝色，传达稳健与可信 */
    --secondary-color: #F5F5F5; /* 灰色，提供柔和的对比 */
    --accent-orange: #FFAB40; /* 亮橙色，用于按钮和CTA */
    --accent-green: #34C759; /* 绿色，用于强调信息 */
    --text-color: #333333; /* 正文字体颜色 */
    --background-gradient: linear-gradient(135deg, #1E3A8A, #34C759); /* 背景渐变 */
}

/* 全局样式 */
body {
    margin: 0;
    padding: 0;
    background: var(--background-gradient);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    font-size: 16px; /* 正文字号 */
    line-height: 1.6;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--primary-color);
    color: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 导航菜单 */
.navbar .menu {
    display: flex;
    gap: 20px;
}

.navbar .menu a {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

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

/* 汉堡菜单样式 */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

.hamburger div {
    width: 25px;
    height: 3px;
    background-color: #fff;
    transition: all 0.3s ease;
}

/* 响应式导航 */
@media (max-width: 768px) {
    .navbar .menu {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .navbar.active .menu {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background-color: var(--primary-color);
        padding: 20px;
    }

    .navbar.active .menu a {
        padding: 10px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* 主要内容容器 */
.container {
    padding: 100px 40px 40px 40px; /* 顶部留出导航栏空间 */
    max-width: 1200px;
    margin: 0 auto;
}

/* 章节导航 */
.chapter-nav {
    position: sticky;
    top: 80px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.chapter-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.chapter-nav ul li {
    margin: 0;
}

.chapter-nav ul li a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    transition: color 0.3s ease;
}

.chapter-nav ul li a:hover {
    color: var(--accent-orange);
}

/* 视觉区块样式 */
.section {
    background-color: #fff;
    padding: 40px;
    margin-bottom: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    animation: fadeIn 1s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

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

.section h2, .section h3, .section h4 {
    color: var(--primary-color);
}

.section h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.section h3 {
    font-size: 20px;
    margin-bottom: 15px;
}

.section h4 {
    font-size: 18px;
    margin-bottom: 10px;
}

.section p {
    font-size: 16px;
    margin-bottom: 15px;
}

/* 图片样式 */
.section img {
    width: 100%;
    max-width: 320px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* 装饰线条 */
.decorative-line {
    height: 3px;
    background: var(--accent-orange);
    margin: 30px 0;
    border-radius: 2px;
    width: 50px;
}

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

.button:hover {
    background-color: darken(var(--accent-green), 10%);
    transform: translateY(-3px);
}

/* 代码块样式 */
.code-block {
    background-color: #f0f0f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

.code-block pre {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    color: #2d2d2d;
}

/* 演示CSS3代码示例区 */
.css-example {
    background-color: #e8f4fd;
    border-left: 4px solid var(--accent-orange);
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

.css-example code {
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    color: #1E3A8A;
}

/* 背景动画 */
@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 底部样式 */
.footer {
    background-color: var(--primary-color);
    color: #fff;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.footer .branding, 
.footer .links, 
.footer .sustainability {
    flex: 1 1 200px;
    margin: 10px 0;
}

.footer a {
    color: var(--accent-green);
    text-decoration: none;
    margin-right: 15px;
    font-size: 16px;
}

.footer a:hover {
    text-decoration: underline;
}

.footer .sustainability::before {
    content: '♻️ ';
}

/* 图表区域 */
.chart {
    position: relative;
    height: 300px;
    background: var(--secondary-color);
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.chart::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, var(--primary-color), var(--accent-orange));
    opacity: 0.1;
    animation: gradientMove 5s linear infinite;
}

@keyframes gradientMove {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 100% 0;
    }
}

/* 按钮微交互 */
.button-interact {
    background-color: var(--accent-green);
    border: none;
    padding: 10px 20px;
    color: #fff;
    border-radius: 4px;
    transition: transform 0.2s, background-color 0.3s;
}

.button-interact:hover {
    transform: translateY(-3px);
    background-color: darken(var(--accent-green), 10%);
}

/* 数据可视化 */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 40px;
    background-color: #fff;
}

@media (max-width: 1024px) {
    .dashboard {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 60px 20px 20px 20px;
    }

    .footer {
        flex-direction: column;
        align-items: center;
    }
}

/* 防止横向滚动 */
body, html {
    overflow-x: hidden;
}

