function futuristic_architecture_openNav() {
  jQuery(".sidenav").addClass('show');
}
function futuristic_architecture_closeNav() {
  jQuery(".sidenav").removeClass('show');
}

( function( window, document ) {
  function futuristic_architecture_keepFocusInMenu() {
    document.addEventListener( 'keydown', function( e ) {
      const futuristic_architecture_nav = document.querySelector( '.sidenav' );

      if ( ! futuristic_architecture_nav || ! futuristic_architecture_nav.classList.contains( 'show' ) ) {
        return;
      }
      const elements = [...futuristic_architecture_nav.querySelectorAll( 'input, a, button' )],
        futuristic_architecture_lastEl = elements[ elements.length - 1 ],
        futuristic_architecture_firstEl = elements[0],
        futuristic_architecture_activeEl = document.activeElement,
        tabKey = e.keyCode === 9,
        shiftKey = e.shiftKey;

      if ( ! shiftKey && tabKey && futuristic_architecture_lastEl === futuristic_architecture_activeEl ) {
        e.preventDefault();
        futuristic_architecture_firstEl.focus();
      }

      if ( shiftKey && tabKey && futuristic_architecture_firstEl === futuristic_architecture_activeEl ) {
        e.preventDefault();
        futuristic_architecture_lastEl.focus();
      }
    } );
  }
  futuristic_architecture_keepFocusInMenu();
} )( window, document );

var futuristic_architecture_btn = jQuery('#button');

jQuery(window).scroll(function() {
  if (jQuery(window).scrollTop() > 300) {
    futuristic_architecture_btn.addClass('show');
  } else {
    futuristic_architecture_btn.removeClass('show');
  }
});

futuristic_architecture_btn.on('click', function(e) {
  e.preventDefault();
  jQuery('html, body').animate({scrollTop:0}, '300');
});

jQuery(document).ready(function() {
  var top_categories_old = jQuery('#top-projects .owl-carousel');
    top_categories_old.owlCarousel({
    margin: 30,
    nav:false,
    autoplay : true,
    lazyLoad: false,
    autoplayTimeout: 5000,
    loop: true,
    dots: true,
    navText : ['<i class="fas fa-arrow-left" aria-hidden="true"></i>','<i class="fas fa-arrow-right" aria-hidden="true"></i>'],
    responsive: {
      0: {
        items: 1
      },
      576: {
        items: 2
      },
      768: {
        items: 2
      },
      1024: {
        items: 3,
        onInitialized: futuristic_architecture_setFirstSlideClass,
        onTranslated: futuristic_architecture_setFirstSlideClass
      },
      1200: {
        items: 3,
        onInitialized: futuristic_architecture_setFirstSlideClass,
        onTranslated: futuristic_architecture_setFirstSlideClass
      }
    },
    autoplayHoverPause : false,
    mouseDrag: true,
  });
  function futuristic_architecture_setFirstSlideClass(event) {
    // Remove the 'unique-class' from all items
    jQuery('#top-projects .owl-item').removeClass('active-height');

    // Get the current slide index
    var currentIndex = event.item.index;
    // console.log("currentIndex  ", currentIndex)
    // Add the 'unique-class' to the first item in the current view
    jQuery('#top-projects .owl-item').eq(currentIndex + 1).addClass('active-height');
  }
  function futuristic_architecture_laptop_setFirstSlideClass(event) {
    // Remove the 'unique-class' from all items
    jQuery('#top-projects .owl-item').removeClass('active-height');

    // Get the current slide index
    var currentIndex = event.item.index;
    // console.log("currentIndex  ", currentIndex)
    // Add the 'unique-class' to the first item in the current view
    jQuery('#top-projects .owl-item').eq(currentIndex ).addClass('active-height');
  }
})

window.addEventListener('load', (event) => {
  jQuery(".loading").delay(2000).fadeOut("slow");
});

jQuery('.header-search-wrapper .search-main').click(function(){
  jQuery('.search-form-main').toggleClass('active-search');
  jQuery('.search-form-main .search-field').focus();
});

jQuery(window).scroll(function() {
  var data_sticky = jQuery('.main-header').attr('data-sticky');

  if (data_sticky == "true") {
    if (jQuery(this).scrollTop() > 1){
      jQuery('.main-header').addClass("stick_header");
    } else {
      jQuery('.main-header').removeClass("stick_header");
    }
  }
});