* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
 
body {
    background-color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
 
header {
    padding: 20px 0;
    text-align: center;
}
 
.logo {
    max-height: 120px;
    max-width: 300px;
    height: auto;
    width: auto;
}
 
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    padding: 15px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}
 
.gallery-item {
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
	display: flex; /* 新增 */
    align-items: center; /* 新增 */
    justify-content: center; /* 新增 */
    background-color: #f5f5f5; /* 新增 - 作为加载时的背景 */
}
 
.gallery-item:hover {
    transform: scale(1.02);
}
 
.gallery-item img {
    width: 100%;
    height: 100%; /* 修改 */
    object-fit: cover; /* 确保图片填满容器 */
    min-height: 100%; /* 新增 */
    min-width: 100%; /* 新增 */
}
 
/* 灯箱样式 */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}
 
.lightbox.show  {
    opacity: 1;
}
 
.lightbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
	pointer-events: none;
}
 
/* 灯箱内容 - 关键修改 */
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 80vh;
    margin: 0 auto;
    pointer-events: auto; /* 内容区域接收点击事件 */
}
 
.lightbox.show  .lightbox-content {
    transform: scale(1);
}
 
/* 修改灯箱图片样式 */
.lightbox-content img {
    max-width: 100%;
    max-height: calc(80vh - 60px); /* 为说明文字留出空间 */
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
 
.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
	pointer-events: auto; /* 按钮接收点击事件 */
    z-index: 10;
}
 
.close-btn:hover {
    color: #ccc;
}
 
/* 保持对导航按钮的调整 */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    pointer-events: auto; /* 按钮接收点击事件 */
    z-index: 10;
}
 
.nav-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}
 
.prev-btn {
    left: 30px;
}
 
.next-btn {
    right: 30px;
}
 
.caption {
    color: white;
    margin-top: 15px;
    font-size: 18px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    position: relative; /* 确保在灯箱内正确定位 */
    z-index: 1; /* 防止被其他元素遮挡 */
}
 
/* 加载指示器 */
.loading {
    text-align: center;
    padding: 20px;
    display: none;
}
 
/* 响应式调整 */
@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
        padding: 10px;
    }
    
    .logo {
        max-height: 50px;
    }
    
    .lightbox-content {
        max-width: 90%;
    }
    
    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 30px;
    }
    
    .prev-btn {
        left: 10px;
    }
    
    .next-btn {
        right: 10px;
    }
}
 
@media (max-width: 480px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 8px;
        padding: 8px;
    }
    
    .logo {
        max-height: 40px;
    }
    
    .lightbox-content {
        max-width: 95%;
    }
    
    .close-btn {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 25px;
    }
    
    .caption {
        font-size: 16px;
    }
}

/* 夜间模式样式 */
body.dark-mode  {
    background-color: #5a506a;
}
 
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    z-index: 100;
}
 
/* 响应式调整 */
@media (max-width: 768px) {
    .theme-toggle {
        top: 15px;
        right: 15px;
        font-size: 20px;
    }
}
 
@media (max-width: 480px) {
    .theme-toggle {
        top: 10px;
        right: 10px;
        font-size: 18px;
    }
}