/* ==========================================================================
   首页「热门壁纸」区块
   ========================================================================== */

.index-web-section.txdh-wallpaper-section {
    padding-bottom: 16px;
}

.index-web-section.txdh-wallpaper-section .txdh-wall-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    height: auto;
    min-height: 32px;
    margin: 0 0 14px;
    overflow: visible;
}

.index-web-section.txdh-wallpaper-section .txdh-wall-title h3 {
    flex: none;
    margin: 0;
    padding-left: 14px;
    line-height: 32px;
    font-size: 17px;
    color: #333;
}

.index-web-section.txdh-wallpaper-section .txdh-wall-title h3:before {
    top: 7px;
    height: 18px;
}

.txdh-wall-tabs {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 2px 14px;
    font-size: 13px;
    line-height: 1;
}

/* 分类与「更多」均不允许被压缩，空间不足时整体换行而不是互相重叠 */
.txdh-wall-tabs button,
.txdh-wall-more {
    flex: 0 0 auto;
    white-space: nowrap;
}

.txdh-wall-tabs button {
    position: relative;
    margin: 0;
    padding: 4px 0 6px;
    border: 0;
    background: none;
    color: #8b95a1;
    font-size: 13px;
    font-family: inherit;
    line-height: 18px;
    cursor: pointer;
    outline: none;
    transition: color .2s ease;
}

.txdh-wall-tabs button:after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: #20c4ab;
    transform: translateX(-50%);
    transition: width .24s ease;
}

.txdh-wall-tabs button:hover {
    color: #20c4ab;
}

.txdh-wall-tabs button.active {
    color: #20c4ab;
    font-weight: 600;
}

.txdh-wall-tabs button.active:after {
    width: 100%;
}

.txdh-wall-more {
    display: inline-block;
    padding: 4px 0 6px;
    color: #b0b8c1;
    font-size: 13px;
    line-height: 18px;
    transition: color .2s ease;
}

.txdh-wall-more:after {
    content: "›";
    margin-left: 3px;
    font-size: 14px;
}

.txdh-wall-more:hover {
    color: #20c4ab;
}

/* 主题全局样式 .title a{position:absolute;right:0;top:0;height:40px;line-height:40px}
   会把「更多」从文档流中抽出并压在最后一个分类上，这里重置为普通行内元素 */
.index-web-section.txdh-wallpaper-section .txdh-wall-title .txdh-wall-more {
    position: static;
    right: auto;
    top: auto;
    height: auto;
    line-height: 18px;
    font-size: 13px;
    color: #b0b8c1;
}

.index-web-section.txdh-wallpaper-section .txdh-wall-title .txdh-wall-more:hover {
    color: #20c4ab;
}

/* ------------------------------ 列表 ------------------------------ */
.txdh-wall-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.txdh-wall-item {
    min-width: 0;
    list-style: none;
}

.txdh-wall-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.txdh-wall-pic {
    display: block;
    position: relative;
    overflow: hidden;
    padding-bottom: 63%;
    background: #f2f4f7;
    box-shadow: 0 1px 3px rgba(17, 24, 39, .06);
}

.txdh-wall-pic img {
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    transition: transform .45s ease;
}

.txdh-wall-pic img.is-error {
    object-fit: contain;
    padding: 14% 8%;
    background: #f4f6f8;
}

.txdh-wall-pic:after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46%;
    background: linear-gradient(180deg, rgba(10, 18, 26, 0), rgba(10, 18, 26, .38));
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

.txdh-wall-size {
    position: absolute;
    left: 8px;
    top: 8px;
    z-index: 2;
    padding: 1px 7px;
    border-radius: 10px;
    background: rgba(10, 18, 26, .55);
    color: #fff;
    font-size: 11px;
    font-style: normal;
    line-height: 16px;
    letter-spacing: .3px;
    pointer-events: none;
}

.txdh-wall-name {
    display: block;
    overflow: hidden;
    margin: 8px 0 0;
    height: 18px;
    color: #333;
    font-size: 13px;
    font-weight: 400;
    line-height: 18px;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: color .2s ease;
}

.txdh-wall-meta {
    display: flex;
    align-items: center;
    margin: 4px 0 0;
    color: #a3abb5;
    font-size: 12px;
    line-height: 16px;
}

.txdh-wall-meta i {
    margin: 0 4px;
    font-style: normal;
}

.txdh-wall-meta .txdh-wall-cat {
    color: #8b95a1;
}

.txdh-wall-item:hover .txdh-wall-pic img {
    transform: scale(1.07);
}

.txdh-wall-item:hover .txdh-wall-pic:after {
    opacity: 1;
}

.txdh-wall-item:hover .txdh-wall-name {
    color: #20c4ab;
}

