/* NGG Pro Display Replacement Styles */

.ngg-pro-replacement {
    width: 100%;
    margin: 1.5em 0;
    box-sizing: border-box;
}

.ngg-pro-item {
    overflow: hidden;
    box-sizing: border-box;
}

.ngg-pro-item a {
    display: block;
    text-decoration: none;
    line-height: 0;
}

.ngg-pro-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: block;
}

.ngg-pro-item:hover img {
    transform: scale(1.05);
    opacity: 0.85;
}

/* Layout: Mosaic - Justified rows using flexbox */
.layout-mosaic {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.layout-mosaic .ngg-pro-item {
    height: 220px;
    flex-grow: 1;
    min-width: 150px;
}

/* Use aspect-ratio from inline style to let items size naturally */
.layout-mosaic .ngg-pro-item[style*="aspect-ratio"] {
    height: auto;
}

/* Justified row layout via JS - these classes are set dynamically */
.layout-mosaic.justified {
    gap: 4px;
}

.layout-mosaic.justified .ngg-pro-row {
    display: flex;
    gap: 4px;
    width: 100%;
}

.layout-mosaic.justified .ngg-pro-item {
    height: auto;
    min-width: 0;
    flex-grow: 0;
    flex-shrink: 0;
}

/* Layout: Tile - 3-column grid */
.layout-tile {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.layout-tile .ngg-pro-item img {
    height: auto;
}

/* Layout: Masonry - CSS columns */
.layout-masonry {
    column-count: 4;
    column-gap: 4px;
}

.layout-masonry .ngg-pro-item {
    break-inside: avoid;
    margin-bottom: 4px;
}

.layout-masonry .ngg-pro-item img {
    height: auto;
}

/* Layout: Horizontal Filmstrip */
.layout-filmstrip {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    height: 350px;
}

.layout-filmstrip .ngg-pro-item {
    flex: 0 0 auto;
    height: 100%;
    scroll-snap-align: start;
}

.layout-filmstrip .ngg-pro-item img {
    height: 100%;
    width: auto;
    object-fit: cover;
}

/* Layout: Blog Gallery - single column, large images */
.layout-blog {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.layout-blog .ngg-pro-item {
    margin-bottom: 1.5em;
}

.layout-blog .ngg-pro-item img {
    height: auto;
    border-radius: 2px;
}

/* Layout: Slideshow */
.layout-slideshow {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}

.layout-slideshow .ngg-pro-item {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s ease;
}

.layout-slideshow .ngg-pro-item.active {
    opacity: 1;
}

.layout-slideshow .ngg-pro-item img {
    object-fit: contain;
}

/* Lightbox overlay */
.ngg-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ngg-lightbox-overlay img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: default;
}

.ngg-lightbox-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 1000000;
    line-height: 1;
    font-family: sans-serif;
    font-weight: 300;
}

.ngg-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 48px;
    cursor: pointer;
    z-index: 1000000;
    padding: 20px;
    user-select: none;
    font-family: sans-serif;
    font-weight: 300;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.ngg-lightbox-nav:hover {
    opacity: 1;
}

.ngg-lightbox-prev {
    left: 10px;
}

.ngg-lightbox-next {
    right: 10px;
}

.ngg-lightbox-counter {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: #aaa;
    font-size: 14px;
    font-family: sans-serif;
}

/* Gallery section headings - match menu color */
.entry-content h2,
.entry-content h3,
.textwidget h2,
.textwidget h3,
.panel-widget-style h2,
.panel-widget-style h3 {
    color: #cccccc !important;
}

/* Responsive */
@media (max-width: 768px) {
    .layout-tile {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        grid-auto-rows: 150px;
    }

    .layout-masonry {
        column-count: 2;
    }

    .layout-filmstrip {
        height: 200px;
    }

    .layout-mosaic .ngg-pro-item {
        height: 160px;
    }
}

@media (max-width: 480px) {
    .layout-tile {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 120px;
    }

    .layout-masonry {
        column-count: 1;
    }

    .layout-mosaic .ngg-pro-item {
        height: 120px;
    }
}
