/* 基本样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
    color: #333;
}

/*
 * 关键部分注释:
 * - `position: fixed`: 使导航栏固定在顶部。
 * - `z-index: 1000`: 确保导航栏在其他内容之上。
 * - `box-shadow`: 添加阴影效果，使其更具层次感。
 * - `display: flex`: 使用 Flexbox 布局，方便对齐。
 */
header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #333;
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 0;
}

nav ul li {
    margin: 0 1rem;
}

nav ul li a {
    color: #333;
    text-decoration: none;
    font-weight: bold;
}

/* 
 * 关键部分注释:
 * - `height: 100vh`: 使首页区域占满整个屏幕高度。
 * - `background`: 设置背景图，`cover`使其覆盖整个区域。
 */
#home {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: url('../assets/background.jpg') no-repeat center center/cover;
    color: #fff;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* 内容区域 */
main {
    padding-top: 60px; /* 导航栏高度 */
}

section {
    padding: 4rem 2rem;
    max-width: 960px;
    margin: 0 auto;
}

section h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

/* 关于我 */
.resume {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.about-card {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.about-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.about-card h3 {
    color: #007bff; /* 天蓝色 */
}

/* 
 * 关键部分注释:
 * - `display: grid`: 使用 Grid 布局，方便创建卡片网格。
 * - `grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))`: 响应式网格，自动调整列数。
 * - `transition`: 为 hover 效果添加平滑过渡。
 * - `:hover`: 定义鼠标悬停时的样式，`transform: translateY(-10px)`使其向上移动，`box-shadow`增加阴影。
 */
.project-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.card h3 {
    margin-top: 0;
}

/* 联系方式 */
.contact-info {
    text-align: center;
}

.profile-pic {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

/* 项目页面和联系页面标题背景图片 */
.hero-section {
    position: relative;
    text-align: center;
    color: white;
    padding: 100px 20px;
    background-image: url('../images/background.jpg');
    background-size: cover;
    background-position: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.hero-section h2 {
    position: relative;
    z-index: 1;
    font-size: 3em;
    margin: 0;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    padding-top: 30px;
}

.project-details {
    display: none;
}

.project-details.active {
    display: block;
}

.project-details h3 {
    text-align: center;
    font-size: 2em;
    margin-bottom: 20px;
}

.project-info {
    text-align: left;
}

.project-info h4 {
    font-size: 1.5em;
    margin-top: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

.project-info ul {
    list-style: disc;
    padding-left: 20px;
}

@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

/* 
 * 关键部分注释:
 * - `@media (max-width: 768px)`: 媒体查询，当屏幕宽度小于768px时应用内部样式。
 * - `flex-direction: column`: 在小屏幕上将导航栏变为垂直排列。
 */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        align-items: center;
    }

    nav ul li {
        margin: 0.5rem 0;
    }

    .hero h1 {
        font-size: 2rem;
    }
}