/* ============================================
   continua.quest — Holographic Meditation Scroll
   ============================================ */

/* Custom Properties */
:root {
    --void-black: #050508;
    --deep-ultraviolet: #0D0A1A;
    --pure-white: #FFFFFF;
    --pale-lavender: #C8BFE7;
    --electric-cyan: #00F0FF;
    --neon-magenta: #FF00E5;
    --electric-mint: #00FFCC;
    --prismatic-gold: #FFD700;
    --violet-pulse: #8B5CF6;
    --scroll-progress: 0;
    --scroll-y: 0;
    --spring-enter: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-settle: cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--void-black);
    color: var(--pale-lavender);
    font-family: 'Newsreader', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Background Grid (fixed, sacred geometry)
   ============================================ */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 800ms ease;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 39px,
            rgba(13, 10, 26, 0.08) 39px,
            rgba(13, 10, 26, 0.08) 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 39px,
            rgba(13, 10, 26, 0.08) 39px,
            rgba(13, 10, 26, 0.08) 40px
        );
}

.bg-grid.visible {
    opacity: 1;
}

/* ============================================
   Ambient Breathing Pulse
   ============================================ */
.ambient-pulse {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 120vmax;
    height: 120vmax;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        var(--deep-ultraviolet) 0%,
        var(--void-black) 70%
    );
    animation: breathe 12s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        opacity: 0.8;
    }
}

/* ============================================
   The Spine (Central Vertical Line)
   ============================================ */
.spine {
    position: fixed;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    transform: translateX(-50%) scaleY(0);
    transform-origin: center center;
    transition: transform 1200ms var(--spring-enter);
    background: linear-gradient(
        180deg,
        var(--electric-cyan) 0%,
        var(--neon-magenta) 25%,
        var(--violet-pulse) 50%,
        var(--prismatic-gold) 75%,
        var(--electric-cyan) 100%
    );
    background-size: 100% 300%;
    background-position: 0% calc(var(--scroll-progress) * 200%);
}

.spine.visible {
    transform: translateX(-50%) scaleY(1);
}

.spine::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 100%;
    background: inherit;
    filter: blur(12px);
    opacity: 0.4;
}

/* ============================================
   Timeline Container
   ============================================ */
.timeline {
    position: relative;
    z-index: 2;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 20vh 0;
}

.hero-content {
    position: relative;
}

.hero-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 4.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pure-white);
    text-shadow:
        0 0 20px rgba(0, 255, 255, 0.3),
        0 0 40px rgba(255, 0, 255, 0.15),
        0 0 80px rgba(0, 255, 128, 0.08);
    margin-bottom: 1.5rem;
}

.hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 600ms ease, transform 600ms var(--spring-enter);
}

.hero-title .letter.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-title .letter.visible::after {
    content: '';
    position: absolute;
    inset: 0;
    animation: letterGlow 600ms ease-out forwards;
}

@keyframes letterGlow {
    0% {
        text-shadow:
            0 0 30px rgba(0, 240, 255, 0.8),
            0 0 60px rgba(255, 0, 229, 0.5),
            0 0 100px rgba(139, 92, 246, 0.3);
    }
    100% {
        text-shadow:
            0 0 20px rgba(0, 255, 255, 0.3),
            0 0 40px rgba(255, 0, 255, 0.15),
            0 0 80px rgba(0, 255, 128, 0.08);
    }
}

.hero-subtitle {
    font-family: 'Newsreader', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--pale-lavender);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms ease 200ms, transform 800ms var(--spring-settle) 200ms;
    letter-spacing: 0.04em;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Timeline Nodes
   ============================================ */
.timeline-node {
    position: relative;
    padding: 80px 0;
    text-align: center;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease, transform 500ms var(--spring-enter);
}

.timeline-node.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Node Crossbar */
.node-crossbar {
    position: relative;
    width: 0%;
    height: 1px;
    margin: 0 auto 2rem;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--electric-cyan) 20%,
        var(--neon-magenta) 50%,
        var(--prismatic-gold) 80%,
        transparent 100%
    );
    transition: width 600ms var(--spring-enter);
    overflow: visible;
}

