/* ============================================
   economics.day - Blobitecture Fluid Layout
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --liquid-teal: #0D7377;
    --magma-coral: #E8654A;
    --deep-humus: #2C1810;
    --pale-calcium: #F6F1EA;
    --peat: #3D2E1F;
    --overlap-umber: #7A4B2A;
    --mineral-green: #A8C5A0;

    --font-display: 'Sora', sans-serif;
    --font-body: 'Source Serif 4', serif;
    --font-mono: 'DM Mono', monospace;

    --ease-natural: cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

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

body {
    font-family: var(--font-body);
    background-color: var(--pale-calcium);
    color: var(--peat);
    overflow-x: hidden;
    position: relative;
    line-height: 1.65;
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    font-weight: 400;
}

/* --- Grain Overlay (SVG turbulence noise) --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Sediment Layers (fixed background bands) --- */
#sediment-layers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.sediment-band {
    position: absolute;
    left: -10%;
    width: 120%;
    height: 40%;
}

.sediment-green {
    top: -5%;
    background: var(--mineral-green);
    opacity: 0.08;
    transform: rotate(-2deg);
}

.sediment-coral {
    top: 35%;
    background: var(--magma-coral);
    opacity: 0.06;
    transform: rotate(3deg);
}

.sediment-teal {
    top: 70%;
    background: var(--liquid-teal);
    opacity: 0.05;
    transform: rotate(-4deg);
}

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

.nav-bubble {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid rgba(44, 24, 16, 0.3);
    background: rgba(246, 241, 234, 0.7);
    backdrop-filter: blur(4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s var(--ease-natural);
}

.nav-bubble:hover {
    background: var(--liquid-teal);
    border-color: var(--liquid-teal);
    transform: scale(1.15);
}

.nav-bubble:hover .nav-label {
    color: var(--pale-calcium);
}

.nav-bubble.active {
    background: var(--liquid-teal);
    border-color: var(--liquid-teal);
}

.nav-bubble.active .nav-label {
    color: var(--pale-calcium);
}

.nav-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--liquid-teal);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
}

/* --- Blob Keyframes --- */
@keyframes blobMorph1 {
    0%, 100% { border-radius: 35% 65% 55% 45% / 50% 40% 65% 55%; }
    25% { border-radius: 45% 55% 65% 35% / 55% 45% 55% 50%; }
    50% { border-radius: 55% 45% 40% 60% / 45% 60% 40% 55%; }
    75% { border-radius: 40% 60% 50% 50% / 60% 35% 55% 45%; }
}

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

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

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

@keyframes blobPulseReverse {
    0%, 100% { transform: scale(1.03); }
    50% { transform: scale(0.97); }
}

@keyframes flowDash {
    0% { stroke-dashoffset: 1000; }
    100% { stroke-dashoffset: 0; }
}

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

@keyframes conceptDrift {
    0%, 100% { transform: translate(var(--drift-x, 0px), var(--drift-y, 0px)); }
    50% { transform: translate(calc(var(--drift-x, 0px) * -1), calc(var(--drift-y, 0px) * -1)); }
}

