.tour-gallery {
    --tg-gap: 14px;
    position: relative;
    display: grid;
    gap: var(--tg-gap);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.tour-gallery button {
    font: inherit;
}

.tour-gallery__stage {
    position: relative;
    min-width: 0;
    height: var(--tg-height, 620px);
    overflow: hidden;
    border-radius: 16px;
    background: #111;
}

.tour-gallery__hero {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.tour-gallery__hero img,
.tour-gallery__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: var(--tg-fit, cover);
}

.tour-gallery__nav,
.tour-gallery__lightbox-nav,
.tour-gallery__close {
    position: absolute;
    z-index: 3;
    display: grid;
    place-items: center;
    border: 0;
    color: #fff;
    background: rgba(0, 0, 0, .48);
    cursor: pointer;
}

.tour-gallery__nav {
    top: 50%;
    width: 44px;
    height: 56px;
    transform: translateY(-50%);
    font-size: 28px;
}

.tour-gallery__nav--prev { left: 10px; border-radius: 8px; }
.tour-gallery__nav--next { right: 10px; border-radius: 8px; }

.tour-gallery__counter {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    color: #fff;
    background: rgba(0, 0, 0, .58);
    font-size: 14px;
}

.tour-gallery__thumbs {
    display: grid;
    gap: var(--tg-gap);
    min-width: 0;
}

.tour-gallery__thumb {
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 10px;
    background: #ddd;
    cursor: pointer;
    opacity: .78;
}

.tour-gallery__thumb:hover,
.tour-gallery__thumb:focus-visible,
.tour-gallery__thumb.is-active {
    border-color: #0d6efd;
    opacity: 1;
}

.tour-gallery--hero-grid {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}

.tour-gallery--hero-grid .tour-gallery__thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(90px, 1fr);
    max-height: var(--tg-height, 620px);
    overflow-y: auto;
}

.tour-gallery--thumbnail-strip .tour-gallery__thumbs {
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 16%);
    height: 112px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}

.tour-gallery--thumbnail-strip .tour-gallery__thumb {
    scroll-snap-align: start;
}

.tour-gallery__lightbox[hidden] { display: none; }

.tour-gallery__lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 40px 72px;
    background: rgba(0, 0, 0, .94);
}

.tour-gallery__lightbox img {
    max-width: 100%;
    max-height: calc(100vh - 80px);
    object-fit: contain;
}

.tour-gallery__close {
    top: 16px;
    right: 18px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 34px;
}

.tour-gallery__lightbox-nav {
    top: 50%;
    width: 48px;
    height: 64px;
    transform: translateY(-50%);
    border-radius: 8px;
    font-size: 30px;
}

.tour-gallery__lightbox-nav--prev { left: 16px; }
.tour-gallery__lightbox-nav--next { right: 16px; }
.tour-gallery-open { overflow: hidden; }
.tour-gallery-message { padding: 1rem; border: 1px solid #d9d9d9; border-radius: 8px; }

@media (max-width: 900px) {
    .tour-gallery__stage { height: var(--tg-mobile-height, 320px); }
    .tour-gallery--hero-grid { grid-template-columns: 1fr; }
    .tour-gallery--hero-grid .tour-gallery__thumbs,
    .tour-gallery--thumbnail-strip .tour-gallery__thumbs {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(105px, 28%);
        grid-auto-rows: 84px;
        height: 88px;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
    }
}

@media (max-width: 520px) {
    .tour-gallery { --tg-gap: 8px; }
    .tour-gallery__stage,
    .tour-gallery__thumb { border-radius: 9px; }
    .tour-gallery__nav { width: 38px; height: 48px; }
    .tour-gallery__lightbox { padding: 56px 12px; }
    .tour-gallery__lightbox-nav { width: 40px; height: 54px; }
    .tour-gallery__lightbox-nav--prev { left: 8px; }
    .tour-gallery__lightbox-nav--next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .tour-gallery * { scroll-behavior: auto !important; }
}
