.ndi-gallery {
    width: 100%;
}

.ndi-grid {
    display: grid;
    grid-template-columns: repeat(var(--ndi-col), minmax(0, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.ndi-card {
    position: relative;
    padding: 0;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f3f3, #ececec);
    height: 240px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.ndi-media-shell,
.ndi-slide-shell {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, rgba(255, 255, 255, 0.18) 8%, rgba(255, 255, 255, 0.42) 18%, rgba(255, 255, 255, 0.18) 33%);
    background-size: 200% 100%;
    animation: ndiShimmer 1.2s linear infinite;
    pointer-events: none;
}

.ndi-card.is-loaded .ndi-media-shell,
.ndi-slide.is-loaded .ndi-slide-shell,
.ndi-thumb.is-loaded::before {
    opacity: 0;
}

.ndi-card img,
.ndi-slide img,
.ndi-thumb img {
    width: 100%;
    height: 100%;
    display: block;
}

.ndi-card img,
.ndi-thumb img {
    object-fit: cover;
}

.ndi-lazy-media {
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 0.45s ease, transform 0.6s ease;
}

.ndi-lazy-media.is-loaded {
    opacity: 1;
    transform: scale(1);
}

.ndi-card:focus-visible .ndi-lazy-media.is-loaded {
    transform: scale(1.08);
}

.ndi-card-views,
.ndi-lightbox-views {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
}

.ndi-card-views {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 2;
}

.ndi-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.96);
    z-index: 999999;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.ndi-lightbox.is-open {
    opacity: 1;
}

.ndi-slider-wrap {
    width: min(90vw, 1200px);
    height: min(88vh, 820px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 0 120px;
    box-sizing: border-box;
}

.ndi-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.ndi-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.ndi-slide.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ndi-slide img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    object-fit: contain;
}

.ndi-topbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    color: #fff;
    z-index: 5;
    box-sizing: border-box;
}

.ndi-topbar-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ndi-count {
    color: #fff;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 20px;
    width: fit-content;
}

.ndi-actions {
    display: flex;
    gap: 12px;
}

.ndi-actions button,
.ndi-arrow,
.ndi-thumb {
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
}

.ndi-full,
.ndi-close {
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.ndi-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 4;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.28);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.ndi-prev {
    left: 20px;
}

.ndi-next {
    right: 20px;
}

.ndi-thumbs-wrap {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

.ndi-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.ndi-thumb {
    position: relative;
    min-width: 90px;
    width: 90px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    opacity: 0.6;
    cursor: pointer;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.08);
}

.ndi-thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, rgba(255, 255, 255, 0.12) 8%, rgba(255, 255, 255, 0.3) 18%, rgba(255, 255, 255, 0.12) 33%);
    background-size: 200% 100%;
    animation: ndiShimmer 1.2s linear infinite;
    transition: opacity 0.3s ease;
}

.ndi-thumb.active {
    opacity: 1;
    border-color: #fff;
}

.ndi-thumb img {
    position: relative;
    z-index: 1;
}

@media (max-width: 1024px) {
    .ndi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .ndi-slider-wrap {
        width: 94vw;
        padding-bottom: 110px;
    }

    .ndi-arrow {
        display: none;
    }
}

@media (max-width: 600px) {
    .ndi-grid {
        grid-template-columns: 1fr;
    }
}

@media (hover: hover) and (pointer: fine) {
    .ndi-card:hover .ndi-lazy-media.is-loaded {
        transform: scale(1.08);
    }
}

@keyframes ndiShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}