/* --- Section: The Reservoir --- */
.section-reservoir {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

/* Background blobs */
.reservoir-bg-blob {
    position: absolute;
    width: 30vw;
    height: 30vw;
    opacity: 0;
    animation-fill-mode: forwards;
}

.reservoir-bg-blob.blob-coral {
    background: radial-gradient(ellipse at 50% 50%, var(--magma-coral) 0%, rgba(232, 101, 74, 0.3) 40%, transparent 70%);
    top: 15%;
    left: 10%;
    opacity: 0.4;
    animation: blobMorph2 15s ease-in-out infinite, blobPulse 10s ease-in-out infinite;
    animation-delay: 0.5s;
}

.reservoir-bg-blob.blob-humus {
    background: radial-gradient(ellipse at 50% 50%, var(--deep-humus) 0%, rgba(44, 24, 16, 0.3) 40%, transparent 70%);
    bottom: 10%;
    right: 8%;
    opacity: 0.4;
    animation: blobMorph3 18s ease-in-out infinite, blobPulseReverse 12s ease-in-out infinite;
    animation-delay: 0.7s;
}

/* Hero blob */
.hero-blob {
    position: relative;
    width: 65vw;
    height: 60vh;
    min-height: 400px;
    background: radial-gradient(ellipse at 40% 45%, var(--liquid-teal) 0%, rgba(13, 115, 119, 0.3) 50%, transparent 80%);
    border-radius: 35% 65% 55% 45% / 50% 40% 65% 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: blobMorph1 12s ease-in-out infinite, blobPulse 8s ease-in-out infinite;
    box-shadow: inset 0 0 60px rgba(13, 115, 119, 0.1);
    opacity: 0;
    transition: opacity 1.2s var(--ease-natural);
    z-index: 2;
}

.hero-blob.visible {
    opacity: 1;
}

.hero-blob-inner {
    text-align: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.8s var(--ease-natural);
    transition-delay: 0.5s;
}

.hero-blob.visible .hero-blob-inner {
    opacity: 1;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 5.5rem);
    color: var(--deep-humus);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin-bottom: 0.5em;
}

.site-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    color: var(--peat);
    opacity: 0.7;
    max-width: 38ch;
    margin: 0 auto;
    line-height: 1.5;
}

/* --- Flow Lines --- */
.flow-line {
    position: relative;
    width: 100%;
    height: 200px;
    z-index: 1;
    display: block;
    overflow: visible;
}

.flow-path {
    fill: none;
    stroke: rgba(44, 24, 16, 0.25);
    stroke-width: 1.5;
    stroke-dasharray: 8 12;
    stroke-dashoffset: 1000;
    animation: flowDash 40s linear infinite;
    stroke-linecap: round;
}

/* --- Wavy Dividers --- */
.wavy-divider {
    position: absolute;
    width: 100%;
    height: 60px;
    z-index: 2;
    pointer-events: none;
}

.wavy-divider-1 {
    top: 95vh;
}

.wavy-divider-2 {
    top: calc(250vh + 200px);
}

.wavy-path {
    fill: none;
    stroke: rgba(44, 24, 16, 0.15);
    stroke-width: 3;
    stroke-linecap: round;
}

/* --- Section: The Confluence --- */
.section-confluence {
    position: relative;
    min-height: 150vh;
    padding: 10vh 5vw;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confluence-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* Narrative blobs */
.narrative-blob {
    position: relative;
    width: 40vw;
    min-width: 300px;
    max-width: 550px;
    min-height: 280px;
    padding: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 60px rgba(13, 115, 119, 0.08);
    mix-blend-mode: multiply;
    opacity: 0;
    transition: opacity 0.8s var(--ease-natural), transform 0.8s var(--ease-natural);
}

.narrative-blob.visible {
    opacity: 1;
    transform: translate(0, 0) !important;
}

.narrative-blob-inner {
    position: relative;
    z-index: 2;
    max-width: 38ch;
}

.blob-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--deep-humus);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin-bottom: 1rem;
}

.blob-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    color: var(--peat);
    line-height: 1.65;
}

/* Production blob - from left */
.blob-production {
    background: radial-gradient(ellipse at 45% 50%, rgba(13, 115, 119, 0.5) 0%, rgba(13, 115, 119, 0.15) 50%, transparent 80%);
    border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
    animation: blobMorph1 14s ease-in-out infinite;
    align-self: flex-start;
    transform: translateX(-30vw);
    margin-bottom: -8vh;
}

/* Distribution blob - from right */
.blob-distribution {
    background: radial-gradient(ellipse at 55% 50%, rgba(232, 101, 74, 0.45) 0%, rgba(232, 101, 74, 0.12) 50%, transparent 80%);
    border-radius: 55% 45% 40% 60% / 45% 55% 50% 50%;
    animation: blobMorph2 16s ease-in-out infinite;
    align-self: flex-end;
    transform: translateX(30vw);
    margin-bottom: -8vh;
}

