:root {
    --ngp-button-bg: #fff;
    --ngp-button-text: #111;
    --ngp-button-border: #111;
    --ngp-button-bg-hover: #111;
    --ngp-button-text-hover: #fff;
    --ngp-button-font-size: 16px;
    --ngp-button-font-weight: 600;
    --ngp-button-radius: 999px;
    --ngp-button-padding-y: 12px;
    --ngp-button-padding-x: 22px;
    --ngp-lightbox-bg: rgba(8, 8, 10, .94);
    --ngp-lightbox-text: #fff;
    --ngp-lightbox-caption: #d9d9dd;
    --ngp-lightbox-caption-size: 14px;
    --ngp-lightbox-counter: #fff;
    --ngp-lightbox-counter-size: 13px;
    --ngp-lightbox-control-bg: rgba(255,255,255,.10);
    --ngp-lightbox-control-hover: rgba(255,255,255,.18);
    --ngp-lightbox-control-text: #fff;
    --ngp-lightbox-control-size: 44px;
    --ngp-lightbox-image-radius: 0px;
}

.ngp-gallery {
    --ngp-gap: 12px;
    --ngp-radius: 12px;
    --ngp-cols-desktop: 4;
    --ngp-cols-tablet: 3;
    --ngp-cols-mobile: 2;
    --ngp-aspect: 4 / 3;
    width: 100%;
}

.ngp-gallery *,
.ngp-lightbox * {
    box-sizing: border-box;
}

.ngp-gallery-inner {
    width: 100%;
}

.ngp-layout-grid .ngp-gallery-inner {
    display: grid;
    grid-template-columns: repeat(var(--ngp-cols-desktop), minmax(0, 1fr));
    gap: var(--ngp-gap);
    align-items: stretch;
}

.ngp-layout-masonry .ngp-gallery-inner {
    columns: var(--ngp-cols-desktop);
    column-gap: var(--ngp-gap);
}

.ngp-layout-masonry .ngp-item {
    break-inside: avoid;
    margin: 0 0 var(--ngp-gap);
}

.ngp-layout-justified .ngp-gallery-inner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ngp-gap);
}

.ngp-layout-justified .ngp-item {
    flex: 0 0 auto;
}

.ngp-layout-justified .ngp-item-link {
    height: 180px;
}

.ngp-item {
    min-width: 0;
    margin: 0;
    overflow: visible;
}

.ngp-item-link {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: var(--ngp-radius);
    background: #f2f2f2;
    line-height: 0;
    text-decoration: none !important;
    outline-offset: 3px;
}

.ngp-layout-grid:not(.ngp-aspect-auto) .ngp-item-link {
    aspect-ratio: var(--ngp-aspect);
}

.ngp-layout-grid:not(.ngp-aspect-auto) .ngp-item-link .ngp-image,
.ngp-layout-justified .ngp-item-link .ngp-image {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
}

.ngp-image {
    display: block;
    width: 100%;
    max-width: none !important;
    height: 100%;
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    object-fit: cover;
    object-position: center center;
    transition: transform .35s ease, opacity .25s ease, filter .25s ease;
}

.ngp-aspect-auto .ngp-image,
.ngp-layout-masonry .ngp-image {
    position: static;
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
}

.ngp-hover-zoom .ngp-item-link:hover .ngp-image {
    transform: scale(1.025);
}

.ngp-hover-fade .ngp-item-link:hover .ngp-image {
    filter: brightness(.88);
}

.ngp-caption {
    margin-top: 7px;
    font-size: .88em;
    line-height: 1.35;
    opacity: .72;
}

.ngp-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: clamp(18px, 3vw, 30px);
}

.ngp-more-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: var(--ngp-button-padding-y) var(--ngp-button-padding-x);
    border: 1px solid var(--ngp-button-border);
    border-radius: var(--ngp-button-radius);
    color: var(--ngp-button-text) !important;
    background: var(--ngp-button-bg);
    font-size: var(--ngp-button-font-size);
    font-weight: var(--ngp-button-font-weight);
    line-height: 1.2;
    text-decoration: none !important;
    transition: transform .18s ease, background-color .18s ease, color .18s ease, border-color .18s ease;
}

.ngp-more-button:hover,
.ngp-more-button:focus-visible {
    color: var(--ngp-button-text-hover) !important;
    background: var(--ngp-button-bg-hover);
    transform: translateY(-1px);
}

@media (max-width: 1024px) {
    .ngp-layout-grid .ngp-gallery-inner {
        grid-template-columns: repeat(var(--ngp-cols-tablet), minmax(0, 1fr));
    }
    .ngp-layout-masonry .ngp-gallery-inner {
        columns: var(--ngp-cols-tablet);
    }
}

