/* ==========================================================================
   sim-ai.xyz - Bioluminescent Deep-Sea Generative Experience
   Palette: dark-neon | Typography: Cormorant Garamond + Nunito
   ========================================================================== */

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

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

body {
    background: #0a0b1e;
    color: #f0e8f5;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: fixed;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* --- Noise Overlay --- */
.noise-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: url(#noiseFilter);
    opacity: 1;
    pointer-events: none;
    z-index: 9999;
}

/* --- Typography --- */
h1, .conv-question, .fragment, .signal-text, .scroll-bubble-label {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
}

.conv-question {
    font-style: normal;
}

.fragment, .scroll-bubble-label {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
}

.title-main {
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: #f0e8f5;
    text-shadow: 0 0 30px rgba(185, 70, 255, 0.4), 0 0 60px rgba(185, 70, 255, 0.2);
}

.title-main .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: wordReveal 1.2s ease-out forwards;
}

.title-main .word:nth-child(1) { animation-delay: 2s; }
.title-main .word-separator:nth-child(2) { animation-delay: 2.2s; }
.title-main .word:nth-child(3) { animation-delay: 2.4s; }
.title-main .word-separator:nth-child(4) { animation-delay: 2.6s; }
.title-main .word:nth-child(5) { animation-delay: 2.8s; }

.title-main .word-separator {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    animation: wordReveal 1.2s ease-out forwards;
}

.subtitle {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    color: rgba(200, 192, 216, 0.9);
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s ease-out 3.2s forwards;
}

.pulse-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    color: #c8c0d8;
    opacity: 0.9;
    line-height: 1.75;
    max-width: 380px;
    margin-bottom: 1.8rem;
}

.conv-question {
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    color: #00f0ff;
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.conv-answer {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    color: rgba(240, 232, 245, 0.9);
    line-height: 1.75;
    margin-bottom: 3rem;
}

.conv-answer:last-child {
    margin-bottom: 0;
}

.signal-text {
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    color: #f0e8f5;
    letter-spacing: 0.02em;
    line-height: 1.15;
    text-shadow: 0 0 30px rgba(185, 70, 255, 0.4);
    margin-bottom: 2rem;
}

.glow-link {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    color: #00f0ff;
    opacity: 0.7;
    text-decoration: none;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 300ms ease;
    display: inline-block;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.glow-link:hover {
    transform: scale(1.15);
    opacity: 1;
    text-shadow: 0 0 30px rgba(0, 240, 255, 0.6), 0 0 60px rgba(0, 240, 255, 0.3);
}

/* --- Scenes (General) --- */
.scene {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12vh 8vw;
    overflow: hidden;
}

.scene-content {
    position: relative;
    z-index: 2;
}

/* Fade states for scene transitions */
.scene .scene-content,
.scene .pulse-bubbles,
.scene .dendrite-canvas,
.scene .garden-fragments,
.scene .signal-bubbles {
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.scene.is-visible .scene-content,
.scene.is-visible .pulse-bubbles,
.scene.is-visible .dendrite-canvas,
.scene.is-visible .garden-fragments,
.scene.is-visible .signal-bubbles {
    opacity: 1;
}

.scene.is-fading .scene-content,
.scene.is-fading .pulse-bubbles,
.scene.is-fading .dendrite-canvas,
.scene.is-fading .garden-fragments,
.scene.is-fading .signal-bubbles {
    opacity: 0.2;
}

/* --- Scene 1: The Void --- */
.scene-void {
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    background: #0a0b1e;
    box-shadow: inset 0 0 200px 60px #12132e;
}

.scene-void .noise-field {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.scene-void-content {
    text-align: center;
    z-index: 2;
}

/* --- Scene 2: The Pulse --- */
.scene-pulse {
    min-height: 100vh;
    background: #0a0b1e;
    align-items: center;
    justify-content: flex-start;
}

.scene-pulse-content {
    position: relative;
    z-index: 2;
    padding-left: 2vw;
}

.pulse-bubbles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.float-bubbles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.micro-float {
    fill: none;
    stroke-width: 1;
    opacity: 0.7;
    animation: bubbleDrift1 var(--float-duration, 5s) ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
}

.micro-float:nth-child(3n) { stroke: #00f0ff; }
.micro-float:nth-child(3n+1) { stroke: #ff2d6b; }
.micro-float:nth-child(3n+2) { stroke: #b946ff; }

.micro-float {
    --float-duration: calc(3s + var(--i) * 0.5s);
    --float-delay: calc(var(--i) * -0.3s);
}

/* Macro Bubbles */
.macro-bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.macro-bubble-1 {
    width: 200px;
    height: 200px;
    top: 20%;
    right: 15%;
    background: radial-gradient(circle, rgba(185, 70, 255, 0.3) 0%, transparent 70%);
    animation: bubblePulse1 4s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(185, 70, 255, 0.2);
}

.macro-bubble-2 {
    width: 120px;
    height: 120px;
    top: 55%;
    right: 35%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.25) 0%, transparent 70%);
    animation: bubblePulse2 5s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.15);
}

.macro-bubble-3 {
    width: 80px;
    height: 80px;
    top: 70%;
    right: 10%;
    background: radial-gradient(circle, rgba(255, 45, 107, 0.25) 0%, transparent 70%);
    animation: bubblePulse3 6s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(255, 45, 107, 0.15);
}

/* --- Scene 3: The Garden --- */
.scene-garden {
    min-height: 120vh;
    background: #0a0b1e;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 8vh;
}

.dendrite-canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.dendrite-canvas path {
    fill: none;
    stroke: #39ff8e;
    stroke-opacity: 0.6;
    stroke-width: 1.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 6px rgba(57, 255, 142, 0.3));
}

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

.fragment {
    position: absolute;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    color: #00f0ff;
    opacity: 0;
    transition: opacity 1s ease-out;
}

.scene-garden.is-visible .fragment {
    opacity: 0.7;
}

.fragment-1 { top: 25%; left: 12%; }
.fragment-2 { top: 35%; left: 55%; }
.fragment-3 { top: 45%; left: 28%; }
.fragment-4 { top: 50%; left: 70%; }
.fragment-5 { top: 60%; left: 15%; }
.fragment-6 { top: 65%; left: 48%; }
.fragment-7 { top: 72%; left: 75%; }
.fragment-8 { top: 80%; left: 35%; }

/* --- Scene 4: The Conversation --- */
.scene-conversation {
    min-height: 100vh;
    background: #0a0b1e;
    justify-content: center;
    align-items: center;
}

.conversation-content {
    max-width: 520px;
    margin: 0 auto;
    background-color: #1a1b35;
    background: rgba(26, 27, 53, 0.4);
    padding: 4rem;
    border-radius: 12px;
}

/* Text reveal for conversation items */
.conversation-content .conv-question,
.conversation-content .conv-answer {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scene-conversation.is-visible .conv-question,
.scene-conversation.is-visible .conv-answer {
    opacity: 1;
    transform: translateY(0);
}

.scene-conversation.is-visible .conv-question:nth-child(1) { transition-delay: 0.1s; }
.scene-conversation.is-visible .conv-answer:nth-child(2) { transition-delay: 0.3s; }
.scene-conversation.is-visible .conv-question:nth-child(3) { transition-delay: 0.5s; }
.scene-conversation.is-visible .conv-answer:nth-child(4) { transition-delay: 0.7s; }
.scene-conversation.is-visible .conv-question:nth-child(5) { transition-delay: 0.9s; }
.scene-conversation.is-visible .conv-answer:nth-child(6) { transition-delay: 1.1s; }

/* --- Scene 5: The Signal --- */
.scene-signal {
    min-height: 80vh;
    background: #0a0b1e;
    justify-content: center;
    align-items: center;
}

.scene-signal .noise-field {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.signal-bubbles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.macro-bubble-4 {
    position: absolute;
    width: 160px;
    height: 160px;
    top: 25%;
    left: 20%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.3) 0%, transparent 70%);
    animation: bubblePulse2 5s ease-in-out infinite;
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.2);
}

.macro-bubble-5 {
    position: absolute;
    width: 100px;
    height: 100px;
    bottom: 30%;
    right: 25%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 45, 107, 0.3) 0%, transparent 70%);
    animation: bubblePulse3 4.5s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(255, 45, 107, 0.15);
}

