document.querySelectorAll('.accordion-button').forEach(button => {
button.addEventListener('click', () => {
const item = button.parentElement;
const content = item.querySelector('.accordion-content');
if (item.classList.contains('active')) {
content.style.maxHeight = '0px';
item.classList.remove('active');
} else {
document.querySelectorAll('.accordion-item').forEach(i => {
i.classList.remove('active');
i.querySelector('.accordion-content').style.maxHeight = '0px';
});
item.classList.add('active');
content.style.maxHeight = content.scrollHeight + 'px';
// Smooth Scroll to Active Section
setTimeout(() => {
item.scrollIntoView({ behavior: "smooth", block: "start" });
}, 300); // Slight delay for better effect
}
});
});