/** 
 * Tage der digitalen Freiheit
 * Handcrafted with ♥ by x~alotl
 */
document.addEventListener('DOMContentLoaded', function () {
    const locationLinks = document.querySelectorAll('.location-link');
    const markers = document.querySelectorAll('.location-marker');
    locationLinks.forEach(link => {
        link.addEventListener('click', function (e) {
            e.preventDefault();
            markers.forEach(marker => {
                marker.classList.remove('active');
            });
            const targetLocation = this.getAttribute('data-target');
            const targetMarker = document.querySelector(`[data-location="${targetLocation}"]`);
            if (targetMarker) {
                targetMarker.classList.add('active');

                const targetFloor = this.getAttribute('href');
                const targetElement = document.querySelector(targetFloor);
                if (targetElement) {
                    targetElement.scrollIntoView({ behavior: 'smooth' });
                }
                setTimeout(() => {
                    targetMarker.classList.remove('active');
                }, 10000);
            }
        });
    });
});
