/* style.css - 强制优先级修复版 */

* {
    margin: 0; padding: 0; box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6; color: #333;
    background-color: #1a1a2e;
    margin: 0; padding: 0; overflow-x: hidden;
}

/* === 页面头部 === */
header {
    background-color: transparent !important;
    color: #ffffff; padding: 1.2rem 0;
    text-align: center; margin-bottom: 25px;
    box-shadow: none !important;
}

header h1 {
    margin-bottom: 0.5rem; font-size: 2.2rem;
    color: #9D65FF;
    letter-spacing: 1px;
}

/* === 主要内容 === */
main {
    max-width: 1300px; margin: 0 auto; padding: 0 15px;
    position: relative;
}

h2 {
    text-align: center; margin-bottom: 1.5rem;
    color: #ffffff; font-size: 1.8rem;
}

/* === 图片画廊布局 === */
.gallery-grid {
    display: grid; 
    grid-template-columns: repeat(5, 1fr);
    gap: 50px 25px; /* 行间距 50px，列间距 25px */
    margin-top: 30px;
    padding: 0 5px;
}

/* 使用 .gallery-item 的子元素直接强制定位 */
.gallery-item {
    position: relative !important;
    background-color: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: transform 0.3s ease-in-out;
    cursor: pointer;
    overflow: visible !important;
    display: flex !important; 
    flex-direction: column !important;
    justify-content: flex-start !important;
    height: auto !important;
    padding-bottom: 20px;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.01);
}

.gallery-item img {
    width: 100%; 
    height: auto !important;
    object-fit: contain; 
    display: block;
    border-radius: 12px;
    padding: 0;
    flex-grow: 0 !important;
}

/* === 关键修正：标题容器 (自然流动) === */
.gallery-item .caption-container {
    position: relative !important;
    width: 100% !important;
    z-index: 9999 !important;
    display: block !important;
    visibility: visible !important;
    margin-bottom: 5px !important;
    flex-shrink: 0; /* 标题不被压缩 */
}

.gallery-item .gallery-caption {
    padding: 10px !important;
    font-size: 0.9rem !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    opacity: 1 !important;
}

/* === 响应式调整 === */
@media (max-width: 1200px) { .gallery-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .gallery-grid { grid-template-columns: 1fr; } }
