
/* 全局样式设置 */

/* 设置页面的盒模型为边框盒模型，方便布局 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 设置页面的基础字体和背景 */
body {
    font-family: 'Roboto', sans-serif; /* 使用Roboto无衬线字体，提升可读性和科技感 */
    font-size: 16px; /* 正文字号设置为16px，符合用户阅读习惯 */
    color: #333333; /* 设置文本颜色为深灰，避免纯黑带来的视觉疲劳 */
    background: linear-gradient(135deg, #0F4C81, #FFD700); /* 使用蓝金渐变作为背景，增强层次感 */
    line-height: 1.6; /* 增加行高，提升文本可读性 */
    overflow-x: hidden; /* 防止横向滚动条出现，保证页面在不同设备上良好展示 */
}

/* 设置链接的基本样式，并添加过渡效果 */
a {
    color: #FFD700; /* 链接颜色使用金色，突出显示 */
    text-decoration: none; /* 去除下划线 */
    transition: color 0.3s ease; /* 添加颜色过渡效果 */
}

a:hover {
    color: #0F4C81; /* 悬停时颜色变化为蓝色 */
}

/* 设置导航栏的样式 */
.navbar {
    position: fixed; /* 固定在页面顶部 */
    top: 0;
    width: 100%;
    background-color: rgba(15, 76, 129, 0.9); /* 半透明背景，增强层次感 */
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000; /* 确保导航栏在最上层 */
    transition: background-color 0.3s ease; /* 背景颜色过渡效果 */
}

.navbar.scrolled {
    background-color: #0F4C81; /* 滚动后背景颜色变为不透明蓝色 */
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    color: #FFD700;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    font-size: 1em;
    position: relative;
}

/* 添加导航链接的悬停下划线动画 */
.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: #FFD700;
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%; /* 悬停时下划线扩展到整个链接宽度 */
}

/* 设置首屏横幅的样式 */
.header {
    height: 100vh; /* 设置为视口高度 */
    background: url('https://images.gptkong.com/demo/sample1.png') center/cover no-repeat; /* 使用示例图片作为背景 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #FFFFFF;
    position: relative;
}

.header::after {
    content: '这是一个网页样式设计参考'; /* 在显著位置提示信息 */
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(15, 76, 129, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
}

/* 首屏横幅的文本样式 */
.header h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.header p {
    font-size: 1.2em;
    max-width: 600px;
    margin-bottom: 30px;
}

/* 设置CTA按钮的样式 */
.cta-button {
    background: #FFD700;
    color: #0F4C81;
    padding: 15px 30px;
    border: none;
    border-radius: 30px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.cta-button:hover {
    background: #0B3D91;
    color: #FFFFFF;
    transform: scale(1.05); /* 悬停时稍微放大按钮 */
}

/* 设置内容区域的样式 */
.content-section {
    padding: 80px 40px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    background-color: #F5F5F5; /* 使用浅灰色作为辅助色块 */
}

.content-section:nth-child(even) {
    background-color: #FFFFFF; /* 交替使用白色和辅助色块，增强层次感 */
}

/* 设置每个模块的标题样式 */
.content-section h2 {
    font-size: 2em;
    color: #0F4C81;
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.content-section h2::after {
    content: '';
    width: 50px;
    height: 3px;
    background: #FFD700;
    position: absolute;
    bottom: 0;
    left: 0;
}

/* 设置段落的样式 */
.content-section p {
    font-size: 1em;
    color: #333333;
    line-height: 1.8;
}

/* 设置图像的样式 */
.content-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;
}

.content-section img:hover {
    transform: scale(1.05); /* 悬停时稍微放大图片 */
}

/* 设置带有图标的模块 */
.icon-module {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-module img {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

/* 设置导航章节的样式 */
.chapter-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 500;
}

.chapter-nav a {
    background: #FFD700;
    color: #0F4C81;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    transition: background 0.3s ease, transform 0.3s ease;
}

.chapter-nav a:hover {
    background: #0B3D91;
    color: #FFFFFF;
    transform: translateX(-10px); /* 悬停时向左移动 */
}

/* 设置底部信息栏的样式 */
.footer {
    background-color: #0F4C81;
    color: #FFFFFF;
    padding: 40px;
    text-align: center;
}

.footer a {
    color: #FFD700;
    margin: 0 10px;
    display: inline-block;
}

.footer a:hover {
    color: #FFFFFF;
}

/* 设置CSS代码示例部分的样式 */
.code-example {
    background-color: #2D2D2D;
    color: #CCCCCC;
    padding: 20px;
    border-radius: 10px;
    font-family: 'Courier New', Courier, monospace;
    overflow-x: auto;
}

/* 确保代码块内的pre标签样式 */
.code-example pre {
    margin: 0;
    font-size: 0.9em;
}

/* 添加响应式设计 */

/* 针对桌面设备的媒体查询 */
@media (min-width: 1200px) {
    .content-section {
        padding: 100px 100px;
    }
}

/* 针对平板设备的媒体查询 */
@media (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
    }
    .nav-links {
        flex-direction: column;
        gap: 10px;
    }
    .header h1 {
        font-size: 2.5em;
    }
    .header p {
        font-size: 1em;
    }
    .cta-button {
        padding: 12px 25px;
        font-size: 0.9em;
    }
}

/* 针对移动设备的媒体查询 */
@media (max-width: 480px) {
    .chapter-nav {
        display: none; /* 移动设备上隐藏章节导航 */
    }
    .content-section {
        padding: 60px 20px;
    }
    .header h1 {
        font-size: 2em;
    }
    .header p {
        font-size: 0.9em;
    }
    .cta-button {
        padding: 10px 20px;
        font-size: 0.8em;
    }
}