.timeline-node.visible .node-crossbar {
    width: 120%;
    margin-left: -10%;
}

.node-crossbar::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--electric-cyan);
    box-shadow:
        0 0 12px var(--electric-cyan),
        0 0 24px rgba(0, 240, 255, 0.4);
    opacity: 0;
    transition: opacity 400ms ease 300ms;
}

.timeline-node.visible .node-crossbar::before {
    opacity: 1;
}

/* Node Label (monospace) */
.node-label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--electric-mint);
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 500ms ease 400ms;
}

.timeline-node.visible .node-label {
    opacity: 1;
}

/* Node Content */
.node-content {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease 500ms, transform 500ms var(--spring-enter) 500ms;
}

.timeline-node.visible .node-content {
    opacity: 1;
    transform: translateY(0);
}

.node-content h2 {
    font-family: 'Zilla Slab', serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pure-white);
    margin-bottom: 1.5rem;
    text-shadow:
        0 0 20px rgba(0, 255, 255, 0.3),
        0 0 40px rgba(255, 0, 255, 0.15),
        0 0 80px rgba(0, 255, 128, 0.08);
}

.node-content p {
    max-width: 520px;
    margin: 0 auto;
    text-align: left;
    color: var(--pale-lavender);
    font-weight: 300;
    line-height: 1.85;
}

.node-content .final-text {
    font-style: italic;
    color: var(--pure-white);
    opacity: 0.85;
}

/* ============================================
   Holographic Collage Fragments
   ============================================ */
.collage-group {
    position: relative;
    height: 300px;
    margin: 40px 0;
    overflow: visible;
}

.collage-fragment {
    position: absolute;
    mix-blend-mode: screen;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 500ms ease, transform 500ms var(--spring-enter);
}

.collage-group.visible .collage-fragment {
    opacity: 1;
    transform: scale(1);
}

/* Stagger fragment animations */
.collage-group.visible .collage-fragment:nth-child(1) { transition-delay: 0ms; }
.collage-group.visible .collage-fragment:nth-child(2) { transition-delay: 80ms; }
.collage-group.visible .collage-fragment:nth-child(3) { transition-delay: 160ms; }
.collage-group.visible .collage-fragment:nth-child(4) { transition-delay: 240ms; }
.collage-group.visible .collage-fragment:nth-child(5) { transition-delay: 320ms; }

/* Collage Group 1 */
.fragment-1 {
    top: 20px;
    left: -30px;
    width: 180px;
    height: 140px;
    clip-path: polygon(15% 0%, 100% 10%, 85% 100%, 0% 80%);
    background: linear-gradient(135deg, var(--electric-cyan), var(--neon-magenta));
    opacity: 0.25;
}
.collage-group.visible .fragment-1 { opacity: 0.25; }

.fragment-2 {
    top: 60px;
    right: -20px;
    width: 150px;
    height: 160px;
    clip-path: polygon(0% 15%, 80% 0%, 100% 85%, 20% 100%);
    background: linear-gradient(200deg, var(--violet-pulse), var(--prismatic-gold));
    mix-blend-mode: color-dodge;
    opacity: 0.2;
}
.collage-group.visible .fragment-2 { opacity: 0.2; }

.fragment-3 {
    top: 100px;
    left: 60px;
    width: 200px;
    height: 120px;
    clip-path: polygon(10% 5%, 90% 0%, 100% 100%, 0% 90%);
    background: linear-gradient(45deg, var(--neon-magenta), var(--electric-cyan), var(--prismatic-gold));
    opacity: 0.18;
}
.collage-group.visible .fragment-3 { opacity: 0.18; }

