/* =====================================================
   APIE PREMIUM ZIG-ZAG GALLERY
===================================================== */

.apie-gallery-section {
    position: relative;
    width: 100%;
    padding: 110px 5%;
    background: #fffaf5;
    overflow: hidden;
}


/* =====================================================
   SOFT BACKGROUND DECORATION
===================================================== */

.apie-gallery-section::before {
    content: "";
    position: absolute;

    width: 500px;
    height: 500px;

    top: -250px;
    left: -250px;

    border-radius: 50%;

    background: rgba(8, 116, 127, 0.05);

    pointer-events: none;
}

.apie-gallery-section::after {
    content: "";
    position: absolute;

    width: 450px;
    height: 450px;

    bottom: -250px;
    right: -220px;

    border-radius: 50%;

    background: rgba(8, 116, 127, 0.04);

    pointer-events: none;
}


/* =====================================================
   HEADING
===================================================== */

.apie-gallery-heading {
    position: relative;
    z-index: 2;

    max-width: 760px;

    margin: 0 auto 65px;

    text-align: center;
}

.apie-gallery-heading span {
    display: inline-block;

    margin-bottom: 14px;

    font-size: 13px;
    font-weight: 800;

    letter-spacing: 3px;

    text-transform: uppercase;

    color: #08747f;
}

.apie-gallery-heading h2 {
    margin: 0;

    font-size: clamp(38px, 5vw, 64px);

    line-height: 1.05;

    font-weight: 800;

    color: #173b40;
}

.apie-gallery-heading h2 strong {
    color: #08747f;
}

.apie-gallery-heading p {
    max-width: 620px;

    margin: 20px auto 0;

    font-size: 16px;

    line-height: 1.8;

    color: #6c7779;
}


/* =====================================================
   GALLERY GRID
===================================================== */

.apie-gallery-grid {
    position: relative;
    z-index: 2;

    width: 100%;
    max-width: 1500px;

    margin: 0 auto;

    display: grid;

    grid-template-columns: repeat(4, 1fr);

    column-gap: 24px;
    row-gap: 24px;

    align-items: start;
}


/* =====================================================
   GALLERY CARD
===================================================== */

.apie-gallery-item {
    position: relative;

    width: 100%;
    height: 360px;

    overflow: hidden;

    cursor: pointer;

    background: #e8eeee;

    border-radius: 26px;

    isolation: isolate;

    box-shadow:
        0 12px 35px rgba(23, 59, 64, 0.09);

    transform: translateY(0);

    transition:
        transform 0.5s cubic-bezier(.2,.8,.2,1),
        box-shadow 0.5s ease;
}


/* =====================================================
   ZIG-ZAG POSITION
===================================================== */

/* IMAGE 01 */
.apie-gallery-item:nth-child(4n + 1) {
    transform: translateY(0);
}

/* IMAGE 02 */
.apie-gallery-item:nth-child(4n + 2) {
    transform: translateY(65px);
}

/* IMAGE 03 */
.apie-gallery-item:nth-child(4n + 3) {
    transform: translateY(0);
}

/* IMAGE 04 */
.apie-gallery-item:nth-child(4n + 4) {
    transform: translateY(65px);
}


/* =====================================================
   DIFFERENT HEIGHTS
===================================================== */

.apie-gallery-item:nth-child(4n + 1) {
    height: 390px;
}

.apie-gallery-item:nth-child(4n + 2) {
    height: 330px;
}

.apie-gallery-item:nth-child(4n + 3) {
    height: 370px;
}

.apie-gallery-item:nth-child(4n + 4) {
    height: 340px;
}


/* =====================================================
   IMAGE
===================================================== */

.apie-gallery-item img {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;

    transition:
        transform 0.9s cubic-bezier(.2,.8,.2,1),
        filter 0.6s ease;
}


/* =====================================================
   DARK HOVER OVERLAY
===================================================== */

.apie-gallery-item::before {
    content: "";

    position: absolute;

    inset: 0;

    z-index: 1;

    background:
        linear-gradient(
            135deg,
            rgba(8, 116, 127, 0.35),
            rgba(0, 0, 0, 0.68)
        );

    opacity: 0;

    transition:
        opacity 0.5s ease;
}


/* =====================================================
   LIGHT CIRCLE EFFECT
===================================================== */

