//SCROLLING TEXT ANIMATION

document.addEventListener("DOMContentLoaded", function () {
    const container = document.querySelector(".scrolling-texts");

    if (!container) return;

    // Wrap original content
    const wrapper = document.createElement("div");
    wrapper.className = "scrolling-texts-inner";

    // Move existing children (the <p> tags) into the wrapper
    while (container.firstChild) {
        wrapper.appendChild(container.firstChild);
    }

    // Clone the wrapper for seamless scroll
    const clone = wrapper.cloneNode(true);

    // Append both to the container
    container.appendChild(wrapper);
    container.appendChild(clone);
});


//GO TO TOP JS
function scrollWithoutHash(event) {
    event.preventDefault();
    const target = document.getElementById('page-top');
    if (target) {
        target.scrollIntoView({ behavior: 'smooth' });
    }
}

document.addEventListener('DOMContentLoaded', function () {
    const backToTopLink = document.querySelector('a[href="#page-top"]');
    if (backToTopLink) {
        backToTopLink.addEventListener('click', scrollWithoutHash);
    }
});
