
/* 全局变量定义 */
:root {
    --primary-color: #2C3E50; /* 主色调：深蓝 */
    --secondary-color: #95A5A6; /* 辅色：灰色 */
    --accent-color: #E67E22; /* 点缀色：橙色 */
    --highlight-color: #F1C40F; /* 点缀色：黄色 */
    --background-gradient: linear-gradient(135deg, #2C3E50, #95A5A6);
    --text-color: #ECF0F1;
    --font-family: 'Roboto', sans-serif;
    --transition-speed: 0.3s;
}

/* 全局样式 */
body {
    margin: 0;
    padding: 0;
    background: var(--background-gradient);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 容器布局 */
.container {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

.navbar .logo {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-color);
}

.navbar ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.navbar ul li {
    margin-left: 20px;
    position: relative;
}

.navbar ul li a {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 12px;
    transition: background var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.navbar ul li a:hover {
    background-color: var(--accent-color);
    transform: scale(1.05);
    border-radius: 5px;
    rel: "nofollow";
}

/* 主要内容区域 */
.main-content {
    margin-top: 80px; /* 避免被固定导航栏遮挡 */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* 文章部分样式 */
article {
    background-color: rgba(44, 62, 80, 0.8);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

article h2, article h3 {
    color: var(--highlight-color);
}

article pre {
    background-color: #34495E;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
}

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

article .button {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background var(--transition-speed) ease, transform var(--transition-speed) ease;
}

article .button:hover {
    background-color: var(--highlight-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* 图片样式 */
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.image-gallery 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;
}

.image-gallery img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 10px rgba(0,0,0,0.15);
}

/* 交互效果 */
button, .button {
    position: relative;
}

button::after, .button::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    border: 2px solid var(--highlight-color);
    border-radius: 5px;
    animation: glow 2s infinite;
    opacity: 0;
}

button:hover::after, .button:hover::after {
    opacity: 1;
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px var(--highlight-color);
    }
    50% {
        box-shadow: 0 0 20px var(--highlight-color);
    }
    100% {
        box-shadow: 0 0 5px var(--highlight-color);
    }
}

/* 模块化布局 */
.module {
    background-color: rgba(44, 62, 80, 0.8);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.module h3 {
    color: var(--highlight-color);
    margin-bottom: 10px;
}

.module ul {
    list-style-type: square;
    padding-left: 20px;
}

.module ul li {
    margin-bottom: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .navbar ul li {
        margin-left: 0;
        width: 100%;
    }

    .navbar ul li a {
        width: 100%;
        box-sizing: border-box;
    }

    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 提示信息样式 */
.alert {
    background-color: var(--accent-color);
    color: var(--primary-color);
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    margin: 20px 0;
    font-weight: bold;
    font-size: 1.2em;
}

/* 链接样式 */
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
    rel: "nofollow";
}

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

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

.code-block::before {
    content: 'CSS3 代码示例';
    display: block;
    font-weight: bold;
    color: var(--highlight-color);
    margin-bottom: 10px;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 结尾样式 */
.footer {
    background-color: var(--primary-color);
    color: var(--text-color);
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid var(--secondary-color);
}

