/* =========================
   案例列表页
========================= */

.case-page {
    padding: 30px 0 50px;
}


/* =========================
   页面标题
========================= */

.page-header,
.case-header {
    margin-bottom: 24px;
}

.page-header h1,
.case-header h1 {
    font-size: 30px;
    line-height: 1.35;
    margin: 0 0 8px;
    color: #111827;
}

.page-header p,
.case-header p {
    font-size: 15px;
    line-height: 1.7;
    color: #666;
    margin: 0;
}


/* =========================
   筛选区
========================= */

.case-filter {
    margin-bottom: 24px;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 220px 120px;
    gap: 12px;
    align-items: center;
}


/* =========================
   案例分类按钮
   关键：预留高度，降低 CLS
========================= */

.case-category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0 24px;

    /* 防止 JS 加载分类后把列表整体往下顶 */
    min-height: 40px;
}

.case-category-bar .category-btn {
    border: 1px solid #dcdcdc;
    background: #fff;
    color: #333;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s ease;
}

.case-category-bar .category-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.case-category-bar .category-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}


/* =========================
   列表区
   关键：预留首屏列表高度，降低 CLS
========================= */

.case-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;

    /* 防止 JS 渲染卡片时页面从空白突然撑开 */
    min-height: 520px;
}


/* =========================
   案例卡片
========================= */

.case-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;

    /* 让卡片高度更稳定 */
    min-height: 430px;
}

.case-cover {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f3f4f6;
    overflow: hidden;
}

.case-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.case-info {
    padding: 14px;
}

.case-category {
    font-size: 13px;
    line-height: 1.4;
    color: #2563eb;
    margin-bottom: 6px;

    min-height: 18px;
}

.case-title {
    font-size: 18px;
    line-height: 1.4;
    margin: 0 0 8px;
    color: #111827;

    /* 防止标题行数变化导致卡片高度跳动 */
    min-height: 50px;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.case-summary {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin: 0 0 10px;

    /* 防止摘要长短差异太大 */
    min-height: 68px;

    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.case-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: #666;
    margin-bottom: 10px;

    min-height: 40px;
}

.case-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 10px;
}


/* =========================
   空状态 / 加载状态
========================= */

.case-empty,
.case-loading {
    grid-column: 1 / -1;
    padding: 30px;
    text-align: center;
    background: #fff;
    border: 1px solid #eee;
    color: #666;

    /* 防止加载态和列表态高度差太大 */
    min-height: 180px;
}


/* =========================
   响应式
========================= */

@media (max-width: 992px) {

    .case-list {
        grid-template-columns: repeat(2, 1fr);
        min-height: 620px;
    }

    .case-card {
        min-height: 420px;
    }

}


@media (max-width: 768px) {

    .case-page {
        padding: 24px 14px 28px !important;
    }

    .page-header,
    .case-header {
        margin-top: 14px;
        margin-bottom: 18px;
        padding: 0 2px;
    }

    .page-header h1,
    .case-header h1,
    .page-header h2 {
        font-size: 24px;
        line-height: 1.35;
        margin-bottom: 10px;
    }

    .page-header p,
    .case-header p {
        font-size: 14px;
        line-height: 1.7;
        margin-bottom: 16px;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .case-category-bar,
    .case-categories,
    .category-filter,
    .filter-tags {
        margin-top: 14px;
        padding: 0 2px;
        min-height: 40px;
    }

    .case-list {
        grid-template-columns: 1fr;
        gap: 16px;

        /* 手机端首屏预留更高，因为一列展示 */
        min-height: 900px;
    }

    .case-card {
        min-height: 410px;
    }

}