/* NGC Gallery Ratio — Frontend Grid + Lightbox */

/* ─── Grid Layout ─── */

.ngc-gallery-grid.wp-block-gallery {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    /* Kill WP default flex and stretch */
    align-items: start !important;
    flex-wrap: nowrap;
}

.ngc-gallery-grid[data-ngc-count="1"] {
    grid-template-columns: 1fr;
}

.ngc-gallery-grid[data-ngc-count="2"] {
    grid-template-columns: repeat(2, 1fr);
}

/* Figures: fill grid cell, contain overflow */
.ngc-gallery-grid .wp-block-image,
.ngc-gallery-grid figure.wp-block-image {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100%;
    overflow: hidden;
}

/* Restore cropping lost by flex→grid switch — high specificity to beat WP core */
.ngc-gallery-grid.wp-block-gallery figure.wp-block-image img {
    display: block;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
    height: auto !important;
}

/* Gallery item cursor for lightbox */
.ngc-gallery-item {
    cursor: pointer;
}

/* ─── Tablet (768–1024px) ─── */
@media (max-width: 1024px) {
    .ngc-gallery-grid.wp-block-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* ─── Mobile (<768px) ─── */
@media (max-width: 768px) {
    .ngc-gallery-grid.wp-block-gallery {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ngc-gallery-grid .wp-block-image {
        max-width: 100%;
    }
}


/* ─── Lightbox ─── */

.ngc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s ease;
}

.ngc-lightbox.active {
    opacity: 1;
}

.ngc-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.ngc-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 8px;
    opacity: .8;
    transition: opacity .15s;
    background: none;
    border: none;
    font-family: inherit;
}

.ngc-lightbox-close:hover {
    opacity: 1;
}

.ngc-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 44px;
    line-height: 1;
    cursor: pointer;
    padding: 24px 16px;
    opacity: .7;
    transition: opacity .15s;
    user-select: none;
    background: none;
    border: none;
    font-family: inherit;
}

.ngc-lightbox-arrow:hover {
    opacity: 1;
}

.ngc-lightbox-prev {
    left: 0;
}

.ngc-lightbox-next {
    right: 0;
}

.ngc-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    letter-spacing: 1px;
    opacity: .8;
    user-select: none;
}

/* Hide arrows on mobile (swipe instead) */
@media (max-width: 768px) {
    .ngc-lightbox-arrow {
        display: none;
    }

    .ngc-lightbox-img {
        max-width: 95vw;
        max-height: 80vh;
    }
}
