/* ===================================================
   chloe.cx v2 - Surreal Dreamlike Digital Landscape
   =================================================== */

/* --- CSS Custom Properties --- */
:root {
    --impossible-dusk: #2b1f3d;
    --horizon-amber: #d4956b;
    --liminal-tile: #c8b8a4;
    --plaster-fog: #e8e0d4;
    --ghost-wire: #3a2d5e;
    --midnight-paper: #1a1428;
    --patina-bronze: #7a6b52;
    --signal-cream: #f5f0e8;
    --warm-stone: #a89880;

    --font-headline: 'Playfair Display', Georgia, serif;
    --font-body: 'Work Sans', 'Segoe UI', sans-serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--midnight-paper);
    color: var(--signal-cream);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(15px, 1.4vw, 19px);
    line-height: 1.7;
    letter-spacing: 0;
    overflow-x: hidden;
}

/* --- Room Navigation --- */
#room-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.nav-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background: var(--warm-stone);
    opacity: 0.6;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid var(--liminal-tile);
    background: transparent;
    margin: 18px 0;
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: background 0.4s ease, transform 0.3s ease;
}

.nav-dot.active {
    background: var(--liminal-tile);
}

.nav-dot:hover {
    transform: scale(1.5);
}

/* --- Room Base --- */
.room {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* ============================================
   ROOM 0 - THE THRESHOLD
   ============================================ */
#room-0 {
    height: 100vh;
    background: linear-gradient(
        to bottom,
        var(--impossible-dusk) 0%,
        var(--impossible-dusk) 55%,
        #3d2a4e 75%,
        var(--horizon-amber) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 800px;
}

.room-0-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 65%;
    background: radial-gradient(
        ellipse at 50% 100%,
        rgba(212, 149, 107, 0.25) 0%,
        rgba(212, 149, 107, 0.08) 30%,
        var(--impossible-dusk) 70%
    );
    pointer-events: none;
}

.room-0-ground {
    position: absolute;
    bottom: 0;
    left: -50%;
    width: 200%;
    height: 55%;
    transform-style: preserve-3d;
    transform: perspective(600px) rotateX(55deg);
    transform-origin: center top;
    opacity: 0;
    animation: groundFadeIn 1500ms 600ms ease-out forwards;
}

.ground-grid {
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(200, 184, 164, 0.15) 0px,
            rgba(200, 184, 164, 0.15) 1px,
            transparent 1px,
            transparent 80px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(200, 184, 164, 0.15) 0px,
            rgba(200, 184, 164, 0.15) 1px,
            transparent 1px,
            transparent 80px
        );
    animation: groundDrift 20s ease-in-out infinite;
}

@keyframes groundFadeIn {
    from {
        opacity: 0;
        transform: perspective(600px) rotateX(55deg) translateY(40px);
    }
    to {
        opacity: 1;
        transform: perspective(600px) rotateX(55deg) translateY(0);
    }
}

@keyframes groundDrift {
    0%, 100% {
        background-position: 0 0;
    }
    50% {
        background-position: 8px 12px;
    }
}

.room-0-title {
    position: relative;
    z-index: 10;
    text-align: center;
    opacity: 0;
    animation: titleFadeIn 2000ms 1200ms ease-out forwards;
    transform-style: preserve-3d;
}

.domain-name {
    font-family: var(--font-headline);
    font-weight: 400;
    font-size: clamp(48px, 8vw, 120px);
    letter-spacing: 0.04em;
    line-height: 1.15;
    color: var(--signal-cream);
    text-shadow:
        0 0 60px rgba(212, 149, 107, 0.25),
        0 0 120px rgba(212, 149, 107, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.3);
    transform: perspective(800px) rotateX(12deg);
}

@keyframes titleFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   ROOM 1 - THE ENGINE ROOM
   ============================================ */
#room-1 {
    min-height: 150vh;
    background: #10081e;
    perspective: 1200px;
    position: relative;
}

.void-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.wireframe-shape {
    position: absolute;
    opacity: 0;
    transition: opacity 2000ms ease-out;
}

.shape-icosahedron {
    top: 12%;
    left: 8%;
    animation: rotateShape1 40s linear infinite;
}

