/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

/* 主容器 */
.works-container {
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 16px;
}

/* 格栅布局 */
.works-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr); /* 默认手机1列 */
    gap: 24px;
}

/* 平板（≥768px）2列 */
@media (min-width: 768px) {
    .works-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 桌面（≥992px）4列 */
@media (min-width: 992px) {
    .works-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 作品卡片（新增背景图样式） */
.work-card {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    cursor: pointer;
    overflow: hidden;          /* 隐藏超出内容 */
    position: relative;        /* 为遮罩层定位 */
    background-size: cover;    /* 背景图覆盖 */
    background-position: center; /* 背景图居中 */
    height: 155px;             /* 新增：固定容器高度（可根据实际调整数值） */
}

/* 新增：半透明遮罩层（保证文字可读性） */
.card-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);  /* 黑色半透明 */
    background-repeat: no-repeat;     /* 背景图不重复平铺 */
    background-size: 100% auto;       /* 宽度跟随容器，高度按比例自动调整 */
    background-position: center;      /* 背景图水平垂直居中 */
    z-index: 1;  /* 位于背景图之上，内容之下 */
}

/* 内容容器（调整层级） */
.card-content {
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translateY(10px);
    position: relative;  /* 启用层级 */
    z-index: 2;  /* 位于遮罩层之上 */
    background-color: rgba(0, 0, 0, 0.7);  /* 新增：浅灰色背景（70%透明度） */
    border-radius: 8px;
    height: 135px;
    overflow: hidden;          /* 隐藏超出内容 */
}

.work-card:hover {
    transform: translateY(-4px);
}

/* 悬停时显示内容 */
.work-card:hover .card-content {
    opacity: 1;
    transform: translateY(0); /* 恢复原位 */
}

/* 标题 */
/* 标题（调整字体大小但不影响卡片尺寸） */
.work-title {
    font-size: 18px;  /* 原16px → 增大2px */
    font-weight: 600;
    margin-bottom: 8px;  /* 保持原有边距 */
    color: rgba(255, 255, 255, 0.95);
}

/* 描述（调整字体大小但不影响卡片尺寸） */
.work-description {
    font-size: 15px;  /* 原14px → 增大1px */
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;  /* 保持原有行高 */
}

/* 关联标签组 */
.work-relations {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* 单个标签 */
.work-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f0f5ff;
    color: #2f54eb;
}

/* 模态框遮罩层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none; /* 默认隐藏 */
    justify-content: center;
    align-items: center;
}

/* 模态框内容区 */
.modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

/* 模态框关闭按钮 */
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    cursor: pointer;
    font-size: 20px;
    color: #666;
}

/* 模态框内图片 */
.modal-image {
    object-fit: contain;
    border-radius: 4px;
    margin: 12px 0;
    max-width: 1280px;   /* 最大宽度限制为1280px */
    max-height: 720px;  /* 最大高度限制为720px */
    width: 100%;         /* 宽度跟随父容器（modal-content）的宽度 */
    height: auto;        /* 高度自动调整保持比例 */
}