.mc-gallery {
    --mcg-ink: #14263a;
    --mcg-accent: #0a7ea4;
    --mcg-bg: #f3f6f9;
    --mcg-gap: 16px;
    --mcg-rail: clamp(140px, 24%, 220px);
    margin: 0 0 1.5em;
    color: var(--mcg-ink);
}

.mc-gallery *,
.mc-gallery *::before,
.mc-gallery *::after {
    box-sizing: border-box;
}

.mc-gallery .mc-gallery__title {
    margin: 0 0 .6em;
    font-size: clamp(1.3rem, 2.2vw, 1.8rem);
    line-height: 1.25;
    font-weight: 700;
}

.mc-gallery__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--mcg-rail);
    gap: var(--mcg-gap);
    align-items: stretch;
}

/* Ảnh lớn bên trái */
.mc-gallery__stage {
    position: relative;
    margin: 0;
    aspect-ratio: var(--mc-gallery-ratio, 16/10);
    background: var(--mcg-bg);
    border-radius: 8px;
    overflow: hidden;
}

.mc-gallery .mc-gallery__main {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .25s ease;
}

.mc-gallery .mc-gallery__main.is-loading {
    opacity: .3;
}

.mc-gallery .mc-gallery__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2em 1em .8em;
    color: #fff;
    font-size: .95rem;
    line-height: 1.4;
    background: linear-gradient(to top, rgba(10, 22, 36, .85), rgba(10, 22, 36, 0));
}

/* Cột cuộn ảnh nhỏ bên phải */
.mc-gallery__rail {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.mc-gallery__viewport {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    cursor: grab;
    /* Làm mờ dần 2 đầu trên/dưới tạo chiều sâu cho vòng xoay */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, #000 85%, transparent 100%);
}

.mc-gallery__viewport:active {
    cursor: grabbing;
}

.mc-gallery .mc-gallery__thumbs {
    position: absolute;
    inset: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mc-gallery .mc-gallery__thumbs li {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%; /* Trục tâm chuẩn */
    margin: 0;
    padding: 0;
    aspect-ratio: var(--mc-gallery-ratio, 16/10);
    transform-origin: center center;
    will-change: transform, opacity;
}

.mc-gallery button.mc-gallery__thumb {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 6px;
    background: var(--mcg-bg);
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: border-color .2s, box-shadow .2s;
}

.mc-gallery button.mc-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Khung ảnh ở giữa đang được chọn */
.mc-gallery button.mc-gallery__thumb.is-active {
    border-color: var(--mcg-accent);
    box-shadow: 0 0 0 1px #fff inset, 0 6px 16px rgba(10, 126, 164, 0.4);
}

/* Màn hình nhỏ (< 720px) chuyển thành cuộn ngang */
@media (max-width: 720px) {
    .mc-gallery__layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .mc-gallery__rail {
        height: 110px;
    }
    .mc-gallery__viewport {
        -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 15%, #000 85%, transparent 100%);
                mask-image: linear-gradient(to right, transparent 0%, #000 15%, #000 85%, transparent 100%);
    }
    .mc-gallery .mc-gallery__thumbs li {
        top: 0;
        bottom: 0;
        left: 50%;
        right: auto;
        width: 130px;
        aspect-ratio: auto;
    }
}