
/* 通用样式设置，确保所有元素采用边框盒模型，消除默认外边距和内边距 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 定义CSS变量，方便统一管理颜色和字体 */
:root {
    --primary-green: #34A853; /* 主色调：环保绿 */
    --tech-blue: #4285F4; /* 主色调：科技蓝 */
    --vibrant-orange: #FBBC05; /* 点缀色：活力橙 */
    --neutral-gray-start: #f5f5f5; /* 辅色：中性灰起始 */
    --neutral-gray-end: #e0e0e0; /* 辅色：中性灰结束 */
    --font-primary: 'Open Sans', sans-serif; /* 正文字体 */
    --font-secondary: 'Roboto', sans-serif; /* 标题字体 */
    --font-monospace: 'Courier New', Courier, monospace; /* 等宽字体 */
}

/* 设置body背景为渐变色，并定义全局字体和基础文本样式 */
body {
    background: linear-gradient(135deg, var(--neutral-gray-start), var(--neutral-gray-end));
    font-family: var(--font-primary);
    color: #333;
    line-height: 1.6;
    padding: 0;
    margin: 0;
}

/* 导航栏样式，固定在顶部，使用Flexbox布局 */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--primary-green);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* 导航栏内部无序列表的样式，水平排列 */
nav ul {
    display: flex;
    list-style: none;
}

/* 导航项的样式，设置左右间距 */
nav ul li {
    margin: 0 1.5rem;
}

/* 导航链接样式，白色字体，去掉下划线 */
nav ul li a {
    color: #fff;
    text-decoration: none;
    font-family: var(--font-secondary);
    font-weight: bold;
    font-size: 16px;
}

/* 导航链接悬停时颜色变化，并添加过渡效果 */
nav ul li a:hover {
    color: var(--vibrant-orange);
    transition: color 0.3s ease;
}

/* 章节导航栏样式，固定在左侧 */
.chapter-nav {
    position: fixed;
    top: 80px; /* 导航栏高度 */
    left: 0;
    width: 200px;
    background: var(--neutral-gray-start);
    padding: 1rem;
    border-right: 1px solid #ddd;
    height: calc(100% - 80px);
    overflow-y: auto;
}

/* 章节导航内部无序列表样式 */
.chapter-nav ul {
    list-style: none;
}

/* 章节导航项的样式，设置下边距 */
.chapter-nav ul li {
    margin-bottom: 0.75rem;
}

/* 章节导航链接样式，科技蓝颜色，去掉下划线 */
.chapter-nav ul li a {
    text-decoration: none;
    color: var(--tech-blue);
    font-size: 16px;
}

/* 章节导航链接悬停时颜色变化，并添加过渡效果 */
.chapter-nav ul li a:hover {
    color: var(--vibrant-orange);
}

/* 主内容容器使用Grid布局，分为左、中、右三栏 */
.container {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 2rem;
    padding: 6rem 2rem 2rem; /* 顶部留出导航栏空间 */
    margin-left: 220px; /* 章节导航栏宽度 + 20px间距 */
}

/* 左侧展示区样式，包含装饰性图片 */
.left {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 中间内容区样式，包含文章内容 */
.center {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 右侧推荐区样式，包含推荐图片和徽章 */
.right {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 提示文本样式，醒目的橙色背景 */
.reference-note {
    background: var(--vibrant-orange);
    color: #fff;
    padding: 1rem;
    text-align: center;
    font-size: 18px;
    margin: 2rem 0;
    border-radius: 5px;
}

/* 装饰性图片样式，圆角、阴影和悬停效果 */
img.decorative {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1rem;
}

img.decorative:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* 文章内容样式，最大宽度和居中显示 */
article {
    max-width: 800px;
    margin: 0 auto;
}

/* 标题样式，使用Roboto字体，科技蓝颜色 */
article h2, article h3, article h4 {
    font-family: var(--font-secondary);
    margin-bottom: 1rem;
    color: var(--tech-blue);
}

/* 正文字体大小和颜色设置 */
article p, article li, article span {
    font-size: 16px;
    color: #333;
}

/* 代码块样式，区别于正文内容 */
pre code {
    display: block;
    padding: 1rem;
    background: #f0f0f0;
    border-left: 4px solid var(--tech-blue);
    overflow-x: auto;
    font-family: var(--font-monospace);
    font-size: 14px;
    border-radius: 5px;
    margin-bottom: 1rem;
}

/* 表格样式，边框和填充 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 0.75rem;
    text-align: left;
    font-size: 15px;
}

table th {
    background-color: var(--neutral-gray-end);
    font-family: var(--font-secondary);
}

/* 按钮样式，绿色背景和圆角 */
.button {
    background: var(--primary-green);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: inline-block;
    text-decoration: none;
    font-size: 16px;
}

.button:hover {
    background: linear-gradient(45deg, var(--primary-green), var(--tech-blue));
}

/* 卡片样式，圆角和阴影 */
.card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1rem;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
}

/* 动画关键帧定义，用于地球仪旋转 */
@keyframes rotateEarth {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 地球仪动画应用 */
.earth {
    width: 200px;
    height: 200px;
    background: url('earth.png') no-repeat center center;
    background-size: cover;
    animation: rotateEarth 60s linear infinite;
}

/* 淡入动画关键帧 */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 淡入动画应用 */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s forwards;
    animation-delay: 0.3s;
}

/* 响应式设计，768px以下调整导航和布局 */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        align-items: center;
    }

    .chapter-nav {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid #ddd;
        margin-bottom: 2rem;
    }

    .container {
        grid-template-columns: 1fr;
        margin-left: 0;
    }
}

/* 环保认证徽章样式，圆形和渐变 */
.badge {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary-green), var(--tech-blue));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-secondary);
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    margin: 1rem auto;
}

.badge:hover {
    transform: scale(1.1);
}

/* 字体样式调整，确保标题和正文的清晰区分 */
h2, h3, h4 {
    font-family: var(--font-secondary);
    font-weight: bold;
}

p, li, span {
    font-family: var(--font-primary);
}

/* 代码样式区分，增加可读性 */
.code-block {
    background: #f0f0f0;
    padding: 1rem;
    border-left: 4px solid var(--tech-blue);
    border-radius: 5px;
    font-family: var(--font-monospace);
    font-size: 14px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

/* 折叠区域样式，增加交互性 */
details {
    margin: 1rem 0;
}

summary {
    font-weight: bold;
    cursor: pointer;
    color: var(--tech-blue);
}

