/* style.css - CSS Grid 自适应布局，PC多列，移动单列 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Poppins', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
    background: #f5f7fb;
    color: #1e293b;
    line-height: 1.4;
}

.gallery-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* 核心：CSS Grid 网格布局 */
.image-grid {
    display: grid;
    gap: 24px;
    /* PC端：自动填充，最小宽度260px，最大1fr，实现响应式列数 */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* 每个图片卡片 */
.grid-item {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.12);
}

.image-card {
    display: block;
    cursor: pointer;
    background: #e2e8f0;
    line-height: 0;
}

.image-card img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.image-card:hover img {
    transform: scale(1.02);
}

/* 移动端：当屏幕宽度小于 640px 时，强制单列 */
@media (max-width: 640px) {
    .image-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .gallery-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }
}

/* 加载更多触发器 */
.load-more-trigger {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}
.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-top: 2px solid #1e293b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 全屏加载层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
    color: white;
    font-weight: 500;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* 灯箱样式 */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.lightbox.show {
    opacity: 1;
}
.lightbox-image-wrapper {
    max-width: 85%;
    max-height: 80%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}
.lightbox-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 35px rgba(0,0,0,0.5);
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform: scale(0.98);
    opacity: 0;
}
.lightbox-content.show-img {
    transform: scale(1);
    opacity: 1;
}
.close-lightbox {
    position: absolute;
    top: 25px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    z-index: 1001;
}
.close-lightbox:hover {
    color: #bbb;
}
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    font-size: 32px;
    padding: 12px 18px;
    cursor: pointer;
    border-radius: 50%;
    transition: 0.2s;
    z-index: 1001;
}
.nav-btn:hover {
    background: rgba(0,0,0,0.8);
    transform: translateY(-50%) scale(1.05);
}
.prev-btn {
    left: 20px;
}
.next-btn {
    right: 20px;
}
@media (max-width: 768px) {
    .nav-btn { font-size: 24px; padding: 8px 14px; }
    .prev-btn { left: 10px; }
    .next-btn { right: 10px; }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 32px;
    margin: 3rem auto;
    max-width: 500px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}
.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.6;
}
.empty-state h3 {
    font-size: 1.4rem;
    color: #334155;
}
.empty-state p {
    color: #5b6e8c;
    margin-top: 0.5rem;
}