/* =====================================================
   loves.quest — Aurora Blobitecture Stylesheet
   ===================================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: #0B0E17;
    color: #E8EDF5;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    line-height: 1.75;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- SVG Noise Filter (hidden) --- */
#noise-svg {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* --- Noise Overlay --- */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
    transition: opacity 1.5s ease;
}

#noise-overlay.intense {
    opacity: 0.08;
}

/* --- Aurora Background --- */
#aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 30% 40%, rgba(0, 229, 195, 0.063) 0%, rgba(123, 97, 255, 0.031) 40%, rgba(224, 64, 251, 0.02) 70%, transparent 100%);
    transition: background-position 0.3s ease-out;
}

/* --- Floating Bioluminescent Blobs --- */
#floating-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.float-blob {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 195, 0.06) 0%, transparent 70%);
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.float-blob-1 {
    width: 8vw;
    height: 8vw;
    top: 15%;
    left: 10%;
    animation: floatDrift1 35s ease-in-out infinite alternate;
}

.float-blob-2 {
    width: 5vw;
    height: 5vw;
    top: 40%;
    right: 8%;
    background: radial-gradient(circle, rgba(123, 97, 255, 0.05) 0%, transparent 70%);
    animation: floatDrift2 42s ease-in-out infinite alternate;
}

.float-blob-3 {
    width: 6vw;
    height: 6vw;
    top: 70%;
    left: 25%;
    animation: floatDrift3 38s ease-in-out infinite alternate;
}

.float-blob-4 {
    width: 4vw;
    height: 4vw;
    top: 20%;
    right: 30%;
    background: radial-gradient(circle, rgba(224, 64, 251, 0.04) 0%, transparent 70%);
    animation: floatDrift4 50s ease-in-out infinite alternate;
}

.float-blob-5 {
    width: 7vw;
    height: 7vw;
    top: 55%;
    right: 15%;
    animation: floatDrift5 45s ease-in-out infinite alternate;
}

.float-blob-6 {
    width: 3vw;
    height: 3vw;
    top: 85%;
    left: 50%;
    background: radial-gradient(circle, rgba(0, 229, 195, 0.05) 0%, transparent 70%);
    animation: floatDrift6 55s ease-in-out infinite alternate;
}

.float-blob-7 {
    width: 5vw;
    height: 5vw;
    top: 10%;
    left: 60%;
    background: radial-gradient(circle, rgba(123, 97, 255, 0.04) 0%, transparent 70%);
    animation: floatDrift7 48s ease-in-out infinite alternate;
}

@keyframes floatDrift1 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(5vw, 8vh); }
}
@keyframes floatDrift2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-4vw, -6vh); }
}
@keyframes floatDrift3 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(6vw, -5vh); }
}
@keyframes floatDrift4 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-3vw, 7vh); }
}
@keyframes floatDrift5 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(4vw, 4vh); }
}
@keyframes floatDrift6 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-6vw, -3vh); }
}
@keyframes floatDrift7 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(3vw, -8vh); }
}

/* --- Heartbeat Canvas --- */
#heartbeat-canvas {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 10vh;
    z-index: 2;
    pointer-events: none;
}

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

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.nav-dot.active {
    background: #00E5C3;
    box-shadow: 0 0 12px rgba(0, 229, 195, 0.6), 0 0 24px rgba(0, 229, 195, 0.3);
}

/* --- Circuit Trace SVG --- */
.circuit-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: visible;
}

.circuit-line {
    stroke: #1E3A5F;
    stroke-width: 0.5;
    fill: none;
    opacity: 0.4;
}

.circuit-node {
    fill: #00E5C3;
    r: 4;
}

/* --- Acts (Sections) --- */
.act {
    position: relative;
    z-index: 5;
    padding: clamp(4vh, 8vh, 12vh) clamp(4vw, 8vw, 12vw);
}

#act-1 {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#act-2 {
    min-height: 150vh;
    padding-top: 8vh;
}

#act-3 {
    min-height: 200vh;
    padding-top: 8vh;
}

#act-4 {
    min-height: 150vh;
    padding-top: 8vh;
}

#act-5 {
    min-height: 150vh;
    padding-top: 8vh;
    padding-bottom: 20vh;
}

