(function($) {



  $("#hamburger-menu").click(function(event) {
    event.stopPropagation();
    $(".header-navigation").addClass("open");

  });

    $(".close-menu").click(function(event) {
    event.stopPropagation();
    $(".header-navigation").removeClass("open");

  });

  $("#hamburger-menu").keypress(function(e) {
    var key = e.which;
    if (key == 13) // the enter key code
    {
      $(".header-navigation").addClass("open");
    }
  });

  $(".close-menu").keypress(function(e) {
    var key = e.which;
    if (key == 13) // the enter key code
    {
      $(".header-navigation").removeClass("open");
    }
  });


AOS.init({
  once: true,
  duration: 700,
});


})(jQuery);

if (jQuery(window).width() < 991){
  const  podcastin_focusableElements =
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const podcastin_modal = document.querySelector('nav#site-navigation'); 

const podcastin_firstFocusableElement = podcastin_modal.querySelectorAll(podcastin_focusableElements)[0]; 
const podcastin_focusableContent = podcastin_modal.querySelectorAll(podcastin_focusableElements);
const podcastin_lastFocusableElement = podcastin_focusableContent[podcastin_focusableContent.length - 1];


document.addEventListener('keydown', function(e) {
let isTabPressed = e.key === 'Tab' || e.keyCode === 9;

if (!isTabPressed) {
  return;
}

if (e.shiftKey) { // if shift key pressed for shift + tab combination
  if (document.activeElement === podcastin_firstFocusableElement) {
    podcastin_lastFocusableElement.focus(); // add focus for the last focusable element
    e.preventDefault();
  }
} else { // if tab key is pressed
  if (document.activeElement === podcastin_lastFocusableElement) { // if focused has reached to last focusable element then focus first focusable element after pressing tab
    podcastin_firstFocusableElement.focus(); // add focus for the first focusable element
    e.preventDefault();
  }
}
});

podcastin_firstFocusableElement.focus();}

