/* 2.5D Room Effect - GPU Accelerated CSS 3D Transforms */

:root {
    --room-width: 800px;
    --room-height: 600px;
    --screen-depth: 300px;
    --perspective: 1000px;
    --color-primary: #a78bfa;
    --color-primary-dark: #8b5cf6;
    --color-bg-dark: #0f172a;
    --color-border: #374151;
    --color-text-light: #f3f4f6;
}

#room-2_5d-container {
    width: 100%;
    max-width: var(--room-width);
    height: var(--room-height);
    margin: 0 auto;
    perspective: var(--perspective);
    transform-style: preserve-3d;
    overflow: hidden;
    cursor: grab;
}

#room-2_5d-container.grabbing {
    cursor: grabbing;
}

.room-2_5d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    /* No transforms applied by default */
}

/* Screen Panels - Layered 3D Effect */
.screen-2_5d {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    text-align: center;
    color: var(--color-text-light);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transform-style: preserve-3d;
    user-select: none;
    will-change: transform;
}

/* Background Screen - Furthest */
.screen-2_5d.bg {
    z-index: 1;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.screen-2_5d.bg::before {
    content: '🌌';
    font-size: 4rem;
    opacity: 0.3;
}

/* Primary Video Screen - Middle */
.screen-2_5d.primary {
    z-index: 2;
    background: rgba(31, 41, 55, 0.95);
    box-shadow: 0 8px 32px rgba(167, 139, 250, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.screen-2_5d.primary video {
    width: 90%;
    height: 90%;
    object-fit: contain;
    border-radius: 4px;
}

/* Commentary/Info Screen - Front */
.screen-2_5d.front {
    z-index: 3;
    background: rgba(31, 41, 55, 0.85);
    box-shadow: 0 12px 40px rgba(167, 139, 250, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.screen-2_5d.front::before {
    content: '💬';
    display: block;
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Accent Screen - Creates depth */
.screen-2_5d.accent {
    z-index: 4;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
    box-shadow: 0 16px 48px rgba(167, 139, 250, 0.25);
    border-color: var(--color-primary);
}

.screen-2_5d.accent::before {
    content: '✨';
    font-size: 3rem;
    opacity: 0.4;
}

/* Lighting & Glow Effects */
.screen-2_5d {
    box-shadow: 
        0 0 20px rgba(167, 139, 250, 0.1),
        inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.screen-2_5d.primary {
    box-shadow: 
        0 0 30px rgba(167, 139, 250, 0.2),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.screen-2_5d.front {
    box-shadow: 
        0 0 40px rgba(167, 139, 250, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.4);
}

.screen-2_5d.accent {
    box-shadow: 
        0 0 50px rgba(167, 139, 250, 0.4),
        inset 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Subtle Animation for Depth Perception */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(2px);
    }
}

.screen-2_5d {
    animation: float 3s ease-in-out infinite;
}

.screen-2_5d:nth-child(1) {
    animation-delay: 0s;
}

.screen-2_5d:nth-child(2) {
    animation-delay: 0.2s;
}

.screen-2_5d:nth-child(3) {
    animation-delay: 0.4s;
}

.screen-2_5d:nth-child(4) {
    animation-delay: 0.6s;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    :root {
        --room-width: 600px;
        --room-height: 450px;
        --screen-depth: 200px;
    }

    .screen-2_5d {
        border-radius: 6px;
    }
}

@media (max-width: 768px) {
    :root {
        --room-width: 100%;
        --room-height: 400px;
        --screen-depth: 150px;
        --perspective: 800px;
    }

    #room-2_5d-container {
        max-width: 100%;
    }

    .screen-2_5d {
        border-radius: 4px;
        border-width: 1px;
    }

    .screen-2_5d.front {
        font-size: 0.95rem;
        padding: 1rem;
    }

    .screen-2_5d.front::before {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .screen-2_5d.accent::before {
        font-size: 2rem;
    }

    .screen-2_5d.bg::before {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    :root {
        --room-height: 300px;
        --screen-depth: 100px;
    }

    .screen-2_5d.primary video {
        width: 95%;
        height: 95%;
    }

    .screen-2_5d.front {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
}

/* Pointer Event Handling */
.screen-2_5d {
    pointer-events: none;
}

#room-2_5d-container {
    pointer-events: auto;
}

/* Smooth Transitions */
.room-2_5d {
    transition: transform 0.1s ease-out;
}

/* Remove will-change on idle */
.room-2_5d.idle .screen-2_5d {
    will-change: auto;
}

/* Active state - enhance glow */
#room-2_5d-container:hover .screen-2_5d {
    filter: brightness(1.05);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .screen-2_5d {
        animation: none !important;
    }

    .room-2_5d {
        transition: none !important;
    }
}

/* Performance Optimization */
.screen-2_5d {
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.room-2_5d {
    transform: translate3d(0, 0, 0);
}
