/* 本地模板库（企业建站一条龙遮罩内容）
   数据来自 /api/template，图片来自 /templates 目录，不依赖外部站点。
   背景与小程序案例、敬请期待一致：全屏 rgba(0,0,0,.9) 深色底，
   面板不再铺白底，改用半透明浅色面 + 白色文字，主色沿用小程序案例的 #6f9aee。 */

.tpl-lib {
    width: 100%;
    height: 100%;
    background: transparent;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding: 0 0 40px;
    text-align: left;
    /* 预留滚动条宽度，否则居中内容会相对可视区偏移几像素 */
    scrollbar-gutter: stable;
    /* 深色面板上默认滚动条太亮，单独调暗 */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .22) transparent;
}

.tpl-lib::-webkit-scrollbar { width: 10px; }
.tpl-lib::-webkit-scrollbar-track { background: transparent; }
.tpl-lib::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .2);
    border-radius: 5px;
}
.tpl-lib::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .34); }

/* 标题与搜索整块居中，下面的筛选和列表仍保持左对齐 */
.tpl-lib-head {
    padding: 28px 40px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    text-align: center;
}

.tpl-lib-tit i {
    display: block;
    /* 字号与字距与「小程序精选案例」「热门小游戏案例」保持一致，
       原来这里是 26px / 无字距，三个遮罩的标题看着不一样大 */
    font-size: 30px;
    font-weight: 700;
    font-style: normal;
    color: #fff;
    letter-spacing: 2px;
}

.tpl-lib-tit span {
    display: block;
    font-size: 13px;
    color: rgba(255, 255, 255, .45);
    /* 英文副标题跟另外两个一样转大写并拉开字距，
       否则「Template Quick Site Expert」和「MINI GAME SHOWCASE」混在一起很跳 */
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 10px;
}

.tpl-search {
    margin-top: 18px;
    font-size: 0; /* 消除 input 与 button 之间的空白间隙 */
}

.tpl-search-input {
    width: 360px;
    max-width: 68%;
    height: 40px;
    line-height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 4px 0 0 4px;
    background: rgba(255, 255, 255, .07);
    font-size: 14px;
    color: #fff;
    box-sizing: border-box;
    vertical-align: middle;
    outline: none;
    transition: border-color .2s, background .2s;
}

.tpl-search-input::placeholder { color: rgba(255, 255, 255, .35); }

.tpl-search-input:focus {
    border-color: #6f9aee;
    background: rgba(255, 255, 255, .11);
}

/* 主色按钮上用深色字：白字压在 #6f9aee 上对比度只有 2.8:1，读起来吃力 */
.tpl-search-btn {
    height: 40px;
    padding: 0 22px;
    border: 1px solid #6f9aee;
    background: #6f9aee;
    color: #10141a;
    font-size: 14px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    vertical-align: middle;
    margin-left: -1px;
    transition: background .2s, border-color .2s;
}

.tpl-search-btn:hover {
    background: #8fb4f5;
    border-color: #8fb4f5;
}

