/* ============================================
   KLEOS HERO - DYNAMIC VERSION
   Animazioni avanzate: parallax, morphing, glitch, particelle
   ============================================ */

:root {
    --primary-red: #C41E3A;
    --dark-red: #8B0000;
    --white: #ffffff;
    --dark: #0a0a0a;
}

/* ============================================
   CANVAS PARTICLES BACKGROUND
   ============================================ */
#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* ============================================
   HERO BACKGROUND IMAGE - ENHANCED
   ============================================ */
.hero-bg-image {
    transition: transform 0.3s ease-out;
    transform-origin: center center;
    will-change: transform;
}

.video-background {
    overflow: hidden;
}

/* Ken Burns effect alternativo (se preferisci) */
@keyframes kenBurns {
    0% { transform: scale(1) translate(0, 0); }
    50% { transform: scale(1.1) translate(-2%, -1%); }
    100% { transform: scale(1) translate(0, 0); }
}

.hero-bg-image.ken-burns {
    animation: kenBurns 30s ease-in-out infinite;
}

/* ============================================
   GRADIENT OVERLAY - SEGUE MOUSE
   ============================================ */
.hero-gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 600px 600px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(196, 30, 58, 0.2) 0%, transparent 70%),
        linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.6) 100%);
    z-index: 3;
    pointer-events: none;
    transition: --mouse-x 0.1s, --mouse-y 0.1s;
}

/* ============================================
   ELEMENTI DECORATIVI MORPHING
   ============================================ */
.hero-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

.morph-shape {
    position: absolute;
    border: 1px solid rgba(196, 30, 58, 0.25);
    will-change: transform;
}

/* Blob morphing grande - destra */
.morph-shape-1 {
    top: 12%;
    right: 6%;
    width: 180px;
    height: 180px;
    animation: morphBlob 12s ease-in-out infinite, floatY 8s ease-in-out infinite;
}

@keyframes morphBlob {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    33% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    66% { border-radius: 50% 60% 30% 60% / 30% 40% 70% 50%; }
}

/* Cerchio pulsante - destra basso */
.morph-shape-2 {
    bottom: 22%;
    right: 10%;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border-color: rgba(255, 255, 255, 0.12);
    animation: pulseGrow 4s ease-in-out infinite, floatY 6s ease-in-out infinite reverse;
}

@keyframes pulseGrow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.15); opacity: 0.8; }
}

/* Quadrato rotante - sinistra */
.morph-shape-3 {
    top: 35%;
    left: 4%;
    width: 55px;
    height: 55px;
    border-color: rgba(196, 30, 58, 0.2);
    animation: rotateFloat 18s linear infinite;
}

@keyframes rotateFloat {
    0% { transform: rotate(0deg) translateY(0); }
    50% { transform: rotate(180deg) translateY(-20px); }
    100% { transform: rotate(360deg) translateY(0); }
}

/* Linea glow - destra */
.morph-shape-4 {
    top: 65%;
    right: 8%;
    width: 100px;
    height: 2px;
    border: none;
    background: linear-gradient(90deg, transparent, rgba(196, 30, 58, 0.4), transparent);
    animation: lineStretch 4s ease-in-out infinite;
}

@keyframes lineStretch {
    0%, 100% { transform: scaleX(1); opacity: 0.4; }
    50% { transform: scaleX(1.8); opacity: 0.9; }
}

/* Cerchio piccolo - sinistra basso */
.morph-shape-5 {
    bottom: 28%;
    left: 8%;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border-color: rgba(255, 255, 255, 0.15);
    animation: floatBounce 5s ease-in-out infinite;
}

@keyframes floatBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-25px) scale(1.1); }
}

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-25px); }
}

/* ============================================
   HERO CONTENT
   ============================================ */
.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 850px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ============================================
   TITOLO CON GLITCH SOTTILE
   ============================================ */
.hero-title {
    font-size: clamp(2.2rem, 5.5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    color: var(--white);
    text-shadow: 0 4px 30px rgba(0,0,0,0.4);
}

.hero-title .highlight {
    color: var(--primary-red);
    position: relative;
    display: inline-block;
}

/* Glitch sottile */
.hero-title .highlight {
    animation: subtleGlitch 8s ease-in-out infinite;
}

@keyframes subtleGlitch {
    0%, 95%, 100% { text-shadow: none; }
    96% { text-shadow: -2px 0 #0ff, 2px 0 #f0f; }
    97% { text-shadow: 2px 0 #0ff, -2px 0 #f0f; }
    98% { text-shadow: none; }
}

/* Underline animato */
.hero-title .highlight::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-red), transparent);
    transform: scaleX(0);
    transform-origin: left;
    animation: drawLine 1.2s ease-out 0.6s forwards;
}

@keyframes drawLine {
    to { transform: scaleX(1); }
}

/* ============================================
   DESCRIZIONE
   ============================================ */
