
/* 基本重置样式，确保跨浏览器的一致性 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
/* 定义颜色变量，主色调70%，辅色25%，点缀色5% */
:root {
    --primary-color: #1F2833; /* 深蓝色 */
    --secondary-color: #C5C6C7; /* 灰色 */
    --accent-color: #4CAF50; /* 亮绿色 */
    --highlight-color: #FF9800; /* 橙色 */
    --background-color: #F5F5F5; /* 浅灰色背景 */
    --text-color: #333333; /* 主要文字颜色 */
    --link-color: var(--accent-color);
    --link-hover-color: var(--highlight-color);
    --font-family: 'Roboto', sans-serif;
}
/* 全局样式设置 */
body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.6;
    padding: 20px;
}
/* 容器设置，使用响应式布局 */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}
/* 标题样式 */
h2, h3, h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: bold;
}
h2 {
    font-size: 24px;
}
h3 {
    font-size: 20px;
}
h4 {
    font-size: 18px;
}
/* 段落样式 */
p {
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--secondary-color);
}
/* 代码块样式 */
pre {
    background-color: #2C2C2C;
    color: #F8F8F2;
    padding: 15px;
    border-radius: 5px;
    overflow: auto;
    position: relative;
}
pre code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}
pre code::before {
    content: '代码示例';
    position: absolute;
    top: -20px;
    left: 10px;
    background-color: var(--primary-color);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
}
/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--primary-color);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
}
.navbar a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    transition: background 0.3s, color 0.3s;
}
.navbar a:hover {
    background: linear-gradient(45deg, var(--accent-color), var(--highlight-color));
    color: #fff;
}
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: center;
    }
}
/* 图片样式 */
img.decorative {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}
img.decorative:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
/* 按钮样式 */
.button {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    border-radius: 5px;
    transition: background 0.5s ease;
    cursor: pointer;
}
.button:hover {
    background: linear-gradient(45deg, var(--accent-color), var(--highlight-color));
}
/* 交互动画 */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}
/* 加载动画 */
.loader {
    width: 100px;
    height: 100px;
    border: 10px solid var(--secondary-color);
    border-top: 10px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* 网格布局示例 */
.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}
/* 栅列宽度 */
.col-1 { grid-column: span 1; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }
/* 链接样式 */
a {
    color: var(--link-color);
    text-decoration: none;
}
a:hover {
    color: var(--link-hover-color);
}
/* 滚动效果 */
.scroll-animation {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}
.scroll-animation.visible {
    opacity: 1;
    transform: translateX(0);
}
/* 响应式调整 */
@media (max-width: 1200px) {
    h2 { font-size: 22px; }
    h3 { font-size: 18px; }
    p { font-size: 15px; }
}
@media (max-width: 768px) {
    h2 { font-size: 20px; }
    h3 { font-size: 16px; }
    p { font-size: 14px; }
}

