window.addEventListener('load', function() {
// Get the current URL hash (without the #)
var hash = window.location.hash.substring(1);
if (!hash) return;
// Find the accordion widget container with the matching ID
var accordion = document.getElementById(hash);
if (!accordion) return;
// Find all accordion items inside this container
var items = accordion.querySelectorAll('.elementor-accordion-item');
if (!items.length) return;
// Loop through items to find the first one that is not already active
var itemToOpen = null;
items.forEach(function(item) {
if (!item.classList.contains('elementor-active') && !itemToOpen) {
itemToOpen = item;
}
});
if (!itemToOpen) return;
// Find the header inside the accordion item
var header = itemToOpen.querySelector('.elementor-tab-title, .elementor-accordion-header');
if (!header) return;
// Trigger a click to open it properly
header.click();
// Scroll to the accordion for smooth UX
accordion.scrollIntoView({ behavior: 'smooth' });
});