/**
 * Footer interactions — back to top + newsletter shell guard.
 *
 * @package Kutby
 */
(function () {
  'use strict';

  var back = document.querySelector('[data-kutby-back-to-top]');
  if (back) {
    var onScroll = function () {
      var show = window.scrollY > 400;
      back.classList.toggle('is-visible', show);
    };
    window.addEventListener('scroll', onScroll, { passive: true });
    onScroll();
    back.addEventListener('click', function () {
      window.scrollTo({ top: 0, behavior: 'smooth' });
    });
  }

  var shells = document.querySelectorAll('[data-kutby-newsletter-shell]');
  shells.forEach(function (form) {
    form.addEventListener('submit', function (event) {
      event.preventDefault();
    });
  });
})();