@media (max-width: 640px) {
    .ngp-layout-grid .ngp-gallery-inner {
        grid-template-columns: repeat(var(--ngp-cols-mobile), minmax(0, 1fr));
    }
    .ngp-layout-masonry .ngp-gallery-inner {
        columns: var(--ngp-cols-mobile);
    }
}

/* Lightbox */
body.ngp-lightbox-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.ngp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 30px);
    background: var(--ngp-lightbox-bg);
    color: var(--ngp-lightbox-text);
    -webkit-tap-highlight-color: transparent;
}

.ngp-lightbox.is-open {
    display: flex;
}

.ngp-lightbox-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.ngp-lightbox-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-in;
    user-select: none;
}

.ngp-lightbox-image-wrap.is-zoom-disabled {
    cursor: default;
}

.ngp-lightbox-image-wrap.is-zoomed {
    cursor: grab;
}

.ngp-lightbox-image-wrap.is-panning {
    cursor: grabbing;
}

.ngp-lightbox-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    will-change: transform, opacity;
}

.ngp-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 125px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--ngp-lightbox-image-radius);
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: center center;
    will-change: transform;
}

.ngp-lightbox-caption {
    max-width: min(820px, 90vw);
    margin: 12px auto 0;
    min-height: 1.4em;
    text-align: center;
    font-size: var(--ngp-lightbox-caption-size);
    line-height: 1.45;
    color: var(--ngp-lightbox-caption);
}

.ngp-lightbox-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
}

.ngp-lightbox-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: var(--ngp-lightbox-control-size);
    padding: 0 12px;
    border-radius: 999px;
    background: var(--ngp-lightbox-control-bg);
    color: var(--ngp-lightbox-counter);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: var(--ngp-lightbox-counter-size);
    pointer-events: auto;
}

.ngp-lightbox-actions {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.ngp-lightbox-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ngp-lightbox-control-size);
    height: var(--ngp-lightbox-control-size);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ngp-lightbox-control-bg);
    color: var(--ngp-lightbox-control-text) !important;
    font-size: calc(var(--ngp-lightbox-control-size) * .40);
    line-height: 1;
    cursor: pointer;
    text-decoration: none !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background-color .18s ease, transform .18s ease, opacity .18s ease;
}

.ngp-lightbox-btn i {
    display: block;
    pointer-events: none;
    line-height: 1;
}

.ngp-lightbox-btn:hover {
    background: var(--ngp-lightbox-control-hover);
}

.ngp-lightbox-btn:active {
    transform: scale(.96);
}

.ngp-lightbox-btn:focus-visible {
    outline: 2px solid var(--ngp-lightbox-control-text);
    outline-offset: 2px;
}

.ngp-lightbox-btn:disabled {
    opacity: .35;
    cursor: default;
}

.ngp-lightbox-btn[hidden],
.ngp-lightbox-meta[hidden] {
    display: none !important;
}

.ngp-lightbox-prev,
.ngp-lightbox-next {
    position: absolute;
    top: 50%;
    z-index: 5;
    transform: translateY(-50%);
}

.ngp-lightbox-prev:active,
.ngp-lightbox-next:active {
    transform: translateY(-50%) scale(.96);
}

.ngp-lightbox-prev { left: 0; }
.ngp-lightbox-next { right: 0; }

.ngp-lightbox-download {
    text-decoration: none;
}

.ngp-lightbox[aria-busy="true"] .ngp-lightbox-image {
    opacity: .35;
}

@media (max-width: 700px) {
    .ngp-lightbox {
        padding: 10px;
    }

    .ngp-lightbox-image {
        max-height: calc(100svh - 110px);
    }

    .ngp-lightbox-prev,
    .ngp-lightbox-next {
        top: auto;
        bottom: 4px;
        transform: none;
    }

    .ngp-lightbox-prev:active,
    .ngp-lightbox-next:active {
        transform: scale(.96);
    }

    /* Telefonis on pinch-zoom loomulikum ja jätab ülariba puhtaks. */
    .ngp-lightbox-zoom-out,
    .ngp-lightbox-zoom-in {
        display: none !important;
    }

    .ngp-lightbox-toolbar {
        gap: 6px;
    }

    .ngp-lightbox-actions {
        gap: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ngp-image,
    .ngp-more-button,
    .ngp-lightbox-btn,
    .ngp-lightbox-slide,
    .ngp-lightbox-image {
        transition: none !important;
    }
}
