<button id="back-to-top" title="Go to top" aria-label="Back to top">
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18">
    <path d="M12 3.5l7 7-1.4 1.4L13 7.3V20h-2V7.3L6.4 11.9 5 10.5z" fill="currentColor"/>
  </svg>
</button>
<script>
document.addEventListener('DOMContentLoaded', function() {
  const backToTop = document.getElementById('back-to-top');
  const scrollThreshold = 300; 
  
  checkScrollPosition();
  
  window.addEventListener('scroll', checkScrollPosition);