/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 页眉样式 */
header {
    background-color: #2c3e50;
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

.profile-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ecf0f1;
    margin-bottom: 1rem;
}

/* 导航栏 */
nav {
    background-color: #34495e;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

nav a {
    color: white;
    padding: 14px 16px;
    text-decoration: none;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: #1abc9c;
}

/* 主要内容 */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

section {
    background: white;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 图片画廊 */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 每行3列 */
    gap: 20px;
    padding: 15px;
    justify-items: center;
}

.photo-item {
    width: 100%; /* 改为百分比宽度 */
    aspect-ratio: 1/1; /* 保持正方形比例 */
    max-width: 300px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s;
}

.photo-item:hover {
    transform: translateY(-5px);
}

.scaled-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.5s;
}

.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px;
    text-align: center;
    font-size: 14px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    overflow: auto;
}

.modal-content {
    display: block;
    max-width: 90%;
    max-height: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#caption {
    color: #fff;
    text-align: center;
    padding: 10px;
    position: absolute;
    bottom: 0;
    width: 100%;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #bbb;
}

/* 页脚 */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 30px;
}

.beian a {
    color: white;
    text-decoration: none;
    font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
    .photo-item {
        width: 30vw;
        height: 30vw;
    }
}

@media (max-width: 600px) {
    .photo-gallery {
        grid-template-columns: 1fr;
    }
    .photo-item {
        width: 45vw;
        height: 45vw;
        min-width: 120px;
        min-height: 120px;
    }
    
    nav a {
        padding: 10px 12px;
        font-size: 14px;
    }
}