/* Scoped Styles for Masonry & Lightbox */

/* Masonry Grid - CSS Grid Implementation */
.jcportfolio-casestudy-wrapper {
    position: relative;
    width: 100%;
}

.jcportfolio-masonry-grid {
    display: grid;
    /* Use variables set by Elementor, fallback to defaults if raw usage */
    grid-template-columns: repeat(var(--jc-masonry-cols, 3), 1fr);
    grid-auto-rows: 10px;
    /* Precise granularity */
    gap: var(--jc-masonry-gap, 20px);
    width: 100%;
}

.jcportfolio-masonry-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    /* Spans will be set by JS, default to auto */
    margin: 0;
    padding: 0;
}

.jcportfolio-masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.jcportfolio-masonry-item:hover img {
    transform: scale(1.05);
}

.jcportfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.jcportfolio-masonry-item:hover .jcportfolio-overlay {
    opacity: 1;
}

.jcportfolio-overlay span {
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

/* Lightbox */
.jcportfolio-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.jcportfolio-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.jcportfolio-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.jcportfolio-lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 90vh;
}

.jcportfolio-lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.jcportfolio-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

.jcportfolio-lightbox-prev,
.jcportfolio-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    font-size: 30px;
    padding: 10px;
    cursor: pointer;
}

.jcportfolio-lightbox-prev:hover,
.jcportfolio-lightbox-next:hover {
    background: rgba(0, 0, 0, 0.6);
}

.jcportfolio-lightbox-prev {
    left: -60px;
}

.jcportfolio-lightbox-next {
    right: -60px;
}

/* Responsive Overrides handled by CSS Variables, but adding safety fallbacks */
@media(max-width: 768px) {
    .jcportfolio-lightbox-prev {
        left: 10px;
    }

    .jcportfolio-lightbox-next {
        right: 10px;
    }
}