.hd-pg-wrap {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
}

/* 左侧外层容器：宽度自动跟随缩略图内容 */
.hd-pg-thumbs-wrap {
    position: relative;
    flex-shrink: 0;
    align-self: flex-start; /* 不被拉伸，跟随内容高度 */
}

/* 左侧缩略图列 */
.hd-pg-thumbs {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;

    /* 高度由 JS 动态设置，等于右侧大图高度 */
    overflow-y: auto;
    overflow-x: hidden;

    /* 隐藏滚动条 */
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.hd-pg-thumbs::-webkit-scrollbar {
    display: none;
}

/* 单个缩略图：宽高由 Elementor 控制项设置 */
.hd-pg-thumb {
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.2s ease;
    background: #f5f5f5;

    /* 默认尺寸，Elementor 控制项会覆盖 */
    width: 160px;
    height: 160px;
}

.hd-pg-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.hd-pg-thumb:hover img {
    opacity: 0.85;
}

/* 选中高亮 */
.hd-pg-thumb.is-active {
    border-color: #D32027;
}

/* 右侧大图区：固定容器，图片覆盖填满 */
.hd-pg-main {
    flex: 1;
    min-width: 0;
    background: #f5f5f5;
    overflow: hidden;

    /* 默认高度，可在 Elementor 面板覆盖 */
    height: 600px;
}

.hd-pg-main-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: opacity 0.25s ease;
}

/* 向上滚动按钮：绝对定位在左侧画廊底部中央 */
.hd-pg-scroll-up {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: #D32027;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;              /* 默认隐藏 */
    transition: opacity 0.2s ease;
    z-index: 10;
}

.hd-pg-scroll-up svg {
    pointer-events: none;
}

/* 悬浮在左侧画廊时显示按钮 */
.hd-pg-thumbs-wrap:hover .hd-pg-scroll-up {
    opacity: 1;
}

/* 已滚动到底部时隐藏按钮 */
.hd-pg-thumbs-wrap.is-bottom .hd-pg-scroll-up {
    opacity: 0 !important;
    pointer-events: none;
}


.hd-pg-main-img.is-switching {
    opacity: 0;
}

/* ============================================================
   平板端 + 移动端（1024px 以下）
   布局：大图在上全宽，缩略图横排在下可左右滑动
   ============================================================ */
@media (max-width: 1024px) {

    /* 整体改为纵向排列 */
    .hd-pg-wrap {
        flex-direction: column;
        gap: 16px !important;
    }

    /* 大图排在上方 */
    .hd-pg-main {
        order: 1;
        width: 100%;
        height: auto !important;
        aspect-ratio: 1 / 1;
    }

    /* 缩略图区排在下方，撑满全宽 */
    .hd-pg-thumbs-wrap {
        order: 2;
        width: 100%;
        align-self: auto;
    }

    /* 缩略图列改为横排，支持左右滑动 */
    .hd-pg-thumbs {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        height: auto !important;
        width: 100%;
    }

    /* 单张缩略图不被压缩，平板默认稍大 */
    .hd-pg-thumb {
        flex-shrink: 0;
        width: 100px;
        height: 100px;
    }

    /* 回到顶部箭头隐藏 */
    .hd-pg-scroll-up {
        display: none;
    }
}

/* ============================================================
   移动端覆盖（767px 以下）
   在平板样式基础上调小缩略图尺寸
   ============================================================ */
@media (max-width: 767px) {

    .hd-pg-wrap {
        gap: 12px !important;
    }

    /* 单张缩略图移动端默认 80px，Elementor 移动端控制项可覆盖 */
    .hd-pg-thumb {
        width: 80px;
        height: 80px;
    }
}

