/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body styling */
body,html {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f4f8;
    color: #333;
    line-height: 1.6;
    height: 100%;  /* 让页面高度充满整个屏幕 */
    margin: 0;     /* 清除默认的 margin */
    display: flex; /* 使用 Flexbox 布局 */
    flex-direction: column; /* 垂直排列 */
    justify-content: space-between; /* 让内容在屏幕内垂直分布 */
}

/* Header styling */
header {
    text-align: center;
    padding: 40px 20px;
    background-color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2em; /* Adjusted font size */
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    color: #7f8c8d;
}

header nav {
    margin-top: 20px;
}

header nav a {
    margin: 0 15px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 1.1em;
}

header nav a:hover {
    text-decoration: underline;
}

/* Main content styling */
main {
    padding: 20px;
}

/* Gallery grid */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.photo {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-top: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
    display: block;
    background: #f0f0f0;
}

/* 恢复图片定位样式 */
.photo img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.photo img.lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.photo img.loaded {
    opacity: 1;
}

.photo:hover {
    transform: scale(1.05);
}


/* Modal for enlarged image */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    margin: auto;
}

/* Footer styling */
footer {
    text-align: center;
    padding: 20px;
    background-color: #fff;
    color: #7f8c8d;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* About page styling */
.bio {
    display: flex;
    flex-direction: column; /* 改为竖直排列 */
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    gap: 20px; /* 调整图片与文字之间的间距 */
    align-items: center; /* 确保文字在容器中居中 */
    text-align: center; /* 文字本身居中 */
}

.bio img.portrait {
    border-radius: 50%;
    width: 200px;
    height: 200px;
    object-fit: cover;
}

.bio-text h2 {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 15px;
}

.bio-text p {
    font-size: 1.2em;
    color: #7f8c8d;
    margin-bottom: 30px;
}

/* Contact page styling */
.contact-info {
    text-align: center;
    padding: 40px 20px;
    margin-top: -200px;
}

.contact-info h2 {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 20px;
}

.contact-info p {
    font-size: 1.2em;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.contact-list {
    list-style: none;
    padding: 0;
}

.contact-list li {
    font-size: 1.2em;
    margin: 15px 0;
}

.contact-list i {
    margin-right: 10px;
    color: #2c3e50;
}

.contact-list a {
    color: #2c3e50;
    text-decoration: none;
}

.contact-list a:hover {
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    main {
    padding: 10px;
    }
    
    .gallery {
        grid-template-columns: repeat(3, 1fr); /* 强制显示3列 */
        gap: 10px;
        margin-top: 10px;
    }

    .bio {
        flex-direction: column;
        text-align: center;
    }

    .bio img.portrait {
        width: 150px;
        height: 150px;
    }

    .contact-info p {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    header p {
        font-size: 1em;
    }

    .contact-info h2 {
        font-size: 1.5em;
    }

    .contact-info p {
        font-size: 0.9em;
    }

    .contact-list li {
        font-size: 1em;
    }
}
