.vsp-gallery {
    --vsp-gallery-columns: 3;
    --vsp-gallery-count: 1;
    --vsp-gallery-gap: 14px;
    --vsp-gallery-mobile-gap: 8px;
    --vsp-gallery-thumb-height: 82px;
    --vsp-gallery-thumb-width: 146px;
    --vsp-gallery-thumb-height-mobile: 64px;
    --vsp-gallery-thumb-width-mobile: 114px;
    width: 100%;
    max-width: 100%;
    margin: 26px 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.vsp-gallery * { box-sizing: border-box; }

/* Klasická mřížka. U dvou obrázků zůstávají oba vedle sebe i na mobilu. */
.vsp-gallery--layout-grid {
    display: grid;
    grid-template-columns: repeat(var(--vsp-gallery-columns), minmax(0, 1fr));
    gap: var(--vsp-gallery-gap);
}
.vsp-gallery--layout-grid.vsp-gallery--count-1 { grid-template-columns: 1fr; }
.vsp-gallery--layout-grid.vsp-gallery--count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vsp-gallery__figure { margin: 0 !important; min-width: 0; }

.vsp-gallery__item {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid #2b2b33;
    border-radius: 12px;
    overflow: hidden;
    background: #101014;
    color: #fff;
    cursor: zoom-in;
    text-align: left;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    line-height: 0 !important;
}
.vsp-gallery__thumb {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: cover;
    transition: transform .28s ease, opacity .28s ease;
}
.vsp-gallery--ratio-1200-660 .vsp-gallery__item { aspect-ratio: 1200 / 660; }
.vsp-gallery--ratio-square .vsp-gallery__item { aspect-ratio: 1 / 1; }
.vsp-gallery--ratio-4-3 .vsp-gallery__item { aspect-ratio: 4 / 3; }
.vsp-gallery--ratio-16-9 .vsp-gallery__item { aspect-ratio: 16 / 9; }
.vsp-gallery--ratio-1200-660 .vsp-gallery__thumb,
.vsp-gallery--ratio-square .vsp-gallery__thumb,
.vsp-gallery--ratio-4-3 .vsp-gallery__thumb,
.vsp-gallery--ratio-16-9 .vsp-gallery__thumb {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}
.vsp-gallery__item:hover .vsp-gallery__thumb { transform: scale(1.025); opacity: .88; }
.vsp-gallery__zoom {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 12, .78);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    opacity: 0;
    transform: translateY(4px);
    transition: .2s ease;
}
.vsp-gallery__item:hover .vsp-gallery__zoom,
.vsp-gallery__item:focus-visible .vsp-gallery__zoom { opacity: 1; transform: none; }
.vsp-gallery__zoom svg { width: 18px; height: 18px; fill: currentColor; }

