/* relativity.studio - Surreal meets Avant-Garde */

:root {
    --exhibition-dark: #1a1a22;
    --linen-wall: #f8f6f2;
    --paradox-red: #d86050;
    --spatial-teal: #3a7878;
    --frame-gold: #c8a848;
    --perspective-mauve: #8868a0;
    --concrete: #d0ccc4;
    --catalog-ink: #3a3028;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lora', serif;
    font-weight: 400;
    color: var(--catalog-ink);
    background-color: var(--linen-wall);
    overflow-x: hidden;
    overflow-y: hidden;
    line-height: 1.75;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
}

h2 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
}

/* Horizontal Gallery */
.horizontal-gallery {
    display: flex;
    width: 600vw;
    height: 100vh;
    scroll-snap-type: x mandatory;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.horizontal-gallery::-webkit-scrollbar {
    display: none;
}

.room {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

/* Room 1: Foyer */
.foyer-split {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
}

.foyer-left {
    width: 61.8%;
    height: 100%;
    background-color: var(--exhibition-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

.foyer-right {
    width: 38.2%;
    height: 100%;
    background-color: var(--linen-wall);
    display: flex;
    align-items: center;
    justify-content: center;
}

.foyer-divider {
    position: absolute;
    left: 61.8%;
    top: 0;
    width: 20px;
    height: 100%;
    transform: translateX(-50%);
    z-index: 5;
}

.foyer-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    opacity: 0;
    animation: foyerFadeIn 0.5s ease 0.4s forwards;
}

.foyer-text-left { color: var(--linen-wall); }
.foyer-text-right { color: var(--exhibition-dark); }

@keyframes foyerFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scroll-hint {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--concrete);
    opacity: 0;
    animation: hintBounce 1.5s ease-in-out 0.9s infinite;
}

@keyframes hintBounce {
    0%, 100% { opacity: 0.5; transform: translateY(-50%) translateX(0); }
    50% { opacity: 1; transform: translateY(-50%) translateX(8px); }
}

/* Rooms 2-4: Impossible Gallery */
.room-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6vw;
    height: 100%;
    padding: 5vh 8vw;
}

.impossible-object {
    flex-shrink: 0;
    position: relative;
}

.room-text {
    max-width: 35ch;
}

.pull-quote {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: var(--exhibition-dark);
    margin-bottom: 1.5rem;
    line-height: 1.3;
    border: none;
    quotes: none;
}

.tech-note {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    color: var(--concrete);
    margin-top: 1.5rem;
}

/* Penrose Triangle */
.penrose-triangle {
    width: 200px;
    height: 200px;
    transition: transform 0.4s ease;
}

.penrose-triangle:hover {
    transform: rotate(5deg);
}

.penrose-arm {
    position: absolute;
    width: 180px;
    height: 40px;
}

.arm-1 {
    background-color: var(--paradox-red);
    top: 20px;
    left: 10px;
    transform: rotate(0deg) skewX(-30deg);
}

.arm-2 {
    background-color: var(--spatial-teal);
    bottom: 20px;
    left: -10px;
    transform: rotate(120deg) skewX(-30deg);
    transform-origin: center;
}

.arm-3 {
    background-color: var(--frame-gold);
    bottom: 20px;
    right: -10px;
    transform: rotate(240deg) skewX(-30deg);
    transform-origin: center;
}

/* Necker Cube */
.necker-cube {
    width: 160px;
    height: 160px;
    position: relative;
    transform-style: preserve-3d;
    animation: neckerFlip 8s ease-in-out infinite;
}

@keyframes neckerFlip {
    0%, 45% { transform: perspective(800px) rotateX(-10deg) rotateY(-15deg); }
    50%, 95% { transform: perspective(800px) rotateX(10deg) rotateY(15deg); }
    100% { transform: perspective(800px) rotateX(-10deg) rotateY(-15deg); }
}

.necker-edge {
    position: absolute;
    background-color: var(--exhibition-dark);
}

/* Front face edges */
.ne-1 { width: 100px; height: 2px; top: 30px; left: 10px; }
.ne-2 { width: 2px; height: 100px; top: 30px; left: 10px; }
.ne-3 { width: 100px; height: 2px; top: 130px; left: 10px; }
.ne-4 { width: 2px; height: 100px; top: 30px; left: 110px; }

/* Back face edges */
.ne-5 { width: 100px; height: 2px; top: 10px; left: 50px; opacity: 0.4; }
.ne-6 { width: 2px; height: 100px; top: 10px; left: 50px; opacity: 0.4; }
.ne-7 { width: 100px; height: 2px; top: 110px; left: 50px; opacity: 0.4; }
.ne-8 { width: 2px; height: 100px; top: 10px; left: 150px; opacity: 0.4; }

/* Connecting edges */
.ne-9 { width: 50px; height: 2px; top: 30px; left: 10px; transform: rotate(-25deg); transform-origin: left; }
.ne-10 { width: 50px; height: 2px; top: 30px; left: 110px; transform: rotate(-25deg); transform-origin: left; }
.ne-11 { width: 50px; height: 2px; top: 130px; left: 10px; transform: rotate(-25deg); transform-origin: left; }
.ne-12 { width: 50px; height: 2px; top: 130px; left: 110px; transform: rotate(-25deg); transform-origin: left; }

/* Impossible Stairs */
.impossible-stairs {
    width: 200px;
    height: 200px;
    position: relative;
}

.stair-set {
    position: absolute;
    display: flex;
}

.stair {
    width: 24px;
    height: 18px;
    border: 1px solid var(--catalog-ink);
}

.stair-set-1 {
    bottom: 0;
    left: 0;
    flex-direction: column-reverse;
}

.stair-set-1 .stair {
    background: var(--concrete);
    margin-left: auto;
}

.stair-set-1 .stair:nth-child(1) { width: 48px; }
.stair-set-1 .stair:nth-child(2) { width: 48px; margin-right: 12px; }
.stair-set-1 .stair:nth-child(3) { width: 48px; margin-right: 24px; }
.stair-set-1 .stair:nth-child(4) { width: 48px; margin-right: 36px; }

.stair-set-2 {
    top: 0;
    left: 0;
    flex-direction: row;
}

.stair-set-2 .stair { background: #c0bcb4; }

.stair-set-3 {
    top: 0;
    right: 0;
    flex-direction: column;
}

.stair-set-3 .stair { background: #b8b4ac; }

.stair-set-4 {
    bottom: 0;
    right: 0;
    flex-direction: row-reverse;
}

.stair-set-4 .stair { background: #d8d4cc; }

/* Room 5: Perspective Room */
#room-perspective {
    background-color: var(--linen-wall);
    display: flex;
    align-items: center;
    justify-content: center;
}

.perspective-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-conic-gradient(
        from 0deg at var(--vp-x, 50%) var(--vp-y, 50%),
        transparent 0deg 9deg,
        var(--concrete) 9deg 9.5deg,
        transparent 9.5deg 18deg
    );
    opacity: 0.3;
}

.manifesto {
    position: relative;
    z-index: 2;
    max-width: 50ch;
    text-align: center;
    padding: 3rem;
    background: rgba(248, 246, 242, 0.85);
}

.manifesto h2 {
    margin-bottom: 1.5rem;
    color: var(--exhibition-dark);
}

.manifesto p {
    margin-bottom: 1rem;
}

/* Room 6: Exit */
.exit-left {
    width: 38.2%;
    background-color: var(--linen-wall);
}

.exit-right {
    width: 61.8%;
    background-color: var(--exhibition-dark);
}

.exit-split .foyer-divider {
    left: 38.2%;
}

.exit-text-left { color: var(--exhibition-dark); }
.exit-text-right { color: var(--linen-wall); }

/* Background colors for gallery rooms */
#room-penrose { background-color: var(--linen-wall); }
#room-necker { background-color: var(--linen-wall); }
#room-stairs { background-color: var(--linen-wall); }

/* Responsive */
@media (max-width: 768px) {
    .room-content {
        flex-direction: column;
        gap: 3vh;
        padding: 5vh 5vw;
    }

    .room-text {
        max-width: none;
    }

    .penrose-triangle,
    .necker-cube,
    .impossible-stairs {
        width: 140px;
        height: 140px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .foyer-text,
    .scroll-hint {
        opacity: 1 !important;
    }

    .necker-cube {
        animation: none;
        transform: perspective(800px) rotateX(-10deg) rotateY(-15deg);
    }

    .horizontal-gallery {
        scroll-snap-type: none;
    }
}
