
/* 
    全局样式定义
    设置网页的基本字体、背景色、色彩搭配等，以确保整体风格统一且符合未来主义设计要求。
*/
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: #ffffff; /* 纯白色背景 */
    color: #1E274A; /* 主色调深蓝色 */
}

/* 
    导航栏样式
    固定在页面顶部，包含主要导航链接，采用半透明背景并在滚动时变为不透明。
*/
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(30, 39, 74, 0.9);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: background-color 0.3s;
}

.navbar.scrolled {
    background-color: rgba(30, 39, 74, 1);
}

.navbar a {
    color: #ffffff;
    text-decoration: none;
    margin: 0 10px;
    font-size: 16px;
    transition: color 0.3s;
}

.navbar a:hover {
    color: #03A9F4; /* 点缀色电光蓝 */
}

/* 
    主要内容区块样式
    每个内容区块独立，使用渐变线条和装饰元素分隔，确保视觉上的层次感与呼吸感。
*/
section {
    padding: 80px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 24px;
    color: #1E274A;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    width: 50px;
    height: 4px;
    background: linear-gradient(135deg, #1E274A, #03A9F4, #8A2BE2);
    position: absolute;
    left: 0;
    bottom: -10px;
    border-radius: 2px;
}

.section-content {
    font-size: 16px;
    line-height: 1.6;
    color: #333333;
}

/* 
    图片样式
    图片具有圆角、阴影和悬浮效果，提升视觉质感。
*/
img {
    width: 100%;
    max-width: 320px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

/* 
    按钮样式
    使用点缀色作为按钮背景，悬停时改变颜色与大小，增加交互性。
*/
.button {
    background-color: #32CD32; /* 点缀色荧光绿 */
    color: #ffffff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
    font-size: 16px;
}

.button:hover {
    transform: scale(1.05);
    background-color: #28a745;
}

/* 
    卡片组件样式
    使用渐变背景和阴影，增加层次感，悬停时阴影加深。
*/
.card {
    background: linear-gradient(145deg, #ffffff, #e0e0e0);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.3);
}

/* 
    加载动画样式
    环形进度条的旋转动画，增强等待时的用户体验。
*/
.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #03A9F4;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 
    导航系统样式
    设计清晰的章节导航，帮助用户快速定位内容。
*/
.side-nav {
    position: fixed;
    top: 100px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-nav a {
    text-decoration: none;
    color: #1E274A;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.side-nav a:hover {
    background-color: #03A9F4;
    color: #ffffff;
}

/* 
    响应式设计
    确保页面在不同设备宽度下良好展示，无需左右滚动。
*/
@media (max-width: 768px) {
    .side-nav {
        display: none;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    section {
        padding: 60px 10px;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 20px;
    }

    .button {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* 
    视差滚动效果
    不同背景层以不同速度滚动，增加页面深度感。
*/
.parallax {
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
}

/* 
    模块进入视窗时的动画效果
    元素在进入视窗时淡入并上移，增强动态感。
*/
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 
    交互式数据可视化图表容器样式
    定义图表容器的布局与样式，确保数据展示清晰。
*/
.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: #1E274A;
    border-radius: 8px;
    overflow: hidden;
    padding: 20px;
}

/* 
    语言切换按钮样式
    简洁的按钮设计，允许用户轻松切换语言界面。
*/
.language-switcher {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.language-button {
    background-color: #03A9F4;
    color: #ffffff;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-family: 'Roboto', sans-serif;
}

.language-button:hover {
    background-color: #0288D1;
}

/* 
    固定导航栏动态背景变化
    滚动时导航栏背景颜色由半透明变为不透明。
*/
window.addEventListener('scroll', function() {
    const navbar = document.querySelector('.navbar');
    if (window.scrollY > 50) {
        navbar.classList.add('scrolled');
    } else {
        navbar.classList.remove('scrolled');
    }

    // 动画触发逻辑
    const elements = document.querySelectorAll('.fade-in');
    elements.forEach(el => {
        const rect = el.getBoundingClientRect();
        if (rect.top < window.innerHeight - 100) {
            el.classList.add('visible');
        }
    });
});

/* 
    视差滚动脚本
    使背景图像与前景内容以不同速度滚动，增加深度感。
*/
$(document).ready(function(){
    $(window).scroll(function(){
        $('.parallax').each(function(){
            var scrolled = $(window).scrollTop();
            var rate = $(this).data('rate');
            $(this).css('background-position', 'center ' + (scrolled * rate) + 'px');
        });
    });

    // Smooth scrolling for internal links
    $('.navbar a, .side-nav a').on('click', function(e) {
        if (this.hash !== "") {
            e.preventDefault();
            var hash = this.hash;
            $('html, body').animate({
                scrollTop: $(hash).offset().top - 70
            }, 800);
        }
    });
});

