
/* 全局样式设置 */
/* 定义CSS变量，方便统一管理颜色 */
:root {
    --primary-color: #1E3A8A; /* 主色调：深蓝色，营造科技感与专业性 */
    --secondary-color: #F5F5F5; /* 辅助色：浅灰色，增强页面层次感 */
    --accent-color: #FFAB40; /* 点缀色：亮橙色，突出关键元素 */
    --text-color: #333333; /* 正文字体颜色 */
    --background-gradient: linear-gradient(135deg, #1E3A8A 0%, #FFAB40 100%); /* 背景渐变 */
    --font-family: 'Roboto', sans-serif; /* 全站字体 */
}

/* 重置默认样式，确保跨浏览器一致性 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 设置背景色和全局字体 */
body {
    background: var(--secondary-color);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.6;
    overflow-x: hidden; /* 防止水平滚动条出现 */
}

/* 头部导航栏样式 */
header {
    background-color: var(--primary-color);
    color: #ffffff;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

/* 导航栏容器 */
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
}

/* 导航品牌 */
.brand {
    font-size: 1.5rem;
    font-weight: bold;
}

/* 导航链接 */
.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1rem;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

/* 主内容区样式 */
.main-content {
    display: grid;
    grid-template-areas:
        "header"
        "content"
        "footer";
    grid-template-columns: 1fr;
    grid-template-rows: 60px 1fr 40px;
    padding-top: 80px; /* 预留头部导航栏空间 */
}

/* 文章内容区 */
.article-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* 文章标题样式 */
.article-section h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* 文章副标题样式 */
.article-section h3 {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
}

/* 文章段落样式 */
.article-section p {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 15px;
}

/* 强调文本颜色 */
.article-section span {
    font-weight: bold;
}

/* 代码块样式 */
.article-section pre {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 5px;
    overflow: auto;
    font-size: 0.9rem;
}

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

/* 图片样式 */
.article-section img {
    width: 100%;
    max-width: 320px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* 卡片设计 */
.card {
    background-color: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* 按钮样式 */
.btn-primary {
    background-color: var(--accent-color);
    color: #ffffff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    background-color: darken(var(--accent-color), 10%);
}

/* 响应式布局 */
@media (min-width: 768px) {
    .article-section {
        grid-template-columns: 1fr 1fr;
    }

    .article-section img {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none; /* 移动端隐藏导航链接，待后续添加汉堡菜单 */
    }

    .article-section {
        padding: 15px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* 提示信息样式 */
.reference-note {
    background-color: var(--accent-color);
    color: #ffffff;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    font-size: 1.2rem;
    margin: 20px 0;
}

/* 页脚样式 */
footer {
    background-color: var(--primary-color);
    color: #ffffff;
    text-align: center;
    padding: 10px 0;
    position: fixed;
    bottom: 0;
    width: 100%;
}

/* 过渡效果与交互 */
.nav-links a::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

/* 阴影效果 */
.box-shadow {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* 边框装饰 */
.decorative-border {
    border-left: 4px solid var(--accent-color);
    padding-left: 10px;
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* 滚动动画 */
.scroll-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 内部链接添加nofollow属性的样式调整 */
a[rel="nofollow"] {
    /* 无特殊样式，仅确保符合属性要求 */
}

/* 栅格系统 */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
}

/* 代码示例样式 */
.code-sample {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    position: relative;
}

/* 代码示例前样式 */
.code-sample::before {
    content: 'CSS3 代码示例';
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 0.9rem;
    color: #ffffff;
    background-color: var(--primary-color);
    padding: 2px 5px;
    border-radius: 3px;
}