.scene-signal-content {
    text-align: center;
    z-index: 2;
    width: 100%;
}

.signal-link {
    margin-top: 1rem;
}

/* --- Scroll Progress Bubble --- */
.scroll-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    z-index: 100;
    cursor: pointer;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-bubble:hover {
    transform: scale(1.3);
}

.scroll-bubble:hover .scroll-bubble-label {
    opacity: 1;
}

.scroll-bubble-svg {
    width: 48px;
    height: 48px;
    transform: rotate(-90deg);
}

.scroll-bubble-track {
    stroke: rgba(185, 70, 255, 0.25);
}

.scroll-bubble-progress {
    stroke: rgba(185, 70, 255, 0.7);
    stroke-dasharray: 144.51;
    stroke-dashoffset: 144.51;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 4px rgba(185, 70, 255, 0.4));
}

.scroll-bubble-label {
    position: absolute;
    font-size: 10px;
    color: #b946ff;
    opacity: 0;
    transition: opacity 300ms ease;
    transform: rotate(0deg);
    pointer-events: none;
}

/* --- Keyframe Animations --- */
@keyframes wordReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bubblePulse1 {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes bubblePulse2 {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes bubblePulse3 {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes bubbleDrift1 {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(8px, -12px);
    }
    50% {
        transform: translate(-5px, -20px);
    }
    75% {
        transform: translate(10px, -8px);
    }
}

@keyframes bubbleDrift2 {
    0%, 100% {
        transform: translate(0, 0);
    }
    33% {
        transform: translate(-10px, -15px);
    }
    66% {
        transform: translate(6px, -25px);
    }
}

@keyframes bubbleDrift3 {
    0%, 100% {
        transform: translate(0, 0);
    }
    20% {
        transform: translate(12px, -8px);
    }
    40% {
        transform: translate(-6px, -18px);
    }
    60% {
        transform: translate(8px, -30px);
    }
    80% {
        transform: translate(-4px, -14px);
    }
}

@keyframes dendriteDraw {
    from {
        stroke-dashoffset: var(--path-length, 400);
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* Pulse text reveal */
.scene-pulse .pulse-text {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scene-pulse.is-visible .pulse-text:nth-child(1) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.scene-pulse.is-visible .pulse-text:nth-child(2) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.6s;
}

/* Signal text reveal */
.scene-signal .signal-text,
.scene-signal .signal-link {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scene-signal.is-visible .signal-text {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}

.scene-signal.is-visible .signal-link {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.6s;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .scene {
        padding: 8vh 6vw;
    }

    .pulse-text {
        max-width: 100%;
    }

    .macro-bubble-1 {
        width: 120px;
        height: 120px;
    }

    .macro-bubble-2 {
        width: 80px;
        height: 80px;
    }

    .macro-bubble-3 {
        width: 50px;
        height: 50px;
    }

    .conversation-content {
        max-width: 100%;
    }

    .fragment {
        font-size: 0.8rem;
    }
}
