


/*-----------------------------------------------------------------------------------*/
/*	Default Js 
/*-----------------------------------------------------------------------------------*/

(function () {
    'use strict';
    var isMobile = {
        Android: function () {
            return navigator.userAgent.match(/Android/i);
        }
        , BlackBerry: function () {
            return navigator.userAgent.match(/BlackBerry/i);
        }
        , iOS: function () {
            return navigator.userAgent.match(/iPhone|iPad|iPod/i);
        }
        , Opera: function () {
            return navigator.userAgent.match(/Opera Mini/i);
        }
        , Windows: function () {
            return navigator.userAgent.match(/IEMobile/i);
        }
        , any: function () {
            return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
        }
    };

 // Close menu 
/*jQuery(function($){
  $(document).on('click', '.close-menu', function(e){
    e.preventDefault();
    $('.navbar-collapse').collapse('hide');
  });
});
*/
   jQuery(function($){
    // delegated -> works for elements cloned later by headhesive
    $(document).on('click', '.close-menu', function(e){
        e.preventDefault();

        // try to hide the closest navbar collapse (handles clone + original)
        var $collapse = $(this).closest('nav').find('.navbar-collapse');
        if (!$collapse.length) $collapse = $('.navbar-collapse'); // fallback: hide all
        $collapse.collapse('hide');
    });

    // optional: keep toggler aria-expanded accurate after hiding
    $('.navbar-collapse').on('hidden.bs.collapse', function(){
        $('.navbar-toggler').attr('aria-expanded', 'false');
    });
    });


    
    // MAGNIFIC POPUP 
    jQuery('.lusy-photos').magnificPopup({
        delegate: 'a.lusy-photo-item', // the selector for gallery item
        type: 'image',
        gallery: {
            enabled: true
        }
    });


    // Full Height
    var fullHeight = function () {
        if (!isMobile.any()) {
            jQuery('.js-fullheight').css('height', jQuery(window).height());
            jQuery(window).resize(function () {
                jQuery('.js-fullheight').css('height', jQuery(window).height());
            });
        }
    };
    // Animations
    var contentWayPoint = function () {
        var i = 0;
        jQuery('.animate-box').waypoint(function (direction) {
            if (direction === 'down' && !jQuery(this.element).hasClass('animated')) {
                i++;
                jQuery(this.element).addClass('item-animate');
                setTimeout(function () {
                    jQuery('body .animate-box.item-animate').each(function (k) {
                        var el = jQuery(this);
                        setTimeout(function () {
                            var effect = el.data('animate-effect');
                            if (effect === 'fadeIn') {
                                el.addClass('fadeIn animated');
                            }
                            else if (effect === 'fadeInLeft') {
                                el.addClass('fadeInLeft animated');
                            }
                            else if (effect === 'fadeInRight') {
                                el.addClass('fadeInRight animated');
                            }
                            else {
                                el.addClass('fadeInUp animated');
                            }
                            el.removeClass('item-animate');
                        }, k * 200, 'easeInOutExpo');
                    });
                }, 100);
            }
        }, {
            offset: '85%'
        });
    };
    
    /* *** Menu Navigation *** */
    var OnePageNav = function () {
        var navToggler = jQuery('.ann-js-lusy-nav-toggle');
        jQuery(".smoothscroll[href^='#'], #ann-navbar ul li a[href^='#']").on('click', function (e) {
            e.preventDefault();
            var hash = this.hash;
            jQuery('html, body').animate({
                scrollTop: jQuery(hash).offset().top
            }, 700, 'easeInOutExpo', function () {
                window.location.hash = hash;
            });
        });
        jQuery("#ann-navbar ul li a[href^='#']").on('click', function (e) {
            if (navToggler.is(':visible')) {
                navToggler.click();
            }
        });
    };
    OnePageNav();
    jQuery(window).scroll(function () {
        var $this = jQuery(this)
            , st = $this.scrollTop()
            , navbar = jQuery('.lusy-header');
        if (st > 150) {
            if (!navbar.hasClass('scrolled')) {
                navbar.addClass('scrolled');
            }
        }
        if (st < 150) {
            if (navbar.hasClass('scrolled')) {
                navbar.removeClass('scrolled sleep');
            }
        }
        if (st > 350) {
            if (!navbar.hasClass('awake')) {
                navbar.addClass('awake');
            }
        }
        if (st < 350) {
            if (navbar.hasClass('awake')) {
                navbar.removeClass('awake');
                navbar.addClass('sleep');
            }
        }
    });
    jQuery('.ann-js-lusy-nav-toggle').on('click', function (e) {
        var $this = jQuery(this);
        e.preventDefault();
        if (jQuery('body').hasClass('menu-open')) {
            $this.removeClass('active');
            jQuery('.lusy-menu .lusy-menu-inner > ul > li').each(function (i) {
                var that = jQuery(this);
                setTimeout(function () {
                    that.removeClass('is-show');
                }, i * 100);
            });
            setTimeout(function () {
                jQuery('.lusy-menu').removeClass('lusy-menu-show');
            }, 800);
            jQuery('body').removeClass('menu-open');
        }
        else {
            jQuery('.lusy-menu').addClass('lusy-menu-show');
            $this.addClass('active');
            jQuery('body').addClass('menu-open');
            setTimeout(function () {
                jQuery('.lusy-menu .lusy-menu-inner > ul > li').each(function (i) {
                    var that = jQuery(this);
                    setTimeout(function () {
                        that.addClass('is-show');
                    }, i * 100);
                });
            }, 500);
        }
    });
    jQuery('nav .dropdown').hover(function () {
        var $this = jQuery(this);
        $this.addClass('show');
        $this.find('> a').attr('aria-expanded', true);
        $this.find('.dropdown-menu').addClass('show');
    }, function () {
        var $this = jQuery(this);
        $this.removeClass('show');
        $this.find('> a').attr('aria-expanded', false);
        $this.find('.dropdown-menu').removeClass('show');
    });
    jQuery('#dropdown04').on('show.bs.dropdown', function () {
        console.log('show');
    });
    
    // Smooth Scrolling
    jQuery('a[href*="#"]')
    // Remove links that don't actually link to anything
    .not('[href="#"]').not('[href="#0"]').click(function (event) {
            // On-page links
            if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
                // Figure out element to scroll to
                var target = jQuery(this.hash);
                target = target.length ? target : jQuery('[name=' + this.hash.slice(1) + ']');
                // Does a scroll target exist?
                if (target.length) {
                    // Only prevent default if animation is actually gonna happen
                    event.preventDefault();
                    jQuery('html, body').animate({
                        scrollTop: target.offset().top
                    }, 1000, function () {
                        // Callback after animation
                        // Must change focus!
                        var $target = jQuery(target);
                        $target.focus();
                        if ($target.is(":focus")) { // Checking if the target was focused
                            return false;
                        }
                        else {
                            $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable
                            $target.focus(); // Set focus again
                        };
                    });
                }
            }
        });


    // Show more
    jQuery(function() {
			jQuery(document).on( 'click', '.lusy-more-trigger', function(event){
				event.preventDefault();
				if (jQuery('.lusy-show-more-container').hasClass('visible')) {
					jQuery('.lusy-show-more-container').toggleClass('animated');
					jQuery('.lusy-show-more-container').removeClass('visible');
				} else {
					jQuery('.lusy-show-more-container').addClass('visible');
					jQuery('.lusy-show-more-container').removeClass('animated');
					jQuery('.lusy-more-wrapper').addClass('hidden');
				}
			})

		});
    jQuery(function() {
      var self = this;
			var $grid = jQuery('.grid');

			$grid.each(function(){
				var $el = jQuery(this);
				var initial_items = 9;
				function showNextItems(pagination) {
					  var itemsMax = jQuery('.visible_item').length;
					  var itemsCount = 0;
					  jQuery('.visible_item').each(function () {
					    if (itemsCount < pagination) {
					        jQuery(this).removeClass('visible_item');
					        itemsCount++;
					    }
					  });
					  if (itemsCount >= itemsMax) {
					    jQuery('.shop-lusy-more-trigger').hide();
					  }
				}
				jQuery('.shop-lusy-more-trigger').on('click', function (e) {
					  e.preventDefault();
						var next_items = 9;
					  showNextItems(next_items);
				});
			});
		});
    // Progress-wrap
     var progressPath = document.querySelector('.progress-wrap path');
    var pathLength = progressPath.getTotalLength();
    progressPath.style.transition = progressPath.style.WebkitTransition = 'none';
    progressPath.style.strokeDasharray = pathLength + ' ' + pathLength;
    progressPath.style.strokeDashoffset = pathLength;
    progressPath.getBoundingClientRect();
    progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear';
    var updateProgress = function () {
        var scroll = jQuery(window).scrollTop();
        var height = jQuery(document).height() - jQuery(window).height();
        var progress = pathLength - (scroll * pathLength / height);
        progressPath.style.strokeDashoffset = progress;
    }
    updateProgress();
    jQuery(window).scroll(updateProgress);
    var offset = 150;
    var duration = 550;
    jQuery(window).on('scroll', function () {
        if (jQuery(this).scrollTop() > offset) {
            jQuery('.progress-wrap').addClass('active-progress');
        } else {
            jQuery('.progress-wrap').removeClass('active-progress');
        }
    });
    jQuery('.progress-wrap').on('click', function (event) {
        event.preventDefault();
        jQuery('html, body').animate({ scrollTop: 0 }, duration);
        return false;
    })
}());