/* ------------------------------ 骨架屏 / 状态 ------------------------------ */
.txdh-wall-item.is-skeleton .txdh-wall-pic,
.txdh-wall-item.is-skeleton .txdh-wall-skel {
    background: linear-gradient(90deg, #f1f3f6 25%, #e7ebef 37%, #f1f3f6 63%);
    background-size: 400% 100%;
    animation: txdhWallShimmer 1.4s ease infinite;
}

.txdh-wall-skel {
    display: block;
    height: 12px;
    margin-top: 9px;
    border-radius: 4px;
}

.txdh-wall-skel-title {
    width: 86%;
}

.txdh-wall-skel-meta {
    width: 46%;
    height: 10px;
    margin-top: 7px;
}

@keyframes txdhWallShimmer {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

.txdh-wall-empty {
    grid-column: 1 / -1;
    padding: 42px 0;
    color: #99a2ad;
    font-size: 13px;
    text-align: center;
    list-style: none;
}

.txdh-wall-retry {
    margin-left: 10px;
    padding: 3px 14px;
    border: 1px solid #20c4ab;
    border-radius: 14px;
    background: none;
    color: #20c4ab;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.txdh-wall-retry:hover {
    background: #20c4ab;
    color: #fff;
}

/* ------------------------------ 底部 ------------------------------ */
.txdh-wall-foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    color: #b0b8c1;
    font-size: 12px;
    line-height: 18px;
}

.txdh-wall-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.txdh-wall-pager[hidden] {
    display: none;
}

.txdh-wall-page-btn {
    min-width: 32px;
    height: 30px;
    padding: 0 11px;
    border: 1px solid #e2e7ec;
    border-radius: 6px;
    background: #fff;
    color: #6b7683;
    font-size: 13px;
    font-family: inherit;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    outline: none;
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.txdh-wall-page-btn:hover:not([disabled]):not(.active) {
    border-color: #20c4ab;
    color: #20c4ab;
}

.txdh-wall-page-btn.active {
    background: #20c4ab;
    border-color: #20c4ab;
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.txdh-wall-page-btn[disabled] {
    color: #c2c8d0;
    cursor: default;
}

.txdh-wall-page-gap {
    min-width: 18px;
    color: #b8bfc7;
    font-size: 13px;
    line-height: 30px;
    text-align: center;
    cursor: default;
}

.txdh-wall-source {
    color: #b0b8c1;
}

/* ------------------------------ 响应式 ------------------------------ */
@media screen and (max-width: 1200px) {
    .txdh-wall-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media screen and (max-width: 900px) {
    .txdh-wall-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* 标题区放不下时，分类独占一行并左对齐，避免相互重叠 */
@media screen and (max-width: 1100px) {
    .index-web-section.txdh-wallpaper-section .txdh-wall-title .txdh-wall-tabs {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
}

@media screen and (max-width: 620px) {
    .index-web-section.txdh-wallpaper-section {
        padding-left: 12px;
        padding-right: 12px;
    }

    .txdh-wall-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 10px;
    }

    .txdh-wall-name {
        font-size: 12px;
    }

    .txdh-wall-meta {
        font-size: 11px;
    }
}

/* 移动端不展示该区块（PHP 端已不输出结构，此处按主题移动端类名兜底） */
body.mobile-page .txdh-wallpaper-section {
    display: none !important;
}

/* ------------------------------ 夜间模式 ------------------------------ */
html.txdh-dark-mode .txdh-wallpaper-section,
html.txdh-dark-mode .indexSearch + .article .txdh-wallpaper-section {
    background: #171f27 !important;
    border-color: #283541 !important;
}

html.txdh-dark-mode .txdh-wallpaper-section .txdh-wall-title h3,
html.txdh-dark-mode .txdh-wall-name {
    color: #e6edf5;
}

html.txdh-dark-mode .txdh-wall-pic,
html.txdh-dark-mode .txdh-wall-item.is-skeleton .txdh-wall-pic,
html.txdh-dark-mode .txdh-wall-item.is-skeleton .txdh-wall-skel {
    background: linear-gradient(90deg, #1c242c 25%, #232d37 37%, #1c242c 63%);
    background-size: 400% 100%;
    box-shadow: none;
}

html.txdh-dark-mode .txdh-wall-pic img.is-error {
    background: #1b242c;
}

html.txdh-dark-mode .txdh-wall-meta,
html.txdh-dark-mode .txdh-wall-meta .txdh-wall-cat,
html.txdh-dark-mode .txdh-wall-foot,
html.txdh-dark-mode .txdh-wall-source,
html.txdh-dark-mode .txdh-wall-empty {
    color: #8b98a6;
}

html.txdh-dark-mode .txdh-wall-item:hover .txdh-wall-name {
    color: #66dccb;
}

html.txdh-dark-mode .txdh-wall-page-btn {
    border-color: #2b3642;
    background: #1b242c;
    color: #8b98a6;
}

html.txdh-dark-mode .txdh-wall-page-btn:hover:not([disabled]):not(.active) {
    border-color: #66dccb;
    color: #66dccb;
}

html.txdh-dark-mode .txdh-wall-page-btn.active {
    border-color: #66dccb;
    background: #66dccb;
    color: #0f1b1a;
}

html.txdh-dark-mode .txdh-wall-page-btn[disabled] {
    color: #5d6874;
}

html.txdh-dark-mode .txdh-wall-page-gap {
    color: #5d6874;
}

html.txdh-dark-mode .txdh-wall-tabs button {
    color: #8b98a6;
}

html.txdh-dark-mode .txdh-wall-tabs button.active,
html.txdh-dark-mode .txdh-wall-tabs button:hover,
html.txdh-dark-mode .index-web-section.txdh-wallpaper-section .txdh-wall-title .txdh-wall-more:hover {
    color: #66dccb;
}

html.txdh-dark-mode .index-web-section.txdh-wallpaper-section .txdh-wall-title .txdh-wall-more {
    color: #7d8a98;
}

html.txdh-dark-mode .txdh-wall-tabs button:after {
    background: #66dccb;
}
