/* =========================================================
   Navjivan Children Hospital Gallery
   ========================================================= */


/* Gallery container */

.nch-gallery {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}


/* =========================================================
   Gallery Grid
   ========================================================= */

.nch-gallery-grid {
    display: grid;
    gap: 24px;
    width: 100%;
}


/* 2 columns */

.nch-gallery-columns-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}


/* 3 columns */

.nch-gallery-columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}


/* 4 columns */

.nch-gallery-columns-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}


/* =========================================================
   Gallery Item
   ========================================================= */

.nch-gallery-item {
    min-width: 0;
}


/*
 * Button reset
 */

.nch-gallery-image-button {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}


/* =========================================================
   Image Wrapper
   ========================================================= */

.nch-gallery-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 14px;
    background: #f3f4f6;
}


/* =========================================================
   Image
   ========================================================= */

.nch-gallery-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;

    transition:
        transform 0.45s ease,
        filter 0.45s ease;
}


/* =========================================================
   Hover Overlay
   ========================================================= */

.nch-gallery-overlay {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0);

    opacity: 0;

    transition:
        opacity 0.3s ease,
        background 0.3s ease;
}


/*
 * View Image button
 */

.nch-gallery-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 18px;

    border-radius: 999px;

    background: rgba(255, 255, 255, 0.95);

    color: #166534;

    font-size: 14px;
    font-weight: 600;

    transform: translateY(10px);

    transition:
        transform 0.3s ease,
        background 0.3s ease;
}


/* =========================================================
   Hover Effect
   ========================================================= */

.nch-gallery-image-button:hover .nch-gallery-image {
    transform: scale(1.06);
}


.nch-gallery-image-button:hover .nch-gallery-overlay {
    background: rgba(0, 0, 0, 0.35);
    opacity: 1;
}


.nch-gallery-image-button:hover .nch-gallery-view {
    transform: translateY(0);
}


/* =========================================================
   Caption
   ========================================================= */

.nch-gallery-caption {
    margin-top: 10px;

    color: #374151;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}


/* =========================================================
   Keyboard Focus
   ========================================================= */

.nch-gallery-image-button:focus-visible {
    outline: 3px solid #22c55e;
    outline-offset: 4px;
    border-radius: 14px;
}


/* =========================================================
   Empty Gallery
   ========================================================= */

.nch-gallery-empty {
    padding: 40px 20px;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    background: #f9fafb;

    text-align: center;

    color: #6b7280;
}


/* =========================================================
   LIGHTBOX
   ========================================================= */

.nch-lightbox {
    position: fixed;
    inset: 0;

    z-index: 999999;

    display: none;

    align-items: center;
    justify-content: center;

    padding: 30px;

    background: rgba(0, 0, 0, 0.94);
}


/*
 * Open state
 */

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


/* =========================================================
   Lightbox Inner
   ========================================================= */

.nch-lightbox-inner {
    position: relative;

    display: flex;

    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
}


/* =========================================================
   Lightbox Content
   ========================================================= */

.nch-lightbox-content {
    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    max-width: calc(100vw - 180px);
    max-height: calc(100vh - 80px);
}


/* =========================================================
   Lightbox Image
   ========================================================= */

.nch-lightbox-image {
    display: block;

    max-width: 100%;
    max-height: calc(100vh - 130px);

    width: auto;
    height: auto;

    object-fit: contain;

    border-radius: 6px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4);
}


/* =========================================================
   Lightbox Caption
   ========================================================= */

.nch-lightbox-caption {
    margin-top: 15px;

    max-width: 90vw;

    color: #ffffff;

    font-size: 16px;
    font-weight: 500;

    text-align: center;
}


/* =========================================================
   Close Button
   ========================================================= */

.nch-lightbox-close {
    position: absolute;

    top: 15px;
    right: 15px;

    z-index: 10;

    display: flex;

    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.12);

    color: #ffffff;

    font-size: 34px;
    line-height: 1;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.nch-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}


/* =========================================================
   Previous / Next Buttons
   ========================================================= */

.nch-lightbox-prev,
.nch-lightbox-next {
    position: absolute;

    top: 50%;

    z-index: 10;

    display: flex;

    align-items: center;
    justify-content: center;

    width: 50px;
    height: 50px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.12);

    color: #ffffff;

    font-size: 26px;

    cursor: pointer;

    transform: translateY(-50%);

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.nch-lightbox-prev {
    left: 20px;
}


.nch-lightbox-next {
    right: 20px;
}


.nch-lightbox-prev:hover,
.nch-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}


.nch-lightbox-prev:focus-visible,
.nch-lightbox-next:focus-visible,
.nch-lightbox-close:focus-visible {
    outline: 3px solid #4ade80;
    outline-offset: 3px;
}


/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 900px) {

    .nch-gallery-columns-4,
    .nch-gallery-columns-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nch-gallery-grid {
        gap: 18px;
    }

}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 600px) {

    .nch-gallery-columns-2,
    .nch-gallery-columns-3,
    .nch-gallery-columns-4 {
        grid-template-columns: 1fr;
    }


    .nch-gallery-grid {
        gap: 20px;
    }


    .nch-gallery-image-wrapper {
        aspect-ratio: 4 / 3;
        border-radius: 12px;
    }


    .nch-gallery-caption {
        font-size: 14px;
    }


    .nch-lightbox {
        padding: 15px;
    }


    .nch-lightbox-content {
        max-width: calc(100vw - 30px);
        max-height: calc(100vh - 100px);
    }


    .nch-lightbox-image {
        max-height: calc(100vh - 150px);
    }


    .nch-lightbox-prev,
    .nch-lightbox-next {
        width: 42px;
        height: 42px;

        font-size: 20px;
    }


    .nch-lightbox-prev {
        left: 8px;
    }


    .nch-lightbox-next {
        right: 8px;
    }


    .nch-lightbox-close {
        top: 8px;
        right: 8px;

        width: 42px;
        height: 42px;

        font-size: 28px;
    }

}


/* =========================================================
   Reduced Motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .nch-gallery-image,
    .nch-gallery-overlay,
    .nch-gallery-view,
    .nch-lightbox-close,
    .nch-lightbox-prev,
    .nch-lightbox-next {
        transition: none;
    }

}