.shape-octahedron {
    top: 45%;
    right: 12%;
    animation: rotateShape2 35s linear infinite;
}

.shape-dodecahedron {
    bottom: 15%;
    left: 45%;
    animation: rotateShape3 50s linear infinite;
}

.shape-small-ico {
    top: 30%;
    right: 28%;
    animation: rotateShape1 25s linear infinite reverse;
}

.shape-tetra {
    top: 65%;
    left: 18%;
    animation: rotateShape2 30s linear infinite reverse;
}

@keyframes rotateShape1 {
    from { transform: rotate3d(0.3, 0.7, 0.1, 0deg); }
    to { transform: rotate3d(0.3, 0.7, 0.1, 360deg); }
}

@keyframes rotateShape2 {
    from { transform: rotate3d(0.7, 0.3, 0.5, 0deg); }
    to { transform: rotate3d(0.7, 0.3, 0.5, 360deg); }
}

@keyframes rotateShape3 {
    from { transform: rotate3d(0.1, 0.5, 0.8, 0deg); }
    to { transform: rotate3d(0.1, 0.5, 0.8, 360deg); }
}

.engine-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18vh 5vw;
    gap: 22vh;
    perspective: 1000px;
}

.text-panel {
    max-width: 480px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1200ms ease-out, transform 1200ms ease-out;
}

.text-panel.visible {
    opacity: 1;
    transform: translateY(0) translateZ(0);
}

.text-panel h2 {
    font-family: var(--font-headline);
    font-weight: 400;
    font-size: clamp(32px, 6vw, 80px);
    letter-spacing: 0.04em;
    line-height: 1.15;
    color: var(--signal-cream);
    margin-bottom: 1.2em;
    text-shadow: 0 0 30px rgba(212, 149, 107, 0.15);
}

.text-panel p {
    color: rgba(245, 240, 232, 0.85);
    line-height: 1.7;
}

.panel-1 {
    align-self: flex-start;
    margin-left: 8%;
}

.panel-2 {
    align-self: flex-end;
    margin-right: 8%;
}

.panel-3 {
    align-self: center;
}

/* ============================================
   ROOM 2 - THE GALLERY
   ============================================ */
#room-2 {
    min-height: 280vh;
    background: var(--plaster-fog);
    padding: 18vh 0 15vh;
}

.gallery-wall {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 5vw;
}

.gallery-frame {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
    margin-bottom: 16vh;
}

.gallery-frame:last-child {
    margin-bottom: 0;
}

.gallery-frame.visible {
    opacity: 1;
    transform: translateY(0);
}

.frame-border {
    border: 3px solid var(--patina-bronze);
    box-shadow: inset 0 0 0 4px var(--plaster-fog), inset 0 0 0 6px var(--patina-bronze);
    padding: 28px;
    background: rgba(245, 240, 232, 0.5);
    max-width: 560px;
    position: relative;
    clip-path: inset(0 100% 100% 0);
    transition: clip-path 800ms ease-out;
}

.gallery-frame.visible .frame-border {
    clip-path: inset(0 0 0 0);
}

.frame-content {
    opacity: 0;
    transition: opacity 600ms 400ms ease-out;
}

.gallery-frame.visible .frame-content {
    opacity: 1;
}

.frame-content h3 {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(24px, 3vw, 40px);
    letter-spacing: 0.04em;
    line-height: 1.15;
    color: var(--impossible-dusk);
    margin-bottom: 0.8em;
}

.frame-content p {
    color: var(--midnight-paper);
    line-height: 1.7;
    font-size: clamp(15px, 1.4vw, 19px);
}

.frame-caption {
    display: block;
    margin-top: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.03em;
    color: var(--patina-bronze);
    font-style: italic;
    opacity: 0;
    transition: opacity 600ms 800ms ease-out;
}

.gallery-frame.visible .frame-caption {
    opacity: 1;
}

/* Staggered frame positions */
.frame-1 { margin-left: 8%; }
.frame-2 { margin-left: 48%; }
.frame-3 { margin-left: 22%; }
.frame-4 { margin-left: 52%; }
.frame-5 { margin-left: 10%; }

/* ============================================
   ROOM 3 - THE ARCHIVE
   ============================================ */
