/* ============================================
   continua.st v2 - Surrealist Dreamscape
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --void-indigo: #1a1040;
    --amber-glow: #d4a574;
    --bone-linen: #f0ece4;
    --cerulean-mist: #5b8fad;
    --blush-haze: #c4889b;
    --graphite-wash: #3a3a4a;

    --line-color: var(--bone-linen);
    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Outfit', sans-serif;
    --font-mono: 'DM Mono', monospace;
}

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

html, body {
    width: 100%;
    height: 100%;
    background: var(--void-indigo);
    color: var(--bone-linen);
    font-family: var(--font-body);
    font-weight: 300;
    overflow: hidden;
    overscroll-behavior: contain;
}

body {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar but keep functionality */
body::-webkit-scrollbar {
    height: 0;
    width: 0;
    display: none;
}
body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* ============================================
   Scroll Container - Horizontal Layout
   ============================================ */
#scroll-container {
    position: relative;
    display: flex;
    flex-direction: row;
    width: max-content;
    height: 100vh;
    background: var(--void-indigo);
}

/* ============================================
   Continuum Line (fixed across all chambers)
   ============================================ */
#continuum-line {
    position: fixed;
    top: 50vh;
    left: 0;
    width: 100vw;
    height: 2px;
    z-index: 50;
    pointer-events: none;
    overflow: visible;
    filter: drop-shadow(0 0 6px rgba(240, 236, 228, 0.4));
}

#the-line {
    stroke: var(--line-color);
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 10000;
    stroke-dashoffset: 10000;
    transition: stroke-dashoffset 1.6s cubic-bezier(0.22, 1, 0.36, 1),
                stroke 1.2s ease;
    vector-effect: non-scaling-stroke;
}

/* Pulsing line subtle animation */
@keyframes line-pulse {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 1; }
}
#continuum-line {
    animation: line-pulse 6s ease-in-out infinite;
}

/* ============================================
   Mathematical Annotations Along the Line
   ============================================ */
#line-annotations {
    position: fixed;
    top: 50vh;
    left: 0;
    width: 100vw;
    height: 0;
    z-index: 51;
    pointer-events: none;
}

.annotation {
    position: absolute;
    top: -22px;
    transform: translate(-50%, 0);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--cerulean-mist);
    opacity: 0;
    white-space: nowrap;
    transition: opacity 1.4s ease;
    text-shadow: 0 0 10px rgba(91, 143, 173, 0.4);
}

.annotation.visible {
    opacity: 0.5;
    animation: annotation-drift 8s ease-in-out infinite;
}

@keyframes annotation-drift {
    0%, 100% { transform: translate(-50%, 0); opacity: 0.5; }
    50%      { transform: translate(-50%, -4px); opacity: 0.7; }
}

/* ============================================
   Floating Geometric Primitives
   ============================================ */
#floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
    overflow: hidden;
}

.float-shape {
    position: absolute;
    border: 1px solid var(--cerulean-mist);
    opacity: 0.18;
    pointer-events: none;
}
.float-shape.shape-circle  { border-radius: 50%; }
.float-shape.shape-blush   { border-color: var(--blush-haze); }
.float-shape.shape-arc {
    border: none;
    border-top: 1px solid var(--cerulean-mist);
    border-radius: 50% 50% 0 0;
    height: 50%;
}

/* ============================================
   Fog / Atmospheric Layers
   ============================================ */
.fog-layer {
    position: fixed;
    top: -50vh;
    width: 200vw;
    height: 200vh;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: screen;
}

.fog-layer-1 {
    left: -50vw;
    background: radial-gradient(ellipse at 30% 50%,
        rgba(91, 143, 173, 0.18) 0%,
        rgba(26, 16, 64, 0) 55%);
    animation: fog-drift-a 60s ease-in-out infinite alternate;
}
.fog-layer-2 {
    left: -30vw;
    background: radial-gradient(ellipse at 70% 60%,
        rgba(196, 136, 155, 0.12) 0%,
        rgba(26, 16, 64, 0) 60%);
    animation: fog-drift-b 75s ease-in-out infinite alternate;
}
.fog-layer-3 {
    left: -70vw;
    background: radial-gradient(ellipse at 50% 40%,
        rgba(212, 165, 116, 0.10) 0%,
        rgba(26, 16, 64, 0) 65%);
    animation: fog-drift-c 90s ease-in-out infinite alternate;
}

@keyframes fog-drift-a {
    0%   { transform: translateX(0)    translateY(0); }
    100% { transform: translateX(8vw)  translateY(-3vh); }
}
@keyframes fog-drift-b {
    0%   { transform: translateX(0)    translateY(0); }
    100% { transform: translateX(-6vw) translateY(4vh); }
}
@keyframes fog-drift-c {
    0%   { transform: translateX(0)    translateY(0); }
    100% { transform: translateX(5vw)  translateY(-5vh); }
}

/* ============================================
   Chamber - Common Frame
   ============================================ */