.apie-gallery-item::after {
    content: "";

    position: absolute;

    width: 190px;
    height: 190px;

    top: -95px;
    right: -95px;

    border-radius: 50%;

    background:
        rgba(255, 255, 255, 0.13);

    z-index: 2;

    transform: scale(1);

    transition:
        transform 0.8s cubic-bezier(.2,.8,.2,1);
}


/* =====================================================
   OVERLAY CONTENT
===================================================== */

.apie-gallery-overlay {
    position: absolute;

    inset: 0;

    z-index: 5;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-direction: column;

    gap: 16px;

    color: #ffffff;

    opacity: 0;

    transform: scale(0.75);

    transition:
        opacity 0.45s ease,
        transform 0.55s cubic-bezier(.2,.8,.2,1);
}


/* =====================================================
   VIEW IMAGE TEXT
===================================================== */

.apie-gallery-overlay span {
    display: block;

    font-size: 13px;

    font-weight: 800;

    letter-spacing: 2px;

    text-transform: uppercase;

    color: #ffffff;
}


/* =====================================================
   EXPAND ICON
===================================================== */

.apie-gallery-overlay i {
    width: 64px;
    height: 64px;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 50%;

    border: 1px solid rgba(255, 255, 255, 0.75);

    background: rgba(255, 255, 255, 0.13);

    color: #ffffff;

    font-size: 19px;

    line-height: 1;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.15);

    transition:
        transform 0.35s ease,
        background 0.35s ease,
        box-shadow 0.35s ease;
}


/* =====================================================
   HOVER EFFECT
===================================================== */

.apie-gallery-item:hover {
    transform: translateY(-8px) !important;

    box-shadow:
        0 25px 60px rgba(8, 116, 127, 0.20);
}


.apie-gallery-item:hover img {
    transform: scale(1.12);

    filter:
        saturate(1.12)
        contrast(1.04);
}


.apie-gallery-item:hover::before {
    opacity: 1;
}


.apie-gallery-item:hover::after {
    transform: scale(3.3);
}


.apie-gallery-item:hover .apie-gallery-overlay {
    opacity: 1;

    transform: scale(1);
}


.apie-gallery-item:hover .apie-gallery-overlay i {
    transform: scale(1.1);

    background: rgba(255, 255, 255, 0.20);

    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.25);
}


/* =====================================================
   LIGHTBOX
===================================================== */

.apie-lightbox {
    position: fixed;

    inset: 0;

    z-index: 999999;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 40px;

    background:
        rgba(5, 20, 22, 0.95);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.4s ease,
        visibility 0.4s ease;
}


.apie-lightbox.active {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}


/* =====================================================
   LIGHTBOX CONTENT
===================================================== */

.apie-lightbox-content {
    position: relative;

    width: auto;
    max-width: min(1100px, 82vw);
    max-height: 82vh;

    display: flex;

    align-items: center;
    justify-content: center;

    transform:
        scale(0.75)
        translateY(25px);

    transition:
        transform 0.55s cubic-bezier(.2,.8,.2,1);
}


.apie-lightbox.active .apie-lightbox-content {
    transform:
        scale(1)
        translateY(0);
}


/* =====================================================
   LIGHTBOX IMAGE
===================================================== */

.apie-lightbox-content img {
    display: block;

    max-width: 100%;

    max-height: 78vh;

    width: auto;
    height: auto;

    object-fit: contain;

    border-radius: 16px;

    box-shadow:
        0 30px 100px rgba(0, 0, 0, 0.60);

    opacity: 1;

    transform: scale(1);

    transition:
        opacity 0.2s ease,
        transform 0.25s ease;
}


/* =====================================================
   CLOSE BUTTON
===================================================== */

.apie-lightbox-close {
    position: absolute;

    top: 25px;
    right: 30px;

    z-index: 20;

    width: 54px;
    height: 54px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid rgba(255,255,255,0.30);

    border-radius: 50%;

    background:
        rgba(255,255,255,0.09);

    color: #ffffff;

    font-size: 19px;

    cursor: pointer;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    transition:
        background 0.3s ease,
        transform 0.3s ease;
}


.apie-lightbox-close:hover {
    background:
        rgba(255,255,255,0.20);

    transform:
        rotate(90deg);
}


/* =====================================================
   PREVIOUS / NEXT
===================================================== */

.apie-lightbox-prev,
.apie-lightbox-next {
    position: absolute;

    top: 50%;

    z-index: 20;

    width: 58px;
    height: 58px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid rgba(255,255,255,0.28);

    border-radius: 50%;

    background:
        rgba(255,255,255,0.09);

    color: #ffffff;

    font-size: 18px;

    cursor: pointer;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    transition:
        background 0.3s ease,
        transform 0.3s ease;
}


