/* --- REUSABLE LAYOUT STYLES --- */
.gallery-instance-wrapper {
    display: flex;
    flex-direction: row; /* Desktop: Side by Side */
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px; 
    margin: 0 auto 40px auto;
    background: #fff;
    overflow-x: hidden;
    padding: 20px;
    box-sizing: border-box;
    gap: 20px;
}

.gallery-container {
    position: relative;
    flex: 1; 
    width: 60%;
    height: 60vh; 
    min-height: 400px;
    background: #ffffff; 
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    perspective: 1000px;
    border: 1px solid #eee;
    border-radius: 12px;
    
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none; 
}

.white-wall-scene, .white-wall {
    position: relative;
    transform-style: preserve-3d;
}

.ww-item {
    position: absolute;
    width: 300px;  
    height: 220px;
    top: -110px;   
    left: -150px;  
    transform-style: preserve-3d;
    backface-visibility: hidden;
    border: 6px solid #ffffff; 
    background: #ffffff; 
    box-sizing: border-box; 
    transition: border-radius 0.3s ease; 
}

.ww-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    border-radius: 0;
    transition: border-radius 0.3s ease;
}

.ww-item.active {
    border-radius: 40px; 
    z-index: 10;
}
.ww-item.active img {
    border-radius: 30px; 
}

/* --- WIDGET STYLES --- */
.selection-widget {
    width: 35%; /* Desktop width */
    max-width: 500px;
    padding: 20px;
    background: #ffffff;
    text-align: center;
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.selection-widget h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.selected-image-container {
    position: relative;
    width: 100%;         
    height: auto;       
    aspect-ratio: 4 / 3; 
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    background: #f0f0f0;
}

.selected-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    display: block;
}

.expand-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
    z-index: 20;
}
.expand-btn:hover { background: rgba(0, 0, 0, 0.8); }

/* --- MODAL --- */
.fullscreen-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.fullscreen-modal.open { display: flex; }
.fullscreen-image { max-width: 90%; max-height: 90%; object-fit: contain; }
.close-btn { position: absolute; top: 20px; right: 30px; color: white; font-size: 40px; cursor: pointer; background: none; border: none; z-index: 10000; }

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 900px) {
    .gallery-instance-wrapper {
        flex-direction: column; /* Stack vertically on mobile */
        padding: 10px;
    }
    .gallery-container {
        width: 100%;
        height: 60vh; /* Taller vertical viewing window */
    }
    .white-wall-scene {
        transform: scale(0.55); /* Safely zooms out the entire 3D rig on mobile */
    }
    .selection-widget {
        width: 100%;
        max-width: 100%;
        padding: 10px;
        margin-top: 20px;
    }
}