.chamber {
    position: relative;
    height: 100vh;
    flex: 0 0 auto;
    scroll-snap-align: start;
    overflow: hidden;
    transition: backdrop-filter 200ms ease, filter 200ms ease;
}

.chamber-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pulsing arrow at right edge */
.chamber-arrow {
    position: absolute;
    right: 3vw;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 64px;
    color: var(--bone-linen);
    opacity: 0.3;
    z-index: 60;
    animation: arrow-pulse 3.2s ease-in-out infinite;
    pointer-events: none;
    text-shadow: 0 0 18px rgba(240, 236, 228, 0.35);
}

@keyframes arrow-pulse {
    0%, 100% { opacity: 0.18; transform: translate(0, -50%); }
    50%      { opacity: 0.55; transform: translate(6px, -50%); }
}

/* Chamber refocus dreamlike effect on enter */
.chamber.refocus {
    filter: blur(2px);
}

/* ============================================
   Chamber 1 - The Threshold (100vw x 100vh)
   ============================================ */
#chamber-1 {
    width: 100vw;
    background: radial-gradient(ellipse at 50% 50%,
        #221552 0%,
        var(--void-indigo) 60%);
    animation: chamber1-shift 30s ease-in-out infinite alternate;
}

@keyframes chamber1-shift {
    0% {
        background: radial-gradient(ellipse at 50% 50%,
            #221552 0%,
            var(--void-indigo) 60%);
    }
    100% {
        background: radial-gradient(ellipse at 50% 50%,
            #5a3e36 0%,
            #2a1e3e 60%);
    }
}

.title-text {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(48px, 14vw, 220px);
    letter-spacing: 0.08em;
    line-height: 1;
    text-align: center;
    user-select: none;
    color: transparent;
    -webkit-text-stroke: 1px var(--bone-linen);
    text-stroke: 1px var(--bone-linen);
    filter: drop-shadow(0 0 22px rgba(91, 143, 173, 0.35));
}

.title-text .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 1.2s ease, transform 1.4s ease;
}

.title-text .letter.in {
    opacity: 0.92;
    transform: translateY(0);
}

/* ============================================
   Chamber 2 - The Axiom (120vw x 100vh)
   ============================================ */
#chamber-2 {
    width: 120vw;
    background: linear-gradient(90deg,
        var(--void-indigo) 0%,
        var(--graphite-wash) 50%,
        var(--void-indigo) 100%);
}

.perspective-container {
    perspective: 800px;
    perspective-origin: 50% 50%;
    transform-style: preserve-3d;
}

.axiom-word {
    position: absolute;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(36px, 4.5vw, 84px);
    color: var(--bone-linen);
    letter-spacing: 0.04em;
    transform: translateZ(0) translateX(0);
    opacity: 0;
    filter: blur(8px);
    transition: opacity 1.6s ease, filter 1.6s ease, transform 1.4s ease;
    will-change: transform, filter;
}

.axiom-word.visible {
    opacity: 0.9;
    filter: blur(0);
}

.axiom-word.deep-back {
    transform: translateZ(-200px);
}
.axiom-word.deep-front {
    transform: translateZ(200px);
}

.axiom-word-accent {
    color: var(--amber-glow);
    font-weight: 400;
}

/* Watermarks */
.watermark {
    position: absolute;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: 20vw;
    letter-spacing: 0.05em;
    color: var(--bone-linen);
    opacity: 0.04;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.watermark-1 {
    top: 14%;
    left: 6%;
    transform: rotate(-8deg);
}
.watermark-2 {
    bottom: 12%;
    left: 35%;
    transform: rotate(12deg);
    color: var(--amber-glow);
    opacity: 0.05;
}
.watermark-3 {
    top: 30%;
    left: 30%;
    transform: rotate(-5deg);
    color: var(--bone-linen);
    opacity: 0.05;
}
.watermark-4 {
    top: 20%;
    left: 10%;
    transform: rotate(-15deg);
    color: var(--cerulean-mist);
    opacity: 0.05;
}

/* ============================================
   Chamber 3 - The Spectrum (150vw x 100vh)
   ============================================ */
#chamber-3 {
    width: 150vw;
    background: linear-gradient(90deg,
        var(--void-indigo) 0%,
        var(--graphite-wash) 14%,
        var(--cerulean-mist) 32%,
        var(--blush-haze) 52%,
        var(--amber-glow) 72%,
        var(--bone-linen) 92%,
        var(--void-indigo) 100%);
}

.spectrum-field {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.spectrum-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.geo-shape {
    fill: none;
    stroke: var(--bone-linen);
    stroke-width: 1.2;
    opacity: 0.45;
    vector-effect: non-scaling-stroke;
}
.geo-circle-1 {
    animation: geo-drift-x 80s linear infinite alternate;
}
.geo-circle-2 {
    animation: geo-drift-y 95s linear infinite alternate;
}
.geo-parabola {
    animation: geo-drift-y 70s linear infinite alternate-reverse;
}
.geo-wave {
    animation: geo-drift-x 110s linear infinite alternate-reverse;
}
.geo-ellipse {
    animation: geo-drift-y 90s linear infinite alternate;
}
.geo-arc {
    animation: geo-drift-x 75s linear infinite alternate;
}

@keyframes geo-drift-x {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(40px, -10px); }
}
@keyframes geo-drift-y {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-15px, 30px); }
}

