
/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 设置全局字体和背景色 */
body {
    font-family: 'Open Sans', sans-serif;
    color: #FFFFFF;
    background: linear-gradient(135deg, #2C3E50 70%, #34495E 25%, #1ABC9C 5%);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(44, 62, 80, 0.8); /* 半透明背景 */
    backdrop-filter: blur(10px); /* 磨砂玻璃效果 */
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.navbar .logo {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    color: #ECF0F1;
}

.navbar .nav-links a {
    color: #ECF0F1;
    margin-left: 20px;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

.navbar .nav-links a:hover {
    color: #1ABC9C;
}

/* 主容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 20px 20px 20px; /* 顶部留出导航栏空间 */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 40px;
}

/* 提示信息样式 */
.prompt {
    font-size: 20px;
    color: #E74C3C;
    text-align: center;
    margin-bottom: 40px;
    font-weight: bold;
}

/* 文章样式 */
article {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

article h2, article h3 {
    font-family: 'Montserrat', sans-serif;
    color: #ECF0F1;
    margin-bottom: 20px;
}

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

article pre {
    background: rgba(44, 62, 80, 0.8);
    border-radius: 10px;
    padding: 15px;
    overflow-x: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

/* 代码块标题样式 */
pre code::before {
    content: "CSS 代码示例";
    position: absolute;
    top: -25px;
    left: 15px;
    background: #1ABC9C;
    color: #FFFFFF;
    padding: 5px 10px;
    border-radius: 5px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
}

pre code {
    overflow: visible;
    position: relative;
}

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

img.decorative:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* 按钮样式 */
.button {
    display: inline-block;
    padding: 10px 20px;
    background: #1ABC9C;
    color: #FFFFFF;
    border: none;
    border-radius: 25px;
    text-decoration: none;
    font-size: 16px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.button:hover {
    background: #16A085;
    transform: translateY(-3px);
}

/* 代码块样式 */
pre code {
    display: block;
    background: #34495E;
    padding: 15px;
    border-radius: 10px;
    overflow-x: auto;
}

pre code::before {
    content: "CSS 代码示例";
    position: absolute;
    top: -25px;
    left: 15px;
    background: #1ABC9C;
    color: #FFFFFF;
    padding: 5px 10px;
    border-radius: 5px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
}

pre code {
    overflow: visible;
}

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

.section {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 响应式图片网格 */
.image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.image-grid img {
    flex: 1 1 calc(33.333% - 20px);
}

/* 防止导航栏内容溢出 */
.navbar .nav-links {
    display: flex;
    align-items: center;
}

.navbar .nav-links a {
    white-space: nowrap;
}

/* 确保容器最小宽度 */
.container > * {
    min-width: 500px;
}

/* 提示信息样式调整 */
.prompt {
    font-size: 22px;
    color: #E74C3C;
    text-align: center;
    margin-bottom: 50px;
    font-weight: bold;
}

/* 防止水平滚动 */
body, html {
    width: 100%;
    overflow-x: hidden;
}

/* 其他辅助样式 */
footer {
    text-align: center;
    padding: 20px;
    background: rgba(44, 62, 80, 0.8);
    backdrop-filter: blur(10px);
    color: #ECF0F1;
    position: relative;
    bottom: 0;
    width: 100%;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

footer a {
    color: #1ABC9C;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #16A085;
}

/* 适配小屏幕 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .navbar .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .navbar .nav-links a {
        margin: 10px 0;
    }

    .image-grid img {
        flex: 1 1 calc(50% - 20px);
    }
}

@media (max-width: 480px) {
    .image-grid img {
        flex: 1 1 100%;
    }
}

