/* ============================================
   KLEOS - ANIMAZIONI AVANZATE SEZIONI
   Effetti: reveal, tilt, glow con REWIND
   Gli elementi escono da dove sono entrati
   ============================================ */

/* ============================================
   ZIPPER ANIMATION - Classe visible
   ============================================ */
.zipper-visible {
    opacity: 1 !important;
    transform: translateY(0) translateX(0) scale(1) rotate(0deg) !important;
}

/* ============================================
   REWIND ANIMATION BASE
   Gestito principalmente da JavaScript
   ============================================ */
.rewind-ready {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.rewind-ready.visible {
    opacity: 1;
}

/* ============================================
   SECTION HEADERS - ANIMATED
   ============================================ */
.section-header {
    position: relative;
}

.section-title {
    position: relative;
    display: inline-block;
}

/* Linea che si disegna sotto il titolo */
.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-red, #C41E3A), transparent);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.section-header.aos-animate .section-title::after {
    width: 80px;
}

/* Subtitle fade staggered */
.section-subtitle {
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.6s ease 0.3s;
}

.section-header.aos-animate .section-subtitle {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   METODO KLEOS CARDS - 3D TILT
   ============================================ */
.metodo-step {
    position: relative;
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    perspective: 1000px;
    overflow: hidden;
}

/* Glow effect on hover */
.metodo-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                rgba(196, 30, 58, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: 20px;
}

.metodo-step:hover::before {
    opacity: 1;
}

.metodo-step:hover {
    transform: translateY(-10px) rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg));
    box-shadow: 
        0 25px 50px rgba(0,0,0,0.15),
        0 0 0 1px rgba(196, 30, 58, 0.2);
}

/* Icon container animated */
.metodo-step-icon {
    position: relative;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-red, #C41E3A), #8B0000);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.metodo-step-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg) translateX(-100%);
    transition: transform 0.6s ease;
}

.metodo-step:hover .metodo-step-icon::before {
    transform: rotate(45deg) translateX(100%);
}

.metodo-step:hover .metodo-step-icon {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 10px 30px rgba(196, 30, 58, 0.4);
}

.metodo-step-icon i {
    font-size: 1.8rem;
    color: white;
    transition: transform 0.4s ease;
}

.metodo-step:hover .metodo-step-icon i {
    transform: scale(1.2);
}

/* Title with underline reveal */
.metodo-step-title {
    position: relative;
    display: inline-block;
    margin-bottom: 1rem;
}

.metodo-step-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-red, #C41E3A);
    transition: width 0.4s ease;
}

.metodo-step:hover .metodo-step-title::after {
    width: 100%;
}

/* Button magnetic effect */
.metodo-step-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.metodo-step-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(196, 30, 58, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
}

.metodo-step-btn:hover::before {
    width: 300%;
    height: 300%;
}

.metodo-step-btn:hover {
    transform: translateX(5px);
}

.metodo-step-btn i {
    transition: transform 0.3s ease;
}

.metodo-step-btn:hover i {
    transform: translateX(5px);
}

/* ============================================
   ECOSISTEMA SECTION
   ============================================ */
.ecosistema-kleos {
    position: relative;
    overflow: hidden;
}

/* Background animated gradient */
.ecosistema-kleos::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(196, 30, 58, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(196, 30, 58, 0.05) 0%, transparent 50%);
    animation: ecosistemaPulse 10s ease-in-out infinite;
}

@keyframes ecosistemaPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.ecosistema-feature {
    position: relative;
    padding: 2rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Shimmer effect */
.ecosistema-feature::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transition: left 0.8s ease;
}

.ecosistema-feature:hover::after {
    left: 100%;
}

.ecosistema-feature:hover {
    transform: translateY(-8px);
    border-color: rgba(196, 30, 58, 0.3);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.ecosistema-feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, rgba(196, 30, 58, 0.2), rgba(196, 30, 58, 0.1));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: all 0.4s ease;
}

