document.addEventListener('DOMContentLoaded', function () {
    'use strict';

    document.querySelectorAll('[data-name="to-top"]').forEach(function (ToTop) {
        ToTop.addEventListener('click', function (event) {
            event.preventDefault();
            window.scrollTo({
                top: 0,
                behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth'
            });
        });
    });
});
