
/* 全局变量定义，包括主色调、辅色调和点缀色 */
:root {
    --main-color: #1E90FF; /* 深蓝色作为主色调 */
    --secondary-color: #696969; /* 灰色作为辅色调 */
    --accent-color: #32CD32; /* 绿色作为点缀色 */
    --background-color: #F0F8FF; /* 背景颜色，避免纯白 */
    --text-color: #333333; /* 文字主色 */
    --link-color: #1E90FF; /* 链接颜色 */
    --link-hover-color: #32CD32; /* 链接悬停颜色 */
}

/* 全局样式，应用背景色和文字颜色 */
body {
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    font-size: 16px;
}

/* 固定导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--main-color);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 导航栏链接样式 */
.navbar a {
    color: white;
    margin: 0 1rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* 主容器样式，使用网格布局确保响应性 */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    padding: 6rem 2rem 2rem 2rem; /* 顶部留出导航栏空间 */
}

/* 文章标题样式 */
h2, h3, h4 {
    color: var(--main-color);
    margin-bottom: 1rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

/* 段落样式 */
p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* 高亮代码块样式 */
pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 5px;
    overflow: auto;
    position: relative;
}

/* 代码块内代码颜色 */
pre code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

/* 代码块前添加语言标识 */
pre code::before {
    content: 'CSS3 示例代码';
    display: block;
    background-color: var(--secondary-color);
    color: white;
    padding: 0.5rem;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    font-size: 0.85rem;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

table th, table td {
    border: 1px solid var(--secondary-color);
    padding: 0.75rem;
    text-align: left;
}

table th {
    background-color: var(--main-color);
    color: white;
}

table tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* 图片样式，包括圆角、阴影和悬停效果 */
img {
    width: 100%;
    max-width: 320px;
    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:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* 按钮样式，带有悬停和点击动画 */
.button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.button:hover {
    background-color: darken(var(--accent-color), 10%);
    transform: translateY(-2px);
}

.button::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(50, 205, 50, 0.5);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
}

.button:active::after {
    transform: scale(1);
    animation: ripple 0.6s linear;
}

/* 波纹动画 */
@keyframes ripple {
    to {
        opacity: 0;
        transform: scale(4);
    }
}

/* 面包屑导航样式 */
.breadcrumb {
    list-style: none;
    display: flex;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb li {
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.breadcrumb li::after {
    content: '>';
    margin-left: 0.5rem;
    color: var(--secondary-color);
}

.breadcrumb li:last-child::after {
    content: '';
}

/* 留白与容器优化，确保内容不低于500px宽度 */
.section {
    min-width: 500px;
    padding: 1rem;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 折叠区域样式 */
.collapsible {
    background-color: var(--secondary-color);
    color: white;
    cursor: pointer;
    padding: 0.75rem;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 1rem;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.active, .collapsible:hover {
    background-color: var(--accent-color);
}

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

.content p {
    margin: 1rem 0;
}

/* 动画效果，用于滚动时内容淡入 */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 1s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 数据可视化图表样式 */
.chart-bar {
    width: 50px;
    background-color: var(--secondary-color);
    margin: 0 10px;
    animation: grow 2s forwards;
}

.chart-bar:hover {
    background-color: var(--accent-color);
}

@keyframes grow {
    from {
        height: 0;
    }
    to {
        height: 200px;
    }
}

/* 视频容器样式 */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.video-container iframe {
    position: absolute;
    top:0;
    left: 0;
    width: 100%;
    height: 100%;
}

