/*-----------------------------------------------------------------------------------

    Theme Name: Constry - Construction HTML Template
    Description: Construction HTML Template
    Author: Website Layout
    Version: 1.0
        
    ---------------------------------- */    

(function($) {

    "use strict";

    var $window = $(window);

        $("#preloader").fadeOut("normall",function(){$(this).remove()}),$window.on("scroll",function(){var o=$window.scrollTop(),e=$(".navbar-brand img"),t=$(".navbar-brand.logodefault img");o<=50?($("header").removeClass("scrollHeader").addClass("fixedHeader"),e.attr("src","img/logos/logo-inner.png")):($("header").removeClass("fixedHeader").addClass("scrollHeader"),e.attr("src","img/logos/logo.png")),t.attr("src","img/logos/logo.png")}),$window.on("scroll",function(){500<$(this).scrollTop()?$(".scroll-to-top").fadeIn(400):$(".scroll-to-top").fadeOut(400)}),$(".scroll-to-top").on("click",function(o){o.preventDefault(),$("html, body").animate({scrollTop:0},600)});var pageSection=$(".parallax,.bg-img");function SetResizeContent(){}pageSection.each(function(o){$(this).attr("data-background")&&$(this).css("background-image","url("+$(this).data("background")+")")}),$window.resize(function(o){setTimeout(function(){SetResizeContent()},500),o.preventDefault()}),SetResizeContent();

    // === when document ready === //
    $(document).ready(function(){

        $(".clients-carousel1").owlCarousel({loop:!0,nav:!1,dots:!1,autoplay:!0,smartSpeed:1500,autoplayTimeout:4e3,responsiveClass:!0,autoplayHoverPause:!1,responsive:{0:{items:1},481:{items:2},576:{items:2},768:{items:3},992:{items:4},1200:{items:5}}}),$(".portfolio-carousel").owlCarousel({loop:!0,nav:!1,dots:!1,autoplay:!0,smartSpeed:1500,autoplayTimeout:4e3,responsiveClass:!0,autoplayHoverPause:!1,margin:50,responsive:{0:{items:1,margin:10},481:{items:2,margin:20},576:{items:2},768:{items:3},992:{items:4},1200:{items:5}}}),$(".testimonial-carousel1").owlCarousel({loop:!0,nav:!1,dots:!0,autoplay:!0,smartSpeed:1500,navText:["<span class='fa-solid fa-arrow-left-long'></span>","<span class='fa-solid fa-arrow-right-long'></span>"],autoplayTimeout:4e3,items:1,responsive:{992:{dots:!1,nav:!0}}}),$(".slider-fade").owlCarousel({items:1,loop:!0,dots:!1,margin:0,nav:!1,autoplay:!0,autoplayTimeout:5e3,smartSpeed:1500,animateIn:"fadeIn",animateOut:"fadeOut"}),$(".slider-fade1").owlCarousel({items:1,loop:!0,dots:!1,margin:0,nav:!1,autoplay:!0,autoplayTimeout:5e3,smartSpeed:1500,navText:["<span class='ti-angle-left'></span>","<span class='ti-angle-right'></span>"],animateIn:"fadeIn",animateOut:"fadeOut",responsive:{768:{nav:!0}}}),$(".owl-carousel").owlCarousel({items:1,loop:!0,dots:!1,margin:0,autoplay:!0,smartSpeed:500});var owl=$(".slider-fade");owl.on("changed.owl.carousel",function(a){a=a.item.index-2;$("span").removeClass("animated fadeInUp"),$("h1").removeClass("animated fadeInUp"),$("p").removeClass("animated fadeInUp"),$("a").removeClass("animated fadeInUp"),$(".owl-item").not(".cloned").eq(a).find("span").addClass("animated fadeInUp"),$(".owl-item").not(".cloned").eq(a).find("h1").addClass("animated fadeInUp"),$(".owl-item").not(".cloned").eq(a).find("p").addClass("animated fadeInUp"),$(".owl-item").not(".cloned").eq(a).find("a").addClass("animated fadeInUp")}),$(".countup").counterUp({delay:25,time:2e3}),$(".countdown").countdown({date:"01 Nov 2025 00:01:00",format:"on"}),$(".current-year").text((new Date).getFullYear());

        /*------------------------------------
            10. Cursor Helper
        --------------------------------------*/
        
        if ($(".cursor-helper").length) {

            var cursor = document.querySelector('.cursor-helper-outer');
            var cursorinner = document.querySelector('.cursor-helper-inner');
            var a = document.querySelectorAll('a');
            var footer = document.querySelectorAll('footer');
            var owlcarousel = document.querySelectorAll('.owl-carousel');
            var bgsecondary = document.querySelectorAll('.bg-secondary');
            
            document.addEventListener('mousemove', function (e) {
              var x = e.clientX;
              var y = e.clientY;
              cursor.style.transform = `translate3d(calc(${e.clientX}px - 50%), calc(${e.clientY}px - 50%), 0)`
            });

            document.addEventListener('mousemove', function (e) {
              var x = e.clientX;
              var y = e.clientY;
              cursorinner.style.left = x + 'px';
              cursorinner.style.top = y + 'px';
            });

            document.addEventListener('mousedown', function () {
              cursor.classList.add('click');
              cursorinner.classList.add('cursor-helper-innerhover')
            });

            document.addEventListener('mouseup', function () {
              cursor.classList.remove('click')
              cursorinner.classList.remove('cursor-helper-innerhover')
            });

            a.forEach(item => {
              item.addEventListener('mouseover', () => {
                cursor.classList.add('cursor-link');
              });
              item.addEventListener('mouseleave', () => {
                cursor.classList.remove('cursor-link');
              });
            });

            footer.forEach(item => {
              item.addEventListener('mouseover', () => {
                cursor.classList.add('cursor-light');
              });
              item.addEventListener('mouseleave', () => {
                cursor.classList.remove('cursor-light');
              });
            });

            owlcarousel.forEach(item => {
              item.addEventListener('mouseover', () => {
                cursor.classList.add('cursor-slider');
              });
              item.addEventListener('mouseleave', () => {
                cursor.classList.remove('cursor-slider');
              });
            });

            bgsecondary.forEach(item => {
              item.addEventListener('mouseover', () => {
                cursor.classList.add('cursor-light');
              });
              item.addEventListener('mouseleave', () => {
                cursor.classList.remove('cursor-light');
              });
            });

          }
      
    });

    $window.on("load",function(){$(".portfolio-gallery").lightGallery(),$(".portfolio-link").on("click",o=>{o.stopPropagation()})});

})(jQuery);