/**
 * Tech Bubbles - Liquid Physics Section
 * Desktop: Matter.js physics with drag/throw
 * Mobile: Two-row scrolling marquee (opposite directions)
 * Liquid wobble effect using SVG filters
 */

/* ============================================
   SVG FILTER & LIQUID WOBBLE EFFECT
   ============================================ */

/* Hide the container until JS initializes - prevents flash */
#tech-bubbles-section {
    opacity: 0;
    transition: opacity 0.5s ease;
    position: relative;
    z-index: 10;
}

#tech-bubbles-section.initialized {
    opacity: 1;
}

.tech-bubbles-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    min-height: 550px;
    margin: 0 auto;
    overflow: visible;
    border-radius: 1rem;
}

/* Header inside container */
.tech-bubbles-header {
    text-align: center;
    padding: 2rem 1rem 0.5rem;
    position: relative;
    z-index: 100;
    pointer-events: none;
}

.tech-bubbles-header .imwp-section-title {
    margin-bottom: 0.25rem;
}

/* ============================================
   BUBBLE PILL STYLES
   ============================================ */

.tech-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 14px 24px;
    background: rgba(30, 30, 35, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    white-space: nowrap;
    z-index: 1;
    flex-shrink: 0;
    position: absolute;
    will-change: transform;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, filter 0.3s ease, border-radius 0.1s ease;
    gap: 12px;
    color: #ffffff;
}

/* Wobble effect - triggered on collision/click only */
.tech-bubble.wobble {
    animation: collisionWobble 0.4s ease-out;
}

@keyframes collisionWobble {
    0% {
        border-radius: 50px;
    }

    20% {
        border-radius: 46px 54px 48px 52px;
    }

    40% {
        border-radius: 54px 46px 52px 48px;
    }

    60% {
        border-radius: 48px 52px 54px 46px;
    }

    80% {
        border-radius: 52px 48px 46px 54px;
    }

    100% {
        border-radius: 50px;
    }
}



/* Logo inside bubble */
.tech-bubble-logo {
    width: auto;
    height: 24px;
    max-width: 140px;
    flex-shrink: 0;
    object-fit: contain;
    pointer-events: none;
}

/* ============================================
   HOVER & INTERACTION STATES
   ============================================ */

.tech-bubble:hover {
    filter: brightness(1.15);
    border-color: rgba(207, 91, 46, 0.5);
    box-shadow:
        0 8px 35px rgba(207, 91, 46, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 20px rgba(207, 91, 46, 0.2);
}



.tech-bubble:active,
.tech-bubble.dragging {
    cursor: grabbing;
    z-index: 100;
    filter: brightness(1.2);
    border-color: rgba(207, 91, 46, 0.7);
    box-shadow:
        0 15px 50px rgba(207, 91, 46, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 30px rgba(207, 91, 46, 0.3);
    animation: none;
}

/* ============================================
   LIGHT THEME STYLES
   ============================================ */

html[data-theme="light"] .tech-bubble {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    color: #1a1a1a !important;
}

html[data-theme="light"] .tech-bubble:hover {
    border-color: rgba(207, 91, 46, 0.4);
    box-shadow:
        0 8px 35px rgba(207, 91, 46, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 0 20px rgba(207, 91, 46, 0.15);
}

html[data-theme="light"] .tech-bubble:active,
html[data-theme="light"] .tech-bubble.dragging {
    border-color: rgba(207, 91, 46, 0.6);
    box-shadow:
        0 15px 50px rgba(207, 91, 46, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 0 30px rgba(207, 91, 46, 0.2);
}

html[data-theme="light"] .tech-bubble-logo.invert-on-light {
    filter: invert(1);
}

.tech-bubble-logo.invert-on-dark {
    filter: invert(1);
}

html[data-theme="light"] .tech-bubble-logo.invert-on-dark {
    filter: none;
}

/* ============================================
   PHYSICS CANVAS (Desktop)
   ============================================ */

.physics-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ============================================
   MOBILE MARQUEE
   ============================================ */

.tech-bubbles-container.mobile-marquee {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    padding: 1rem 0;
    height: auto;
    min-height: 180px;
}

.tech-bubbles-container.mobile-marquee .tech-bubbles-header {
    display: block;
    position: relative;
    padding: 1rem 1rem 0.5rem;
    text-align: center;
}

.marquee-row {
    display: flex;
    gap: 1rem;
    width: max-content;
}

.marquee-row .tech-bubble {
    position: relative;
    animation: liquidWobble 4s ease-in-out infinite;
    padding: 10px 18px;
}

.marquee-row .tech-bubble-logo {
    height: 20px;
    max-width: 100px;
}

/* Row 1: scroll left */
.marquee-row-1 {
    animation: marqueeLeft 30s linear infinite;
}

/* Row 2: scroll right */
.marquee-row-2 {
    animation: marqueeRight 35s linear infinite;
}

@keyframes marqueeLeft {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

@keyframes marqueeRight {
    0% {
        transform: translateX(-50%);
    }

    100% {
        transform: translateX(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 767px) {
    .tech-bubbles-container:not(.mobile-marquee) {
        display: none;
    }

    .tech-bubble {
        position: relative;
    }
}

@media (min-width: 768px) {
    .tech-bubbles-container.mobile-marquee {
        display: none;
    }
}