/* Hlavní obrázek a pás náhledů. */
.vsp-gallery--layout-showcase { display: block; }
.vsp-gallery__showcase-main { width: 100%; margin: 0 0 var(--vsp-gallery-gap); }
.vsp-gallery__showcase-open { width: 100%; }
.vsp-gallery__showcase-strip,
.vsp-gallery--many .vsp-gallery__showcase-strip {
    display: flex;
    align-items: stretch;
    gap: var(--vsp-gallery-mobile-gap);
    width: 100%;
    padding: 0 0 3px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: #f73873 #1b1b21;
    -webkit-overflow-scrolling: touch;
}
.vsp-gallery__showcase-strip::-webkit-scrollbar { height: 7px; }
.vsp-gallery__showcase-strip::-webkit-scrollbar-track { background: #1b1b21; border-radius: 999px; }
.vsp-gallery__showcase-strip::-webkit-scrollbar-thumb { background: #f73873; border-radius: 999px; }
.vsp-gallery__showcase-thumb {
    appearance: none;
    display: block;
    flex: 0 0 auto;
    width: var(--vsp-gallery-thumb-width);
    height: var(--vsp-gallery-thumb-height);
    min-width: 0;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: #101014;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    line-height: 0;
    opacity: .76;
    transition: border-color .18s ease, opacity .18s ease, transform .18s ease;
    scroll-snap-align: start;
}
.vsp-gallery__showcase-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.vsp-gallery__showcase-thumb:hover,
.vsp-gallery__showcase-thumb:focus-visible { opacity: 1; transform: translateY(-1px); }
.vsp-gallery__showcase-thumb.is-active {
    border-color: #f73873;
    opacity: 1;
}

/* Lightbox */
.vsp-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(5, 5, 8, var(--vsp-gallery-backdrop, .78));
    backdrop-filter: blur(var(--vsp-gallery-blur, 14px));
    -webkit-backdrop-filter: blur(var(--vsp-gallery-blur, 14px));
}
.vsp-gallery-lightbox.is-open { display: flex; }
.vsp-gallery-lightbox__dialog {
    position: relative;
    width: min(100%, calc(var(--vsp-gallery-max-width, 1200px) + 160px));
    max-height: calc(100dvh - 56px);
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: center;
    gap: 14px;
}
.vsp-gallery-lightbox__stage {
    position: relative;
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vsp-gallery-lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, var(--vsp-gallery-max-width, 1200px));
    max-height: var(--vsp-gallery-max-height, 82vh);
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0,0,0,.54);
}
.vsp-gallery-lightbox__caption {
    max-width: min(900px, calc(100vw - 120px));
    color: #fff;
    background: rgba(15,15,20,.78);
    border: 1px solid rgba(255,255,255,.1);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.55;
    text-align: center;
}
.vsp-gallery-lightbox__caption:empty { display: none; }
.vsp-gallery-lightbox__close,
.vsp-gallery-lightbox__prev,
.vsp-gallery-lightbox__next {
    appearance: none;
    border: 0;
    color: #fff;
    background: rgba(12,12,17,.82);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s ease, transform .18s ease, opacity .18s ease;
}
.vsp-gallery-lightbox__close:hover,
.vsp-gallery-lightbox__prev:hover,
.vsp-gallery-lightbox__next:hover { background: var(--vsp-gallery-accent, #f73873); }
.vsp-gallery-lightbox__close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 4;
    width: 44px;
    height: 44px;
    border-radius: 10px;
}
.vsp-gallery-lightbox__prev,
.vsp-gallery-lightbox__next {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    transform: translateY(-50%);
}
.vsp-gallery-lightbox__prev { left: 0; }
.vsp-gallery-lightbox__next { right: 0; }
.vsp-gallery-lightbox__prev:hover,
.vsp-gallery-lightbox__next:hover { transform: translateY(-50%) scale(1.03); }
.vsp-gallery-lightbox button svg { width: 22px; height: 22px; fill: currentColor; }
.vsp-gallery-lightbox__counter {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 4;
    color: #fff;
    background: rgba(12,12,17,.78);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 800;
}
body.vsp-gallery-lightbox-open { overflow: hidden !important; }

@media (max-width: 900px) {
    .vsp-gallery--layout-grid:not(.vsp-gallery--count-1):not(.vsp-gallery--count-2) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .vsp-gallery { margin: 18px 0; }
    .vsp-gallery--layout-grid {
        gap: var(--vsp-gallery-mobile-gap);
    }
    .vsp-gallery--layout-grid.vsp-gallery--count-1 { grid-template-columns: 1fr; }
    .vsp-gallery--layout-grid.vsp-gallery--count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vsp-gallery__item { border-radius: 8px; }
    .vsp-gallery__zoom { display: none; }

    .vsp-gallery__showcase-main { margin-bottom: var(--vsp-gallery-mobile-gap); }
    .vsp-gallery__showcase-strip,
    .vsp-gallery--many .vsp-gallery__showcase-strip {
        gap: var(--vsp-gallery-mobile-gap);
        padding-bottom: 3px;
    }
    .vsp-gallery__showcase-thumb {
        width: var(--vsp-gallery-thumb-width-mobile);
        height: var(--vsp-gallery-thumb-height-mobile);
        border-radius: 6px;
    }

    .vsp-gallery-lightbox { padding: 12px; }
    .vsp-gallery-lightbox__dialog { max-height: calc(100dvh - 24px); gap: 10px; }
    .vsp-gallery-lightbox__image { max-width: calc(100vw - 24px); max-height: 72vh; border-radius: 10px; }
    .vsp-gallery-lightbox__caption { max-width: calc(100vw - 24px); font-size: 14px; padding: 9px 11px; }
    .vsp-gallery-lightbox__close { top: 4px; right: 4px; width: 40px; height: 40px; }
    .vsp-gallery-lightbox__prev,
    .vsp-gallery-lightbox__next { width: 42px; height: 42px; top: auto; bottom: 8px; transform: none; }
    .vsp-gallery-lightbox__prev:hover,
    .vsp-gallery-lightbox__next:hover { transform: none; }
    .vsp-gallery-lightbox__prev { left: 8px; }
    .vsp-gallery-lightbox__next { right: 8px; }
    .vsp-gallery-lightbox__counter { top: 8px; left: 8px; }
}
