/* =============================================
   concengine.com - Neomorphic Bubble Engine
   ============================================= */

:root {
    --nm-bg: #E8E4F0;
    --nm-shadow-dark: #C9C3D9;
    --nm-shadow-light: #FFFFFF;
    --nm-raised: 8px 8px 16px #C9C3D9, -8px -8px 16px #FFFFFF;
    --nm-recessed: inset 6px 6px 12px #C9C3D9, inset -6px -6px 12px #FFFFFF;
    --nm-bubble: 12px 12px 24px #C9C3D9, -12px -12px 24px #FFFFFF, inset -4px -4px 8px rgba(255,204,213,0.3);
    --accent-coral: #F7A8B8;
    --accent-mint: #A8F0D4;
    --accent-butter: #F5E6A3;
    --text-primary: #3A2E4D;
    --text-secondary: #7B6F8E;
    --pulse-color: #B8A9E8;
    --bubble-glow: #FFCCD5;
    --surface-raised: #EDE9F5;
    --surface-recessed: #DDD8EA;
    --radius-soft: 16px;
    --radius-round: 50%;
    --font-display: 'Nunito', sans-serif;
    --font-body: 'Quicksand', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--nm-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.75;
    font-size: 1.125rem;
    font-weight: 400;
}

/* ---- Particle Canvas ---- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

/* ---- Navigation Pill ---- */
#nav-pill {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: var(--nm-bg);
    box-shadow: var(--nm-raised);
    border-radius: 32px;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 0;
    height: 48px;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), padding 0.3s ease, gap 0.3s ease;
    cursor: pointer;
    width: auto;
    max-width: 160px;
}

#nav-pill:hover {
    max-width: 600px;
    gap: 16px;
    padding: 8px 28px;
}

.nav-wordmark {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 12px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease 0.1s;
    white-space: nowrap;
}

#nav-pill:hover .nav-links {
    opacity: 1;
}

.nav-links a {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius-soft);
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: var(--surface-raised);
}

/* ---- Chambers ---- */
.chamber {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 96px 48px 48px;
    z-index: 2;
    overflow: hidden;
}

.chamber-bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, var(--surface-raised) 0%, var(--surface-recessed) 100%);
    opacity: 0.5;
    pointer-events: none;
    z-index: -1;
}

.chamber-bg-gradient.warm {
    background: radial-gradient(ellipse at center, #EDE4F0 0%, #F0E8EE 100%);
    opacity: 0.7;
}

.chamber-warm {
    background: linear-gradient(180deg, var(--nm-bg) 0%, #F0E8EE 100%);
}

/* ---- Z-Pattern Elements ---- */
.z-top-bar {
    align-self: flex-start;
    max-width: 680px;
    width: 100%;
    padding: 24px 32px;
    border-radius: var(--radius-soft);
    z-index: 5;
}

.raised-ridge {
    box-shadow: var(--nm-raised);
    background: var(--nm-bg);
}

.z-bottom-bar {
    align-self: flex-end;
    max-width: 680px;
    width: 100%;
    padding: 24px 32px;
    border-radius: var(--radius-soft);
    z-index: 5;
}

.recessed-trough {
    box-shadow: var(--nm-recessed);
    background: var(--nm-bg);
}

/* ---- Typography ---- */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
}

h2 {
    font-size: clamp(1.8rem, 3.5vw, 3rem);
}

h3 {
    font-size: clamp(1.3rem, 2.5vw, 2rem);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text-primary);
}

/* Kinetic text - characters wrapped in spans by JS */
.kinetic-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kinetic-text .char.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.kinetic-text .char-space {
    display: inline-block;
    width: 0.3em;
}

/* Fade-in text */
.fade-in-text {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Bubbles ---- */
.engine-bubble {
    border-radius: var(--radius-round);
    box-shadow: var(--nm-bubble);
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.6), rgba(255,204,213,0.15) 50%, rgba(184,169,232,0.1) 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease-out;
}

