(function () {
  var name = document.querySelector('.hero-name');
  if (!name) return;
  if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;

  function glitch() {
    name.classList.add('is-glitching');
    setTimeout(function () { name.classList.remove('is-glitching'); }, 500);
    setTimeout(glitch, 4000 + Math.random() * 7000);
  }
  setTimeout(glitch, 3500);
})();
