/* 1. Grid & Cards Layout */
.cpt-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    padding: 20px;
}

.gallery-item {
    cursor: pointer;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
}

/* NEW WRAPPER FOR IMAGE AREA */
.gallery-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 12 / 7;
    overflow: hidden;
    background: #f0f0f0;
    font-family: "Inter";
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-meta {
    padding: 18px 0;
    border-top: 1px solid #f5f5f5;
    flex-grow: 1;
    background: #fff;
    position: relative;
    z-index: 2;
}

.img-meta-title {
    font-family: "Inter";
    margin: 0 0 4px;
    font-size: 24px;
    color: #000000;
    font-weight: 600;
}

.img-meta-caption {
    margin: 0;
    font-size: 18px;
    font-family: "Inter";
    color: #000000;
    line-height: 1.5;
}

.blurred-image {
    filter: blur(40px) brightness(0.9);
    transform: scale(1.03);
}

.reveal-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 700;
    z-index: 5;
    font-size: 11px;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    color: #333;
    pointer-events: none;
}

/* NEW MAGNIFYING GLASS ICON */
.enlarge-icon {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    pointer-events: none;
    transition: background 0.3s ease;
}

.gallery-item:hover .enlarge-icon {
    background: rgba(0, 0, 0, 0.7);
}

/* 2. Modal Card Styling */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-card {
    background: #fff;
    width: 100%;
    max-width: 580px;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #333;
    font-size: 30px;
    cursor: pointer;
    z-index: 20;
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}

.modal-header h3 {
    margin: 0 0 4px;
    font-size: 22px;
    color: #111;
    font-weight: 700;
}

.modal-header p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* 3. Masking Slider Logic */
.modal-media-area {
    position: relative;
    width: 100%;
    aspect-ratio: 16/12;
    background: #fafafa;
    overflow: hidden;
}

.pro-slider-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.slider-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.before-img {
    z-index: 2;
    clip-path: inset(0px calc(100% - var(--pos)) 0px 0px);
}

.slider-divider {
    position: absolute;
    inset: 0;
    left: var(--pos);
    width: 2px;
    background: #fff;
    z-index: 3;
    transform: translateX(-50%);
    pointer-events: none;
}

.slider-handle {
    position: absolute;
    top: 50%;
    left: var(--pos);
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: #fff;
    border-radius: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.slider-handle svg {
    color: #333;
}

.slider-range-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 10;
    margin: 0;
}

/* Tags moved to BOTTOM */
.corner-tag {
    position: absolute;
    bottom: 20px;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    border-radius: 4px;
    z-index: 5;
}

.tag-left {
    left: 20px;
}

.tag-right {
    right: 20px;
}

.gallery-footer {
    text-align: center;
    margin-top: 50px;
    padding-bottom: 10px;
}

.button.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* 4. Lightbox Navigation Styling */
.modal-navigation-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    background: #fff;
    border-top: 1px solid #f5f5f5;
    width: 100%;
    min-height: 80px;
}

.modal-nav-item {
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    user-select: none;
    border: none;
}

.modal-nav-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.modal-nav-item svg {
    width: 20px;
    height: 20px;
    fill: #000000;
    pointer-events: none;
}

@media screen and (max-width: 768px) {
    .img-meta-title {
        font-size: 20px;
    }

    .img-meta-caption {
        font-size: 15px;
        margin-bottom: 1em;
    }
}

@media screen and (max-width: 767px) {

    /* 1. Grid & Cards Layout */
    .cpt-gallery-grid {
        display: grid;
        padding: 0px;
        grid-template-columns: repeat(1, 1fr);
    }

    .gallery-image-wrapper {
        max-height: 250px;
    }

    .gallery-item .card-meta {
        padding-bottom: 0px;
    }

    .gallery-item .card-meta .img-meta-caption {
        margin-bottom: 0px !important;
    }

    .gallery-footer {
        margin-top: 40px;
        padding-bottom: 30px;
    }

    .modal-header {
        padding: 20px 40px 20px 20px;
    }
}