.engine-bubble:hover {
    transform: scale(1.04);
    box-shadow: 14px 14px 28px #C9C3D9, -14px -14px 28px #FFFFFF, inset -4px -4px 8px rgba(255,204,213,0.3);
}

.large-bubble {
    width: clamp(240px, 35vw, 400px);
    height: clamp(240px, 35vw, 400px);
    animation: bubbleRotate 20s linear infinite;
}

.medium-bubble {
    animation: bubbleRotate 25s linear infinite reverse;
}

.bubble-160 {
    width: 160px;
    height: 160px;
}

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

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

.bubble-inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bubble-specular {
    position: absolute;
    top: 12%;
    left: 22%;
    width: 30%;
    height: 20%;
    border-radius: var(--radius-round);
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    transform: rotate(-25deg);
}

.bubble-specular.large-spec {
    top: 8%;
    left: 18%;
    width: 35%;
    height: 25%;
}

.wireframe-ico {
    opacity: 0.7;
}

.wireframe-rotate {
    transform-origin: center;
    animation: wireframeRotate 15s linear infinite;
}

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

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

/* ---- Z-Diagonal / Bubble Bridge ---- */
.z-diagonal {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 32px;
    z-index: 5;
}

.bubble-bridge {
    flex-wrap: wrap;
}

/* ---- Data Bubbles ---- */
.data-bubble {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: var(--x, 50%);
    top: var(--y, 50%);
    transform: translate(-50%, -50%);
    animation: dataHover 3s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    box-shadow: 6px 6px 12px #C9C3D9, -6px -6px 12px #FFFFFF;
}

.data-bubble.mint {
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(168,240,212,0.4));
}

.data-bubble.butter {
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(245,230,163,0.4));
}

.data-bubble span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    opacity: 0.7;
}

@keyframes dataHover {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-8px); }
}

/* ---- Pulse Attention ---- */
.pulse-attention {
    position: relative;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-round);
    border: 2px solid var(--pulse-color);
    transform: translate(-50%, -50%);
    animation: pulseRing 2s ease-out infinite;
    pointer-events: none;
}

@keyframes pulseRing {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.6;
    }
    100% {
        width: 160%;
        height: 160%;
        opacity: 0;
    }
}

/* ---- Transition Zones ---- */
.transition-zone {
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.transition-bubble {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-round);
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.6), var(--bubble-glow) 60%, var(--accent-coral) 100%);
    box-shadow: var(--nm-bubble);
    transition: transform 0.3s ease;
}

/* ---- Concentric Rings ---- */
.concentric-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.rings-right {
    left: auto;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
}

/* ---- Connection Filaments ---- */
.filaments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ---- Chamber 3: Flow Channel ---- */
.flow-channel-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
    padding: 80px 0;
}

.flow-channel {
    width: 80%;
    height: 64px;
    border-radius: 32px;
    position: relative;
    overflow: hidden;
}

.flow-bubble-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.flow-data-bubble {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-round);
    top: 50%;
    transform: translateY(-50%);
    animation: flowMove var(--speed, 4s) linear infinite;
    animation-delay: calc(var(--speed, 4s) * -1 * var(--offset-num, 0));
    left: -32px;
}

.flow-data-bubble.mint {
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.7), var(--accent-mint));
    box-shadow: 4px 4px 8px #C9C3D9, -4px -4px 8px #FFFFFF;
}

.flow-data-bubble.coral {
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.7), var(--accent-coral));
    box-shadow: 4px 4px 8px #C9C3D9, -4px -4px 8px #FFFFFF;
}

.flow-data-bubble.butter {
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.7), var(--accent-butter));
    box-shadow: 4px 4px 8px #C9C3D9, -4px -4px 8px #FFFFFF;
}

@keyframes flowMove {
    0% { left: -32px; }
    100% { left: calc(100% + 32px); }
}

/* Concept Bubbles */
.concept-bubble {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}

.concept-bubble.above {
    top: 0;
}

.concept-bubble.below {
    bottom: 0;
}

