/* 
   TRUE MEDIA Website - Advanced Gallery Features
   Enhanced image grid and lightbox functionality
*/

/* Masonry Grid Layout */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 10px;
    grid-gap: 15px;
}

.masonry-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

.masonry-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.masonry-item:hover .masonry-info {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced Studio Grid */
.studio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.studio-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    cursor: pointer;
    height: 300px;
    opacity: 1;
    transform: scale(1);
}

.studio-item.filtered-out {
    opacity: 0;
    transform: scale(0.8);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.studio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.studio-item:hover img {
    transform: scale(1.05);
}

.studio-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.studio-item:hover .studio-info {
    transform: translateY(-10px);
}

/* Enhanced Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transition: transform 0.3s ease;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    border: 5px solid #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.lightbox-caption {
    position: absolute;
    bottom: -40px;
    left: 0;
    width: 100%;
    text-align: center;
    color: #fff;
    font-size: 16px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 30px;
    color: #fff;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
}

.lightbox-prev, .lightbox-next {
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    opacity: 0.7;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.lightbox-prev:hover, .lightbox-next:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
}

/* Image Comparison Slider */
.image-comparison {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    margin: 40px 0;
    border-radius: 8px;
}

.image-comparison img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-comparison .before-image {
    z-index: 1;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.image-comparison .after-image {
    z-index: 0;
}

.comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background-color: #fff;
    z-index: 2;
    transform: translateX(-50%);
    cursor: ew-resize;
}

.comparison-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.comparison-slider::after {
    content: '↔';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: 20px;
    font-weight: bold;
}

/* 360-degree Viewer */
.viewer-360 {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    margin: 40px 0;
    border-radius: 8px;
    background-color: #f5f5f5;
}

.viewer-360 img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.viewer-360 img.active {
    opacity: 1;
}

.viewer-360-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 30px;
}

.viewer-360-controls button {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    margin: 0 10px;
}

.viewer-360-controls .rotate-left::before {
    content: '↺';
}

.viewer-360-controls .rotate-right::before {
    content: '↻';
}

.viewer-360-controls .view-360::before {
    content: '360°';
}

.viewer-360-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .studio-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .studio-item {
        height: 250px;
    }
    
    .image-comparison,
    .viewer-360 {
        height: 300px;
    }
}

@media (max-width: 576px) {
    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .studio-item {
        height: 200px;
    }
    
    .image-comparison,
    .viewer-360 {
        height: 250px;
    }
}