.ecosistema-feature:hover .ecosistema-feature-icon {
    background: linear-gradient(135deg, var(--primary-red, #C41E3A), #8B0000);
    transform: rotate(-10deg) scale(1.1);
}

.ecosistema-feature-icon i {
    font-size: 1.5rem;
    color: var(--primary-red, #C41E3A);
    transition: color 0.4s ease;
}

.ecosistema-feature:hover .ecosistema-feature-icon i {
    color: white;
}

/* ============================================
   VANTAGGI SECTION - Gestito principalmente da JS
   ============================================ */
.vantaggi-kleos {
    position: relative;
}

.vantaggio-check i {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.vantaggio-item:hover .vantaggio-check i {
    transform: scale(1.2);
    color: var(--primary-red, #C41E3A);
}

/* ============================================
   CTA BUTTONS GLOBAL - RIPPLE EFFECT
   ============================================ */
.btn-kleos,
.btn-general {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-kleos::after,
.btn-general::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255,255,255,0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.btn-kleos:hover::after,
.btn-general:hover::after {
    animation: rippleEffect 1s ease-out;
}

@keyframes rippleEffect {
    0% {
        transform: scale(0) translate(-50%, -50%);
        opacity: 0.5;
    }
    100% {
        transform: scale(40) translate(-50%, -50%);
        opacity: 0;
    }
}

/* ============================================
   COUNTERS / STATS - ANIMATED
   ============================================ */
.stat-number {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-red, #C41E3A), #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: transform 0.3s ease;
}

.stat-number:hover {
    transform: scale(1.1);
}

/* ============================================
   FLOATING ELEMENTS - PARALLAX
   ============================================ */
.parallax-float {
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* ============================================
   SCROLL PROGRESS INDICATOR
   ============================================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-red, #C41E3A), #ff6b6b);
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* ============================================
   IMAGE REVEAL EFFECTS
   ============================================ */
.img-reveal {
    position: relative;
    overflow: hidden;
}

.img-reveal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-red, #C41E3A);
    transform: translateX(-100%);
    z-index: 1;
}

.img-reveal.revealed::before {
    animation: imgRevealSlide 0.8s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

@keyframes imgRevealSlide {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

.img-reveal img {
    transform: scale(1.2);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}

.img-reveal.revealed img {
    transform: scale(1);
}

/* ============================================
   TEXT SPLIT ANIMATION
   ============================================ */
.split-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) rotate(10deg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.split-text.revealed .char {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* Stagger delay per ogni carattere */
.split-text .char:nth-child(1) { transition-delay: 0.02s; }
.split-text .char:nth-child(2) { transition-delay: 0.04s; }
.split-text .char:nth-child(3) { transition-delay: 0.06s; }
.split-text .char:nth-child(4) { transition-delay: 0.08s; }
.split-text .char:nth-child(5) { transition-delay: 0.1s; }
.split-text .char:nth-child(6) { transition-delay: 0.12s; }
.split-text .char:nth-child(7) { transition-delay: 0.14s; }
.split-text .char:nth-child(8) { transition-delay: 0.16s; }
.split-text .char:nth-child(9) { transition-delay: 0.18s; }
.split-text .char:nth-child(10) { transition-delay: 0.2s; }

/* ============================================
   MAGNETIC BUTTONS
   ============================================ */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   CURSOR FOLLOWER (richiede JS)
   ============================================ */
.cursor-follower {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid var(--primary-red, #C41E3A);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.15s ease-out, width 0.2s, height 0.2s;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
}

.cursor-follower.hovering {
    width: 60px;
    height: 60px;
    background: rgba(196, 30, 58, 0.1);
}

/* ============================================
   NOISE TEXTURE OVERLAY
   ============================================ */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ============================================
   SMOOTH SCROLL SECTIONS
   ============================================ */
section {
    scroll-margin-top: 80px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .cursor-follower {
        display: none;
    }
    
    .metodo-step:hover {
        transform: translateY(-5px);
    }
    
    .vantaggio-item:hover {
        transform: translateX(5px);
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}