/* Explain: Styles for the 3D virtual gallery section, including room, walls, floor, and modal. */
.vg-section {
    background: linear-gradient(180deg, #17110e 0%, #241b15 100%);
    color: #f4e9d8;
}

.vg-section .lead {
    color: #d9c9b4;
}

.vg-stage {
    position: relative;
    height: 440px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(201, 154, 58, 0.28);
    background:
        radial-gradient(120% 90% at 50% 0%, #3a2c22 0%, #17110e 52%, #070503 100%);
    perspective: 1150px;
    perspective-origin: 50% 47%;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
}

@media (min-width: 768px) {
    .vg-stage {
        height: 560px;
    }
}

.vg-stage.is-dragging {
    cursor: grabbing;
}

.vg-room {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: scale(var(--vg-scale, 1)) rotateY(var(--vg-rot, 0deg));
    transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

.vg-stage.is-dragging .vg-room {
    transition: none;
}

.vg-surface {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

/* Back wall (holds the marquee of artworks) */
.vg-surface--back {
    width: 1500px;
    height: 620px;
    margin: -310px 0 0 -750px;
    padding: 40px 0;
    overflow: hidden;
    transform: translateZ(-850px);
    background: linear-gradient(180deg, #33271f 0%, #241b15 58%, #130e0b 100%);
    border: 1px solid rgba(201, 154, 58, 0.2);
    box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.78);
}

/* Side walls receding toward the back — gives the room its depth */
.vg-surface--left {
    width: 850px;
    height: 620px;
    margin: -310px 0 0 -425px;
    transform: translate3d(-750px, 0, -425px) rotateY(90deg);
    background: linear-gradient(90deg, #2d2219 0%, #201811 55%, #0a0705 100%);
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.85);
}

.vg-surface--right {
    width: 850px;
    height: 620px;
    margin: -310px 0 0 -425px;
    transform: translate3d(750px, 0, -425px) rotateY(-90deg);
    background: linear-gradient(90deg, #0a0705 0%, #201811 45%, #2d2219 100%);
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.85);
}

.vg-surface--floor {
    width: 1500px;
    height: 850px;
    margin: -425px 0 0 -750px;
    transform: translate3d(0, 310px, -425px) rotateX(90deg);
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 130px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 130px),
        linear-gradient(180deg, #0a0705 0%, #1b1410 55%, #2a2019 100%);
}

.vg-surface--ceiling {
    width: 1500px;
    height: 850px;
    margin: -425px 0 0 -750px;
    transform: translate3d(0, -310px, -425px) rotateX(-90deg);
    background:
        radial-gradient(60% 90% at 50% 0%, rgba(201, 154, 58, 0.16), transparent 70%),
        linear-gradient(0deg, #0a0705 0%, #1d160f 70%, #2b2018 100%);
}

.vg-track {
    display: flex;
    align-items: center;
    gap: 30px;
    height: 100%;
    width: max-content;
    animation: vg-marquee 70s linear infinite;
    will-change: transform;
}

.vg-stage:hover .vg-track,
.vg-track:focus-within {
    animation-play-state: paused;
}

@keyframes vg-marquee {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-3960px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .vg-track {
        animation: none;
    }
}

.vg-frame {
    position: relative;
    flex: 0 0 auto;
    width: 300px;
    height: 100%;
    padding: 8px;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid rgba(201, 154, 58, 0.5);
    background: #0c0907;
    box-shadow:
        0 36px 50px -28px rgba(0, 0, 0, 0.95),
        0 0 0 7px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(201, 154, 58, 0.14);
    transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.vg-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vg-frame__label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2rem 0.6rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f7ecd9;
    text-align: center;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.88));
}

.vg-frame:hover,
.vg-frame:focus-visible {
    transform: scale(1.05);
    border-color: var(--accent-color);
    box-shadow:
        0 40px 60px -24px rgba(0, 0, 0, 0.95),
        0 0 30px rgba(201, 154, 58, 0.4);
}

.vg-controls {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    display: flex;
    gap: 0.6rem;
    z-index: 3;
}

.vg-ctrl {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(201, 154, 58, 0.45);
    background: rgba(15, 11, 8, 0.75);
    color: var(--accent-color);
    backdrop-filter: blur(6px);
    transition: all 0.25s ease;
}

.vg-ctrl:hover {
    background: var(--accent-color);
    color: #241a06;
}

.vg-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1.4rem;
    margin-top: 0.9rem;
    font-size: 0.82rem;
    color: #b8a68f;
}

.vg-hint span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.vg-hint i {
    color: var(--accent-color);
}

.vg-strip {
    display: flex;
    gap: 0.7rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
}

.vg-thumb {
    flex: 0 0 auto;
    width: 92px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem;
    border-radius: 10px;
    border: 1px solid rgba(201, 154, 58, 0.22);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.25s ease;
}

.vg-thumb img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 6px;
}

.vg-thumb span {
    font-size: 0.72rem;
    color: #d9c9b4;
    text-align: center;
}

.vg-thumb:hover {
    border-color: var(--accent-color);
    background: rgba(201, 154, 58, 0.12);
}

.vg-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 70;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.vg-modal.is-open {
    display: flex;
}

.vg-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 6, 0.85);
    backdrop-filter: blur(4px);
}

.vg-modal__panel {
    position: relative;
    z-index: 2;
    width: min(1120px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(201, 154, 58, 0.4);
    background: #120d0a;
    color: #f4e9d8;
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.92);
}

.vg-modal.is-open .vg-modal__panel {
    animation: vg-pop 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes vg-pop {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (min-width: 768px) {
    .vg-modal__panel {
        display: grid;
        grid-template-columns: 1.2fr 0.8fr;
    }
}

.vg-modal__media {
    position: relative;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    min-height: 300px;
    background: radial-gradient(120% 90% at 50% 0%, #251b13 0%, #0a0705 72%);
}

.vg-modal__media img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.9);
}

.vg-modal__media.is-loading::after {
    content: '';
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 3px solid rgba(201, 154, 58, 0.25);
    border-top-color: var(--accent-color);
    animation: vg-spin 0.8s linear infinite;
}

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

.vg-modal__body {
    padding: 1.6rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.vg-modal__body h3 {
    font-size: 1.5rem;
    margin-top: 0.3rem;
}

.vg-modal__body p {
    margin-top: 0.7rem;
    color: #d3c3ae;
    font-size: 0.95rem;
    line-height: 1.9;
}

.vg-modal__meta {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-color);
}

.vg-modal__close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(201, 154, 58, 0.4);
    background: rgba(12, 9, 7, 0.8);
    color: #f4e9d8;
    transition: all 0.2s ease;
}

.vg-modal__close:hover {
    background: var(--accent-color);
    color: #241a06;
}