/* --- Blob Container Base --- */
.blob-container {
    position: relative;
    padding: clamp(2rem, 4vw, 3.5rem);
    margin-bottom: clamp(12vh, 20vh, 30vh);
    background: rgba(0, 229, 195, 0.08);
    border: 1px solid rgba(30, 58, 95, 0.4);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blobMorph 14s ease-in-out infinite;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 900ms cubic-bezier(0.68, -0.55, 0.265, 1.55),
                transform 900ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.blob-container.visible {
    opacity: 1;
    transform: scale(1);
}

/* --- Blob Morph Keyframes --- */
@keyframes blobMorph {
    0%   { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25%  { border-radius: 58% 42% 56% 44% / 62% 35% 65% 38%; }
    50%  { border-radius: 40% 60% 35% 65% / 55% 45% 55% 45%; }
    75%  { border-radius: 65% 35% 52% 48% / 38% 62% 40% 60%; }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

@keyframes blobMorph2 {
    0%   { border-radius: 40% 60% 55% 45% / 45% 55% 40% 60%; }
    25%  { border-radius: 55% 45% 42% 58% / 58% 42% 55% 45%; }
    50%  { border-radius: 35% 65% 60% 40% / 40% 60% 35% 65%; }
    75%  { border-radius: 60% 40% 45% 55% / 55% 45% 60% 40%; }
    100% { border-radius: 40% 60% 55% 45% / 45% 55% 40% 60%; }
}

@keyframes blobMorph3 {
    0%   { border-radius: 50% 50% 40% 60% / 60% 40% 50% 50%; }
    25%  { border-radius: 42% 58% 55% 45% / 45% 55% 42% 58%; }
    50%  { border-radius: 58% 42% 48% 52% / 52% 48% 58% 42%; }
    75%  { border-radius: 45% 55% 60% 40% / 40% 60% 45% 55%; }
    100% { border-radius: 50% 50% 40% 60% / 60% 40% 50% 50%; }
}

/* --- Blob Positioning --- */
.blob-left {
    width: clamp(55vw, 65vw, 70vw);
    margin-left: clamp(2vw, 8vw, 12vw);
    margin-right: auto;
}

.blob-right {
    width: clamp(55vw, 65vw, 70vw);
    margin-right: clamp(2vw, 8vw, 12vw);
    margin-left: auto;
}

.annotation-blob {
    width: clamp(25vw, 30vw, 35vw);
    background: rgba(123, 97, 255, 0.06);
}

/* --- Hero Blob --- */
.blob-hero {
    width: clamp(70vw, 80vw, 90vw);
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(0, 229, 195, 0.06);
    animation: blobMorph 12s ease-in-out infinite;
    opacity: 1;
    transform: scale(1);
}

.hero-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(2.8rem, 8vw, 5.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #E8EDF5;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #00E5C3, #7B61FF, #E040FB);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 300;
    color: #8FA3BF;
    max-width: 500px;
    line-height: 1.75;
}

/* --- Act Labels --- */
.act-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #3DFFA0;
    display: block;
    margin-bottom: 1.5rem;
}

.act-label-section {
    margin-bottom: 6vh;
    margin-left: clamp(2vw, 8vw, 12vw);
}

.act-label-error {
    color: #FF4D6A;
}

/* --- Dependency Blobs --- */
.blob-dependency {
    animation-duration: 16s;
}

.blob-dependency:nth-child(3) {
    animation-name: blobMorph2;
    animation-duration: 15s;
}

.blob-dependency:nth-child(4) {
    animation-name: blobMorph3;
    animation-duration: 18s;
}

.dep-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    font-weight: 400;
    color: #3DFFA0;
    display: block;
    margin-bottom: 1.5rem;
    letter-spacing: 0.01em;
}

.dep-description {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 300;
    color: #8FA3BF;
    line-height: 1.75;
    margin-top: 1.5rem;
}

/* --- Molecule SVG --- */
.molecule-container {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

.molecule-svg {
    width: clamp(120px, 20vw, 200px);
    height: auto;
}

.molecule-rotate {
    transform-origin: 100px 80px;
    animation: moleculeSpin 720s linear infinite;
}

@keyframes moleculeSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Philosophy Quote --- */
.philosophy-quote {
    border: none;
    padding: 0;
    margin: 0;
}

/* --- Code Blocks --- */
.code-block {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.8rem, 1.4vw, 1rem);
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.8;
    color: #E8EDF5;
    border-left: 3px solid #3DFFA0;
    padding-left: 1.5rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
}

/* --- Typewriter Effect --- */
.typewriter {
    visibility: hidden;
}

.typewriter.typing,
.typewriter.typed {
    visibility: visible;
}

.typewriter-cursor {
    display: inline;
    color: #3DFFA0;
    animation: cursorBlink 0.6s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Runtime Blobs --- */
.blob-runtime {
    background: rgba(123, 97, 255, 0.10);
}

.blob-runtime:nth-child(odd) {
    animation-name: blobMorph2;
    animation-duration: 15s;
}

.blob-runtime:nth-child(even) {
    animation-name: blobMorph3;
    animation-duration: 17s;
}

/* --- Annotation --- */
.annotation {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 300;
    color: #8FA3BF;
    line-height: 1.75;
    font-style: italic;
}

.annotation code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: #3DFFA0;
    background: rgba(61, 255, 160, 0.08);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

/* --- Error Blobs (Act 4) --- */
.act-error .blob-container,
.blob-error {
    background: rgba(255, 77, 106, 0.08);
    border-color: rgba(255, 77, 106, 0.3);
}

.error-code {
    border-left-color: #FF4D6A;
    color: #E8EDF5;
}

.error-annotation {
    color: #FF4D6A;
    opacity: 0.85;
}

.blob-error.jitter {
    animation: blobJitter 0.15s ease-in-out;
}

@keyframes blobJitter {
    0% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-2px, 1px) scale(1); }
    50% { transform: translate(2px, -1px) scale(1); }
    75% { transform: translate(-1px, 2px) scale(1); }
    100% { transform: translate(0, 0) scale(1); }
}

