
/* 
    全局样式设置
    这里定义了全局的字体、颜色变量以及基础布局
*/
:root {
    --primary-color: #4B6CB7; /* 主色调，蓝紫渐变 */
    --secondary-color: #FEB47B; /* 辅助色，橙色渐变 */
    --accent-color: #FF7E5F; /* 点缀色，橙色 */
    --background-color: #F0F4F8; /* 页面背景色，浅灰 */
    --font-family: 'Roboto', sans-serif; /* 全局字体 */
    --transition-speed: 0.3s; /* 全局过渡速度 */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: var(--background-color);
    color: #333;
    line-height: 1.6;
    overflow-x: hidden; /* 禁止水平滚动 */
}

/* 导航栏样式 */
.navbar {
    background: linear-gradient(90deg, #4B6CB7, #182848); /* 蓝紫渐变背景 */
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition-speed) ease;
}

.navbar a {
    color: #fff;
    text-decoration: none;
    margin: 0 15px;
    font-size: 16px;
    transition: color var(--transition-speed) ease;
}

.navbar a:hover {
    color: var(--accent-color);
}

/* 主内容区样式 */
.container {
    max-width: 1200px;
    margin: 100px auto 50px; /* 顶部留出导航栏空间 */
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

/* 文章内容样式 */
article {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

article h2, article h3, article h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

article p {
    margin-bottom: 20px;
    font-size: 16px;
}

article pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    overflow: auto;
    margin-bottom: 20px;
}

article code {
    color: #d63384;
    font-family: 'Courier New', Courier, monospace;
}

article img {
    width: 100%;
    max-width: 320px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

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

/* 按钮样式 */
.button {
    background: linear-gradient(45deg, #FF7E5F, #FEB47B); /* 橙色渐变 */
    border: none;
    padding: 10px 20px;
    color: #fff;
    cursor: pointer;
    border-radius: 5px;
    transition: background var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.button:hover {
    background: linear-gradient(45deg, #FEB47B, #FF7E5F);
    transform: translateY(-2px);
}

/* 卡片式设计 */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: linear-gradient(135deg, #FF7E5F, #FEB47B);
    border-radius: 15px;
    padding: 30px;
    color: #fff;
    text-align: center;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

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

/* 加载动画样式 */
.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 100px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滚动动画 */
body.scrolled {
    background: linear-gradient(180deg, #182848, #4B6CB7);
    transition: background 1s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .container {
        margin: 80px 20px 20px;
    }
    .card-container {
        grid-template-columns: 1fr;
    }
    article img {
        max-width: 100%;
    }
}

/* 动态数据图表样式 */
.bar-chart {
    display: flex;
    align-items: flex-end;
    height: 200px;
    gap: 10px;
}

.bar {
    width: 40px;
    background: linear-gradient(180deg, #4B6CB7, #182848);
    transition: height 0.5s ease, background var(--transition-speed) ease;
}

.bar:hover {
    background: linear-gradient(180deg, #182848, #4B6CB7);
}

/* 折叠区域样式 */
.collapsible {
    background-color: #f1f1f1;
    color: #444;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    border-radius: 5px;
    transition: background-color var(--transition-speed) ease;
}

.collapsible:hover {
    background-color: #ddd;
}

.collapsible:after {
    content: '\002B'; /* 加号符号 */
    float: right;
}

.collapsible.active:after {
    content: "\2212"; /* 减号符号 */
}

.content {
    padding: 0 18px;
    display: none;
    overflow: hidden;
    background-color: #f9f9f9;
    border-radius: 5px;
}

/* 强调提示语 */
.highlight {
    background-color: var(--accent-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    text-align: center;
    margin-bottom: 30px;
    font-size: 18px;
    font-weight: bold;
}

/* 代码块标题样式 */
pre code::before {
    content: "CSS3 示例代码";
    display: block;
    background: var(--primary-color);
    color: #fff;
    padding: 5px 10px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    font-size: 14px;
    font-weight: bold;
}

pre code {
    overflow: visible;
}

