/* ============================================================
   免费模板列表页专用样式（templist.html）
   独立于 case 样式，封面按 379:665 竖图比例展示，桌面一行四列
   ============================================================ */

/* 分类导航 */
.free-tpl .case-group,
.case-group {
    font-size: 18px;
    margin: 0 auto 24px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0 28px;
    max-width: 1200px
}

.case-group-item {
    color: #595757;
    cursor: pointer;
    line-height: 50px;
    white-space: nowrap
}

.case-group-item:hover {
    color: #007aff
}

.case-group-item.active {
    border-bottom: 2px solid #007aff;
    color: #007aff;
    font-weight: 600
}

/* 列表容器：桌面一行四列 */
.case-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px
}

/* 卡片 */
.case-list .activity-item {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(220, 220, 220, .5);
    position: relative;
    transition: all .35s ease-in-out;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    /* 关键：视口外的卡片浏览器直接跳过排版/绘制，几十张卡也不会拖慢首屏；
       contain-intrinsic-size 给它一个预估高度，避免滚动条跳动和布局抖动 */
    content-visibility: auto;
    contain-intrinsic-size: auto 560px
}

.case-list .activity-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 22px rgba(0, 122, 255, .18)
}

/* 封面：锁定 379:665 竖图比例，长图完整显示不被压扁 */
.case-list .activity-item .cover-container {
    position: relative;
    width: 100%;
    aspect-ratio: 379 / 665;
    background: #f2f4f7;
    border-radius: 10px 10px 0 0;
    overflow: hidden
}

.case-list .activity-item .cover-container img.cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block
}

/* ---------------- 悬停二维码（鼠标移入卡片才出现） ---------------- */
.case-list .activity-item .cover-container .mask {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .38);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s
}

.case-list .activity-item:hover .cover-container .mask {
    opacity: 1;
    visibility: visible
}

.qrcode-container {
    width: 128px;
    padding: 10px 10px 9px;
    box-sizing: border-box;
    border-radius: 8px;
    background: #fff;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18)
}

.qrcode-container .qrcode {
    line-height: 0;
    min-height: 96px
}

.qrcode-container .qrcode canvas {
    width: 100% !important;
    height: auto !important
}

.qrcode-container .hint-text {
    font-size: 11px;
    line-height: 18px;
    color: #999
}

.qrcode-container .create-btn {
    display: block;
    margin-top: 6px;
    height: 26px;
    line-height: 26px;
    border-radius: 13px;
    background: #007aff;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s ease
}

.qrcode-container .create-btn:hover {
    background: #0068da;
    color: #fff
}

/* 触屏设备没有 hover，遮罩不显示，避免卡在半透明状态 */
@media (hover: none) {
    .case-list .activity-item .cover-container .mask {
        display: none
    }
}

/* 搜索框按钮 */
.input span {
    cursor: pointer
}

/* 标题（卡片只保留标题，不再显示活动类型/风格标签） */
.actitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 700;
    color: #000 !important;
    margin: 12px auto;
    padding: 0 10px;
    text-align: center;
    cursor: pointer
}

.actitle a:hover {
    color: #5f89f7
}

/* 模板数量 */
.theme-count {
    max-width: 1200px;
    margin: -14px auto 14px;
    padding: 0 12px;
    font-size: 13px;
    color: #999;
    text-align: center
}

/* 空数据 */
.list-empty {
    text-align: center;
    padding: 60px 0;
    color: #999
}

.list-empty img {
    width: 120px;
    margin-bottom: 12px
}

/* 平板：三列 */
@media (min-width: 700px) and (max-width: 999px) {
    .case-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px
    }
}

/* 手机：两列 */
@media (max-width: 699px) {
    .case-group {
        gap: 0 14px;
        margin-bottom: 14px
    }

    .case-group .case-group-item {
        font-size: 13px;
        line-height: 38px
    }

    .case-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        padding: 0 10px
    }

    .case-list .activity-item:hover {
        transform: none
    }

    .case-list .activity-item {
        contain-intrinsic-size: auto 350px
    }

    .qrcode-container {
        width: 112px
    }

    .qrcode-container .qrcode {
        min-height: 84px
    }

    .actitle {
        margin: 10px auto
    }
}
