/**
 * Floating Sponsors - Fluid Movement with Proper Layering
 * Z-index: Background (0) < Sponsors (1-2) < Content (10+)
 */

/* Container - positioned between background and content */
.floating-sponsors-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    /* Critical: Above background gradient, below hero content */
    z-index: 1;
}

/* Ensure hero content stays above sponsors */
.hero-container,
.hero-content,
.countdown-timer,
.hero-badge,
.hero-title,
.hero-subtitle,
.hero-cta,
.btn,
.card,
.race-card,
.detail-card {
    position: relative;
    z-index: 10 !important;
}

/* Individual floating sponsor */
.floating-sponsor {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    will-change: transform;
    /* Keep sponsors in their layer */
    z-index: 1;
}

/* Sponsor bubble with glass morphism */
.floating-sponsor-bubble {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 50%;
    padding: 12px;
    box-shadow: 
        0 8px 32px rgba(31, 38, 135, 0.15),
        0 4px 16px rgba(31, 38, 135, 0.08),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effect */
.floating-sponsor:hover .floating-sponsor-bubble {
    transform: scale(1.2) rotate(10deg);
    box-shadow: 
        0 12px 40px rgba(31, 38, 135, 0.25),
        0 8px 24px rgba(31, 38, 135, 0.15),
        inset 0 0 0 2px rgba(255, 255, 255, 0.8);
}

/* Logo styling */
.floating-sponsor-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1.1) contrast(1.1);
}

/* Bouncing animation across full screen */
@keyframes bounceAround {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    10% {
        transform: translate(150px, 100px) rotate(36deg) scale(1.1);
    }
    20% {
        transform: translate(300px, 50px) rotate(72deg) scale(0.95);
    }
    30% {
        transform: translate(450px, 200px) rotate(108deg) scale(1.05);
    }
    40% {
        transform: translate(350px, 350px) rotate(144deg) scale(0.9);
    }
    50% {
        transform: translate(200px, 400px) rotate(180deg) scale(1.15);
    }
    60% {
        transform: translate(50px, 350px) rotate(216deg) scale(1);
    }
    70% {
        transform: translate(-100px, 250px) rotate(252deg) scale(1.1);
    }
    80% {
        transform: translate(-50px, 150px) rotate(288deg) scale(0.95);
    }
    90% {
        transform: translate(50px, 50px) rotate(324deg) scale(1.05);
    }
    100% {
        transform: translate(0, 0) rotate(360deg) scale(1);
    }
}

/* Floating path animation */
@keyframes floatPath {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(200px, -100px) rotate(90deg);
    }
    50% {
        transform: translate(400px, 100px) rotate(180deg);
    }
    75% {
        transform: translate(100px, 200px) rotate(270deg);
    }
}

/* Orbital animation */
@keyframes orbit {
    0% {
        transform: rotate(0deg) translateX(200px) rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) translateX(200px) rotate(-90deg) scale(1.1);
    }
    50% {
        transform: rotate(180deg) translateX(200px) rotate(-180deg) scale(0.9);
    }
    75% {
        transform: rotate(270deg) translateX(200px) rotate(-270deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) translateX(200px) rotate(-360deg) scale(1);
    }
}

/* Wave-like movement */
@keyframes wave {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    20% {
        transform: translate(100px, -50px) rotate(10deg);
    }
    40% {
        transform: translate(200px, 50px) rotate(-10deg);
    }
    60% {
        transform: translate(300px, -30px) rotate(15deg);
    }
    80% {
        transform: translate(150px, 30px) rotate(-15deg);
    }
}

/* Apply different animations to each sponsor */
.floating-sponsor:nth-child(1) {
    animation: bounceAround 25s infinite ease-in-out;
    top: 10%;
    left: 5%;
}

.floating-sponsor:nth-child(2) {
    animation: floatPath 20s infinite ease-in-out reverse;
    top: 15%;
    right: 10%;
}

.floating-sponsor:nth-child(3) {
    animation: orbit 30s infinite linear;
    top: 50%;
    left: 50%;
    transform-origin: center;
}

.floating-sponsor:nth-child(4) {
    animation: wave 18s infinite ease-in-out;
    bottom: 20%;
    left: 10%;
}

.floating-sponsor:nth-child(5) {
    animation: bounceAround 22s infinite ease-in-out reverse;
    bottom: 30%;
    right: 15%;
}

/* Additional sponsors */
.floating-sponsor:nth-child(n+6) {
    animation: floatPath 28s infinite ease-in-out;
}

/* Stagger animation delays */
.floating-sponsor:nth-child(1) { animation-delay: 0s; }
.floating-sponsor:nth-child(2) { animation-delay: 3s; }
.floating-sponsor:nth-child(3) { animation-delay: 6s; }
.floating-sponsor:nth-child(4) { animation-delay: 9s; }
.floating-sponsor:nth-child(5) { animation-delay: 12s; }

/* Tier-specific sizes */
.floating-sponsor[data-tier="main"] .floating-sponsor-bubble {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 215, 0, 0.4);
}

.floating-sponsor[data-tier="technical"] .floating-sponsor-bubble {
    width: 90px;
    height: 90px;
}

.floating-sponsor[data-tier="media"] .floating-sponsor-bubble {
    width: 85px;
    height: 85px;
}

.floating-sponsor[data-tier="support"] .floating-sponsor-bubble {
    width: 75px;
    height: 75px;
}

.floating-sponsor[data-tier="charity"] .floating-sponsor-bubble {
    width: 75px;
    height: 75px;
}

/* Mobile optimization */
@media (max-width: 768px) {
    /* Smaller bubbles on mobile */
    .floating-sponsor-bubble {
        width: 60px;
        height: 60px;
        padding: 8px;
    }
    
    .floating-sponsor[data-tier="main"] .floating-sponsor-bubble {
        width: 70px;
        height: 70px;
    }
    
    .floating-sponsor[data-tier="technical"] .floating-sponsor-bubble {
        width: 65px;
        height: 65px;
    }
    
    /* Simpler mobile animation */
    @keyframes mobileFloat {
        0%, 100% {
            transform: translate(0, 0) rotate(0deg) scale(1);
        }
        25% {
            transform: translate(50px, -30px) rotate(90deg) scale(1.05);
        }
        50% {
            transform: translate(100px, 30px) rotate(180deg) scale(0.95);
        }
        75% {
            transform: translate(30px, 50px) rotate(270deg) scale(1.05);
        }
    }
    
    /* Apply mobile animation to all sponsors */
    .floating-sponsor {
        animation: mobileFloat 15s infinite ease-in-out !important;
    }
    
    /* Reposition for mobile */
    .floating-sponsor:nth-child(1) { top: 5%; left: 5%; }
    .floating-sponsor:nth-child(2) { top: 10%; right: 5%; }
    .floating-sponsor:nth-child(3) { top: 40%; left: 10%; }
    .floating-sponsor:nth-child(4) { bottom: 30%; right: 10%; }
    .floating-sponsor:nth-child(5) { bottom: 10%; left: 15%; }
}

/* Very small mobile */
@media (max-width: 480px) {
    .floating-sponsor-bubble {
        width: 50px;
        height: 50px;
        padding: 6px;
    }
    
    .floating-sponsor[data-tier="main"] .floating-sponsor-bubble {
        width: 60px;
        height: 60px;
    }
}

/* Ensure proper layering in hero section */
.hero-section {
    position: relative;
}

.hero-gradient,
.hero-gradient-animated {
    position: absolute;
    z-index: 0;
}

.hero-overlay {
    position: absolute;
    z-index: 0;
}