
/* 
    全局样式设置
    这里定义了网页的全局字体、颜色以及基础布局。
*/
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif; /* 使用现代无衬线字体 */
    background: linear-gradient(135deg, #1e3c72 70%, #2a5298 25%, #00ff7f 5%); /* 渐变背景色，符合黄金比例 */
    color: #ffffff;
    line-height: 1.6;
}

/* 
    导航栏样式
    固定在页面顶部，包含主导航链接，并且具有悬停效果。
*/
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(30, 60, 114, 0.9); /* 半透明背景 */
    padding: 20px 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 轻微阴影增加层次感 */
}

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

.navbar li {
    margin: 0 15px;
}

.navbar a {
    color: #ffffff;
    text-decoration: none;
    font-size: 18px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.navbar a:hover {
    color: #00ff7f; /* 点缀色变化 */
    transform: scale(1.1); /* 放大效果 */
}

/* 
    主要内容区样式
    将不同的内容区域分开，使用网格布局和留白进行区分。
*/
.main-content {
    padding-top: 100px; /* 为固定导航栏留出空间 */
    display: grid;
    grid-template-columns: 1fr 3fr 1fr; /* 三列布局 */
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.sidebar-left, .sidebar-right {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px); /* 玻璃效果 */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.content-area {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 
    章节导航样式
    提供清晰的章节导航，帮助用户快速定位内容。
*/
.chapter-nav {
    position: sticky;
    top: 100px;
    background: rgba(30, 60, 114, 0.8);
    padding: 15px;
    border-radius: 8px;
}

.chapter-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chapter-nav li {
    margin-bottom: 10px;
}

.chapter-nav a {
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

.chapter-nav a:hover {
    color: #00ff7f;
}

/* 
    图像样式
    定义所有装饰性图片的圆角、阴影和悬停效果。
*/
img.decorative {
    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;
}

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

/* 
    标题样式
    定义不同层级标题的字体大小和颜色。
*/
h1, h2, h3, h4 {
    font-family: 'Open Sans', sans-serif;
    color: #ffffff;
}

h1 {
    font-size: 32px;
    margin-bottom: 20px;
}

h2 {
    font-size: 28px;
    margin-bottom: 15px;
}

h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

h4 {
    font-size: 20px;
    margin-bottom: 8px;
}

/* 
    文章内容样式
    定义段落和代码块的样式，确保可读性和美观。
*/
.article-content p {
    font-size: 16px;
    margin-bottom: 15px;
    color: #f0f0f0;
}

.article-content pre {
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.article-content code {
    color: #00ff7f;
    font-family: 'Courier New', Courier, monospace;
}

/* 
    提示信息样式
    明显的位置显示提示信息“这是一个网页样式设计参考”。
*/
.prompt-message {
    text-align: center;
    font-size: 20px;
    margin: 30px 0;
    color: #00ff7f;
    font-weight: bold;
}

/* 
    响应式设计
    使用媒体查询确保在不同屏幕宽度下的布局和元素调整。
*/
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr 2fr;
    }
    .sidebar-right {
        display: none; /* 隐藏右侧边栏 */
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .navbar ul {
        flex-direction: column;
    }
    .navbar li {
        margin: 10px 0;
    }
    .chapter-nav {
        position: static;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 24px;
    }
    h2 {
        font-size: 22px;
    }
    h3 {
        font-size: 20px;
    }
    h4 {
        font-size: 18px;
    }
    .navbar a {
        font-size: 16px;
    }
}

/* 
    动画效果
    定义页面加载时的淡入动画和滚动触发的元素动画。
*/
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 2s ease-in-out;
}

@keyframes slideIn {
    from { transform: translateX(-50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-in {
    animation: slideIn 1s ease forwards;
}

/* 
    高亮代码块样式
    专门用于展示CSS3代码示例的样式，与文章内容区分开来。
*/
.code-example {
    background: rgba(30, 60, 114, 0.9);
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.code-example code {
    color: #00ff7f;
    font-family: 'Courier New', Courier, monospace;
}

/* 
    底部样式
    定义页面底部的样式，保持与整体风格一致。
*/
.footer {
    background: rgba(30, 60, 114, 0.9);
    padding: 20px 0;
    text-align: center;
    color: #ffffff;
    font-size: 16px;
}

.footer a {
    color: #00ff7f;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s ease;
}

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