
/* 全局样式设置 */
:root {
    /* 定义颜色变量，遵循70%主色、25%辅色、5%点缀色的配比 */
    --main-color-forest-green: #228B22; /* 森林绿 */
    --main-color-soil-brown: #8B4513; /* 土壤棕 */
    --main-color-sky-blue: #87CEEB; /* 天空蓝 */
    --accent-color-orange: #FFA500; /* 橙色 */
    --accent-color-fluorescent: #32CD32; /* 荧光绿 */
    --neutral-color-beige: #F5F5DC; /* 米色 */
    --neutral-color-gray: #A9A9A9; /* 灰色 */
    --metallic-gradient: linear-gradient(45deg, #B0C4DE, #4682B4); /* 金属渐变色 */

    /* 字体大小变量 */
    --font-size-body: 16px;
    --font-size-h2: 20px;
    --font-size-h3: 18px;
    --font-size-h4: 17px;
}

/* 全局字体和背景 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--neutral-color-gray);
    color: var(--main-color-sky-blue);
    line-height: 1.6;
}

/* 导航栏样式 */
nav {
    background-color: var(--main-color-forest-green);
    padding: 20px;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin: 0 15px;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-size: var(--font-size-h3);
    transition: color 0.3s ease;
}

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

/* 主视觉区域 */
.main-visual {
    margin-top: 80px; /* 与固定导航栏间距 */
    position: relative;
    height: 500px;
    background: var(--main-color-sky-blue);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.main-visual::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://images.gptkong.com/demo/sample1.png') no-repeat center center;
    background-size: cover;
    opacity: 0.3;
}

.main-visual h1 {
    z-index: 1;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* 内容区块样式 */
.section {
    padding: 60px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    background-color: var(--neutral-color-beige);
}

.section:nth-child(even) {
    background-color: var(--neutral-color-gray);
}

.section img {
    width: 100%;
    max-width: 320px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.section-content {
    flex: 1;
    min-width: 300px;
}

.section-content h2 {
    font-size: var(--font-size-h2);
    color: var(--main-color-forest-green);
    margin-bottom: 20px;
}

.section-content p {
    font-size: var(--font-size-body);
    color: var(--neutral-color-gray);
}

/* CSS3 代码示例样式 */
.code-sample {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    margin: 20px 0;
}

.code-sample code {
    display: block;
    white-space: pre;
}

/* 按钮样式 */
.button {
    background: var(--metallic-gradient);
    border: none;
    padding: 15px 30px;
    color: white;
    font-size: var(--font-size-h3);
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.3s ease, background 0.3s ease;
}

.button:hover {
    transform: scale(1.05);
    background: var(--main-color-soil-brown);
}

/* 章节导航样式 */
.chapter-nav {
    position: fixed;
    right: 20px;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chapter-nav a {
    background: var(--main-color-forest-green);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: var(--font-size-h4);
    transition: background 0.3s ease;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .section {
        flex-direction: column;
        align-items: center;
    }

    nav ul {
        flex-direction: column;
    }

    .chapter-nav {
        display: none;
    }
}

