
/* 生态智境——自然有机与科技融合的创新网页设计 CSS样式 */

/* 根元素定义颜色变量 */
:root {
    --main-green: #8BC34A;
    --earth-tone: #F5DEB3;
    --gold: #FFD700;
    --light-blue: #87CEFA;
    --dark-gray: #333333;
    --light-gray: #f0f0f0;
    --font-primary: 'Roboto', sans-serif;
    --font-secondary: 'Handwritten', cursive;
}

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

body {
    font-family: var(--font-primary);
    background: linear-gradient(135deg, var(--main-green), var(--earth-tone));
    color: var(--dark-gray);
    line-height: 1.6;
    padding: 20px;
}

header {
    text-align: center;
    padding: 50px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

header h1 {
    font-family: var(--font-secondary);
    font-size: 3em;
    color: var(--gold);
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    color: var(--dark-gray);
}

nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

nav a {
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: bold;
    position: relative;
}

nav a::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width 0.3s;
    position: absolute;
    bottom: -5px;
    left: 0;
}

nav a:hover::after {
    width: 100%;
}

.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}

.card img {
    width: 100%;
    height: auto;
    display: block;
}

.card-content {
    padding: 20px;
}

.card-content h3 {
    font-family: var(--font-secondary);
    font-size: 1.8em;
    color: var(--main-green);
    margin-bottom: 10px;
}

.card-content p {
    font-size: 1em;
    color: var(--dark-gray);
}

.article-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 40px;
}

.article-section h2 {
    font-family: var(--font-secondary);
    font-size: 2.5em;
    color: var(--light-blue);
    margin-bottom: 20px;
    text-align: center;
}

.article-section pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    margin-bottom: 20px;
}

.article-section code {
    background: #e0e0e0;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.article-section ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-top: 10px;
}

.footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    font-size: 1em;
    color: var(--dark-gray);
}

/* 动画效果 */
.transition-effect {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s ease-in-out forwards;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 320px) {
    header h1 {
        font-size: 2em;
    }
    .card-content h3 {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    nav {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) and (max-width: 1200px) {
    .container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1201px) {
    .container {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 代码高亮样式 */
.code-block {
    background: #272822;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
}

