document.addEventListener("DOMContentLoaded", function () {
    document.querySelectorAll(".faq-header").forEach(function (header) {
        header.addEventListener("click", function (e) {
            const id = e.currentTarget.getAttribute("id");
            const max = e.currentTarget.getAttribute("data");
            const ref = e.currentTarget.getAttribute("ref");
            const expanded = e.currentTarget.getAttribute("aria-expanded");

            if (expanded === "true") {
                document
                    .querySelector("#" + id + " .icon #" + id + "-down")
                    .classList.remove("hide");
                document
                    .querySelector("#" + id + " .icon #" + id + "-up")
                    .classList.add("hide");
            } else {
                document
                    .querySelector("#" + id + " .icon #" + id + "-down")
                    .classList.add("hide");
                document
                    .querySelector("#" + id + " .icon #" + id + "-up")
                    .classList.remove("hide");
            }
        });
    });
});
