/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "微软雅黑", "Microsoft YaHei", Arial, sans-serif;
}

/* 全局变量（方便改配色） */
:root {
    --primary-color: #2c3e50; /* 主色：深蓝灰 */
    --secondary-color: #3498db; /* 次要色：浅蓝 */
    --accent-color: #e74c3c; /* 强调色：红 */
    --light-color: #f5f7fa; /* 浅色背景 */
    --dark-color: #34495e; /* 深色文字 */
    --card-shadow: 0 4px 12px rgba(0,0,0,0.1); /* 卡片阴影 */
}

/* 容器（居中、限制宽度） */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* 导航栏 */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.logo i {
    color: var(--secondary-color);
    margin-right: 0.5rem;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.nav-links a i {
    margin-right: 0.3rem;
}

.nav-links a:hover {
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

/* 首页横幅 */
.hero {
    background: linear-gradient(rgba(44, 62, 80, 0.8), rgba(44, 62, 80, 0.9)), 
                url("https://picsum.photos/1920/1080?random=0") center/cover no-repeat;
    color: white;
    padding: 6rem 0;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.hero-btn {
    background-color: var(--secondary-color);
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 4px;
    color: white;
    text-decoration: none;
    cursor: pointer;
}

.hero-btn:hover {
    background-color: #2980b9;
    transition: background-color 0.3s ease;
}

/* 通用区块样式 */
.section {
    padding: 4rem 0;
}

.section h2 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.section h2 i {
    margin-right: 0.8rem;
    color: var(--secondary-color);
}

/* 关于我 */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--dark-color);
}

.about-content p {
    margin-bottom: 1rem;
}

/* 技能栈 */
.skills-section {
    background-color: var(--light-color);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.skill-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    text-align: center;
}

.skill-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.skill-card p {
    color: var(--dark-color);
    line-height: 1.6;
}

/* 项目网格 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* 项目卡片 */
.project-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.project-img img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-card h3 {
    color: var(--primary-color);
    margin: 1.5rem 1.5rem 0.8rem;
    font-size: 1.3rem;
}

.project-card p {
    color: var(--dark-color);
    line-height: 1.6;
    margin: 0 1.5rem 1rem;
}

.project-links {
    padding: 0 1.5rem 1.5rem;
}

/* 按钮通用样式 */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn i {
    margin-right: 0.3rem;
}

.btn:hover {
    background-color: #2980b9;
}

/* 联系方式 */
.contact-section {
    background-color: var(--light-color);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.contact-item {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    text-align: center;
}

.contact-item i {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.contact-item p {
    font-size: 1.1rem;
    color: var(--dark-color);
}

/* 页脚 */
.footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 0;
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer i {
    color: var(--accent-color);
}

/* 响应式适配（手机/平板） */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        text-align: center;
    }

    .nav-links {
        justify-content: center;
        margin-top: 1rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .section h2 {
        font-size: 1.8rem;
    }

    .project-img img {
        height: 180px;
    }
}
/* 在style.css末尾加 */
@media (max-width: 768px) {
    /* 手机上导航栏文字换行 */
    header h1 {
        font-size: 18px;
    }
    /* 手机上卡片占满宽度 */
    .project-card {
        width: 100%;
    }
    /* 手机上导航链接竖向排列 */
    nav {
        flex-direction: column;
        gap: 10px;
    }
}