/* style.css */

/* 基本重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.6;
    color: #333;
    background-color: #f8f8f8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.site-header {
    text-align: center;
    padding: 40px 20px;
    background-color: #e0f2f7; /* 这里修改为浅蓝色 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.site-header h1 {
    font-size: 2.8em;
    color: #333;
    margin-bottom: 10px;
}

.site-header p {
    font-size: 1.2em;
    color: #666;
}

/* 画廊容器 */
.gallery-container {
    flex-grow: 1; /* 让画廊内容占据尽可能多的空间 */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* 响应式列布局 */
    gap: 30px; /* 卡片之间的间距 */
    padding: 20px;
    max-width: 1200px; /* 限制最大宽度，居中显示 */
    margin: 0 auto;
}

/* 画作卡片样式 */
.artwork-card {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden; /* 确保内容在圆角内 */
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: grid; /* 使卡片内部内容也使用 grid 布局 */
    grid-template-rows: 250px 1fr; /* 图片区固定高度，描述区自适应 */
}

.artwork-card:hover {
    transform: translateY(-5px); /* 悬停时稍微上浮 */
    box-shadow: 0 12px 24px rgba(0,0,0,0.15); /* 悬停时阴影加深 */
}

/* 图片容器和图片本身的样式 - 解决图片裁剪问题的关键 */
.artwork-image-wrapper {
    width: 100%;
    height: 100%; /* 继承 artwork-card 的 grid-template-rows 高度 */
    display: flex; /* 使用 flex 居中图片 */
    justify-content: center;
    align-items: center;
    overflow: hidden; /* 隐藏超出容器的部分，以防万一 */
    background-color: #f0f0f0; /* 当图片不完全填充时，显示背景色 */
    border-bottom: 1px solid #eee; /* 图片和描述之间的分隔线 */
}

/* 确保图片包裹在a标签内时，点击区域是整个图片区域 */
.artwork-image-wrapper a {
    display: flex; /* 让a标签充满wrapper并居中其内容 */
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    cursor: zoom-in; /* 提示用户可以点击放大 */
}

.artwork-card img {
    max-width: 100%; /* 确保图片不会超出容器宽度 */
    max-height: 100%; /* 确保图片不会超出容器高度 */
    object-fit: contain; /* 关键：图片完全显示，不裁剪，可能留白 */
    display: block; /* 移除图片底部可能存在的额外空间 */
}

/* 画作信息区 */
.artwork-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* 让日期在底部 */
}

.artwork-info h3 {
    font-size: 1.4em;
    color: #333;
    margin-bottom: 8px;
}

.artwork-info p {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 10px;
    flex-grow: 1; /* 让描述占据剩余空间 */
}

.artwork-date {
    font-size: 0.85em;
    color: #999;
    text-align: right;
    display: block; /* 确保日期独占一行并右对齐 */
}

/* 加载更多按钮容器 */
.load-more-container {
    text-align: center;
    padding: 40px 20px;
    background-color: #fff;
    margin-top: 20px;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.03);
}

#loadMoreBtn {
    background-color: #007bff; /* 蓝色按钮 */
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 18px;
    border-radius: 25px; /* 圆角按钮 */
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    outline: none; /* 移除点击时的焦点边框 */
}

#loadMoreBtn:hover {
    background-color: #0056b3; /* 悬停时颜色变深 */
    transform: translateY(-2px); /* 悬停时轻微上浮 */
}

#loadMoreBtn:active {
    background-color: #004085; /* 点击时颜色更深 */
    transform: translateY(0); /* 点击时恢复原位 */
}

/* 底部样式 */
.site-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: auto; /* 将 footer 推到底部 */
    background-color: #333;
    color: #f0f0f0;
    font-size: 0.9em;
}

.site-footer p {
    margin-bottom: 5px;
}

/* 媒体查询：适应小屏幕 */
@media (max-width: 768px) {
    .site-header h1 {
        font-size: 2em;
    }

    .site-header p {
        font-size: 1em;
    }

    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* 小屏幕时卡片可以更窄 */
        gap: 20px;
        padding: 15px;
    }

    .artwork-card {
        grid-template-rows: 220px 1fr; /* 小屏幕时图片区域高度略减 */
    }

    .artwork-info h3 {
        font-size: 1.2em;
    }

    .artwork-info p {
        font-size: 0.9em;
    }

    #loadMoreBtn {
        padding: 12px 25px;
        font-size: 16px;
    }
}

/* --- 新增Lightbox样式 --- */
#lightbox-overlay {
    display: none ; /* 默认隐藏 */
    position: fixed; /* 固定定位，覆盖整个视口 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* 半透明黑色背景 */
    z-index: 1000; /* 确保在所有内容之上 */
    justify-content: center;
    align-items: center;
    cursor: zoom-out; /* 提示可点击背景关闭 */
}

#lightbox-content {
    position: relative;
    max-width: 90%; /* 最大宽度限制 */
    max-height: 90%; /* 最大高度限制 */
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex; /* 用于垂直布局图片和标题 */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto; /* 允许点击内容区域内部的元素 */
    cursor: default; /* 内容区域鼠标恢复默认 */
}

#lightbox-image {
    max-width: 100%; /* 图片最大宽度 */
    max-height: 80vh; /* 图片最大高度，vh是视口高度的百分比 */
    display: block;
    object-fit: contain; /* 确保图片完整显示，不裁剪，可能留白 */
    margin-bottom: 15px;
}

#lightbox-caption {
    color: #333;
    font-size: 1.1em;
    text-align: center;
    margin-top: 10px;
}

#lightbox-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    color: #555;
    cursor: pointer;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 5px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

#lightbox-close:hover {
    color: #000;
    background-color: #eee;
}

/* 当灯箱打开时，隐藏body的滚动条，防止背景滚动 */
body.lightbox-open {
    overflow: hidden;
}