/* --- Return / Final Blobs (Act 5) --- */
.blob-return {
    width: clamp(60vw, 70vw, 80vw);
    margin: 0 auto clamp(12vh, 20vh, 30vh) auto;
    background: rgba(0, 229, 195, 0.08);
    text-align: center;
    padding: clamp(3rem, 6vw, 5rem);
    position: relative;
    overflow: hidden;
}

.blob-return .code-block {
    border-left: none;
    padding-left: 0;
    text-align: left;
    display: inline-block;
}

.return-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(0, 229, 195, 0.12) 0%, rgba(123, 97, 255, 0.06) 40%, transparent 70%);
    pointer-events: none;
    z-index: -1;
    animation: returnPulse 4s ease-in-out infinite;
}

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

.blob-final {
    width: clamp(60vw, 70vw, 80vw);
    margin: 0 auto;
    background: rgba(123, 97, 255, 0.08);
    text-align: center;
    padding: clamp(4rem, 8vw, 6rem);
    animation: blobMorph 12s ease-in-out infinite;
}

.final-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 500;
    color: #E8EDF5;
    line-height: 2;
}

.final-line {
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.final-line.reveal {
    opacity: 1;
    transform: translateY(0);
}

.final-signature {
    display: block;
    margin-top: 3rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    font-weight: 400;
    color: #8FA3BF;
    opacity: 0.5;
    letter-spacing: 0.01em;
}

/* --- Breathing Pauses --- */
.breathing-pause {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
}

.pause-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    font-weight: 400;
    color: #8FA3BF;
    opacity: 0.3;
    letter-spacing: 0.05em;
}

/* --- Math Block --- */
.math-block {
    margin-top: 0.5rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .blob-left,
    .blob-right {
        width: 85vw;
        margin-left: auto;
        margin-right: auto;
    }

    .annotation-blob {
        width: 75vw;
    }

    #nav-dots {
        right: 12px;
    }

    .blob-container {
        padding: clamp(1.5rem, 3vw, 2.5rem);
    }

    .blob-hero {
        width: 90vw;
        min-height: 50vh;
    }

    .blob-return,
    .blob-final {
        width: 85vw;
    }
}

@media (max-width: 480px) {
    .blob-left,
    .blob-right {
        width: 92vw;
    }

    .annotation-blob {
        width: 85vw;
    }

    #nav-dots {
        right: 8px;
        gap: 12px;
    }

    .nav-dot {
        width: 8px;
        height: 8px;
    }
}
