/* GBP Advanced Gallery (Elementor widget, gbp-widgets plugin)
   Desktop: CSS grid. Tablet/mobile (≤1024px): Swiper carousel — the JS adds
   .gbp-ag--carousel and initialises Swiper; without it (or with JS disabled)
   the grid below is the layout at every width. The 1024px breakpoint here
   MUST match MQ_CAROUSEL in advanced-gallery.js.
   Values are fallbacks matched to the reference artwork; Elementor style
   controls override them via per-widget generated CSS. */

.gbp-ag {
    --gbp-ag-cols: 4;
    --gbp-ag-gap: 16px;
    --gbp-ag-hover-speed: 300ms;
    position: relative;
}

/* ── Grid base (default layout + no-JS fallback) ── */

.gbp-ag:not(.gbp-ag--carousel) .swiper {
    overflow: visible; /* don't clip hover lift/shadow in grid mode */
}

.gbp-ag:not(.gbp-ag--carousel) .swiper-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--gbp-ag-cols), minmax(0, 1fr));
    gap: var(--gbp-ag-gap);
    /* Safety net: strip any Swiper residue after a destroy() */
    transform: none;
    box-sizing: border-box;
}

.gbp-ag:not(.gbp-ag--carousel) .swiper-slide {
    width: auto;
    margin: 0;
}

/* No-JS fallback columns (Swiper never mounts). When JS is active these
   rules stop applying below 1025px because .gbp-ag--carousel is present. */
@media (max-width: 1024px) {
    .gbp-ag:not(.gbp-ag--carousel) .swiper-wrapper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .gbp-ag:not(.gbp-ag--carousel) .swiper-wrapper {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* ── Item / card ── */

.gbp-ag .swiper-slide.gbp-ag__item {
    height: auto; /* equal-height cards inside Swiper's flex track */
}

.gbp-ag__link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.gbp-ag__card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    margin: 0; /* figure reset */
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
}

.gbp-ag__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    flex: 0 0 auto;
    transition: transform var(--gbp-ag-hover-speed) ease, filter var(--gbp-ag-hover-speed) ease;
}

.gbp-ag__caption {
    padding: 10px 12px 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #1a1a1a;
}

/* ── Hover effects (root modifiers set from the Hover Effect control) ── */

.gbp-ag--hover-zoom .gbp-ag__item:hover .gbp-ag__image {
    transform: scale(1.05);
}

.gbp-ag--hover-lift .gbp-ag__card {
    transition: transform var(--gbp-ag-hover-speed) ease, box-shadow var(--gbp-ag-hover-speed) ease;
}

.gbp-ag--hover-lift .gbp-ag__item:hover .gbp-ag__card {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.gbp-ag--hover-brighten .gbp-ag__item:hover .gbp-ag__image {
    filter: brightness(1.08);
}

/* ── Carousel chrome (arrows + dots, tablet/mobile only) ── */

.gbp-ag-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: #1a1a1a;
    cursor: pointer;
    transition: opacity 0.25s ease;
}

.gbp-ag-arrow svg {
    fill: #ffffff;
}

.gbp-ag-arrow--prev { left: 8px; }
.gbp-ag-arrow--next { right: 8px; }

.gbp-ag-arrow.swiper-button-disabled {
    opacity: 0.35;
    cursor: default;
}

/* Dots sit in normal flow below the track, not absolutely over it */
.gbp-ag .swiper-pagination.gbp-ag-dots {
    position: static;
    margin-top: 16px;
    text-align: center;
}

.gbp-ag .swiper-pagination-bullet {
    background-color: rgba(0, 0, 0, 0.25);
    opacity: 1;
}

.gbp-ag .swiper-pagination-bullet-active {
    background-color: #1a1a1a;
}

/* Desktop is the grid — hide the carousel chrome entirely, except for
   galleries with "Enable Carousel on Desktop" switched on
   (.gbp-ag--desktop-carousel), where Swiper runs at every width. */
@media (min-width: 1025px) {
    .gbp-ag:not(.gbp-ag--desktop-carousel) .gbp-ag-arrow,
    .gbp-ag:not(.gbp-ag--desktop-carousel) .swiper-pagination.gbp-ag-dots {
        display: none;
    }
}
