/**
 * Galéria produktu – [gf_gallery]
 *
 * Hlavný obrázok (stage) s tlačidlom lupy, rail náhľadov (aktívny so zeleným rámom)
 * a lightbox na zväčšenie. Premenné sa dedia z design.css (:root).
 */

.gf-gallery {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 560px;
}

/* ---------- Hlavný obrázok ---------- */
/* Bez pozadia a rámu – stage je len samotná fotka produktu. */
.gf-gallery__stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: none;
    border: none;
    border-radius: var(--gf-radius-md, 6px);
    overflow: hidden;
}

/* Kvalifikovaný selektor (img.…), aby prepísal globálne štýly obrázkov
   témy/Elementoru (height:auto, border-radius, box-shadow a pod.). */
.gf-gallery img.gf-gallery__main {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: none;
    transition: transform var(--gf-t-base, 250ms) var(--gf-ease, ease);
}

.gf-gallery[data-zoom="true"] .gf-gallery__main {
    cursor: zoom-in;
}

.gf-gallery[data-zoom="true"] .gf-gallery__stage:hover .gf-gallery__main {
    transform: scale(1.03);
}

/* ---------- Tlačidlo lupy ---------- */
/* Vyššia špecificita (button.…), aby ho neprefarbili globálne štýly tlačidiel
   témy/Elementoru (zelené pozadie, padding a pod.). */
.gf-gallery button.gf-gallery__zoom {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    border: none;
    border-radius: var(--gf-radius-pill, 999px);
    background: #fff;
    color: var(--gf-green-700, #1a9d5a);
    cursor: pointer;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    transition: transform var(--gf-t-fast, 180ms) var(--gf-ease, ease),
    background var(--gf-t-fast, 180ms) var(--gf-ease, ease),
    color var(--gf-t-fast, 180ms) var(--gf-ease, ease);
}

.gf-gallery button.gf-gallery__zoom svg {
    width: 20px;
    height: 20px;
    display: block;
}

.gf-gallery button.gf-gallery__zoom:hover,
.gf-gallery button.gf-gallery__zoom:focus-visible {
    background: var(--gf-green-700, #1a9d5a);
    color: #fff;
    transform: scale(1.06);
    outline: none;
}

/* Reset globálnych štýlov tlačidiel aj pre náhľady a ovládanie lightboxu. */
.gf-gallery button.gf-gallery__thumb,
.gf-gallery button.gf-gallery__lb-close,
.gf-gallery button.gf-gallery__lb-arrow {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    box-sizing: border-box;
    font: inherit;
    line-height: 1;
}

.gf-gallery button.gf-gallery__thumb {
    padding: 0 !important;
}

/* ---------- Náhľady (thumbnaily) ---------- */
.gf-gallery__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-left: auto;
    margin-right: auto;
}

.gf-gallery__thumb {
    width: 80px;
    height: 80px;
    padding: 0;
    border: 2px solid var(--gf-border-light, #e5e7e3);
    border-radius: var(--gf-radius-md, 6px);
    background: var(--gf-bone-50, #fcfcfb);
    cursor: pointer;
    overflow: hidden;
    transition: border-color var(--gf-t-fast, 180ms) var(--gf-ease, ease),
    transform var(--gf-t-fast, 180ms) var(--gf-ease, ease);
}

.gf-gallery .gf-gallery__thumb img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: none;
}

.gf-gallery__thumb:hover,
.gf-gallery__thumb:focus-visible {
    border-color: var(--gf-green-500, #2ecc71);
    transform: translateY(-2px);
    outline: none;
}

.gf-gallery__thumb.is-active {
    border-color: var(--gf-green-700, #1a9d5a);
}

/* ---------- Lightbox ---------- */
.gf-gallery__lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vmin;
    background: rgba(13, 20, 16, 0.88);
    opacity: 0;
    transition: opacity var(--gf-t-base, 250ms) var(--gf-ease, ease);
}

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

.gf-gallery__lightbox.is-open {
    opacity: 1;
}

.gf-gallery__lightbox img.gf-gallery__lb-image {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    border-radius: var(--gf-radius-sm, 4px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.gf-gallery__lb-close,
.gf-gallery__lb-arrow {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--gf-radius-pill, 999px);
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    cursor: pointer;
    line-height: 1;
    transition: background var(--gf-t-fast, 180ms) var(--gf-ease, ease),
    transform var(--gf-t-fast, 180ms) var(--gf-ease, ease);
}

.gf-gallery__lb-close:hover,
.gf-gallery__lb-arrow:hover,
.gf-gallery__lb-close:focus-visible,
.gf-gallery__lb-arrow:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    outline: none;
}

.gf-gallery__lb-close {
    top: 4vmin;
    right: 4vmin;
    width: 48px;
    height: 48px;
    font-size: 28px;
}

.gf-gallery__lb-arrow {
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    font-size: 34px;
}

.gf-gallery__lb-arrow:hover {
    transform: translateY(-50%) scale(1.06);
}

.gf-gallery__lb-arrow--prev {
    left: 4vmin;
}

.gf-gallery__lb-arrow--next {
    right: 4vmin;
}

.gf-gallery__lb-counter {
    position: absolute;
    bottom: 4vmin;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 14px;
    border-radius: var(--gf-radius-pill, 999px);
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--gf-font-mono, monospace);
    font-size: 13px;
    letter-spacing: 0.04em;
}

body.gf-gallery-lightbox-open {
    overflow: hidden;
}

/* ---------- Responsívne ---------- */
@media (max-width: 480px) {
    .gf-gallery__thumb {
        width: 64px;
        height: 64px;
    }

    .gf-gallery__lb-arrow {
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gf-gallery__main,
    .gf-gallery__zoom,
    .gf-gallery__thumb,
    .gf-gallery__lightbox,
    .gf-gallery__lb-close,
    .gf-gallery__lb-arrow {
        transition: none;
    }
}
