/* === Thumbnail Slider Block v2.5.0 === */

.tsb-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    outline: none;
    -webkit-user-select: none;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

/* ── 主幻燈片列（箭頭 + 圖片） ── */
.tsb-slider-row {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* 無箭頭時圖片佔滿 */
.tsb-slider-row.tsb-no-arrows {
    grid-template-columns: 1fr;
}

/* ── 縮圖列：與主圖貼齊（跳過箭頭欄） ── */
.tsb-thumbnails {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: #bbb transparent;
    box-sizing: border-box;
    /* 左右 padding = 箭頭寬 + gap = 48px + 8px = 56px */
    padding-left: 56px;
    padding-right: 56px;
}
.tsb-thumbnails::-webkit-scrollbar       { height: 4px; }
.tsb-thumbnails::-webkit-scrollbar-thumb { background: #bbb; border-radius: 2px; }

/* ── 箭頭：圓形外框，在圖片外 ── */
.tsb-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1.5px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    color: #555;
    padding: 0;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}
.tsb-arrow:hover {
    border-color: #888;
    color: #111;
    box-shadow: 0 1px 6px rgba(0,0,0,0.15);
}
.tsb-arrow svg {
    display: block;
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

/* ── 主軌道 wrap ── */
.tsb-track-wrap {
    position: relative;
    min-width: 0;
}

.tsb-track {
    position: relative;
    overflow: hidden;
    background: #111;
    width: 100%;
    box-sizing: border-box;
}

/* ── 說明文字：疊在圖片底部，50% 透明黑底 ── */
.tsb-caption {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 14px;
    padding: 8px 16px;
    text-align: left;
    line-height: 1.5;
    /* 疊在 track 底部 */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* ── 固定高度 ── */
.tsb-fixed-height .tsb-slide {
    display: none;
    position: absolute;
    inset: 0;
}
.tsb-fixed-height .tsb-slide.tsb-active { display: block; }
.tsb-fixed-height .tsb-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── 自動高度 ── */
.tsb-auto-height .tsb-track { height: auto !important; }
.tsb-auto-height .tsb-slide { display: none; width: 100%; }
.tsb-auto-height .tsb-slide.tsb-active { display: block; }
.tsb-auto-height .tsb-slide img {
    display: block;
    width: 100%;
    height: auto;
}

/* ── 縮圖 ── */
.tsb-thumb {
    flex: 0 0 auto;
    cursor: pointer;
    border-radius: 3px;
    overflow: hidden;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
}
.tsb-thumb:hover            { opacity: 0.8; }
.tsb-thumb.tsb-thumb-active { opacity: 1; border-color: #0073aa; }
.tsb-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── 放大鏡（手機觸控） ── */
.tsb-magnifier {
    position: fixed;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    overflow: hidden;
    pointer-events: none;
    z-index: 9999;
    display: none;
    background: #000;
}
.tsb-magnifier img {
    position: absolute;
    transform-origin: 0 0;
}

/* ════ RWD ════ */
@media ( max-width: 768px ) {
    .tsb-slider-row { grid-template-columns: 36px 1fr 36px; gap: 6px; }
    .tsb-arrow { width: 32px; height: 32px; }
    .tsb-arrow svg { width: 14px; height: 14px; }
    .tsb-thumbnails { padding-left: 42px; padding-right: 42px; }
    .tsb-thumb { max-width: 20vw; max-height: 20vw; }
}

@media ( max-width: 480px ) {
    .tsb-slider-row { grid-template-columns: 30px 1fr 30px; gap: 4px; }
    .tsb-arrow { width: 28px; height: 28px; }
    .tsb-arrow svg { width: 12px; height: 12px; }
    .tsb-thumbnails { gap: 4px; padding-left: 34px; padding-right: 34px; }
    .tsb-thumb { max-width: 16vw; max-height: 16vw; }
    .tsb-caption { font-size: 12px; padding: 6px 12px; }
}
