/* thethird.quest - Glassmorphism Horizontal Scroll Experience */

:root {
    --frost-deep: #0b0e1a;
    --aurora: #9b8ec4;
    --glacial: #7ec8cf;
    --pale-ice: #e0eaf5;
    --phantom: #c49baa;
    --starlight: #f0f4fa;
    --deep-amethyst: #2a1f4e;
    --frozen-teal: #3d7a80;
    --scroll-weight: 200;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--frost-deep);
    color: rgba(240, 244, 250, 0.85);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 300;
}

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, rgba(126,200,207,0.6), rgba(155,142,196,0.4), rgba(126,200,207,0.6));
    backdrop-filter: blur(20px);
    z-index: 1000;
    transition: width 0.1s ease-out;
}

/* Navigation Dots */
.nav-dots {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 999;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(224, 234, 245, 0.08);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    padding: 0;
}

.nav-dot.active {
    background: rgba(126, 200, 207, 0.35);
    border-color: rgba(126, 200, 207, 0.6);
    box-shadow: 0 0 12px rgba(126, 200, 207, 0.25);
}

.nav-dot:hover {
    background: rgba(126, 200, 207, 0.2);
    border-color: rgba(126, 200, 207, 0.5);
}

/* Particle Canvas */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Main Corridor */
.corridor {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.corridor::-webkit-scrollbar {
    display: none;
}

/* Chamber Base */
.chamber {
    position: relative;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
}

.chamber-bg {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.chamber-mid {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.chamber-fg {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Wave SVGs */
.wave-svg {
    position: absolute;
    width: 100%;
    left: 0;
}

.wave-bg {
    bottom: 10%;
    height: 40%;
    opacity: 0.7;
}

.wave-bg-low {
    bottom: 25%;
    opacity: 0.5;
}

.wave-path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.chamber.visible .wave-path {
    stroke-dashoffset: 0;
}

/* === CHAMBER 1 - The Threshold === */
.chamber-1 .chamber-fg {
    gap: 32px;
}

.title-main {
    font-family: 'Outfit', sans-serif;
    font-weight: var(--scroll-weight);
    font-size: clamp(3.5rem, 9vw, 8rem);
    color: rgba(240, 244, 250, 0.6);
    letter-spacing: 0.15em;
    opacity: 0;
    animation: fadeInTitle 4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.5s forwards;
}

@keyframes fadeInTitle {
    to { opacity: 1; }
}

.scroll-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    animation: fadeInTitle 2s cubic-bezier(0.25, 0.1, 0.25, 1) 3s forwards;
}

.hint-text {
    font-family: 'Kode Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(200, 220, 240, 0.5);
}

.chevron-group {
    display: flex;
    gap: 2px;
}

.chevron {
    font-size: 1.2rem;
    color: rgba(126, 200, 207, 0.5);
    animation: pulseChevron 2s ease-in-out infinite;
}

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

@keyframes pulseChevron {
    0%, 100% { opacity: 0.3; transform: translateX(0); }
    50% { opacity: 0.8; transform: translateX(4px); }
}

/* Frost Circles */
.frost-circle {
    position: absolute;
    border-radius: 50%;
}

.frost-circle-1 {
    width: 180px;
    height: 180px;
    top: 12%;
    right: 18%;
    background: rgba(155, 142, 196, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(155, 142, 196, 0.12);
}

.frost-circle-2 {
    width: 120px;
    height: 120px;
    top: 8%;
    right: 25%;
    background: rgba(126, 200, 207, 0.06);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(126, 200, 207, 0.1);
}

.frost-circle-3 {
    width: 80px;
    height: 80px;
    top: 22%;
    right: 22%;
    background: rgba(196, 155, 170, 0.05);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(196, 155, 170, 0.08);
}

/* === CHAMBER 2 - The Reflection === */
.reflection-panels {
    flex-direction: row;
    gap: 4vw;
    padding: 0 6vw;
}

.glass-panel {
    position: relative;
    width: 28vw;
    height: 60vh;
    background: rgba(224, 234, 245, 0.06);
    backdrop-filter: blur(12px) saturate(1.4);
    border: 1px solid rgba(224, 234, 245, 0.12);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(11, 14, 26, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1), transform 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.chamber-2.visible .glass-panel {
    opacity: 1;
    transform: translateY(0);
}

.chamber-2.visible .panel-2 {
    transition-delay: 0.2s;
}

.chamber-2.visible .panel-3 {
    transition-delay: 0.4s;
}

.glyph {
    position: absolute;
    top: -12px;
    left: -8px;
}

.panel-number {
    font-family: 'Kode Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(200, 220, 240, 0.5);
    margin-bottom: 20px;
}

.panel-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.6vw, 1.25rem);
    line-height: 1.85;
    color: rgba(255, 255, 255, 0.85);
}

/* Glass panel shimmer */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.glass-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    background-size: 200% 100%;
    animation: shimmer 8s ease-in-out infinite;
    pointer-events: none;
}

/* === CHAMBER 3 - The Depth === */
.depth-content {
    align-items: center;
    justify-content: center;
}

.glass-window {
    width: 70vw;
    height: 70vh;
    background: rgba(224, 234, 245, 0.04);
    backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(224, 234, 245, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(11, 14, 26, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1), transform 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.chamber-3.visible .glass-window {
    opacity: 1;
    transform: scale(1);
}

.depth-word {
    font-family: 'Outfit', sans-serif;
    font-weight: var(--scroll-weight);
    font-size: clamp(5rem, 12vw, 10rem);
    color: rgba(240, 244, 250, 0.7);
    letter-spacing: 0.15em;
    transition: font-weight 0.3s ease;
}

.arrow-trace {
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1) 1s;
}

.chamber-3.visible .arrow-trace {
    opacity: 1;
}

.arrow-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.8s;
}

.chamber-3.visible .arrow-path {
    stroke-dashoffset: 0;
}

/* === CHAMBER 4 - The Dissolution === */
.dissolution-field {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2vw;
    padding: 10vh 8vw;
}

.glass-fragment {
    background: rgba(224, 234, 245, 0.05);
    backdrop-filter: blur(12px) saturate(1.4);
    border: 1px solid rgba(224, 234, 245, 0.08);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(11, 14, 26, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1), transform 1s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.glass-fragment span {
    font-family: 'Outfit', sans-serif;
    font-weight: 200;
    letter-spacing: 0.15em;
    color: rgba(240, 244, 250, 0.6);
}

.frag-1 { width: 16vw; height: 14vh; font-size: 1.4rem; }
.frag-2 { width: 20vw; height: 18vh; font-size: 1.6rem; }
.frag-3 { width: 14vw; height: 12vh; font-size: 1.2rem; }
.frag-4 { width: 22vw; height: 16vh; font-size: 1.5rem; }
.frag-5 { width: 18vw; height: 20vh; font-size: 1.3rem; }
.frag-6 { width: 24vw; height: 14vh; font-size: 1.1rem; }

.frag-1 { background: rgba(196, 155, 170, 0.05); }
.frag-2 { background: rgba(155, 142, 196, 0.04); }
.frag-3 { background: rgba(126, 200, 207, 0.06); }
.frag-4 { background: rgba(224, 234, 245, 0.03); }
.frag-5 { background: rgba(196, 155, 170, 0.04); }
.frag-6 { background: rgba(155, 142, 196, 0.05); }

.chamber-4.visible .glass-fragment {
    opacity: 1;
    transform: translateY(0);
}

.chamber-4.visible .frag-1 { transition-delay: 0s; }
.chamber-4.visible .frag-2 { transition-delay: 0.15s; }
.chamber-4.visible .frag-3 { transition-delay: 0.3s; }
.chamber-4.visible .frag-4 { transition-delay: 0.45s; }
.chamber-4.visible .frag-5 { transition-delay: 0.6s; }
.chamber-4.visible .frag-6 { transition-delay: 0.75s; }

.frag-1 span { font-weight: 200; }
.frag-2 span { font-weight: 300; }
.frag-3 span { font-weight: 200; }
.frag-4 span { font-weight: 400; }
.frag-5 span { font-weight: 300; }
.frag-6 span { font-weight: 200; }

/* === CHAMBER 5 - The Arrival === */
.chamber-5 {
    background: linear-gradient(135deg, #0b0e1a 0%, #2a1f4e 100%);
}

.arrival-content {
    align-items: center;
    justify-content: center;
}

.arrival-circle {
    width: 40vw;
    height: 40vw;
    max-width: 500px;
    max-height: 500px;
    border-radius: 50%;
    background: rgba(224, 234, 245, 0.04);
    backdrop-filter: blur(32px) saturate(1.4);
    border: 1px solid rgba(224, 234, 245, 0.1);
    box-shadow: 0 8px 48px rgba(11, 14, 26, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 2s cubic-bezier(0.25, 0.1, 0.25, 1), transform 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.chamber-5.visible .arrival-circle {
    opacity: 1;
    transform: scale(1);
}

.arrival-line {
    font-family: 'Kode Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(200, 220, 240, 0.5);
    display: block;
    text-align: center;
}

.arrival-domain {
    font-size: 0.85rem;
    color: rgba(240, 244, 250, 0.7);
    letter-spacing: 0.2em;
}

.arrival-phrase {
    color: rgba(126, 200, 207, 0.5);
}

/* Scattered Glyphs */
.glyph-scattered {
    position: absolute;
    opacity: 0;
    transition: opacity 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.chamber-5.visible .glyph-scattered {
    opacity: 1;
}

.glyph-s1 { top: 15%; left: 20%; }
.glyph-s2 { top: 70%; left: 15%; }
.glyph-s3 { top: 25%; right: 18%; }
.glyph-s4 { bottom: 20%; right: 25%; }
.glyph-s5 { top: 50%; left: 10%; }

.chamber-5.visible .glyph-s1 { transition-delay: 0.5s; }
.chamber-5.visible .glyph-s2 { transition-delay: 1s; }
.chamber-5.visible .glyph-s3 { transition-delay: 1.5s; }
.chamber-5.visible .glyph-s4 { transition-delay: 2s; }
.chamber-5.visible .glyph-s5 { transition-delay: 2.5s; }

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

    .glass-panel {
        width: 80vw;
        height: auto;
        min-height: 25vh;
    }

    .glass-window {
        width: 85vw;
        height: 75vh;
    }

    .dissolution-field {
        padding: 5vh 4vw;
        gap: 3vw;
    }

    .glass-fragment {
        width: 40vw !important;
        height: 12vh !important;
    }

    .arrival-circle {
        width: 70vw;
        height: 70vw;
    }

    .nav-dots {
        right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wave-path {
        stroke-dashoffset: 0 !important;
        transition: none !important;
    }

    .title-main,
    .scroll-hint,
    .glass-panel,
    .glass-window,
    .glass-fragment,
    .arrival-circle,
    .glyph-scattered {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }

    .chevron {
        animation: none !important;
    }

    .glass-panel::after {
        animation: none !important;
    }
}