.fragment-4 {
    top: 30px;
    left: 50%;
    transform: translateX(-50%) scale(0.7);
    width: 120px;
    height: 180px;
    clip-path: polygon(50% 0%, 100% 40%, 80% 100%, 20% 100%, 0% 40%);
    background: conic-gradient(from 45deg, var(--electric-cyan), var(--neon-magenta), var(--prismatic-gold), var(--violet-pulse), var(--electric-cyan));
    opacity: 0.15;
}
.collage-group.visible .fragment-4 { opacity: 0.15; transform: translateX(-50%) scale(1); }

/* Collage Group 2 */
.fragment-5 {
    top: 30px;
    left: 10%;
    width: 220px;
    height: 130px;
    clip-path: polygon(5% 10%, 95% 0%, 100% 90%, 0% 100%);
    background: linear-gradient(160deg, var(--prismatic-gold), var(--neon-magenta));
    mix-blend-mode: color-dodge;
    opacity: 0.2;
}
.collage-group.visible .fragment-5 { opacity: 0.2; }

.fragment-6 {
    top: 80px;
    right: 0;
    width: 160px;
    height: 150px;
    clip-path: polygon(20% 0%, 100% 20%, 80% 100%, 0% 80%);
    background: linear-gradient(220deg, var(--electric-cyan), var(--violet-pulse));
    opacity: 0.22;
}
.collage-group.visible .fragment-6 { opacity: 0.22; }

.fragment-7 {
    top: 50px;
    left: 30%;
    width: 170px;
    height: 170px;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    background: conic-gradient(from 120deg, var(--neon-magenta), var(--electric-mint), var(--violet-pulse), var(--neon-magenta));
    opacity: 0.16;
}
.collage-group.visible .fragment-7 { opacity: 0.16; }

/* Collage Group 3 */
.fragment-8 {
    top: 10px;
    left: -20px;
    width: 140px;
    height: 200px;
    clip-path: polygon(0% 0%, 100% 10%, 90% 100%, 10% 90%);
    background: linear-gradient(180deg, var(--electric-cyan), var(--neon-magenta), var(--prismatic-gold));
    opacity: 0.2;
}
.collage-group.visible .fragment-8 { opacity: 0.2; }

.fragment-9 {
    top: 40px;
    right: -10px;
    width: 160px;
    height: 140px;
    clip-path: polygon(10% 0%, 100% 15%, 90% 100%, 0% 85%);
    background: linear-gradient(300deg, var(--violet-pulse), var(--electric-cyan));
    mix-blend-mode: color-dodge;
    opacity: 0.18;
}
.collage-group.visible .fragment-9 { opacity: 0.18; }

.fragment-10 {
    top: 120px;
    left: 40%;
    width: 130px;
    height: 130px;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    background: conic-gradient(from 200deg, var(--prismatic-gold), var(--electric-cyan), var(--neon-magenta), var(--prismatic-gold));
    opacity: 0.15;
}
.collage-group.visible .fragment-10 { opacity: 0.15; }

.fragment-11 {
    top: 60px;
    left: 15%;
    width: 100px;
    height: 160px;
    clip-path: polygon(30% 0%, 100% 20%, 70% 100%, 0% 80%);
    background: linear-gradient(90deg, var(--neon-magenta), var(--prismatic-gold));
    opacity: 0.14;
}
.collage-group.visible .fragment-11 { opacity: 0.14; }

.fragment-12 {
    top: 0;
    right: 20%;
    width: 110px;
    height: 120px;
    clip-path: polygon(0% 20%, 100% 0%, 100% 80%, 0% 100%);
    background: linear-gradient(45deg, var(--electric-mint), var(--violet-pulse));
    mix-blend-mode: color-dodge;
    opacity: 0.17;
}
.collage-group.visible .fragment-12 { opacity: 0.17; }

/* Collage Group 4 */
.fragment-13 {
    top: 20px;
    left: 5%;
    width: 200px;
    height: 180px;
    clip-path: polygon(5% 5%, 95% 0%, 100% 95%, 0% 100%);
    background: conic-gradient(from 300deg, var(--electric-cyan), var(--neon-magenta), var(--violet-pulse), var(--prismatic-gold), var(--electric-cyan));
    opacity: 0.2;
}
.collage-group.visible .fragment-13 { opacity: 0.2; }

