document.addEventListener("DOMContentLoaded", () => {
const el = document.querySelector(".store-footer__inner p:first-of-type");
if (!el) return;
const text = el.innerText.trim();
el.innerHTML = ``;
const tw = el.querySelector(".typewriter");
// ✅ حل المشكلة في الموبايل
tw.style.display = "inline-block";
tw.style.maxWidth = "100%";
tw.style.whiteSpace = "normal"; // يخلي الكلام يلف
tw.style.wordWrap = "break-word"; // يمنع الخروج برا
tw.style.overflowWrap = "break-word";
let i = 0;
function type() {
if (i <= text.length) {
tw.innerText = text.substring(0, i);
i++;
setTimeout(type, 120); // سرعة الكتابة
} else {
setTimeout(() => {
i = 0;
type();
}, 1500); // وقت التوقف قبل الإعادة
}
}
type();
});
(() => {
// ====== إعداد الـ CSS عبر إنشاء عنصر