/* Galleria prodotto custom — versione di prova. */

.fg-single-gallery {
    --fg-gallery-green: #173c2b;
    --fg-gallery-border: #dce3d8;

    min-width: 0;
}

.fg-single-gallery [hidden] {
    display: none !important;
}

/* Foto principale */

.fg-single-gallery .fg-single-gallery-main {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--fg-gallery-border);
    border-radius: 5px;
    background: #fff;
}

/* Mostra la prima foto anche prima dell'avvio di Swiper. */
.fg-single-gallery-main:not(.swiper-initialized)
    .fg-single-gallery-slide:not(:first-child) {
    display: none;
}

.fg-single-gallery .fg-single-gallery-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 14px;
    box-sizing: border-box;
    background: #fff;
    cursor: zoom-in;
}

.fg-single-gallery .fg-single-gallery-link img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
    border-radius: 0;
    object-fit: contain;
}

/* Frecce della foto principale */

.fg-single-gallery .fg-single-gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transform: translateY(-50%);
    border: 1px solid var(--fg-gallery-border);
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.95);
    color: var(--fg-gallery-green);
    box-shadow: none;
    cursor: pointer;
}

.fg-single-gallery .fg-single-gallery-prev {
    left: 12px;
}

.fg-single-gallery .fg-single-gallery-next {
    right: 12px;
}

.fg-single-gallery .fg-single-gallery-arrow > span {
    display: none;
}

.fg-single-gallery .fg-single-gallery-arrow::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    box-sizing: border-box;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
}

.fg-single-gallery .fg-single-gallery-prev::before {
    transform: translateX(2px) rotate(-135deg);
}

.fg-single-gallery .fg-single-gallery-next::before {
    transform: translateX(-2px) rotate(45deg);
}

/* Carosello miniature */

.fg-single-gallery .fg-single-thumbs-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-top: 12px;
}

.fg-single-gallery .fg-single-gallery-thumbs {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 3px;
    overflow: hidden;
}

.fg-single-gallery .fg-single-thumb-slide {
    width: 92px;
    height: auto;
}

.fg-single-gallery .fg-single-gallery-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    height: 92px;
    min-height: 92px;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    margin: 0;
    padding: 6px;
    overflow: hidden;
    border: 1px solid var(--fg-gallery-border);
    border-radius: 4px !important;
    background: #fff;
    color: var(--fg-gallery-green);
    box-shadow: none;
    cursor: pointer;
    transition: border-color 180ms ease;
}

.fg-single-gallery .fg-single-gallery-thumb[aria-pressed="true"] {
    border-color: var(--fg-gallery-green);
    box-shadow: inset 0 0 0 1px var(--fg-gallery-green);
}

.fg-single-gallery .fg-single-gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0 !important;
    object-fit: contain;
}

/* Frecce delle miniature */

.fg-single-gallery .fg-single-thumbs-arrow {
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid var(--fg-gallery-border);
    border-radius: 50% !important;
    background: #fff;
    color: var(--fg-gallery-green);
    box-shadow: none;
    cursor: pointer;
}

.fg-single-gallery .fg-single-thumbs-arrow::before {
    content: "";
    display: block;
    width: 7px;
    height: 7px;
    box-sizing: border-box;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
}

.fg-single-gallery .fg-single-thumbs-prev::before {
    transform: translateX(2px) rotate(-135deg);
}

.fg-single-gallery .fg-single-thumbs-next::before {
    transform: translateX(-2px) rotate(45deg);
}

.fg-single-gallery .fg-single-thumbs-arrow.swiper-button-disabled {
    opacity: 0.35;
    cursor: default;
}

.fg-single-gallery .fg-single-thumbs-arrow.swiper-button-lock,
.fg-single-gallery .fg-single-gallery-arrow.swiper-button-lock {
    display: none;
}

/* Galleria a tutto schermo */

.fg-single-gallery-lightbox:not([open]) {
    display: none;
}

.fg-single-gallery-lightbox[open] {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.88);
color: #fff;
}

.fg-single-gallery-lightbox::backdrop {
    background: transparent;
}

