function setVH() {
  let vh = (window.visualViewport?.height || window.innerHeight) * 0.01;
  document.documentElement.style.setProperty('--vh', `${vh}px`);
}

// Run only once on initial page load
document.addEventListener('DOMContentLoaded', setVH);