/**
 * EasySite Pro – Mega menu keyboard/accessibility helpers
 */
(function () {
	'use strict';

	document.querySelectorAll('.easysite-mega-menu-item > a').forEach(function (link) {
		link.addEventListener('keydown', function (e) {
			if (e.key === 'Enter' || e.key === ' ') {
				var parent = link.parentElement;
				var panel = parent.querySelector('.easysite-mega-panel');
				if (panel) {
					e.preventDefault();
					panel.style.display = panel.style.display === 'grid' ? 'none' : 'grid';
				}
			}
		});
	});
})();