.fg-single-gallery-lightbox .fg-lightbox-slider {
    position: absolute;
    top: calc(70px + env(safe-area-inset-top, 0px));
    right: 70px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    left: 70px;
    overflow: hidden;
}

.fg-single-gallery-lightbox .fg-lightbox-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.fg-single-gallery-lightbox .fg-lightbox-slide img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
    object-fit: contain;
}

.fg-single-gallery-lightbox .fg-single-gallery-close {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: calc(18px + env(safe-area-inset-right, 0px));
    z-index: 3;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid #dce3d8;
    border-radius: 50% !important;
    background: #fff;
    color: #173c2b;
    font: 30px/1 Arial, sans-serif;
    box-shadow: none;
    cursor: pointer;
}

.fg-single-gallery-lightbox .fg-lightbox-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: block;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transform: translateY(-50%);
    border: 1px solid #173c2b;
    border-radius: 50% !important;
    background: #173c2b;
    color: #fff;
    font-size: 0;
    line-height: 0;
    box-shadow: 0 2px 8px rgba(23, 60, 43, 0.15);
    cursor: pointer;
}

.fg-single-gallery-lightbox .fg-lightbox-prev {
    left: calc(16px + env(safe-area-inset-left, 0px));
}

.fg-single-gallery-lightbox .fg-lightbox-next {
    right: calc(16px + env(safe-area-inset-right, 0px));
}

.fg-single-gallery-lightbox .fg-lightbox-arrow::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: 11px;
    height: 11px;
    margin: 0;
    box-sizing: border-box;
    border: 0;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform-origin: center;
}

.fg-single-gallery-lightbox .fg-lightbox-prev::before {
    transform: translate(-30%, -50%) rotate(-135deg);
}

.fg-single-gallery-lightbox .fg-lightbox-next::before {
    transform: translate(-70%, -50%) rotate(45deg);
}

.fg-single-gallery-lightbox .fg-lightbox-count {
    position: absolute;
    right: 0;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 0;
    text-align: center;
    font-size: 14px;
    letter-spacing: 0.08em;
}

.fg-single-gallery-lightbox .fg-lightbox-arrow.swiper-button-lock {
    display: none;
}

.fg-single-gallery .fg-single-gallery-lightbox
button.fg-lightbox-arrow:hover {
    background-color: #24573d !important;
    color: #fff !important;
    border-color: #24573d;
}

.fg-single-gallery .fg-single-gallery-lightbox
button.fg-single-gallery-close:hover {
    background-color: #fff !important;
    color: #173c2b !important;
    border-color: #173c2b;
}

@media (max-width: 767px) {
    .fg-single-gallery-lightbox .fg-lightbox-slider {
        right: 12px;
        left: 12px;
    }

    .fg-single-gallery-lightbox .fg-lightbox-arrow {
        top: auto;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        transform: none;
    }
}

/* Hover: fondo bianco, bordo verde */

.fg-single-gallery button.fg-single-gallery-thumb:hover,
.fg-single-gallery button.fg-single-gallery-arrow:hover,
.fg-single-gallery button.fg-single-thumbs-arrow:hover,
.fg-single-gallery button.fg-single-gallery-close:hover {
    background-color: #fff !important;
    color: var(--fg-gallery-green) !important;
    border-color: var(--fg-gallery-green);
}

.fg-single-gallery .fg-single-gallery-thumb:hover,
.fg-single-gallery .fg-single-gallery-thumb:active {
    transform: none;
}

/* Navigazione da tastiera */

.fg-single-gallery button:focus-visible,
.fg-single-gallery a:focus-visible {
    outline: 2px solid var(--fg-gallery-green);
    outline-offset: 2px;
}

/* Mobile */

@media (max-width: 767px) {
    .fg-single-gallery .fg-single-gallery-link {
        padding: 10px;
    }

    .fg-single-gallery .fg-single-thumb-slide {
        width: 76px;
    }

    .fg-single-gallery .fg-single-gallery-thumb {
        width: 76px;
        min-width: 76px;
        max-width: 76px;
        height: 76px;
        min-height: 76px;
    }

    .fg-single-gallery .fg-single-gallery-arrow {
        width: 38px;
        height: 38px;
    }
}