export default function initAwardsToggle() {
   const buttons = document.querySelectorAll(".awards-slide__btn-more");

   buttons.forEach((button) => {
      button.addEventListener("click", () => {
         const slide = button.closest(".awards-slide");
         const text = slide.querySelector(".awards-slide__text");
         const btnText = button.querySelector(".btn-more__text");

         slide.classList.toggle("active");
         button.classList.toggle("open");

         if (slide.classList.contains("active")) {
            text.style.maxHeight = text.scrollHeight + "px";
            text.style.marginBottom = "20" + "px";
            btnText.textContent = "свернуть";
         } else {
            text.style.maxHeight = null;
            text.style.marginBottom = null;
            btnText.textContent = "развернуть";
         }
      });
   });
}