/*-----------------------------------------------------------------------------------*/
/*	Accordion
/*-----------------------------------------------------------------------------------*/
// Accordion Box
  if (jQuery(".faqs-box").length) {
    jQuery(".faqs-box").on("click", ".acc-btn", function () {
      var outerBox = jQuery(this).parents(".faqs-box");
      var target = jQuery(this).parents(".accordion");

      if (jQuery(this).next(".acc-content").is(":visible")) {
        //return false;
        jQuery(this).removeClass("active");
        jQuery(this).next(".acc-content").slideUp(300);
        jQuery(outerBox).children(".accordion").removeClass("active-block");
      } else {
        jQuery(outerBox).find(".accordion .acc-btn").removeClass("active");
        jQuery(this).addClass("active");
        jQuery(outerBox).children(".accordion").removeClass("active-block");
        jQuery(outerBox).find(".accordion").children(".acc-content").slideUp(300);
        target.addClass("active-block");
        jQuery(this).next(".acc-content").slideDown(300);
      }
    });
  }

// NEW MAIN JS // 

jQuery(document).ready(function ($) {
    'use strict';
    /*-----------------------------------------------------------------------------------*/
    /*	STICKY HEADER
    /*-----------------------------------------------------------------------------------*/
    if ($(".navbar").length) {
        var options = {
            offset: 350,
            offsetSide: 'top',
            classes: {
                clone: 'banner--clone fixed',
                stick: 'banner--stick',
                unstick: 'banner--unstick'
            },
           /* onStick: function() {
                $($.SmartMenus.Bootstrap.init);
            },*/
            onUnstick: function() {
                $('.navbar .btn-group').removeClass('open');
            }
        };
        var banner = new Headhesive('.navbar', options);
    }
    /*-----------------------------------------------------------------------------------*/
    /*	HAMBURGER MENU ICON
    /*-----------------------------------------------------------------------------------*/
	$(".hamburger.animate").on( "click", function() {
        $(".hamburger.animate").toggleClass("active");
    });
    $('.onepage .navbar .nav li a').on('click', function() {
        $('.navbar .navbar-collapse.show').collapse('hide');
        $('.hamburger.animate').removeClass('active');
    });
  
    /*-----------------------------------------------------------------------------------*/
    /*	ONEPAGE HEADER OFFSET
    /*-----------------------------------------------------------------------------------*/	
    var header_height = $('.navbar:not(.banner--clone)').outerHeight();
    var shrinked_header_height = 68;
    var firstStyle = {
        'padding-top': '' + shrinked_header_height + 'px',
        'margin-top': '-' + shrinked_header_height + 'px'
    };
    $('.onepage section').css(firstStyle);
    var secondStyle = {
        'padding-top': '' + header_height + 'px',
        'margin-top': '-' + header_height + 'px'
    };
    $('.onepage section:first-of-type').css(secondStyle);
	/*-----------------------------------------------------------------------------------*/
    /*	ONEPAGE NAV LINKS
    /*-----------------------------------------------------------------------------------*/	
	var empty_a = $('.onepage .navbar ul.navbar-nav a[href="#"]');	
	empty_a.on('click', function(e) {
	    e.preventDefault();
	});
    /*-----------------------------------------------------------------------------------*/
	/*	ONEPAGE SMOOTH SCROLL
	/*-----------------------------------------------------------------------------------*/	
	$(function() {
	  /*setTimeout(function() {
	    if (location.hash) {
	      window.scrollTo(0, 0);
	      var target = location.hash.split('#');
	      smoothScrollTo($('#'+target[1]));
	    }
	  }, 1);  */
	  $('a.scroll[href*=#]:not([href=#])').on('click', function() {
	    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
	      smoothScrollTo($(this.hash));
	      return false;
	    }
	  });  
	  function smoothScrollTo(target) {
	    var target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
	    
	    if (target.length) {
	      $('html,body').animate({
	        scrollTop: target.offset().top
	      }, 1500, 'easeInOutExpo');
	    }
	  }
	});
});

