/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* 隐藏根滚动条，保留页面滚动能力，兼容主流浏览器及 IE/旧版 Edge */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
}

/* 瀑布流容器 - 改为 Flex 布局 */
.container {
    display: flex;
    align-items: flex-start; /* 使得各列高度独立，不被拉伸 */
    gap: 15px; /* 列间距 */
    padding: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

/* 单独的一列 */
.column {
    display: flex;
    flex-direction: column;
    gap: 15px; /* 图片上下间距 */
    flex: 1; /* 均匀平分宽度 */
    min-width: 0; /* 防止内部图片内容过宽撑破列 */
}

/* 移除之前的 break-inside 和 margin-bottom（现由 flex gap 控制） */
.image-item {
    position: relative;
    background-color: #ddd; /* 加载前的占位背景色 */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-height: 100px; /* 避免没加载时太扁导致视口判定失误 */
    transition: transform 0.45s ease, box-shadow 0.45s ease;
}

.image-item:hover,
.image-item:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.18);
}

.image-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0) 68%);
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.35s ease, left 0.12s ease-out, top 0.12s ease-out;
    pointer-events: none;
    z-index: 1;
}

.image-item:hover .image-glow,
.image-item:focus-within .image-glow {
    opacity: 1;
}

/* box为图片的大小：宽度100%，高度自适应 */
.image-item img {
    position: relative;
    z-index: 0;
    width: 100%;
    height: auto;
    display: block;
    opacity: 0; /* 初始透明，等待加载完成后显示 */
    transition: opacity 0.4s ease-in-out, transform 0.45s ease, filter 0.45s ease; /* 渐显动画 */
}

.image-item:hover img,
.image-item:focus-within img {
    transform: scale(1.03);
    filter: brightness(0.9);
}

/* 底部用于触发无限滚动的哨兵元素 */
#sentinel {
    height: 20px;
    width: 100%;
}

/* ========== Lightbox 样式 ========== */

/* Lightbox 容器 */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Lightbox 背景遮罩层 */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    z-index: 1;
}

/* Lightbox 内容容器 */
.lightbox-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 90%;
    max-height: 90vh;
    animation: zoomIn 0.3s ease-out;
}

/* Lightbox 图片 */
.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    margin-bottom: 30px;
}

/* 控制按钮容器 */
.lightbox-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

/* 玻璃态按钮 */
.glass-btn {
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 30px;
    color: #fff;
    cursor: pointer;
    
    /* iOS 玻璃态效果 */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.1);
    
    /* 过渡动画 */
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateY(0);
    
    /* 防止文本选中 */
    user-select: none;
    -webkit-user-select: none;
}

/* 按钮悬停效果 - iOS 液态玻璃动画 */
.glass-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    box-shadow: 
        inset 0 1px 3px rgba(255, 255, 255, 0.4),
        0 15px 45px rgba(0, 0, 0, 0.2);
    transform: translateY(-3px);
    letter-spacing: 0.5px;
}

/* 按钮按下效果 */
.glass-btn:active {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.2),
        0 5px 20px rgba(0, 0, 0, 0.15);
}

/* 按钮禁用状态 */
.glass-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 动画：淡入 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 动画：缩放进入 */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 关闭按钮（左上角）- 可选 */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 28px;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 3;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .image-glow {
        display: none;
    }

    .lightbox-image {
        max-height: 60vh;
        margin-bottom: 20px;
    }

    .lightbox-controls {
        flex-wrap: wrap;
        gap: 12px;
    }

    .glass-btn {
        padding: 10px 24px;
        font-size: 13px;
    }

    .lightbox-content {
        max-width: 95%;
        padding: 0 10px;
    }
}
