/*!
 * Hello Elementor Child - Grain Effect
 * Version: 1.0.0
 * Description: Effetto grain/noise sempre visibile
 * File: /assets/css/grain.css
 */

/* =============================================================================
   GRAIN EFFECT - SEMPRE ATTIVO
   ============================================================================= */

.grain {
    position: fixed !important;
    top: -50% !important;
    left: -50% !important;
    width: 200% !important;
    height: 200% !important;
    background: url('/wp-content/uploads/2025/08/noise.png') repeat;
    background-size: 200px 200px;
    opacity: 0.15;
    animation: noise 1.2s steps(10) infinite both;
    pointer-events: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    z-index: 99998;
    mix-blend-mode: multiply;
    max-width: unset !important;
    
    /* Ottimizzazioni performance */
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    /* Blocca completamente le interazioni */
    pointer-events: none !important;
    touch-action: none !important;
    
    /* Impedisce selezione e interazioni */
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    
    /* iOS specifico */
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
    
    /* Impedisce che intercetti eventi touch */
    -webkit-touch-action: none !important;
    -ms-touch-action: none !important;
}

@keyframes noise {
    0% { transform: translate3d(1%, -1%, 0); }
    10% { transform: translate3d(-5%, -2%, 0); }
    20% { transform: translate3d(10%, 5%, 0); }
    30% { transform: translate3d(5%, -11%, 0); }
    40% { transform: translate3d(-12%, -5%, 0); }
    50% { transform: translate3d(10%, 9%, 0); }
    60% { transform: translate3d(15%, 0%, 0); }
    70% { transform: translate3d(-10%, 8%, 0); }
    80% { transform: translate3d(10%, 2%, 0); }
    90% { transform: translate3d(1%, 5%, 0); }
    100% { transform: translate3d(0%, 8%, 0); }
}

/* =============================================================================
   OTTIMIZZAZIONI PERFORMANCE E ACCESSIBILITÀ
   ============================================================================= */

/* Disabilita grain per chi preferisce movimento ridotto */
@media (prefers-reduced-motion: reduce) {
    .grain {
        animation: none !important;
        opacity: 0.05 !important; /* Versione statica molto leggera */
    }
}

/* Riduce intensità su mobile per risparmiare batteria */
@media (max-width: 768px) {
    .grain {
        opacity: 0.08;
        animation-duration: 2s; /* Più lento = meno consumo batteria */
    }
}

/* Disabilita su connessioni lente per risparmiare dati */
@media (prefers-reduced-data: reduce) {
    .grain {
        display: none !important;
    }
}