/* Gallery ảnh chèn trong bài (WP8.1, GalleryRenderer). CSS nội dung bài ép kích thước/lề cho img, figure → dùng !important ở các thuộc tính đó. */
.vd-gallery {
    position: relative;
    margin: 24px 0;
}

.vd-gallery__item {
    margin: 0 !important;
    padding: 0 !important;
}

.vd-gallery__link {
    display: block;
    overflow: hidden;
    border-radius: 8px;
    background: #f3efea;
}

.vd-gallery__link img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    object-fit: cover;
}

.vd-gallery__caption {
    margin-top: 8px;
    font-size: 15px;
    font-style: italic;
    line-height: 1.5;
    color: #4d4d4d;
}

/* Carousel: mỗi lần một ảnh, cuộn ngang bằng scroll-snap (vuốt trên mobile, nút trên desktop) */
.vd-gallery--carousel .vd-gallery__track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    outline-offset: 4px;
}

.vd-gallery--carousel .vd-gallery__track::-webkit-scrollbar {
    display: none;
}

.vd-gallery--carousel .vd-gallery__item {
    flex: 0 0 100%;
    scroll-snap-align: start;
    min-width: 0;
}

/* Khung cố định 3:2, ảnh phủ kín khung (object-fit: cover chung ở trên — ảnh khác tỉ lệ bị cắt bớt) */
.vd-gallery--carousel .vd-gallery__link {
    aspect-ratio: 3 / 2;
}

.vd-gallery__bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.vd-gallery__count {
    margin-right: auto;
    font-size: 14px;
    color: #767676;
}

.vd-gallery__prev,
.vd-gallery__next {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #bdbdbd;
    border-radius: 50%;
    background: #fff url(/css/icon/slideBlogDetail-right.svg) no-repeat center;
    cursor: pointer;
}

.vd-gallery__prev {
    background-image: url(/css/icon/slideBlogDetail-left.svg);
}

.vd-gallery__prev:disabled,
.vd-gallery__next:disabled {
    background-color: #eee;
    opacity: .5;
    cursor: default;
}

/* Có chú thích: bộ đếm nằm cùng hàng nút, chú thích ngay dưới ảnh */
.vd-gallery--carousel .vd-gallery__caption {
    min-height: 1.5em;
}

/* Lưới: 2 cột cả desktop lẫn mobile (gallery thường 4 ảnh → 2×2), ô 4:3 cắt vừa, bấm để xem ảnh đầy đủ */
.vd-gallery--grid .vd-gallery__track {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.vd-gallery--grid .vd-gallery__link {
    aspect-ratio: 4 / 3;
}

.vd-gallery--grid .vd-gallery__link img {
    transition: transform .3s;
}

.vd-gallery--grid .vd-gallery__link:hover img {
    transform: scale(1.04);
}

.vd-gallery--grid .vd-gallery__caption {
    margin-top: 4px;
    font-size: 13px;
}

@media (max-width: 767px) {
    .vd-gallery--grid .vd-gallery__track {
        gap: 8px;
    }
}
