
/* 基本重置样式，确保不同浏览器的一致性 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 设置全局字体和背景 */
body {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background: linear-gradient(135deg, #1E3A8A 70%, #FF8C00 25%, #00CED1 5%);
    color: #333333;
    padding: 20px;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(30, 144, 255, 0.9);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: top 0.3s;
    z-index: 1000;
}

.navbar.hidden {
    top: -80px;
}

.navbar a {
    color: #ffffff;
    text-decoration: none;
    margin: 0 10px;
    position: relative;
}

.navbar a::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: #ffffff;
    transition: width 0.3s;
    position: absolute;
    bottom: -5px;
    left: 0;
}

.navbar a:hover::after {
    width: 100%;
}

/* 主容器布局 */
.container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main"
        "footer footer";
    grid-gap: 20px;
    padding-top: 80px; /* 为导航栏留出空间 */
}

/* 侧边栏样式 */
.sidebar {
    grid-area: sidebar;
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s;
}

.sidebar img:hover {
    transform: scale(1.05);
}

/* 主要内容区域样式 */
.main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 文章标题样式 */
article h2 {
    font-size: 2em;
    color: #1E3A8A;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* 文章副标题样式 */
article h3 {
    font-size: 1.5em;
    color: #FF8C00;
    margin: 15px 0;
    position: relative;
}

article h3::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: #00CED1;
    margin-top: 5px;
    border-radius: 2px;
}

/* 文章段落样式 */
article p {
    font-size: 1em;
    color: #333333;
    margin-bottom: 15px;
    text-align: justify;
}

/* 代码块样式 */
article pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    overflow: auto;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

article pre code {
    font-family: 'Courier New', Courier, monospace;
    color: #2F4F4F;
    font-size: 0.95em;
}

/* 代码块标题 */
article pre code::before {
    content: '代码示例';
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #1E90FF;
}

/* 引用样式 */
article blockquote {
    border-left: 4px solid #FF8C00;
    padding-left: 15px;
    color: #666666;
    margin: 20px 0;
}

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

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

/* 按钮样式 */
button {
    background: radial-gradient(circle, #00CED1, #4682B4);
    border: none;
    padding: 10px 20px;
    color: #ffffff;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s, transform 0.3s;
}

button:hover {
    background: radial-gradient(circle, #4682B4, #00CED1);
    transform: translateY(-3px);
}

/* 底部区域样式 */
.footer {
    grid-area: footer;
    background: rgba(47, 79, 79, 0.9);
    color: #ffffff;
    padding: 20px;
    display: flex;
    justify-content: space-around;
    border-radius: 10px;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

.footer a {
    color: #FFA500;
    text-decoration: none;
    transition: color 0.3s;
}

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

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        grid-template-areas:
            "header header"
            "main main"
            "sidebar sidebar"
            "footer footer";
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 10px 20px;
    }
    
    .navbar a {
        margin: 0 5px;
        font-size: 0.9em;
    }
    
    article h2 {
        font-size: 1.8em;
    }
    
    article h3 {
        font-size: 1.3em;
    }
    
    button {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .container {
        grid-template-areas:
            "header"
            "main"
            "sidebar"
            "footer";
    }
    
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .footer {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