/* ============================================
   Chamber 4 - The Architecture (130vw x 100vh)
   ============================================ */
#chamber-4 {
    width: 130vw;
    background: linear-gradient(90deg,
        var(--void-indigo) 0%,
        var(--graphite-wash) 50%,
        var(--void-indigo) 100%);
}

.architecture-space {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1200px;
    perspective-origin: 50% 50%;
}

/* Colonnade - receding columns */
.colonnade {
    position: absolute;
    bottom: 12%;
    left: 4%;
    width: 50%;
    height: 70%;
    transform-style: preserve-3d;
    display: flex;
    align-items: flex-end;
    gap: 1.6%;
}

.column {
    --col-progress: calc(var(--col-index) / 11);
    flex: 1;
    height: calc(100% - var(--col-progress) * 35%);
    background: linear-gradient(180deg,
        rgba(240, 236, 228, 0) 0%,
        rgba(240, 236, 228, 0.18) 18%,
        rgba(196, 136, 155, 0.15) 100%);
    border-left: 1px solid rgba(240, 236, 228, 0.25);
    border-right: 1px solid rgba(240, 236, 228, 0.12);
    transform-origin: bottom center;
    transform: translateZ(calc(var(--col-index) * -30px))
               translateY(calc(var(--col-progress) * 6%));
    opacity: calc(0.85 - var(--col-progress) * 0.55);
    border-radius: 4px 4px 0 0;
}

/* Arches above colonnade */
.arches {
    position: absolute;
    top: 18%;
    left: 4%;
    width: 50%;
    height: 28%;
    display: flex;
    align-items: flex-end;
    gap: 1.6%;
    transform-style: preserve-3d;
}

.arch {
    --arch-progress: calc(var(--arch-index) / 10);
    flex: 1;
    height: 70%;
    border: 1px solid rgba(240, 236, 228, 0.22);
    border-radius: 50% 50% 0 0;
    background: radial-gradient(ellipse at 50% 100%,
        rgba(91, 143, 173, 0.10) 0%,
        rgba(26, 16, 64, 0) 70%);
    transform: translateZ(calc(var(--arch-index) * -30px))
               translateY(calc(var(--arch-progress) * 6%));
    opacity: calc(0.7 - var(--arch-progress) * 0.5);
}

/* Impossible staircase */
.staircase {
    position: absolute;
    top: 22%;
    right: 6%;
    width: 36%;
    height: 56%;
    transform-style: preserve-3d;
    transform: rotateX(8deg) rotateY(-12deg);
}

.stair {
    --stair-progress: calc(var(--stair-index) / 7);
    position: absolute;
    left: calc(var(--stair-index) * 11%);
    bottom: calc(var(--stair-index) * 11%);
    width: 30%;
    height: 12%;
    background: linear-gradient(180deg,
        rgba(212, 165, 116, 0.18) 0%,
        rgba(196, 136, 155, 0.14) 100%);
    border: 1px solid rgba(240, 236, 228, 0.20);
    transform: translateZ(calc(var(--stair-index) * 14px))
               rotate(calc(var(--stair-progress) * 4deg));
    opacity: calc(0.85 - var(--stair-progress) * 0.45);
}

/* ============================================
   Chamber 5 - The Resolve (100vw x 100vh)
   ============================================ */
#chamber-5 {
    width: 100vw;
    background: linear-gradient(90deg,
        var(--void-indigo) 0%,
        #2a1e3e 30%,
        var(--graphite-wash) 60%,
        var(--blush-haze) 85%,
        var(--amber-glow) 100%);
}

.resolve-space {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.title-ghost {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(48px, 12vw, 180px);
    opacity: 0.18;
    -webkit-text-stroke: 0.5px var(--bone-linen);
    z-index: 2;
}

.title-ghost span {
    display: inline-block;
    opacity: 0.7;
}

.spiral-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(280px, 40vw, 520px);
    height: clamp(280px, 40vw, 520px);
    z-index: 5;
    filter: drop-shadow(0 0 16px rgba(240, 236, 228, 0.3));
}

.spiral-line {
    fill: none;
    stroke: var(--bone-linen);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    transition: stroke-dashoffset 4s cubic-bezier(0.22, 1, 0.36, 1);
}

.spiral-line.draw {
    stroke-dashoffset: 0;
}

.resolve-text {
    position: absolute;
    bottom: 18%;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(18px, 1.6vw, 28px);
    color: var(--bone-linen);
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 2.4s ease 1.2s;
    z-index: 6;
    text-shadow: 0 0 14px rgba(26, 16, 64, 0.55);
}

.resolve-text.visible {
    opacity: 0.85;
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    #the-line {
        stroke-dashoffset: 0;
    }
    .spiral-line {
        stroke-dashoffset: 0;
    }
}