/* Consumption blob - from bottom */
.blob-consumption {
    background: radial-gradient(ellipse at 50% 45%, rgba(168, 197, 160, 0.5) 0%, rgba(168, 197, 160, 0.15) 50%, transparent 80%);
    border-radius: 45% 55% 60% 40% / 55% 45% 45% 55%;
    animation: blobMorph3 13s ease-in-out infinite;
    align-self: center;
    transform: translateY(30vh);
}

/* --- Section: The Delta --- */
.section-delta {
    position: relative;
    min-height: 150vh;
    padding: 15vh 5vw;
    z-index: 1;
}

.delta-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

/* Concept blobs */
.concept-blob {
    --drift-x: calc((var(--i) * 17 % 40 - 20) * 0.3px);
    --drift-y: calc((var(--i) * 23 % 30 - 15) * 0.3px);
    position: relative;
    aspect-ratio: 1;
    min-width: 100px;
    max-width: 180px;
    background: var(--blob-color);
    border-radius: 40% 60% 55% 45% / 50% 45% 55% 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: transform 0.4s var(--ease-natural), border-radius 0.4s var(--ease-natural);
    animation: blobMorph1 calc(10s + var(--i) * 1s) ease-in-out infinite, conceptDrift calc(15s + var(--i) * 2s) ease-in-out infinite;
    box-shadow: inset 0 0 40px rgba(13, 115, 119, 0.06);
    opacity: 0;
    transform: translateX(calc((var(--i) * 17 % 40 - 20) * 1px)) translateY(calc((var(--i) * 23 % 30 - 15) * 1px));
}

.concept-blob.visible {
    opacity: 1;
}

.concept-blob:hover {
    transform: scale(1.15) translateX(0) translateY(0);
    border-radius: 50%;
}

.concept-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--liquid-teal);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.5rem;
    line-height: 1.2;
}

/* --- Section: The Estuary --- */
.section-estuary {
    position: relative;
    min-height: 100vh;
    padding: 15vh 5vw;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.estuary-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.closing-blob {
    position: relative;
    width: 65vw;
    min-width: 320px;
    max-width: 800px;
    min-height: 50vh;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(13, 115, 119, 0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(232, 101, 74, 0.25) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(168, 197, 160, 0.3) 0%, transparent 70%);
    border-radius: 40% 60% 50% 50% / 55% 45% 55% 45%;
    animation: blobMorph2 16s ease-in-out infinite;
    box-shadow: inset 0 0 80px rgba(13, 115, 119, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 1s var(--ease-natural), transform 1s var(--ease-natural);
}

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

.closing-blob-inner {
    max-width: 38ch;
}

.closing-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.15rem;
    color: var(--peat);
    line-height: 1.7;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-blob {
        width: 85vw;
        height: 50vh;
        min-height: 320px;
    }

    .reservoir-bg-blob {
        width: 40vw;
        height: 40vw;
    }

    .narrative-blob {
        width: 80vw;
        min-width: 260px;
        max-width: 100%;
    }

    .blob-production {
        align-self: center;
    }

    .blob-distribution {
        align-self: center;
    }

    .confluence-container {
        gap: 4vh;
    }

    .closing-blob {
        width: 85vw;
        padding: 2.5rem;
    }

    .delta-container {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 1.2rem;
    }

    #nav-bubbles {
        right: 12px;
        gap: 12px;
    }

    .nav-bubble {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .hero-blob {
        width: 92vw;
        height: 45vh;
    }

    .narrative-blob {
        width: 90vw;
        padding: 2rem;
        min-height: 220px;
    }

    .closing-blob {
        width: 92vw;
        padding: 2rem;
    }

    .delta-container {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 1rem;
    }

    .concept-blob {
        min-width: 80px;
    }
}