.fragment-14 {
    top: 50px;
    right: -15px;
    width: 150px;
    height: 200px;
    clip-path: polygon(20% 0%, 100% 10%, 80% 100%, 0% 90%);
    background: linear-gradient(170deg, var(--prismatic-gold), var(--electric-cyan));
    mix-blend-mode: color-dodge;
    opacity: 0.18;
}
.collage-group.visible .fragment-14 { opacity: 0.18; }

.fragment-15 {
    top: 80px;
    left: 25%;
    width: 180px;
    height: 140px;
    clip-path: polygon(50% 0%, 100% 30%, 85% 100%, 15% 100%, 0% 30%);
    background: linear-gradient(260deg, var(--neon-magenta), var(--electric-mint));
    opacity: 0.16;
}
.collage-group.visible .fragment-15 { opacity: 0.16; }

/* ============================================
   Diffraction Rainbow Borders
   ============================================ */
.node-crossbar::after {
    content: '';
    position: absolute;
    inset: -1px;
    background: conic-gradient(
        from var(--angle, 0deg),
        var(--electric-cyan),
        var(--neon-magenta),
        var(--prismatic-gold),
        var(--electric-mint),
        var(--violet-pulse),
        var(--electric-cyan)
    );
    opacity: 0.3;
    z-index: -1;
    filter: blur(2px);
}

/* Unique diffraction angles per node */
.timeline-node:nth-child(1) { --angle: 0deg; }
.timeline-node:nth-child(2) { --angle: 30deg; }
.timeline-node:nth-child(3) { --angle: 72deg; }
.timeline-node:nth-child(4) { --angle: 108deg; }
.timeline-node:nth-child(5) { --angle: 144deg; }
.timeline-node:nth-child(6) { --angle: 180deg; }
.timeline-node:nth-child(7) { --angle: 216deg; }
.timeline-node:nth-child(8) { --angle: 252deg; }
.timeline-node:nth-child(9) { --angle: 288deg; }
.timeline-node:nth-child(10) { --angle: 324deg; }

/* ============================================
   Holographic Hover Effects
   ============================================ */
.timeline-node:hover .node-crossbar {
    filter: brightness(1.3);
    box-shadow:
        0 0 20px rgba(0, 240, 255, 0.2),
        0 0 40px rgba(255, 0, 229, 0.1);
}

.timeline-node:hover .node-content h2 {
    text-shadow:
        0 0 30px rgba(0, 255, 255, 0.5),
        0 0 60px rgba(255, 0, 255, 0.25),
        0 0 100px rgba(0, 255, 128, 0.12);
}

.collage-fragment:hover {
    filter: brightness(1.5);
    transition: filter 300ms ease;
}

/* ============================================
   Closing Space
   ============================================ */
.closing-space {
    height: 40vh;
}

/* ============================================
   Opening Animation States
   ============================================ */
body.loading .bg-grid,
body.loading .spine,
body.loading .hero-title .letter,
body.loading .hero-subtitle {
    opacity: 0;
    transition: none;
}

/* ============================================
   Holographic Ribbon on Timeline Column
   ============================================ */
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 240, 255, 0.02) 20%,
        rgba(255, 0, 229, 0.015) 40%,
        rgba(139, 92, 246, 0.02) 60%,
        rgba(255, 215, 0, 0.015) 80%,
        transparent 100%
    );
    background-size: 100% 300%;
    background-position: 0% calc(var(--scroll-progress) * 200%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 700px) {
    .timeline {
        padding: 0 16px;
    }

    .collage-group {
        height: 200px;
    }

    .collage-fragment {
        transform: scale(0.6);
    }

    .collage-group.visible .collage-fragment {
        transform: scale(0.85);
    }

    .timeline-node.visible .node-crossbar {
        width: 110%;
        margin-left: -5%;
    }

    .node-content p {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(1.6rem, 8vw, 2.5rem);
    }

    .collage-group {
        height: 160px;
    }
}
