/* ==========================================================
   INDEX.CSS - 首页专属样式 (调整为严格 4 列布局和卡片尺寸)
   ========================================================== */

h2 {
    margin: 30px 0 15px;
    font-size: 22px;
    color: #1f2937;
    font-weight: 600;
}

/* 焦点大图/轮播区 */
.featured-wallpaper {
    position: relative;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.featured-wallpaper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wallpaper-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 30px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.1));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.wallpaper-info h3 {
    margin: 0;
    font-size: 28px;
}

/* 热门分类网格 - 保持 4 列不变 */
.categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}
.category-item {
    height: 150px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
    transition: transform 0.3s;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #9ca3af;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow: hidden;
}
.category-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s;
}
.category-item span {
    z-index: 10;
}
.category-item:hover {
    transform: translateY(-5px);
}
.category-item:hover::after {
    background-color: rgba(0, 0, 0, 0.5);
}

/* 列表卡片 - 核心修改：固定 4 列，并固定高度 */
.grid-view {
    display: grid;
    /* 采用 4 列等宽布局，保证在 PC 宽度下，卡片严格为 4 列 */
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.item-card {
    background-color: var(--card-bg);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s, transform 0.3s;
}

.item-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    transform: translateY(-3px);
}

.card-link {
    display: block;
    position: relative;
    /* PC 模式下卡片高度严格设置为 230px，模拟原网站宽高比 */
    height: 230px;
    overflow: hidden;
}

.item-card img {
    width: 100%;
    height: 100%;
    /* 确保图片填充卡片，保持宽高比并居中截取 */
    object-fit: cover;
    display: block;
    transition: transform 0.5s;
}

.item-card:hover img {
    transform: scale(1.05);
}

/* 4K 标记 */
.quality-tag {
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 6px 0 6px 0;
    z-index: 10;
    pointer-events: none;
}

/* 信息覆盖层 - 默认隐藏/透明 */
.info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    padding: 0 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0));
    color: white;
    opacity: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: opacity 0.3s ease, height 0.3s ease;
    z-index: 5;
    pointer-events: none;
}

/* 鼠标悬停时显示 */
.card-link:hover .info-overlay {
    height: 40px;
    opacity: 1;
    padding: 0 10px 10px 10px;
}

.overlay-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}
.overlay-res {
    font-size: 12px;
    color: #cccccc;
}

.more-link-box {
    text-align: center;
    margin: 30px 0;
}

/* 响应式调整 (Mobile) */
@media (max-width: 768px) {
    .categories {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 手机屏幕下，强制 2 列 */
    .grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .card-link {
        /* 手机模式下卡片高度严格设置为 170px */
        height: 170px;
    }

    /* 调整移动端覆盖层字体大小 */
    .overlay-title {
        font-size: 12px;
    }
    .overlay-res {
        font-size: 10px;
    }
}