// PLUGINS // 
/*-------------------------------------------------------------------------------------
[TABLE OF CONTENTS]

-------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/*	01. SMARTMENUS
/*-----------------------------------------------------------------------------------*/

/*	02. STICKY HEADER
/*-----------------------------------------------------------------------------------*/
// Headhesive
/*-----------------------------------------------------------------------------------*/
/*	03. HAMBURGER MENU ICON
/*-----------------------------------------------------------------------------------*/
/*!
 // jquery hmbrgr 

/*-----------------------------------------------------------------------------------*/
/*	04. PICTUREFILL RETINA IMAGE
/*-----------------------------------------------------------------------------------*/

document.addEventListener("DOMContentLoaded", function () {
    const sections = document.querySelectorAll("section[id]");
    const navLinks = document.querySelectorAll(".navbar-nav .nav-link");

    window.addEventListener("scroll", () => {
        let current = "";
        const scrollY = window.pageYOffset;

        sections.forEach((section) => {
            const sectionTop = section.offsetTop - 100; // adjust offset if needed
            const sectionHeight = section.offsetHeight;
            if (scrollY >= sectionTop && scrollY < sectionTop + sectionHeight) {
                current = section.getAttribute("id");
            }
        });

        navLinks.forEach((link) => {
            link.classList.remove("active");
            if (link.getAttribute("href") === "#" + current) {
                link.classList.add("active");
            }
        });
    });
});



