/* SomGeek – galérie v článkoch a fullscreen lightbox */

.sg-article-content .wp-block-gallery,
.sg-article-content .gallery {
    gap: 14px !important;
    margin: 2.2em 0;
}

.sg-article-content .wp-block-gallery .wp-block-image,
.sg-article-content .wp-block-gallery figure,
.sg-article-content .gallery .gallery-item {
    position: relative;
    overflow: hidden;
    margin: 0 !important;
    background: #080c10;
    border: 1px solid #303943;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.sg-article-content .wp-block-gallery .wp-block-image:hover,
.sg-article-content .wp-block-gallery figure:hover,
.sg-article-content .gallery .gallery-item:hover {
    z-index: 2;
    transform: translateY(-3px);
    border-color: var(--sg-gold);
    box-shadow:
        0 16px 34px rgba(0, 0, 0, 0.34),
        0 0 0 1px rgba(226, 170, 22, 0.14);
}

.sg-article-content .wp-block-gallery img,
.sg-article-content .gallery img {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    display: block;
    object-fit: cover;
    cursor: zoom-in;
    transition:
        transform 240ms ease,
        filter 240ms ease;
}

.sg-article-content .wp-block-gallery .wp-block-image:hover img,
.sg-article-content .wp-block-gallery figure:hover img,
.sg-article-content .gallery .gallery-item:hover img {
    transform: scale(1.035);
    filter: brightness(1.06);
}

.sg-article-content .wp-block-gallery figcaption,
.sg-article-content .gallery-caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    margin: 0 !important;
    padding: 28px 10px 9px !important;
    background: linear-gradient(0deg, rgba(4, 7, 10, 0.92), rgba(4, 7, 10, 0));
    color: #f0f2f4 !important;
    font-size: 0.72rem !important;
    line-height: 1.35;
    text-align: left !important;
    pointer-events: none;
}

html[data-sg-theme="light"] .sg-article-content .wp-block-gallery .wp-block-image,
html[data-sg-theme="light"] .sg-article-content .wp-block-gallery figure,
html[data-sg-theme="light"] .sg-article-content .gallery .gallery-item {
    background: #f6f1e8;
    border-color: #d7cbb7;
    box-shadow: 0 10px 24px rgba(70, 55, 30, 0.10);
}

html[data-sg-theme="light"] .sg-article-content .wp-block-gallery .wp-block-image:hover,
html[data-sg-theme="light"] .sg-article-content .wp-block-gallery figure:hover,
html[data-sg-theme="light"] .sg-article-content .gallery .gallery-item:hover {
    border-color: var(--sg-gold-dark);
}

/* Fullscreen lightbox */
.sg-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px 72px 56px;
    background: rgba(2, 4, 7, 0.96);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.sg-gallery-lightbox.is-open {
    display: flex;
}

body.sg-gallery-lightbox-open {
    overflow: hidden;
}

.sg-gallery-lightbox__stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sg-gallery-lightbox__image {
    max-width: min(1600px, 94vw);
    max-height: 88vh;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
    user-select: none;
}

.sg-gallery-lightbox__close,
.sg-gallery-lightbox__prev,
.sg-gallery-lightbox__next {
    position: absolute;
    z-index: 3;
    display: grid;
    place-items: center;
    padding: 0;
    background: rgba(12, 17, 22, 0.86);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    cursor: pointer;
    transition:
        background 160ms ease,
        border-color 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

.sg-gallery-lightbox__close:hover,
.sg-gallery-lightbox__prev:hover,
.sg-gallery-lightbox__next:hover {
    background: var(--sg-gold);
    border-color: var(--sg-gold);
    color: #090b0e;
}

.sg-gallery-lightbox__close {
    top: 18px;
    right: 20px;
    width: 46px;
    height: 46px;
    font-size: 2rem;
    line-height: 1;
}

.sg-gallery-lightbox__prev,
.sg-gallery-lightbox__next {
    top: 50%;
    width: 48px;
    height: 62px;
    transform: translateY(-50%);
    font-size: 2rem;
}

.sg-gallery-lightbox__prev:hover,
.sg-gallery-lightbox__next:hover {
    transform: translateY(-50%) scale(1.04);
}

.sg-gallery-lightbox__prev {
    left: 18px;
}

.sg-gallery-lightbox__next {
    right: 18px;
}

.sg-gallery-lightbox__footer {
    position: absolute;
    right: 72px;
    bottom: 18px;
    left: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #d9dee3;
    font-size: 0.78rem;
    text-align: center;
    pointer-events: none;
}

.sg-gallery-lightbox__caption {
    max-width: 900px;
}

.sg-gallery-lightbox__counter {
    flex: 0 0 auto;
    color: var(--sg-gold-bright);
    font-weight: 800;
}

@media (max-width: 680px) {
    .sg-article-content .wp-block-gallery,
    .sg-article-content .gallery {
        gap: 8px !important;
    }

    .sg-gallery-lightbox {
        padding: 58px 10px 68px;
    }

    .sg-gallery-lightbox__image {
        max-width: 96vw;
        max-height: 78vh;
    }

    .sg-gallery-lightbox__close {
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
    }

    .sg-gallery-lightbox__prev,
    .sg-gallery-lightbox__next {
        top: auto;
        bottom: 12px;
        width: 48px;
        height: 46px;
        transform: none;
    }

    .sg-gallery-lightbox__prev:hover,
    .sg-gallery-lightbox__next:hover {
        transform: scale(1.04);
    }

    .sg-gallery-lightbox__prev {
        left: 10px;
    }

    .sg-gallery-lightbox__next {
        right: 10px;
    }

    .sg-gallery-lightbox__footer {
        right: 68px;
        bottom: 20px;
        left: 68px;
        display: block;
    }

    .sg-gallery-lightbox__caption {
        display: none;
    }
}
