
/* 全局样式设置 */
/* 设定网页的基础样式，包括字体、颜色、背景等 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(135deg, #0D47A1, #37474F); /* 主色调渐变背景 */
    color: #FFFFFF;
    line-height: 1.6;
}

/* 导航栏样式 */
/* 固定在页面顶部，响应式设计，包含悬停效果 */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(13, 71, 161, 0.9);
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: background-color 0.3s ease, padding 0.3s ease;
}

nav.scrolled {
    background-color: #1E88E5;
    padding: 10px 30px;
}

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

nav li {
    margin-left: 20px;
}

nav a {
    color: #FFFFFF;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    transition: color 0.3s ease;
}

nav a:hover {
    color: #FF9800;
}

/* 主要内容容器 */
/* 使用Flexbox和Grid实现响应式布局，确保内容层次分明 */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 100px 20px 50px 20px; /* 上边距留出导航栏空间 */
    max-width: 1200px;
    margin: 0 auto;
}

/* 章节样式 */
/* 每个章节独立成块，包含标题、段落和图片 */
section {
    width: 100%;
    margin-bottom: 50px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 1s forwards;
}

section h2, section h3, section h4 {
    font-family: 'Montserrat', sans-serif;
    color: #FFFFFF;
}

section p {
    font-size: 16px;
    color: #ECEFF1;
}

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

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

/* 代码块样式 */
/* 定制化样式，区别于正文内容 */
pre {
    background: #263238;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

code {
    color: #FFEB3B;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

/* 强调信息样式 */
/* 用于提示“这是一个网页样式设计参考” */
.highlight {
    background: rgba(255, 152, 0, 0.2);
    padding: 10px 20px;
    border-left: 5px solid #FF9800;
    margin: 30px 0;
    font-size: 18px;
}

/* 按钮样式 */
/* 具有悬停动画和过渡效果 */
.btn {
    background-color: #FF9800;
    color: #FFFFFF;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.btn:hover {
    background-color: #F57C00;
    transform: scale(1.05);
}

/* 响应式设计 */
/* 针对不同屏幕宽度调整布局 */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        align-items: center;
    }

    nav li {
        margin: 10px 0;
    }

    .container {
        padding: 80px 10px 30px 10px;
    }

    section {
        padding: 15px;
    }

    section p {
        font-size: 14px;
    }

    .highlight {
        font-size: 16px;
    }
}

/* 动画效果 */
/* 用于元素进入视窗时的淡入上升效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 节点动画 */
/* 模拟数据流动的脉冲效果 */
.node {
    width: 20px;
    height: 20px;
    background-color: #FF9800;
    border-radius: 50%;
    position: absolute;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 数据条形图样式 */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 300px;
    padding: 20px;
    background-color: #263238;
    border-radius: 8px;
    margin: 20px 0;
}

.bar {
    width: 40px;
    background-color: #FF9800;
    position: relative;
    transition: height 0.5s ease;
}

.bar:hover {
    background-color: #F57C00;
}

.bar::after {
    content: attr(data-value);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: #FFFFFF;
    font-family: 'Open Sans', sans-serif;
}

/* 页面过渡效果 */
.page {
    opacity: 0;
    animation: fadeTransition 0.5s forwards;
}

@keyframes fadeTransition {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

