/* ── Grid Gallery Carousel – Frontend Styles ── */

/* ── Grid ── */
.ggc-grid {
    display: grid;
    grid-template-columns: repeat(var(--ggc-cols, 3), 1fr);
    gap: var(--ggc-gap, 16px);
    width: 100%;
}

.ggc-grid__item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    background: #1a1a2e;
}

.ggc-grid__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .45s cubic-bezier(.25, .46, .45, .94),
                filter .45s ease;
    will-change: transform;
}

.ggc-grid__item:hover img {
    transform: scale(1.06);
    filter: brightness(1.08);
}

/* Subtle overlay on hover (only when no caption — captioned tiles already have a gradient) */
.ggc-grid__item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 60%,
        rgba(0, 0, 0, .2) 100%
    );
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
    border-radius: 10px;
}

.ggc-grid__item:not(.has-caption):hover::after {
    opacity: 1;
}

/* Caption: dark gradient strongest at the bottom, fading to transparent toward
   the top so the text is readable without obscuring the rest of the image. */
.ggc-grid__item__caption {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 14px 16px 16px;
    color: #fff;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    pointer-events: none;
    border-radius: 10px;
    z-index: 2;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, .78) 0%,
        rgba(0, 0, 0, .55) 22%,
        rgba(0, 0, 0, .15) 50%,
        rgba(0, 0, 0, 0)   70%
    );
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

.ggc-grid__item__caption span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}

/* ── Lightbox ── */
.ggc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease,
                visibility 0s .3s;
}

.ggc-lightbox.is-active {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
    transition: opacity .3s ease,
                visibility 0s 0s;
}

/* Backdrop */
.ggc-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
}

/* Stage — positions nav buttons and contains the viewport */
.ggc-lightbox__stage {
    position: relative;
    width: 90vw;
    max-width: 900px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Viewport — clips overflowing slides */
.ggc-lightbox__viewport {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 12px;
    background: #0b0b0f;
}

/* Track — holds all slides side by side, slides via translateX */
.ggc-lightbox__track {
    display: flex;
    will-change: transform;
}

.ggc-lightbox__track.is-animating {
    transition: transform .45s cubic-bezier(.4, 0, .2, 1);
}

/* Each slide takes 100% of the viewport width */
.ggc-lightbox__slide {
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ggc-lightbox__slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    user-select: none;
    -webkit-user-drag: none;
    display: block;
}

/* Close button */
.ggc-lightbox__close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .75);
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    transition: color .2s, transform .2s;
    z-index: 10;
}

.ggc-lightbox__close:hover {
    color: #fff;
    transform: scale(1.15);
}

/* Navigation arrows */
.ggc-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 36px;
    line-height: 1;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .2s, border-color .2s;
    z-index: 10;
}

.ggc-lightbox__nav:hover {
    background: rgba(255, 255, 255, .22);
    border-color: rgba(255, 255, 255, .3);
    transform: translateY(-50%) scale(1.08);
}

.ggc-lightbox__nav--prev {
    left: -70px;
}

.ggc-lightbox__nav--next {
    right: -70px;
}

/* Dots */
.ggc-lightbox__dots {
    position: absolute;
    bottom: -36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.ggc-lightbox__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .3);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background .25s, transform .25s;
}

.ggc-lightbox__dot:hover {
    background: rgba(255, 255, 255, .55);
}

.ggc-lightbox__dot.is-active {
    background: #fff;
    transform: scale(1.25);
}

/* Hide arrows when 1 or fewer slides */
.ggc-lightbox__nav.is-hidden,
.ggc-lightbox__dots:empty {
    display: none;
}

/* ── Origin ghost (FLIP animation) ── */
.ggc-lightbox__ghost {
    position: fixed;
    z-index: 999998;
    overflow: hidden;
    pointer-events: none;
    will-change: transform, width, height, top, left, border-radius;
    border-radius: 10px;
}

.ggc-lightbox__ghost img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ggc-lightbox__stage {
        width: 95vw;
    }

    .ggc-lightbox__nav--prev {
        left: 8px;
    }

    .ggc-lightbox__nav--next {
        right: 8px;
    }

    .ggc-lightbox__nav {
        width: 40px;
        height: 40px;
        font-size: 26px;
    }

    .ggc-lightbox__close {
        top: -32px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .ggc-grid {
        --ggc-cols: 2 !important;
    }
}

/* Body scroll lock */
body.ggc-no-scroll {
    overflow: hidden;
}