/* 筛选区 */
.tpl-filter {
    padding: 18px 40px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.tpl-filter-row {
    margin-bottom: 12px;
    font-size: 0;
}

.tpl-filter-row > b {
    display: inline-block;
    width: 84px;
    font-size: 14px;
    color: rgba(255, 255, 255, .78);
    line-height: 28px;
    vertical-align: top;
}

.tpl-filter-opts {
    display: inline-block;
    width: calc(100% - 90px);
    vertical-align: top;
}

.tpl-filter-opts a {
    display: inline-block;
    font-size: 14px;
    color: rgba(255, 255, 255, .7);
    line-height: 28px;
    padding: 0 10px;
    margin: 0 4px 6px 0;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    transition: color .2s, background .2s;
}

.tpl-filter-opts a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.tpl-filter-opts a.active {
    background: #6f9aee;
    color: #10141a;
}

.tpl-filter-opts a em {
    font-style: normal;
    color: rgba(255, 255, 255, .4);
    margin-left: 3px;
    font-size: 12px;
}

.tpl-filter-opts a.active em {
    color: rgba(16, 20, 26, .6);
}

/* 列表区 */
.tpl-lib-body {
    padding: 20px 40px 0;
}

.tpl-count {
    font-size: 13px;
    color: rgba(255, 255, 255, .5);
    margin-bottom: 14px;
}

.tpl-count b {
    color: #6f9aee;
}

.tpl-grid {
    font-size: 0;
    margin: 0 -8px;
    padding: 0;
    list-style: none;
}

/* 一行 5 个。卡片变小后图片是缩小显示而不是放大，比 4 列更清晰 */
.tpl-grid li {
    display: inline-block;
    width: 20%;
    padding: 0 8px 20px;
    box-sizing: border-box;
    vertical-align: top;
}

.tpl-card {
    display: block;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
    text-decoration: none;
    transition: box-shadow .25s, transform .25s, border-color .25s;
}

.tpl-card:hover {
    border-color: #6f9aee;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    transform: translateY(-3px);
}

/* 图片是 350x350 的方图，用定比容器避免加载时抖动 */
.tpl-card-pic {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
}

.tpl-card-pic img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tpl-card-info {
    padding: 10px 11px 12px;
}

.tpl-card-name {
    font-size: 13px;
    color: rgba(255, 255, 255, .88);
    line-height: 19px;
    height: 38px;
    overflow: hidden;
    /* 长名称截断到两行 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tpl-card:hover .tpl-card-name {
    color: #fff;
}

/* 5 列时卡片较窄，行业名偏长，标签与日期各占一行避免挤压换行 */
.tpl-card-meta {
    margin-top: 7px;
    font-size: 11px;
    color: rgba(255, 255, 255, .5);
    line-height: 17px;
}

.tpl-card-tag {
    display: inline-block;
    max-width: 100%;
    padding: 0 5px;
    margin-right: 4px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 2px;
    color: rgba(255, 255, 255, .62);
    /* 行业名过长时省略，不要撑破卡片 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.tpl-card-date {
    display: block;
    margin-top: 5px;
    color: rgba(255, 255, 255, .4);
}

/* 分页 */
.tpl-pager {
    text-align: center;
    padding: 10px 0 20px;
    font-size: 0;
}

.tpl-pager a,
.tpl-pager span {
    display: inline-block;
    min-width: 34px;
    height: 34px;
    line-height: 34px;
    padding: 0 10px;
    margin: 0 4px 8px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 3px;
    font-size: 14px;
    color: rgba(255, 255, 255, .72);
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color .2s, color .2s, background .2s;
}

.tpl-pager a:hover {
    border-color: #6f9aee;
    color: #6f9aee;
}

.tpl-pager span.cur {
    background: #6f9aee;
    border-color: #6f9aee;
    color: #10141a;
    cursor: default;
}

.tpl-pager span.gap {
    border: 0;
    cursor: default;
    min-width: 20px;
    padding: 0;
}

.tpl-empty,
.tpl-loading {
    display: none;
    text-align: center;
    padding: 60px 0;
    font-size: 15px;
    color: rgba(255, 255, 255, .45);
}

/* 响应式：宽屏 5 列，逐级降到 1 列 */
@media screen and (max-width: 1439px) {
    .tpl-grid li { width: 25%; }
}

@media screen and (max-width: 1100px) {
    .tpl-grid li { width: 33.3333%; }
}

@media screen and (max-width: 900px) {
    /* 上内边距保持 28px 不缩，这样标题和另外两个遮罩一样落在 128px
       （容器上边距 100px + 28px）。原来缩到 22px 会比其他两个高 6px。 */
    .tpl-lib-head { padding: 28px 20px 14px; }
    .tpl-filter { padding: 14px 20px 4px; }
    .tpl-lib-body { padding: 16px 20px 0; }
    .tpl-grid li { width: 50%; }
}

@media screen and (max-width: 560px) {
    .tpl-lib-tit i { font-size: 20px; }
    /* 窄屏留出按钮宽度，避免搜索框把按钮挤到换行 */
    .tpl-search-input { max-width: 62%; }
    .tpl-filter-row > b { display: block; width: auto; margin-bottom: 4px; }
    .tpl-filter-opts { width: 100%; }
    .tpl-grid li { width: 100%; }
}
