/* 基本重置和全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px; /* 侧边留白 */
}

a {
    text-decoration: none;
    color: inherit;
}

/* 顶部标题栏样式 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2c3e50;
}

/* 导航菜单（桌面版） */
.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li {
    margin-left: 25px;
}

.main-nav ul li a {
    font-size: 1rem;
    color: #555;
    padding: 5px 10px;
    border-radius: 5px;
    transition: color 0.3s ease, background-color 0.3s ease;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
    color: #fff;
    background-color: #3498db;
}

/* 汉堡菜单按钮样式 (默认隐藏在桌面端) */
.menu-toggle {
    display: none; /* 默认隐藏 */
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #2c3e50;
    cursor: pointer;
    padding: 0;
}

/* 中间图片列表样式 */
.gallery-section {
    padding: 4rem 0;
}

.gallery-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #2c3e50;
}

.gallery-grid {
    display: grid;
    /* 响应式网格布局，每列最小300px，自动填充 */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.gallery-item {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0; /* JS动画初始状态 */
    transform: translateY(20px); /* JS动画初始状态 */
    cursor: pointer; /* 添加指针样式表明可点击 */
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover; /* 保证图片不变形 */
    display: block;
}

.item-description {
    padding: 1.5rem;
}

.item-description h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #3498db;
}

.item-description p {
    font-size: 0.95rem;
    color: #666;
}

/* 中间内容区域 - 添加flex-grow让内容区域占据剩余空间 */
main {
    flex: 1 0 auto;
}

/* 底部样式 */
.footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto; /* 确保footer始终在底部 */
    flex-shrink: 0;
}

/* ==================================== */
/*          媒体查询 (响应式设计)       */
/* ==================================== */

/* 针对平板和更小的屏幕 (例如，最大宽度 768px 或更小) */
@media screen and (max-width: 768px) {
    .container {
        padding: 0 15px; /* 减小侧边留白 */
    }

    /* 顶部标题栏 */
    .header .container {
        flex-wrap: wrap; /* 允许项目换行 */
    }

    .logo {
        margin-right: auto; /* 确保Logo在左，汉堡菜单在右 */
    }

    /* 汉堡菜单按钮显示 */
    .menu-toggle {
        display: block; 
    }

    /* 隐藏桌面导航并设置为移动端样式 */
    .main-nav {
        width: 100%; /* 占据全宽 */
        max-height: 0; /* 默认隐藏 */
        overflow: hidden;
        transition: max-height 0.3s ease-out; /* 平滑收起/展开 */
        flex-basis: 100%; /* 防止导航栏与 logo 在同一行 */
    }

    .main-nav.active {
        max-height: 300px; /* 展开时的高度，根据内容调整 */
        transition: max-height 0.5s ease-in;
    }

    .main-nav ul {
        flex-direction: column; /* 垂直堆叠菜单项 */
        padding: 1rem 0;
        background-color: #f9f9f9;
        border-top: 1px solid #eee;
        margin-top: 1rem;
    }

    .main-nav ul li {
        margin: 0;
        text-align: center;
    }

    .main-nav ul li a {
        display: block; /* 每个链接占据一行 */
        padding: 10px 0;
        border-radius: 0; /* 移除圆角 */
        border-bottom: 1px solid #eee;
    }
    
    .main-nav ul li:last-child a {
        border-bottom: none; /* 最后一个链接没有底边框 */
    }

    /* 调整图片列表的网格布局，在小屏幕上只显示一列 */
    .gallery-grid {
        grid-template-columns: 1fr; /* 强制单列 */
        gap: 1.5rem;
    }

    .gallery-section h2 {
        font-size: 2rem; /* 减小标题字号 */
        margin-bottom: 2rem;
    }

    .item-description h3 {
        font-size: 1.2rem;
    }

    .item-description p {
        font-size: 0.9rem;
    }
}

/* 针对更小的手机屏幕 (例如，最大宽度 480px 或更小) */
@media screen and (max-width: 480px) {
    .container {
        padding: 0 10px; /* 进一步减小侧边留白 */
    }

    .logo a {
        font-size: 1.5rem; /* 减小Logo字号 */
    }

    .gallery-section {
        padding: 2rem 0; /* 减小 section 的上下留白 */
    }

    .gallery-section h2 {
        font-size: 1.8rem;
    }

    .item-description {
        padding: 1rem; /* 减小描述部分的内边距 */
    }

    .footer {
        padding: 1.5rem 0; /* 减小底部留白 */
        font-size: 0.9rem;
    }
}

/* Telegram联系按钮样式 */
.telegram-section {
    margin-top: 3rem;
    text-align: center;
    padding: 2rem 0;
}

.telegram-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0088cc, #2aabee);
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(42, 171, 238, 0.3);
    border: none;
    cursor: pointer;
    gap: 0.8rem;
}

.telegram-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(42, 171, 238, 0.4);
    background: linear-gradient(135deg, #2aabee, #0088cc);
}

.telegram-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(42, 171, 238, 0.3);
}

.telegram-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.telegram-btn:hover .telegram-icon {
    transform: scale(1.1);
}

/* 加载和错误状态样式 */
.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
    animation: pulse 1.5s infinite;
}

.error {
    text-align: center;
    padding: 3rem;
    color: #e74c3c;
    font-size: 1.1rem;
    background-color: #fdf2f2;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}