// One Page Nav
 jQuery(document).ready(function ($) {
    'use strict';
    /* ==============================================
    Active Menu
    =============================================== */
       jQuery(function() {
            var sections = jQuery('section'); 
            var navigation_links = jQuery('.one-page-nav li > a');
            sections.waypoint({
                handler: function(direction) {
                    var active_section;
                    active_section = jQuery(this);
                    if (direction === "up") active_section = active_section.prev();
                    var active_link = jQuery('.one-page-nav li > a[href="#' + active_section.attr("id") + '"]');
                    navigation_links.parent().removeClass("active");
                    active_link.parent().addClass("active");
                    active_section.addClass("active-section");
                },
                offset: '35%'
            });
        });
     });

/*-----------------------------------------------------------------------------------*/
/*	SWIPER
/*-----------------------------------------------------------------------------------*/

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


    $(".basic-slider").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("basic-slider-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("basic-slider-pagination-" + index);
        var swiper1 = new Swiper(".basic-slider-" + index, {
            slidesPerView: 1,
            spaceBetween: 0,
            autoHeight: true,
            grabCursor: true,
            pagination: {
                el: ".basic-slider-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });
    $(".swiper-col3").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-col3-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-col3-pagination-" + index);
        var swiper2 = new Swiper(".swiper-col3-" + index, {
            slidesPerView: 1,
            breakpoints: {
				768: {
                    slidesPerView: 2 
                },
                992: {
                    slidesPerView: 3 
                },
            },
            spaceBetween: 30,
            grabCursor: true,
            pagination: {
                el: ".swiper-col3-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });    
    $(".swiper-col3-20").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-col3-20-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-col3-20-pagination-" + index);
        var swiper3 = new Swiper(".swiper-col3-20-" + index, {
            slidesPerView: 1,
            breakpoints: {
				768: {
                    slidesPerView: 2 
                },
                992: {
                    slidesPerView: 3 
                },
            },
            spaceBetween: 20,
            grabCursor: true,
            pagination: {
                el: ".swiper-col3-20-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });
    $(".swiper-col4").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-col4-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-col4-pagination-" + index);
        var swiper4 = new Swiper(".swiper-col4-" + index, {
            slidesPerView: 1,
            breakpoints: {
				768: {
                    slidesPerView: 2 
                },
                992: {
                    slidesPerView: 3 
                },
                1025: {
                    slidesPerView: 4 
                }
            },
            spaceBetween: 30,
            grabCursor: true,
            pagination: {
                el: ".swiper-col4-pagination-" + index,
                clickable: true,
            }
        });
    });
    $(".swiper-col6").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-col6-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-col6-pagination-" + index);
        var swiper5 = new Swiper(".swiper-col6-" + index, {
            slidesPerView: 2,
            breakpoints: {
				768: {
                    slidesPerView: 3 
                },
                992: {
                    slidesPerView: 4 
                },
                1025: {
                    slidesPerView: 5 
                }
            },
            spaceBetween: 30,
            grabCursor: true,
            pagination: {
                el: ".swiper-col6-pagination-" + index,
                clickable: true,
            }
        });
    });
    $(".swiper-auto").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-auto-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-auto-pagination-" + index);
        var swiper6 = new Swiper(".swiper-auto-" + index, {
            slidesPerView: "auto",
            spaceBetween: 10,
            grabCursor: true,
            loop: false,
            pagination: {
                el: ".swiper-auto-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });   
    $(".swiper-auto-tab").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-auto-tab-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-auto-tab-pagination-" + index);
        var swiper7 = new Swiper(".swiper-auto-tab-" + index, {
            slidesPerView: "auto",
            spaceBetween: 10,
            grabCursor: true,
            observer: true,
			observeParents: true,
            loop: false,
            pagination: {
                el: ".swiper-auto-tab-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });  
    $(".swiper-full").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-full-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-full-pagination-" + index);
        var swiper8 = new Swiper(".swiper-full-" + index, {
            slidesPerView: 1,
            breakpoints: {
                768: {
                    slidesPerView: 2 
                },
                1025: {
                    slidesPerView: 3 
                }
            },
            spaceBetween: 15,
            grabCursor: true,
			mousewheel: {
			    invert: false,
			  },
            pagination: {
                el: ".swiper-full-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });
    $(".swiper-full-single").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-full-single-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-full-single-pagination-" + index);
        var swiper9 = new Swiper(".swiper-full-single-" + index, {
            grabCursor: true,
			mousewheel: {
			    invert: false,
			},
            pagination: {
                el: ".swiper-full-single-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });
    $(".swiper-col3-full").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-col3-full-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-col3-full-pagination-" + index);
        var swiper10 = new Swiper(".swiper-col3-full-" + index, {
            slidesPerView: 1,
            breakpoints: {
				992: {
                    slidesPerView: 2 
                },

				1680: {
                    slidesPerView: 3 
                }
            },
            spaceBetween: 20,
            grabCursor: true,
            pagination: {
                el: ".swiper-col3-full-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });
    $(".swiper-auto-full").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-auto-full-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-auto-full-pagination-" + index);
        var swiper11 = new Swiper(".swiper-auto-full-" + index, {
            slidesPerView: "auto",
            spaceBetween: 15,
            grabCursor: true,
            mousewheel: {
			    invert: false,
			  },
            loop: false,
            pagination: {
                el: ".swiper-auto-full-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    }); 
    $(".swiper-auto-centered").each(function(index, element) {
        var $this = $(this);
        $this.find(".swiper-container").addClass("swiper-auto-centered-" + index);
        $this.find(".swiper-button-prev").addClass("btn-prev-" + index);
        $this.find(".swiper-button-next").addClass("btn-next-" + index);
        $this.find(".swiper-pagination").addClass("swiper-auto-centered-pagination-" + index);
        var swiper12 = new Swiper(".swiper-auto-centered-" + index, {
            slidesPerView: "auto",
            spaceBetween: 10,
            centeredSlides: true,
            grabCursor: true,
            loop: true,
            loopedSlides: 8,
            pagination: {
                el: ".swiper-auto-centered-pagination-" + index,
                clickable: true,
            },
            navigation: {
                nextEl: ".btn-next-" + index,
                prevEl: ".btn-prev-" + index
            }
        });
    });


});


/*-----------------------------------------------------------------------------------*/
/*	SWIPER Portrait
/*-----------------------------------------------------------------------------------*/

document.addEventListener('DOMContentLoaded', function () {
    new Swiper('.swiper-slider-portrait', {
        effect: 'fade', 
        loop: true,
        autoplay: {
            delay: 4000,
            disableOnInteraction: false,
        },
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
        fadeEffect: {
            crossFade: true
        },
    });
}); 

document.addEventListener('DOMContentLoaded', function () {
    const menuModal = document.getElementById('navbarSupportedContent');
    const openMenuButton = document.querySelector('.navbar-toggler');
    const closeMenuButton = document.querySelector('.close-menu');
    const focusableElements = menuModal.querySelectorAll('a, button, [tabindex]:not([tabindex="-1"])');
    const firstFocusable = focusableElements[0];
    const lastFocusable = focusableElements[focusableElements.length - 1];

    // Trap focus within the menu modal
    function trapFocus(e) {
        if (e.key === 'Tab') {
            if (e.shiftKey) { // Shift+Tab
                if (document.activeElement === firstFocusable) {
                    e.preventDefault();
                    lastFocusable.focus();
                }
            } else { // Tab
                if (document.activeElement === lastFocusable) {
                    e.preventDefault();
                    firstFocusable.focus();
                }
            }
        }
    }

    // Open menu and add focus trapping
    openMenuButton.addEventListener('click', () => {
        menuModal.classList.add('open');
        menuModal.setAttribute('aria-hidden', 'false');
        firstFocusable.focus();
        menuModal.addEventListener('keydown', trapFocus);
    });

    // Close menu and remove focus trapping
    closeMenuButton.addEventListener('click', () => {
        menuModal.classList.remove('open');
        menuModal.setAttribute('aria-hidden', 'true');
        openMenuButton.focus();
        menuModal.removeEventListener('keydown', trapFocus);
    });

    // Toggle submenu on keypress for accessibility
    document.querySelectorAll('.menu-item-has-children > a').forEach(link => {
        link.addEventListener('keydown', function (e) {
            if (e.key === 'Enter' || e.key === ' ') {
                e.preventDefault();
                const submenu = link.nextElementSibling;
                if (submenu) {
                    submenu.classList.toggle('open');
                    submenu.setAttribute('aria-expanded', submenu.classList.contains('open'));
                }
            }
        });
    });
});

