<script>
(function() {
  function closeAccordion() {
    // Alle aktiven Header und Inhalte suchen
    var headers = document.querySelectorAll('.zpaccordion-active');
    var contents = document.querySelectorAll('.zpaccordion-active-content');

    headers.forEach(function(h) {
      h.classList.remove('zpaccordion-active');
    });
    contents.forEach(function(c) {
      c.classList.remove('zpaccordion-active-content');
    });
  }

  function delayedClose() {
    // kleiner Delay, damit das Zoho-Script zuerst fertig ist
    setTimeout(closeAccordion, 400);
  }

  // Wenn DOM steht
  document.addEventListener('DOMContentLoaded', delayedClose);

  // Falls Zoho seine Scripts erst bei window.load feuert
  window.addEventListener('load', delayedClose);

  // Zur Sicherheit bei Drehung / Resize auf dem iPhone
  window.addEventListener('orientationchange', function() {
    setTimeout(closeAccordion, 400);
  });
})();
</script>