#room-3 {
    min-height: 120vh;
    background: var(--midnight-paper);
    padding: 15vh 5vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-space {
    display: flex;
    flex-wrap: wrap;
    gap: 36px;
    justify-content: center;
    max-width: 1100px;
    padding: 4vh 0;
}

.index-card {
    width: 240px;
    height: 160px;
    background: var(--signal-cream);
    border: 1px solid var(--liminal-tile);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.06);
    padding: 22px;
    transform: rotate(var(--rotation, 0deg)) translate(var(--offset-x, 0), var(--offset-y, 0));
    transition: all 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
}

.index-card.visible {
    opacity: 1;
}

.index-card:hover {
    transform: rotate(0deg) translateY(-8px) translate(0, 0);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.1);
}

.index-card h4 {
    font-family: var(--font-headline);
    font-weight: 400;
    font-size: 20px;
    letter-spacing: 0.04em;
    line-height: 1.15;
    color: var(--impossible-dusk);
    margin-bottom: 8px;
}

.index-card p {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--patina-bronze);
    line-height: 1.5;
}

/* ============================================
   ROOM 4 - THE EXIT
   ============================================ */
#room-4 {
    height: 100vh;
    background: linear-gradient(
        to bottom,
        var(--impossible-dusk) 0%,
        var(--impossible-dusk) 55%,
        #3d2a4e 75%,
        var(--horizon-amber) 100%
    );
    display: flex;
    align-items: flex-end;
    justify-content: center;
    perspective: 800px;
    padding-bottom: 12vh;
}

.room-4-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: radial-gradient(
        ellipse at 50% 100%,
        rgba(212, 149, 107, 0.15) 0%,
        var(--impossible-dusk) 60%
    );
    pointer-events: none;
}

.room-4-ground {
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 55%;
    transform-style: preserve-3d;
    transform: perspective(400px) rotateX(72deg);
    transform-origin: center bottom;
    opacity: 0.5;
}

.exit-grid {
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(200, 184, 164, 0.1) 0px,
            rgba(200, 184, 164, 0.1) 1px,
            transparent 1px,
            transparent 40px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(200, 184, 164, 0.1) 0px,
            rgba(200, 184, 164, 0.1) 1px,
            transparent 1px,
            transparent 40px
        );
    animation: groundDrift 20s ease-in-out infinite;
}

.room-4-title {
    position: relative;
    z-index: 10;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1500ms ease-out, transform 1500ms ease-out;
}

.room-4-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.domain-name-small {
    font-family: var(--font-headline);
    font-weight: 400;
    font-size: clamp(24px, 4vw, 48px);
    letter-spacing: 0.04em;
    line-height: 1.15;
    color: var(--signal-cream);
    text-shadow: 0 0 40px rgba(212, 149, 107, 0.15);
}

.exit-tagline {
    font-family: var(--font-headline);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(16px, 2vw, 24px);
    letter-spacing: 0.04em;
    color: rgba(245, 240, 232, 0.6);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    #room-nav {
        right: 12px;
    }

    .nav-dot {
        margin: 14px 0;
    }

    .engine-content {
        padding: 10vh 6vw;
        gap: 14vh;
    }

    .panel-1,
    .panel-2,
    .panel-3 {
        align-self: center;
        margin-left: 0;
        margin-right: 0;
    }

    .frame-1,
    .frame-2,
    .frame-3,
    .frame-4,
    .frame-5 {
        margin-left: 0;
    }

    .frame-border {
        max-width: 100%;
    }

    .gallery-frame {
        margin-bottom: 10vh;
    }

    #room-2 {
        min-height: 200vh;
    }

    .archive-space {
        gap: 20px;
    }

    .index-card {
        width: 200px;
        height: 140px;
    }
}

@media (max-width: 480px) {
    .domain-name {
        font-size: clamp(36px, 12vw, 80px);
    }

    .text-panel h2 {
        font-size: clamp(28px, 8vw, 48px);
    }

    .index-card {
        width: 160px;
        height: 120px;
        padding: 14px;
    }

    .index-card h4 {
        font-size: 16px;
    }

    .index-card p {
        font-size: 12px;
    }

    .gallery-frame {
        margin-bottom: 8vh;
    }

    #room-2 {
        min-height: 160vh;
    }
}
