jQuery(document).ready(function ($) {

  $(window).scroll(function () {
    if ($(this).scrollTop() > 100) {
      $(".back-to-top a").fadeIn();
    } else {
      $(".back-to-top a").fadeOut();
    }
  });

  $(".back-to-top a").click(function () {
    $("html, body").animate({ scrollTop: 0 }, 800);
    return false;
  });

  //projects-swiper
  var futuristic_vision_project_Slider = new Swiper(".projects-slider", {
    breakpoints: {
      0: {
        slidesPerView: 1,
        centeredSlides: false,
      },
      768: {
        slidesPerView: 2,
        centeredSlides: false,
      },
      992: {
        slidesPerView: 3,
        centeredSlides: true,
      }
    },
    autoplay: {
      delay: 3000,
      disableOnInteraction: false,
    },
    spaceBetween: 30,
    loop: true,
    navigation: {
      nextEl: ".projects-swiper-button-next",
      prevEl: ".projects-swiper-button-prev",
    },
  });

});

document.addEventListener('DOMContentLoaded', function () {
    const futuristic_vision_counters = document.querySelectorAll('.customer-no');

    futuristic_vision_counters.forEach(function (futuristic_vision_counter) {
        const futuristic_vision_target = parseInt(futuristic_vision_counter.textContent.replace(/\D/g, ''), 10);
        let futuristic_vision_count = 0;
        const futuristic_vision_duration = 1000; // total duration in milliseconds
        const futuristic_vision_startTime = performance.now();

        function updateCounter(futuristic_vision_currentTime) {
            const futuristic_vision_elapsedTime = futuristic_vision_currentTime - futuristic_vision_startTime;
            const futuristic_vision_progress = Math.min(futuristic_vision_elapsedTime / futuristic_vision_duration, 1);
            futuristic_vision_count = Math.floor(futuristic_vision_progress * futuristic_vision_target);
            futuristic_vision_counter.textContent = futuristic_vision_count;

            if (futuristic_vision_progress < 1) {
                requestAnimationFrame(updateCounter);
            } else {
                futuristic_vision_counter.textContent = futuristic_vision_target + '+';
            }
        }
        requestAnimationFrame(updateCounter);
    });
});

jQuery(document).ready(function ($) {
    var futuristic_vision_owl = $(".banner-section-main .owl-carousel");
    futuristic_vision_owl.owlCarousel({
    loop: true,
    items: 1,
    nav: true,
    margin: 30,
    dots: false,
    rtl: false,
    autoplay: true,
    autoplayTimeout: 5000,
    autoplayHoverPause: false,
    animateOut: "fadeOut",
    animateIn: "fadeIn",
    navText: [
      '<span class="owl-prev-icon"><i class="fa-solid fa-chevron-left"></i></span>',
      '<span class="owl-next-icon"><i class="fa-solid fa-chevron-right"></i></span>'
    ]
  });
});

jQuery(document).ready(function ($) {
  $(".service-owl.owl-carousel").owlCarousel({
    loop: true,
    margin: 30,
    nav: false,
    dots: false,
    items: 3,
    autoplay: true,
    autoplayTimeout: 3000,
    responsive: {
      0: {
        items: 1
      },
      576: {
        items: 2
      },
      768: {
        items: 2
      },
      1024: {
        items: 3
      }
    }
  });
});