/**
 * Hero Network/Spider Web Effect - TICINO AUTO SA
 * Animated network lines with gradient fade from center to bottom
 */

/* Network Container */
.hero-bubbles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 2 !important;
    /* Gradient mask - transparent from middle to bottom */
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0) 60%, rgba(0,0,0,0) 100%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0) 60%, rgba(0,0,0,0) 100%);
}

/* Network Canvas */
.hero-network-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Network Node Points */
.hero-node {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(220, 38, 38, 0.6) 40%,
        rgba(249, 115, 22, 0.3) 70%,
        transparent 100%
    );
    box-shadow: 
        0 0 10px rgba(220, 38, 38, 0.5),
        0 0 20px rgba(249, 115, 22, 0.3),
        0 0 30px rgba(220, 38, 38, 0.2);
    pointer-events: none;
    will-change: transform;
}

/* Node pulse animation */
@keyframes node-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.hero-node.pulsing {
    animation: node-pulse 2s ease-in-out infinite;
}

/* Network Lines - drawn via canvas, but we can add glow overlay */
.hero-line-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center 30%,
        rgba(220, 38, 38, 0.05) 0%,
        transparent 50%
    );
}

/* Light mode adjustments */
[data-theme="light"] .hero-node {
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255, 255, 255, 1) 0%,
        rgba(220, 38, 38, 0.7) 40%,
        rgba(249, 115, 22, 0.4) 70%,
        transparent 100%
    );
    box-shadow: 
        0 0 15px rgba(220, 38, 38, 0.6),
        0 0 25px rgba(249, 115, 22, 0.4),
        0 0 35px rgba(220, 38, 38, 0.3);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hero-node {
        animation: none !important;
    }
}

/* Mobile optimization */
@media (max-width: 768px) {
    .hero-bubbles-container {
        -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,0.3) 45%, rgba(0,0,0,0) 55%, rgba(0,0,0,0) 100%);
        mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,0.3) 45%, rgba(0,0,0,0) 55%, rgba(0,0,0,0) 100%);
    }
}

/* Hero Title Letter Glow Effect - Cloned Letter with Bottom Reveal on Hover */
.hero-title .letter-wrapper {
    display: inline-block;
    position: relative;
}

.hero-title .letter {
    display: inline;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cloned letter layer - same font/size, positioned 10px lower, overlaid */
.hero-title .letter-clone {
    position: absolute;
    left: 0;
    top: 2px;
    opacity: 0;
    pointer-events: none;
    color: inherit;
    font: inherit;
    line-height: inherit;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 50%,
        rgba(220, 38, 38, 0.5) 60%,
        rgba(249, 115, 22, 0.8) 75%,
        rgba(220, 38, 38, 1) 90%,
        rgba(220, 38, 38, 1) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: blur(0.5px);
    text-shadow: none;
    transition: opacity 0.4s ease;
    animation: clone-glow 2s ease-in-out infinite;
}

.hero-title .letter-wrapper:hover .letter-clone {
    opacity: 1;
}

/* Glowing light effect at bottom of letter on hover */
.hero-title .letter-glow {
    position: absolute;
    left: -20%;
    right: -20%;
    bottom: -4px;
    height: 8px;
    opacity: 0;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        rgba(249, 115, 22, 0.9) 0%,
        rgba(220, 38, 38, 0.7) 40%,
        transparent 70%
    );
    filter: blur(4px);
    transition: opacity 0.4s ease;
    animation: glow-fade 1.5s ease-in-out infinite;
}

.hero-title .letter-wrapper:hover .letter-glow {
    opacity: 1;
}

/* Glowing animation for cloned letter */
@keyframes clone-glow {
    0%, 100% {
        filter: blur(0.5px) brightness(1);
    }
    50% {
        filter: blur(0.5px) brightness(1.3);
    }
}

/* Light mode adjustments */
[data-theme="light"] .hero-title .letter-clone {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 50%,
        rgba(220, 38, 38, 0.6) 60%,
        rgba(249, 115, 22, 0.9) 75%,
        rgba(220, 38, 38, 1) 90%,
        rgba(220, 38, 38, 1) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
}