.apie-lightbox-prev {
    left: 30px;

    transform:
        translateY(-50%);
}


.apie-lightbox-next {
    right: 30px;

    transform:
        translateY(-50%);
}


.apie-lightbox-prev:hover {
    background:
        rgba(255,255,255,0.20);

    transform:
        translate(-5px, -50%);
}


.apie-lightbox-next:hover {
    background:
        rgba(255,255,255,0.20);

    transform:
        translate(5px, -50%);
}


/* =====================================================
   COUNTER
===================================================== */

.apie-lightbox-counter {
    position: absolute;

    left: 50%;

    bottom: -48px;

    transform:
        translateX(-50%);

    color:
        rgba(255,255,255,0.85);

    font-size: 14px;

    font-weight: 700;

    letter-spacing: 3px;

    white-space: nowrap;
}


/* =====================================================
   TABLET
===================================================== */

@media (max-width: 1100px) {

    .apie-gallery-section {
        padding: 90px 4%;
    }

    .apie-gallery-grid {
        grid-template-columns:
            repeat(3, 1fr);

        gap: 20px;
    }

    .apie-gallery-item {
        height: 320px;
    }

    .apie-gallery-item:nth-child(3n + 1) {
        height: 350px;

        transform:
            translateY(0);
    }

    .apie-gallery-item:nth-child(3n + 2) {
        height: 300px;

        transform:
            translateY(50px);
    }

    .apie-gallery-item:nth-child(3n + 3) {
        height: 330px;

        transform:
            translateY(0);
    }

}


/* =====================================================
   MOBILE TABLET
===================================================== */

@media (max-width: 768px) {

    .apie-gallery-section {
        padding: 75px 20px;
    }

    .apie-gallery-heading {
        margin-bottom: 45px;
    }

    .apie-gallery-grid {
        grid-template-columns:
            repeat(2, 1fr);

        gap: 15px;
    }

    .apie-gallery-item,
    .apie-gallery-item:nth-child(n) {

        height: 250px;

        border-radius: 18px;

        transform:
            translateY(0);
    }

    .apie-gallery-item:nth-child(4n + 2),
    .apie-gallery-item:nth-child(4n + 4) {

        transform:
            translateY(35px);
    }

    .apie-gallery-overlay span {
        font-size: 10px;

        letter-spacing: 1.5px;
    }

    .apie-gallery-overlay i {
        width: 48px;
        height: 48px;

        font-size: 15px;
    }

    .apie-lightbox {
        padding: 20px;
    }

    .apie-lightbox-content {
        max-width: 92vw;

        max-height: 78vh;
    }

    .apie-lightbox-content img {
        max-width: 92vw;

        max-height: 72vh;

        border-radius: 10px;
    }

    .apie-lightbox-close {
        top: 14px;
        right: 14px;

        width: 44px;
        height: 44px;

        font-size: 16px;
    }

    .apie-lightbox-prev,
    .apie-lightbox-next {

        width: 44px;
        height: 44px;

        font-size: 14px;
    }

    .apie-lightbox-prev {
        left: 10px;
    }

    .apie-lightbox-next {
        right: 10px;
    }

}


/* =====================================================
   SMALL MOBILE
===================================================== */

@media (max-width: 480px) {

    .apie-gallery-section {
        padding:
            65px 15px;
    }

    .apie-gallery-grid {
        grid-template-columns:
            repeat(2, 1fr);

        gap: 12px;
    }

    .apie-gallery-item,
    .apie-gallery-item:nth-child(n) {

        height: 220px;

        border-radius: 15px;
    }

    .apie-gallery-item:nth-child(4n + 2),
    .apie-gallery-item:nth-child(4n + 4) {

        transform:
            translateY(25px);
    }

    .apie-gallery-heading h2 {
        font-size: 38px;
    }

    .apie-gallery-heading p {
        font-size: 14px;
    }

}


/* =====================================================
   VERY SMALL MOBILE
===================================================== */

@media (max-width: 360px) {

    .apie-gallery-grid {
        gap: 10px;
    }

    .apie-gallery-item,
    .apie-gallery-item:nth-child(n) {
        height: 190px;
    }

    .apie-gallery-item:nth-child(4n + 2),
    .apie-gallery-item:nth-child(4n + 4) {

        transform:
            translateY(20px);
    }

}