.ag-gallery {
    --ag-max-height: 560px;
    --ag-thumb-height: 84px;
    --ag-stage-width: min(92vw, 980px);
    --ag-thumb-gap: 10px;
    width: 100%;
}

.ag-gallery * {
    box-sizing: border-box;
}

.ag-gallery .ag-stage-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
}

.ag-gallery .ag-stage-shell {
    position: relative;
    width: 100%;
    max-width: var(--ag-stage-width);
    margin: 0 auto;
}

.ag-gallery .ag-stage {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: 220px;
    height: var(--ag-max-height);
    display: flex;
    justify-content: center;
    align-items: center;
}

.ag-gallery .ag-image-trigger {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
}

.ag-gallery .ag-main-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 18px;
    opacity: 1;
    transition: opacity 0.35s ease;
    object-fit: contain;
}

.ag-gallery .ag-main-image.is-fading {
    opacity: 0;
}

.ag-gallery .ag-nav,
.ag-gallery .ag-lightbox-close,
.ag-gallery .ag-lightbox-nav {
    appearance: none;
    -webkit-appearance: none;
    border: 0 !important;
    box-shadow: none !important;
    background-image: none !important;
    font: inherit;
}

.ag-gallery .ag-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.82) !important;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    min-width: 48px;
    min-height: 48px;
    line-height: 1;
}

.ag-gallery .ag-prev {
    left: 14px;
}

.ag-gallery .ag-next {
    right: 14px;
}

.ag-gallery .ag-caption {
    margin-top: 14px;
    text-align: center;
    font-size: 14px;
    line-height: 1.45;
}

.ag-gallery .ag-thumbs-wrap {
    width: 100%;
    max-width: calc((var(--ag-thumb-height) * 5) + (var(--ag-thumb-gap) * 4) + 120px);
    margin: 18px auto 0;
    overflow: hidden;
}

.ag-gallery .ag-thumbs {
    display: flex;
    gap: var(--ag-thumb-gap);
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-items: center;
    scroll-behavior: smooth;
}

.ag-gallery .ag-thumbs::-webkit-scrollbar {
    display: none;
}

.ag-gallery .ag-thumb {
    flex: 0 0 auto;
    border: 2px solid transparent !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 12px;
    cursor: pointer;
    line-height: 0;
    overflow: hidden;
    transition: border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
    opacity: 0.72;
    min-width: auto;
}

.ag-gallery .ag-thumb:hover {
    opacity: 0.95;
}

.ag-gallery .ag-thumb.is-active {
    border-color: #111111 !important;
    opacity: 1;
}

.ag-gallery .ag-thumb img {
    display: block;
    height: var(--ag-thumb-height);
    width: auto;
    max-width: none;
    object-fit: cover;
    border-radius: 10px;
}

/* Lightbox */
.ag-gallery .ag-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
}

.ag-gallery .ag-lightbox.is-open {
    display: block;
}

.ag-gallery .ag-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
}

.ag-gallery .ag-lightbox-dialog {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 80px;
}

.ag-gallery .ag-lightbox-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    text-align: center;
}

.ag-gallery .ag-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 140px);
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 12px;
    object-fit: contain;
}

.ag-gallery .ag-lightbox-caption {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
    line-height: 1.45;
}

.ag-gallery .ag-lightbox-close {
    position: absolute;
    top: 22px;
    right: 22px;
    z-index: 5;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ag-gallery .ag-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ag-gallery .ag-lightbox-prev {
    left: 22px;
}

.ag-gallery .ag-lightbox-next {
    right: 22px;
}

body.ag-lightbox-open {
    overflow: hidden;
}

@media (max-width: 1024px) {
    .ag-gallery {
        --ag-max-height: 480px;
        --ag-stage-width: min(94vw, 860px);
    }

    .ag-gallery .ag-nav {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
    }

    .ag-gallery .ag-prev {
        left: 8px;
    }

    .ag-gallery .ag-next {
        right: 8px;
    }

    .ag-gallery .ag-lightbox-dialog {
        padding: 32px 60px;
    }
}

@media (max-width: 767px) {
    .ag-gallery {
        --ag-max-height: 320px;
        --ag-stage-width: 96vw;
    }

    .ag-gallery .ag-stage {
        min-height: 160px;
    }

    .ag-gallery .ag-nav {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }

    .ag-gallery .ag-thumb img {
        height: 64px;
    }

    .ag-gallery .ag-caption {
        font-size: 13px;
    }

    .ag-gallery .ag-lightbox-dialog {
        padding: 20px 16px 28px;
    }

    .ag-gallery .ag-lightbox-close {
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
        font-size: 24px;
    }

    .ag-gallery .ag-lightbox-nav {
        width: 42px;
        height: 42px;
    }

    .ag-gallery .ag-lightbox-prev {
        left: 8px;
    }

    .ag-gallery .ag-lightbox-next {
        right: 8px;
    }

    .ag-gallery .ag-lightbox-image {
        max-height: calc(100vh - 180px);
    }

    .ag-gallery .ag-lightbox-caption {
        font-size: 13px;
    }
}