const form = document.querySelector(".newsletter-form");

if (form) {
  form.addEventListener("submit", (event) => {
    event.preventDefault();
    const input = form.querySelector("input");
    if (!input) return;
    if (!input.value.trim()) {
      input.placeholder = "請輸入有效的電子郵件";
      input.focus();
      return;
    }
    form.reset();
    alert("感謝訂閱！我們會把最新毛孩消息寄給你。");
  });
}
