/*--------------------------------------------------------------
This is your custom stylesheet.

Add your own styles here to make theme updates easier.
To override any styles from other stylesheets, simply copy them into here and edit away.

Make sure to respect the media queries! Otherwise you may
accidentally add desktop styles to the mobile layout.
https://www.w3schools.com/css/css_rwd_mediaqueries.asp
--------------------------------------------------------------*/
<script>
document.addEventListener('click', function (e) {
  const a = e.target.closest('a[data-offset]');
  if (!a) return;

  const href = a.getAttribute('href') || '';
  if (!href.startsWith('#')) return;                 // same-page anchors only

  const target = document.querySelector(href);
  if (!target) return;

  e.preventDefault();

  // Read per-link offsets (supports desktop/mobile overrides)
  const base = parseInt(a.dataset.offset || '0', 10) || 0;
  const mql = window.matchMedia('(max-width: 768px)');
  const mobile = parseInt(a.dataset.offsetMobile || '0', 10) || 0;
  const offset = mql.matches && mobile ? mobile : base;

  const y = target.getBoundingClientRect().top + window.pageYOffset - offset;
  window.scrollTo({ top: y, behavior: 'smooth' });
});
</script>