.concept-bubble span {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--nm-bg);
    box-shadow: 4px 4px 8px #C9C3D9, -4px -4px 8px #FFFFFF;
    border-radius: var(--radius-soft);
    padding: 6px 14px;
}

.concept-bubble .filament-line {
    margin-top: 4px;
}

.concept-bubble.below .filament-line.up {
    order: -1;
    margin-top: 0;
    margin-bottom: 4px;
}

/* ---- Chamber 4: Resilience ---- */
.resilience-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
    gap: 16px;
    padding: 0 48px;
}

.compress-wall {
    width: 24px;
    height: 200px;
    border-radius: var(--radius-soft);
    flex-shrink: 0;
}

.resilience-bubbles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex: 1;
}

.resilient-bubble {
    transition: border-radius 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rb-1 {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.6), rgba(247,168,184,0.2) 60%, rgba(184,169,232,0.1));
}

.rb-2 {
    width: 140px;
    height: 140px;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.6), rgba(168,240,212,0.2) 60%, rgba(184,169,232,0.1));
}

.rb-3 {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.6), rgba(245,230,163,0.2) 60%, rgba(184,169,232,0.1));
}

/* Compressed state */
.resilient-bubble.compressed {
    border-radius: 40%;
}

.rb-1.compressed {
    width: 140px;
    height: 100px;
}

.rb-2.compressed {
    width: 160px;
    height: 110px;
}

.rb-3.compressed {
    width: 120px;
    height: 80px;
}

/* ---- Chamber 5: Invitation ---- */
.invitation-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.invite-bubble {
    width: clamp(200px, 30vw, 320px);
    height: clamp(200px, 30vw, 320px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.6), rgba(255,204,213,0.2) 50%, rgba(184,169,232,0.15) 100%);
    transition: transform 1s ease;
}

.neo-button {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--text-primary);
    background: var(--nm-bg);
    border: none;
    border-radius: 32px;
    padding: 16px 40px;
    cursor: pointer;
    box-shadow: var(--nm-raised);
    transition: box-shadow 0.2s ease-out, transform 0.2s ease-out;
    position: relative;
    z-index: 2;
}

.neo-button:hover {
    transform: scale(1.04);
    box-shadow: 10px 10px 20px #C9C3D9, -10px -10px 20px #FFFFFF;
}

.neo-button:active {
    box-shadow: var(--nm-recessed);
    transform: scale(0.97);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .chamber {
        padding: 80px 24px 32px;
    }

    .z-top-bar,
    .z-bottom-bar {
        align-self: stretch;
        max-width: 100%;
        padding: 16px 20px;
    }

    .z-diagonal,
    .bubble-bridge {
        flex-direction: column;
        gap: 20px;
    }

    .data-bubble {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        animation: dataHoverMobile 3s ease-in-out infinite;
        animation-delay: var(--delay, 0s);
    }

    @keyframes dataHoverMobile {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-8px); }
    }

    .flow-channel {
        width: 95%;
        height: 48px;
    }

    .concept-bubble {
        display: none;
    }

    .resilience-zone {
        padding: 0 16px;
        gap: 8px;
    }

    .compress-wall {
        width: 16px;
        height: 140px;
    }

    .resilience-bubbles {
        gap: 12px;
    }

    .rb-1 { width: 80px; height: 80px; }
    .rb-2 { width: 100px; height: 100px; }
    .rb-3 { width: 70px; height: 70px; }

    .rb-1.compressed { width: 95px; height: 65px; }
    .rb-2.compressed { width: 115px; height: 75px; }
    .rb-3.compressed { width: 85px; height: 55px; }

    .large-bubble {
        width: 200px;
        height: 200px;
    }

    #nav-pill {
        max-width: 140px;
        padding: 6px 16px;
        height: 40px;
    }

    .nav-wordmark {
        font-size: 0.85rem;
    }

    .transition-zone {
        height: 20vh;
    }
}

/* ---- Utility ---- */
.hidden {
    display: none;
}
