/* ========================================
   3D GALLERY - THREE.JS MUSEUM STYLES
   Immersive art gallery experience
   ======================================== */

/* Gallery Container */
.gallery3d-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    background: var(--bg-white);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.gallery3d-container.active {
    opacity: 1;
    visibility: visible;
}

.gallery3d-container.closing {
    opacity: 0;
}

/* Canvas Wrapper */
.gallery3d-canvas-wrapper {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.gallery3d-canvas-wrapper.pointer-locked {
    cursor: none;
}

.gallery3d-canvas-wrapper canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Exit Button */
.gallery-exit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-exit-btn:hover {
    background: var(--text-dark);
    color: var(--bg-white);
}

.gallery-exit-btn .material-symbols-sharp {
    font-size: 1.2rem;
}

/* Controls Help */
.gallery-controls-help {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px 20px;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    opacity: 0.9;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
}

.control-item kbd {
    display: inline-block;
    padding: 3px 8px;
    background: var(--text-dark);
    color: var(--bg-white);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    min-width: 24px;
    text-align: center;
}

/* Crosshair */
.gallery-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    font-size: 24px;
    font-weight: 200;
    color: var(--text-dark);
    opacity: 0.5;
    pointer-events: none;
    text-shadow: 
        1px 1px 0 var(--bg-white),
        -1px -1px 0 var(--bg-white),
        1px -1px 0 var(--bg-white),
        -1px 1px 0 var(--bg-white);
}

/* Minimap */
.gallery-minimap {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10001;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    padding: 10px;
    opacity: 0.9;
}

.minimap-canvas {
    display: block;
}

/* Info Panel */
.gallery-info-panel {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    min-width: 300px;
    max-width: 500px;
    padding: 25px 30px;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    text-align: center;
}

.gallery-info-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--text-dark);
}

.gallery-info-category {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    opacity: 0.7;
}

.gallery-info-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    line-height: 1;
}

.gallery-info-close:hover {
    opacity: 1;
}

/* 3D Gallery Trigger Button */
.gallery3d-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.gallery3d-trigger .material-symbols-sharp {
    font-size: 1.2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

/* Loading Screen */
.gallery3d-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10003;
    text-align: center;
    color: var(--text-dark);
}

.gallery3d-loading h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--text-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Welcome Overlay */
.gallery-welcome {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10004;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    text-align: center;
    padding: 40px;
}

.gallery-welcome h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.gallery-welcome p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 500px;
    margin-bottom: 30px;
    line-height: 1.8;
}

.gallery-welcome .btn {
    font-size: 1.1rem;
    padding: 15px 40px;
}

/* Vignette Effect */
.gallery3d-canvas-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.15) 100%
    );
}

[data-theme="dark"] .gallery3d-canvas-wrapper::after {
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.3) 100%
    );
}

/* Instruction Toast */
.gallery-toast {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    padding: 15px 25px;
    background: var(--text-dark);
    color: var(--bg-white);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-toast.visible {
    opacity: 1;
}

/* Artwork Highlight Glow */
.artwork-highlight {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

/* Focus Mode (when zoomed) */
.gallery3d-container.zoomed .gallery-controls-help,
.gallery3d-container.zoomed .gallery-minimap,
.gallery3d-container.zoomed .gallery-crosshair {
    opacity: 0;
    pointer-events: none;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .gallery-controls-help {
        bottom: 10px;
        left: 10px;
        padding: 10px 15px;
        font-size: 0.65rem;
    }
    
    .control-item kbd {
        padding: 2px 6px;
        font-size: 0.6rem;
    }
    
    .gallery-minimap {
        width: 100px;
        bottom: 10px;
        right: 10px;
    }
    
    .minimap-canvas {
        width: 80px !important;
        height: 100px !important;
    }
    
    .gallery-exit-btn {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .gallery-exit-btn span:not(.material-symbols-sharp) {
        display: none;
    }
    
    .gallery-info-panel {
        bottom: 60px;
        min-width: 250px;
        padding: 20px;
    }
    
    .gallery-info-title {
        font-size: 1.2rem;
    }
    
    .gallery3d-trigger span:not(.material-symbols-sharp) {
        display: none;
    }
}

/* Touch Device Notice */
@media (hover: none) and (pointer: coarse) {
    .gallery-controls-help {
        display: none;
    }
    
    .gallery3d-container::before {
        content: 'Use two fingers to look around, drag to move';
        position: absolute;
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 10001;
        padding: 10px 20px;
        background: var(--text-dark);
        color: var(--bg-white);
        font-size: 0.8rem;
        white-space: nowrap;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .gallery3d-container {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Dark Theme Adjustments */
[data-theme="dark"] .gallery-crosshair {
    text-shadow: 
        1px 1px 0 var(--text-dark),
        -1px -1px 0 var(--text-dark),
        1px -1px 0 var(--text-dark),
        -1px 1px 0 var(--text-dark);
}

/* Scanline Effect (Optional - uncomment for retro feel) */
/*
.gallery3d-canvas-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    z-index: 10000;
}
*/
