$(document).ready(function () {

    var wind = $(window);

    wow = new WOW({
        boxClass: 'wow',
        animateClass: 'animated',
        offset: 200,
        mobile: false,
        live: false
    });
    wow.init();


    // ---------- to top -----------
    $('.to-top').click(function () {
        $('html, body').animate({
            scrollTop: 0
        }, 1000);
        return false;
    });
    
    
    // dark light theme
    const themeBtn = document.querySelector(".theme-btn");
    const body = document.body;

    // Check saved theme on page load
    if (localStorage.getItem("theme") === "dark") {
      body.classList.add("theme-dark");
      themeBtn.classList.add("active");
    }

    // On click → toggle theme and save preference
    themeBtn.addEventListener("click", () => {
      body.classList.toggle("theme-dark");
      themeBtn.classList.toggle("active");

      if (body.classList.contains("theme-dark")) {
        localStorage.setItem("theme", "dark");
      } else {
        localStorage.setItem("theme", "light");
      }
    });


});


$(window).on("load", function () {
    $(".loader-pg").fadeOut(1000, function () {
        $(this).remove();
    });
});


// ------------ swiper sliders -----------
$(document).ready(function () {

    // ------------ partners sliders -----------
    var swiper = new Swiper('.partners .partners-slider', {
        // slidesPerView: "auto",
        slidesPerView: 8,
        spaceBetween: 50,
        centeredSlides: true,
        pagination: false,
        navigation: false,
        mousewheel: false,
        keyboard: true,
        speed: 30000,
        allowTouchMove: false,
        a11y: false,
        autoplay: {
            delay: 1,
        },
        loop: false,
        breakpoints: {
            0: {
                slidesPerView: 2,
            },
            480: {
                slidesPerView: 2,
            },
            787: {
                slidesPerView: 4,
            },
            991: {
                slidesPerView: 6,
            },
            1200: {
                slidesPerView: 8,
            }
        }
    });


    // portfolio-slider
    var swiper = new Swiper('.portfolio-slider', {
        // slidesPerView: 5,
        spaceBetween: 30,
        // centeredSlides: true,
        speed: 1500,
        pagination: false,
        navigation: {
            nextEl: '.portfolio-slider .swiper-button-next',
            prevEl: '.portfolio-slider .swiper-button-prev',
        },
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
        },
        loop: false,
        breakpoints: {
            0: {
                slidesPerView: 1,
            },
            480: {
                slidesPerView: 2,
            },
            787: {
                slidesPerView: 3,
            },
            991: {
                slidesPerView: 2,
            },
            1200: {
                slidesPerView: 2.2,
            }
        }
    });


    // portfolio-slider
    var swiper = new Swiper('.solutions-slider', {
        slidesPerView: 1,
        spaceBetween: 10,
        centeredSlides: true,
        speed: 1500,
        pagination: {
            el: '.solutions-slider .swiper-pagination',
            clickable: true,
        },
        navigation: false,
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
        },
        loop: false,
        parallax: true,
        on: {
            init: function () {
                var swiper = this;
                for (var i = 0; i < swiper.slides.length; i++) {
                    $(swiper.slides[i])
                        .find(".bg")
                        .attr({
                            "data-swiper-parallax": 0.75 * swiper.width,
                        });
                }
            },
            resize: function () {
                this.update();
            },
        },
    });


    // portfolio-slider
    var swiper = new Swiper('.testi-slider', {
        // slidesPerView: 5,
        spaceBetween: 30,
        centeredSlides: true,
        speed: 1500,
        pagination: {
            el: '.testi-slider .swiper-pagination',
            clickable: true,
        },
        navigation: false,
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
        },
        loop: false,
        breakpoints: {
            0: {
                slidesPerView: 1,
            },
            480: {
                slidesPerView: 2,
            },
            787: {
                slidesPerView: 3,
            },
            991: {
                slidesPerView: 2,
            },
            1200: {
                slidesPerView: 3,
            }
        }
    });

    // portfolio-slider
    var swiper = new Swiper('.modal-project .imgs-slider', {
        slidesPerView: 1,
        spaceBetween: 10,
        centeredSlides: true,
        speed: 1500,
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
        navigation: false,
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
        },
        loop: false,
    });

    // portfolio-slider
    var swiper = new Swiper('.another-posts .posts-slider', {
        // slidesPerView: 5,
        spaceBetween: 30,
        // centeredSlides: true,
        speed: 1500,
        pagination: {
            el: '.another-posts .swiper-pagination',
            clickable: true,
        },
        navigation: false,
        mousewheel: false,
        keyboard: true,
        autoplay: {
            delay: 5000,
        },
        loop: false,
        breakpoints: {
            0: {
                slidesPerView: 1,
            },
            480: {
                slidesPerView: 2,
            },
            787: {
                slidesPerView: 2,
            },
            991: {
                slidesPerView: 2,
            },
            1200: {
                slidesPerView: 2,
            }
        }
    });

});


$(document).ready(function () {

})
