let accordions = document.getElementsByClassName('accordion');
let accordionBodies = document.getElementsByClassName('accordion__item__body');

for (const accordion of accordions) {
  accordion.addEventListener('click', function (e) {
	if(e.target.classList.contains('accordion__item__header')){
		let accBody = document.getElementById(e.target.id + '__body');
		accBody.classList.toggle("accordion__item__body__hidden");
	}
    console.log('accordion clicked', e);
  });
}

// Hide all accordion bodies if there's JS
for (let accordionBody of accordionBodies) {
	accordionBody.classList.add('accordion__item__body__hidden');
}

