export function registerScrollToTop(Alpine) {
    Alpine.data('scrollToTop', () => ({
        visible: false,
        scrollThreshold: 300,

        init() {
            window.addEventListener('scroll', () => {
                this.visible = window.scrollY > this.scrollThreshold;
            }, { passive: true });
        },

        scrollToTop() {
            window.scrollTo({ top: 0, behavior: 'smooth' });
        },
    }));
}
