/* ===== 相册插件样式 ===== */
.ab-album-wrap {
    max-width: var(--ab-max-width, 860px);
    margin: 22px auto;
    width: 100%;
}

.ab-album-title {
    font-size: 13px;
    color: #999;
    margin-bottom: 10px;
    font-weight: 500;
}

.ab-album {
    display: grid;
    gap: var(--ab-gap, 10px);
    width: 100%;
}

.ab-album .ab-item {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ab-album img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--ab-radius, 12px);
    display: block;
    background: #f3f3f3;
    transition: transform .25s ease;
}

.ab-album img:hover {
    transform: scale(1.02);
}

.ab-album .ab-desc {
    font-size: 12px;
    color: #999;
    padding: 6px 4px 2px;
    text-align: center;
    line-height: 1.35;
    width: 100%;
    word-break: break-all;
}

/* ===== 电脑端自适应 ===== */

/* 1张：居中 */
.ab-album.layout-1 {
    grid-template-columns: 1fr;
    justify-items: center;
}
.ab-album.layout-1 .ab-item {
    width: 400px;
    max-width: 90%;
}
.ab-album.layout-1 img {
    height: var(--ab-single-height, 320px);
    width: 100%;
}
.ab-album.layout-1 .ab-desc {
    font-size: 11px;
    padding-top: 5px;
    margin-top: -2px;
    color: #aaa;
}

/* 2张 */
.ab-album.layout-2 {
    grid-template-columns: 1fr 1fr;
}
.ab-album.layout-2 img { height: 520px; }

/* 3张：左大右两小 */
.ab-album.layout-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 210px 210px;
}
.ab-album.layout-3 img:first-child {
    grid-row: 1 / 3;
    height: 100%;
}
.ab-album.layout-3 img:nth-child(2),
.ab-album.layout-3 img:nth-child(3) {
    height: 210px;
}

/* 4张：2×2 */
.ab-album.layout-4 {
    grid-template-columns: 1fr 1fr;
}
.ab-album.layout-4 img { height: 190px; }

/* 5-6张：3列 */
.ab-album.layout-6 {
    grid-template-columns: 1fr 1fr 1fr;
}
.ab-album.layout-6 img { height: 155px; }

/* 7+张：4列 */
.ab-album.layout-9 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}
.ab-album.layout-9 img { height: 135px; }

/* 手动 cols */
.ab-album.cols-1 { grid-template-columns: 1fr !important; justify-items: center; }
.ab-album.cols-2 { grid-template-columns: 1fr 1fr !important; }
.ab-album.cols-3 { grid-template-columns: 1fr 1fr 1fr !important; }
.ab-album.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr !important; }

/* ===== 移动端：固定一行两列，单图居中 ===== */
@media (max-width: 640px) {
    .ab-album-wrap {
        margin: 18px auto;
    }

    .ab-album,
    .ab-album.layout-2,
    .ab-album.layout-3,
    .ab-album.layout-4,
    .ab-album.layout-6,
    .ab-album.layout-9,
    .ab-album.cols-2,
    .ab-album.cols-3,
    .ab-album.cols-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .ab-album.layout-3 {
        grid-template-rows: 150px 150px !important;
    }
    .ab-album.layout-3 img:first-child {
        height: 100% !important;
    }
    .ab-album.layout-3 img:nth-child(2),
    .ab-album.layout-3 img:nth-child(3) {
        height: 150px !important;
    }

    .ab-album img {
        border-radius: 10px;
        height: 250px !important;
        transition: none;
    }

    .ab-album .ab-desc {
        font-size: 11px;
        color: #aaa;
        padding: 5px 2px 2px;
        line-height: 1.3;
    }

    /* 单图移动端：不限制高度 */
    .ab-album.layout-1 {
        grid-template-columns: 1fr !important;
        justify-items: center;
    }
    .ab-album.layout-1 .ab-item {
        width: 82%;
        max-width: 360px;
    }
    .ab-album.layout-1 img {
        height: auto !important;
        width: 100%;
    }
    .ab-album.layout-1 .ab-desc {
        font-size: 11px;
        padding-top: 5px;
    }

    .ab-album.cols-1 {
        grid-template-columns: 1fr !important;
    }
    .ab-album.cols-1 img {
        height: auto !important;
    }
}
