/* ===== 主图：强制1:1正方形，对抗autoheight JS ===== */

/* 覆盖WoodMart JS动态写入的固定高度 */
.wd-carousel-container.wd-gallery-images .wd-carousel-wrap {
    height: auto !important;
}

/* 用padding-top:100%技巧强制正方形，height:0配合padding撑开空间 */
.wd-carousel-container.wd-gallery-images .wd-carousel-item {
    position: relative;
    padding-top: 100% !important;
    height: 0 !important;
    background-color: #0054ac; /* 背景色，横图上下/竖图左右的留白颜色 */
    overflow: hidden;
}

/* figure绝对定位填满正方形容器，flex居中图片 */
.wd-carousel-container.wd-gallery-images .wd-carousel-item figure {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* a标签同样撑满，确保图片可点击区域完整 */
.wd-carousel-container.wd-gallery-images .wd-carousel-item figure a {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 图片contain居中，不裁切，保持原比例 */
.wd-carousel-container.wd-gallery-images .wd-carousel-item figure a img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block;
}

/* ===== 缩略图：固定正方形，cover裁切填满 ===== */

/* 覆盖JS写入的固定高度，加间距 */
.wd-carousel-container.wd-gallery-thumb .wd-carousel-wrap {
    height: auto !important;
   /* gap: 6px; /* 缩略图之间的间距，可调整 */
    align-items: flex-start;
}

/* 固定高度75px与宽度相等形成正方形，无需背景色因为cover会填满 */
.wd-carousel-container.wd-gallery-thumb .wd-carousel-item {
    height: 75px !important;
    overflow: hidden;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 0px; /* 缩略图圆角，可调整 */
}

/* 图片cover裁切填满，阻止flex压缩 */
.wd-carousel-container.wd-gallery-thumb .wd-carousel-item img {
    flex-shrink: 0 !important;
    flex-grow: 1 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    display: block;
}

/* 手机版缩略图高度调整，根据实际测试修改数值 */
@media (max-width: 768px) {
    .wd-carousel-container.wd-gallery-thumb .wd-carousel-item {
        height: 60px !important;
    }
}