/* ═══════════════════════════════════════════════════════════
   The Weird Wanderer — Train Window Experience Module
   Scoped to .train-window-experience
   ═══════════════════════════════════════════════════════════ */

.train-window-experience {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    height: 800vh; /* Endless Journey feel */
    margin: 0;
    padding: 0;
    overflow: visible;
    background: #000; /* Pure black for immersion */
    font-family: inherit;
    color: inherit;
    z-index: 10;
}

.window-sticky {
    position: relative; /* Let GSAP handle pinning */
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Outside World - The Motion Engine (Dual Video Layer) */
.outside-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    background: #000;
}

.video-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0; /* Managed by GSAP */
    transition: filter 0.5s ease;
    will-change: opacity, filter;
}

.video-layer.active {
    opacity: 1;
}

.outside-world img.fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    opacity: 0.5;
}

/* Window Frame - The Realism Layer */
.window-frame {
    position: absolute;
    inset: 0;
    background: url('../assets/train-window-frame.png') no-repeat center;
    background-size: cover; /* Fill the 100vw container */
    opacity: 0.55;
    pointer-events: none;
    z-index: 10;
    filter: brightness(0.6) contrast(1.1);
}

/* Interior Depth & Blending - Blue Atmospheric Glow */
.window-sticky::after {
    content: "";
    position: absolute;
    inset: 0;
    background: 
        /* Deep interior shadows to hide the "room" */
        radial-gradient(circle at center, transparent 20%, rgba(0,0,0,0.98) 85%),
        /* Blue night-train glow leakage */
        linear-gradient(135deg, rgba(30, 50, 100, 0.15) 0%, transparent 40%),
        /* Warm top leakage from cabin light */
        linear-gradient(to bottom, rgba(200, 169, 110, 0.05) 0%, transparent 20%);
    pointer-events: none;
    z-index: 12;
}

/* Noise Texture Overlay - Dramatic Polish */
.window-sticky::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url('https://grainy-gradients.vercel.app/noise.svg');
    opacity: 0.08;
    pointer-events: none;
    z-index: 45;
    mix-blend-mode: overlay;
}

/* Vignette shadow on the edges for cinematic focus */
.window-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 40%, rgba(0,0,0,0.8) 100%);
    pointer-events: none;
}

/* Reflection Layer - The Memory System */
.reflection-layer {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
    overflow: hidden;
}

.memory-item {
    position: absolute;
    opacity: 0;
    will-change: transform, opacity;
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: blur(2px); /* Reflection realism */
    mix-blend-mode: soft-light; /* Melds with window glass */
}

.memory-item img {
    max-width: 320px;
    height: auto;
    opacity: 0.6;
    border-radius: 2px;
}

.memory-item span {
    margin-top: 1rem;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0.5;
}

/* Final Text Reveal */
.final-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    z-index: 40;
    opacity: 0;
}

.final-text h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 300;
    font-style: italic;
    color: var(--accent, #c8a96e);
    text-shadow: 0 0 20px rgba(200, 169, 110, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .memory-item img { max-width: 200px; }
    .outside-world { width: 300%; } /* More speed for mobile */
}
