/**
 * WC Mobile Gallery Slider v3
 * 使用 CSS 變數來讀取後台設定值
 * 透過 body.wcmgs-active 來控制是否生效
 */

/* ========================================
   共用樣式（手機 + 電腦都適用的基礎）
   ======================================== */

/* 縮圖容器：水平捲動 */
body.wcmgs-active .flexy-container .flexy-pills,
body.wcmgs-active .flexy-container .flexy-pills[data-type="thumbs"] {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 10px 0 14px !important;
    margin: 0 !important;
    width: 100% !important;

    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;

    -ms-overflow-style: none;
    scrollbar-width: none;
}

body.wcmgs-active .flexy-container .flexy-pills::-webkit-scrollbar {
    display: none;
}

/* ol 列表 */
body.wcmgs-active .flexy-container .flexy-pills ol {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    width: max-content !important;
}

/* 每個 li */
body.wcmgs-active .flexy-container .flexy-pills ol li {
    flex: 0 0 auto !important;
    width: var(--wcmgs-thumb-size, 64px) !important;
    height: var(--wcmgs-thumb-size, 64px) !important;
    margin: 0 !important;
    padding: 0 !important;
    scroll-snap-align: start;
    border-radius: var(--wcmgs-thumb-radius, 6px);
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.25s ease, opacity 0.25s ease;
    cursor: pointer;
    float: none !important;
}

/* 選中狀態 */
body.wcmgs-active .flexy-container .flexy-pills ol li.active {
    border-color: var(--theme-palette-color-1, #333) !important;
    opacity: 1 !important;
}

/* 未選中半透明 */
body.wcmgs-active .flexy-container .flexy-pills ol li:not(.active) {
    opacity: 0.55;
}

body.wcmgs-active .flexy-container .flexy-pills ol li:hover,
body.wcmgs-active .flexy-container .flexy-pills ol li:active {
    opacity: 1;
}

/* 縮圖容器與圖片 */
body.wcmgs-active .flexy-container .flexy-pills ol li .ct-media-container,
body.wcmgs-active .flexy-container .flexy-pills ol li span {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

body.wcmgs-active .flexy-container .flexy-pills ol li img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: calc(var(--wcmgs-thumb-radius, 6px) - 2px);
}
