/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

/* 画廊容器 */
.gallery-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 画廊标题 */
.gallery-title {
    text-align: center;
    margin: 30px 0;
    color: #2c3e50;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    position: relative;
    padding-bottom: 15px;
}

.gallery-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, #3498db, #9b59b6);
}

/* 核心网格布局 - 始终6列 */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* 画廊项目 - 修改为flex布局以便标题定位 */
.gallery-item {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column; /* 垂直排列 */
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* 图片容器 - 占据剩余空间 */
.image-container {
    flex: 1; /* 占据剩余空间 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.08);
}

/* 图片标题 - 固定在底部并居中 */
.gallery-caption {
    padding: 12px;
    text-align: center;
    font-size: clamp(0.8rem, 2vw, 1rem);
    background-color: #fff;
    border-top: 1px solid #eee;
    margin-top: auto; /* 将标题推到底部 */
}

/* 链接样式 */
.gallery-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 移动端响应式设计 */
@media (max-width: 1200px) {
    .gallery-grid {
        gap: 15px;
    }
}

@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .image-container {
        padding: 10px;
    }
    
    .gallery-caption {
        padding: 8px;
        font-size: 0.7rem;
    }
}

/* 极小型设备调整 */
@media (max-width: 360px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}