/* ==========================================================================
   XSigns Template Gallary
   样式参考 politicalsigns landing 的 "500+ free templates" 区域
   所有类名以 .xtg- 前缀，避免与 xsigns_gallery1 冲突
   ========================================================================== */

.xtg {
    --xtg-cols: 3;
    box-sizing: border-box;
}

.xtg *,
.xtg *::before,
.xtg *::after {
    box-sizing: border-box;
}

/* ---------- 筛选区 ---------- */
.xtg-filters {
    margin: 0 auto 28px;
}

.xtg-filter-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.xtg-filter-row:last-child {
    margin-bottom: 0;
}

.xtg-filter-btn {
    border: 1px solid #eaedf3;
    background: #fff;
    color: #5d6675;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 11px 20px;
    border-radius: 11px;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 39, 71, .06);
    transition: all .15s ease;
}

.xtg-filter-btn:hover {
    color: #0f2747;
    border-color: #d7dde7;
}

.xtg-filter-btn.xtg-active {
    background: #0f2747;
    color: #fff;
    border-color: #0f2747;
    box-shadow: 0 8px 20px rgba(15, 39, 71, .25);
}

/* ---------- 卡片网格 ---------- */
.xtg-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--xtg-cols, 3), 1fr);
    gap: 28px;
    min-height: 120px;
}

.xtg-card {
    background: #fff;
    border: 1px solid #eaedf3;
    border-radius: 18px;
    padding: 18px;
    transition: box-shadow .2s ease, transform .2s ease;
}

.xtg-card:hover {
    box-shadow: 0 18px 40px rgba(15, 39, 71, .1);
    transform: translateY(-2px);
}

.xtg-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #eef1f6;
}

.xtg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.xtg-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    background: rgba(15, 39, 71, .85);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 4px 9px;
}

.xtg-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.xtg-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f2747;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.xtg-btn {
    flex-shrink: 0;
    background: #f5a742;
    color: #23303f;
    font-weight: 700;
    font-size: 13px;
    padding: 11px 22px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(245, 167, 66, .32);
    transition: background .15s ease;
}

.xtg-btn:hover {
    background: #eb9a31;
    color: #23303f;
}

.xtg-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #9aa3b1;
    font-size: 15px;
    padding: 48px 0;
}

/* ---------- 分页 ---------- */
.xtg-pagination {
    margin-top: 36px;
}

.xtg-pages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.xtg-page {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #eaedf3;
    background: #fff;
    color: #5d6675;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    border-radius: 9px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .15s ease;
}

.xtg-page:hover {
    border-color: #0f2747;
    color: #0f2747;
}

.xtg-page-active {
    background: #0f2747;
    color: #fff;
    border-color: #0f2747;
    cursor: default;
}

.xtg-page-disabled {
    opacity: .4;
    cursor: default;
    pointer-events: none;
}

.xtg-page-dots {
    border: none;
    background: transparent;
    cursor: default;
    pointer-events: none;
}

/* ---------- 加载态：遮罩 + 旋转 spinner ---------- */
.xtg-loading .xtg-grid {
    pointer-events: none;
}

/* 半透明遮罩，盖住旧卡片 */
.xtg-loading .xtg-grid::before {
    content: "";
    position: absolute;
    inset: -10px;
    z-index: 5;
    background: rgba(255, 255, 255, .65);
    border-radius: 14px;
    backdrop-filter: blur(1px);
}

/* 居中旋转圈 */
.xtg-loading .xtg-grid::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    z-index: 6;
    border: 3px solid rgba(15, 39, 71, .15);
    border-top-color: #f5a742;
    border-radius: 50%;
    animation: xtg-spin .8s linear infinite;
}

@keyframes xtg-spin {
    to { transform: rotate(360deg); }
}

/* ---------- 响应式：自动降列 ---------- */
@media (max-width: 1024px) {
    .xtg-grid {
        grid-template-columns: repeat(min(var(--xtg-cols, 3), 3), 1fr);
        gap: 22px;
    }
}

@media (max-width: 680px) {
    .xtg-grid {
        grid-template-columns: repeat(min(var(--xtg-cols, 3), 2), 1fr);
        gap: 16px;
    }

    .xtg-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .xtg-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .xtg-grid {
        grid-template-columns: 1fr;
    }
}
