// fade in animation

let fadeins = document.querySelectorAll('.fade-in');

function fadeInElements() {
     fadeins.forEach(fadein => {
          let topEdge = fadein.getBoundingClientRect().top;
          let viewportHeight = window.innerHeight - 175;
          if (viewportHeight > topEdge) {
               fadein.classList.add('in-view');
          } else {
               fadein.classList.remove('in-view');
          }
     });
}

let image = document.querySelector('.hero > img');

function blurry() {
     let sd = window.scrollY * 0.02;
     image.style.filter = "blur(" + sd + "px)";
}

window.addEventListener('scroll', blurry);

fadeInElements();
window.addEventListener('scroll', fadeInElements);
window.addEventListener('resize', fadeInElements);