"use strict"
let ah_last_scroll = 0
// HIDE MENU ON SCROLL
function ah_header_hide_on_scroll() {
  const header = document.querySelector('header.wp-block-template-part')
  const current = window.scrollY
  header.classList.remove('nav-up', 'bgFFF', 'bgFFF2')
  current > ah_last_scroll && current > 110 ? header.classList.add('nav-up') : header.classList.remove('nav-up')
  ah_last_scroll = current
}
function ah_close_l(e) {
	e.preventDefault()
  console.log('close')
  document.getElementById('holding_cover').classList.add('d-none')
}
// EVENTS
window.addEventListener('scroll', function() { 
  ah_header_hide_on_scroll()
})
document.addEventListener('click', function(e) {
  if( e.target.matches('.wp-block-cover__background') ) {
    e.target.parentElement.querySelector('.wp-block-heading a') && e.target.parentElement.querySelector('.wp-block-heading a').click()
    e.target.parentElement.querySelector('.wp-block-post-title a') && e.target.parentElement.querySelector('.wp-block-post-title a').click()
  }
  e.target.matches('#close_link a') && ah_close_l(e)
})