.hero-tagline {
    font-size: 1.4rem;
    font-weight: 300;
    color: rgba(255,255,255,0.9);
    margin-bottom: 1.8rem;
    line-height: 1.7;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-tagline strong {
    font-weight: 600;
    color: var(--white);
}

/* ============================================
   PILLS
   ============================================ */
.hero-pills {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.85rem 1.4rem;
    border-radius: 50px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.hero-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Shine */
.hero-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: pillShine 6s ease-in-out infinite;
}

.hero-pill:nth-child(2)::before { animation-delay: 2s; }
.hero-pill:nth-child(3)::before { animation-delay: 4s; }

@keyframes pillShine {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

.hero-pill i {
    font-size: 0.95rem;
}

.hero-pill.pill-ai i { color: #60a5fa; }
.hero-pill.pill-team i { color: #4ade80; }
.hero-pill.pill-fast i { color: #fbbf24; }

/* ============================================
   CTA
   ============================================ */
.hero-cta-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.btn-hero-primary {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    color: white;
    padding: 1.15rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 25px rgba(196, 30, 58, 0.35);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-hero-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px rgba(196, 30, 58, 0.5);
    color: white;
}

.btn-hero-primary .btn-icon {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.hero-cta-note {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.hero-cta-note span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.hero-cta-note i {
    color: #4ade80;
    font-size: 0.8rem;
}

.btn-hero-secondary {
    background: transparent;
    color: rgba(255,255,255,0.85);
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-hero-secondary:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.35);
    color: white;
}

/* ============================================
   QUICK STEPS INLINE
   ============================================ */
.hero-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}

.hero-step {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    opacity: 0;
    animation: stepIn 0.5s ease-out forwards;
}

.hero-step:nth-child(1) { animation-delay: 1.2s; }
.hero-step:nth-child(3) { animation-delay: 1.4s; }
.hero-step:nth-child(5) { animation-delay: 1.6s; }

@keyframes stepIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-step .step-num {
    width: 28px;
    height: 28px;
    background: rgba(196, 30, 58, 0.75);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.step-arrow {
    color: rgba(255,255,255,0.25);
    font-size: 0.65rem;
    opacity: 0;
    animation: stepIn 0.5s ease-out forwards;
}

.step-arrow:nth-child(2) { animation-delay: 1.3s; }
.step-arrow:nth-child(4) { animation-delay: 1.5s; }

/* ============================================
   CHAT BUTTON
   ============================================ */
.chat-trigger-wrapper {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1000;
}

.chat-trigger-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #000;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 15px;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(74, 222, 128, 0.35);
    animation: badgeFloat 2.5s ease-in-out infinite;
}

@keyframes badgeFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

.chat-trigger-btn {
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, var(--primary-red), var(--dark-red));
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 25px rgba(196, 30, 58, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chat-trigger-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 35px rgba(196, 30, 58, 0.5);
}

/* Pulse ring */
.chat-trigger-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid rgba(196, 30, 58, 0.6);
    border-radius: 50%;
    animation: ringExpand 2.5s ease-out infinite;
}

@keyframes ringExpand {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ============================================
   CHAT BUBBLE
   ============================================ */
.chat-bubble {
    position: fixed;
    bottom: 105px;
    right: 28px;
    background: white;
    padding: 12px 16px;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.12);
    max-width: 230px;
    z-index: 999;
    cursor: pointer;
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    animation: bubbleIn 0.4s ease-out 2.5s forwards;
}

@keyframes bubbleIn {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 22px;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid white;
}

.chat-bubble:hover {
    box-shadow: 0 6px 30px rgba(0,0,0,0.18);
}

.chat-bubble-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #555;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 9px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-bubble:hover .chat-bubble-close { opacity: 1; }
.chat-bubble-close:hover { background: var(--primary-red); }

.chat-bubble-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chat-bubble-icon {
    color: var(--primary-red);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.chat-bubble-text {
    font-size: 0.85rem;
    color: #333;
    line-height: 1.4;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 13px;
    background: var(--primary-red);
    margin-left: 1px;
    vertical-align: middle;
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.chat-bubble.hidden { display: none !important; }

/* ============================================
   SCROLL INDICATOR
   ============================================ */
.scroll-indicator {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    opacity: 0;
    animation: fadeUp 0.6s ease-out 2s forwards;
}

@keyframes fadeUp {
    to { opacity: 0.6; }
}

.scroll-indicator .mouse {
    width: 24px;
    height: 36px;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 15px;
    margin: 0 auto 6px;
    position: relative;
}

.scroll-indicator .wheel {
    width: 3px;
    height: 7px;
    background: rgba(255,255,255,0.6);
    border-radius: 2px;
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    animation: wheelScroll 1.8s ease-in-out infinite;
}

@keyframes wheelScroll {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
    60% { transform: translateX(-50%) translateY(8px); opacity: 0.2; }
}

.scroll-indicator p {
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .morph-shape-1 { width: 120px; height: 120px; }
    .morph-shape-2 { width: 50px; height: 50px; }
    .morph-shape-3 { width: 40px; height: 40px; }
    .morph-shape-4, .morph-shape-5 { display: none; }
    
    .step-arrow { display: none; }
}

@media (max-width: 768px) {
    .hero-shapes { display: none; }
    
    .hero-pills { flex-direction: column; align-items: center; }
    
    .hero-steps { flex-direction: column; gap: 0.6rem; }
    .hero-step { justify-content: center; }
    
    .chat-trigger-wrapper { bottom: 20px; right: 20px; }
    .chat-trigger-btn { width: 54px; height: 54px; font-size: 1.3rem; }
    .chat-trigger-badge { font-size: 0.6rem; padding: 2px 7px; }
    
    .chat-bubble { right: 20px; bottom: 88px; max-width: 200px; }
    
    .hero-tagline { font-size: 1rem; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.9rem; }
    .btn-hero-primary { padding: 0.9rem 1.8rem; font-size: 0.95rem; }
    .hero-cta-note { flex-direction: column; gap: 0.4rem; }
    .hero-pill { font-size: 0.8rem; padding: 0.55rem 0.9rem; }
}