/* 不规则图片墙样式 */
.masonry-gallery {
    margin: 40px auto;
    width: 100%;
    max-width: 1200px;
}

.masonry-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
    position: relative;
}

.masonry-title:after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: #CF8F48;
}

/* 不规则图片墙布局 - 使用网格布局 */
.masonry-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: minmax(150px, auto);
    grid-auto-flow: dense;
    grid-gap: 15px;
    width: 100%;
    overflow-x: auto;
    padding: 20px 0;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.masonry-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* 不同尺寸的图片项 */
.masonry-item:nth-child(3n+1) {
    grid-column: span 1;
    grid-row: span 1;
}

.masonry-item:nth-child(3n+2) {
    grid-column: span 2;
    grid-row: span 1;
}

.masonry-item:nth-child(5n+3) {
    grid-column: span 1;
    grid-row: span 2;
}

.masonry-item:nth-child(4n) {
    grid-column: span 2;
    grid-row: span 2;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .masonry-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .masonry-container {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .masonry-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

.masonry-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    scroll-snap-align: start;
    cursor: pointer;
    height: 100%;
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

.masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: all 0.5s ease;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

/* 添加滑动指示器 */
/* .masonry-gallery::after {
    content: '\f053 滑动查看更多 \f054';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    bottom: 10px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0.8;
    animation: pulse 2s infinite;
    pointer-events: none;
} */

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* 图片标题覆盖层 */
.masonry-item .item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: #fff;
    padding: 15px;
    opacity: 0;
    transition: all 0.3s ease;
}

.masonry-item:hover .item-overlay {
    opacity: 1;
}

.masonry-item .item-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* 图片放大查看功能 */
.masonry-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.masonry-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border: 2px solid #fff;
}

.lightbox-caption {
    position: absolute;
    bottom: -40px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 16px;
    padding: 10px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    padding: 0 20px;
}

.lightbox-btn {
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 滑动导航按钮 */
.masonry-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    transform: translateY(-50%);
    z-index: 5;
    pointer-events: none;
}

.masonry-nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.masonry-nav-btn:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.masonry-nav-btn.hidden {
    opacity: 0;
    visibility: hidden;
}

.masonry-nav-btn i {
    color: #333;
    font-size: 16px;
}

.masonry-container.active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}

/* 动画效果 */
.masonry-item {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 为不同项目设置不同的动画延迟 */
.masonry-item:nth-child(1) { animation-delay: 0.1s; }
.masonry-item:nth-child(2) { animation-delay: 0.2s; }
.masonry-item:nth-child(3) { animation-delay: 0.3s; }
.masonry-item:nth-child(4) { animation-delay: 0.4s; }
.masonry-item:nth-child(5) { animation-delay: 0.5s; }
.masonry-item:nth-child(6) { animation-delay: 0.6s; }
.masonry-item:nth-child(7) { animation-delay: 0.7s; }
.masonry-item:nth-child(8) { animation-delay: 0.8s; }
.masonry-item:nth-child(9) { animation-delay: 0.9s; }
.masonry-item:nth-child(10) { animation-delay: 1.0s; }
.masonry-item:nth-child(11) { animation-delay: 1.1s; }
.masonry-item:nth-child(12) { animation-delay: 1.2s; }