const faqItems = document.querySelectorAll(".faq_item"); faqItems.forEach((faqItem, index) => { const number = faqItem.querySelector(".faq_number"); const paragraphItem = faqItem.querySelector(".faq_item_paragraph"); if (!paragraphItem) return; paragraphItem.style.height = "0px"; paragraphItem.style.overflow = "hidden"; paragraphItem.style.transition = "height 0.3s ease"; const totalItems = faqItems.length; const displayNumber = index < 9 ? `0.${index + 1}` : `${index + 1}`; if (number) { number.textContent = displayNumber; } faqItem.addEventListener("click", () => { const isOpen = faqItem.classList.toggle("is-open"); paragraphItem.classList.toggle("is-open"); if (isOpen) { const fullHeight = paragraphItem.scrollHeight + "px"; paragraphItem.style.height = fullHeight; } else { paragraphItem.style.height = "0px"; } }); });