const parent=document.querySelector('.home .portray-header-custom')?.parentNode;
if(parent){
parent.classList.add('portray-header-custom-wrapper');
}
let cursor=document.querySelector(".portray-testimonial-wrapper .follow-img");
document.addEventListener("mousemove", (e)=> {
let x=e.clientX;
let y=e.clientY;
cursor.style.left=`${x}px`;
cursor.style.top=`${y}px`;
});
function addCursorFollowEffect(parentSelector, childSelector){
const parentDivs=document.querySelectorAll(parentSelector);
parentDivs.forEach((parentDiv)=> {
const childDiv=parentDiv.querySelector(childSelector);
childDiv.style.transition='transform 0.1s ease-out';
parentDiv.addEventListener('mousemove', (event)=> {
const rect=parentDiv.getBoundingClientRect();
let x=event.clientX - rect.left;
let y=event.clientY - rect.top;
const childWidth=childDiv.offsetWidth / 2;
const childHeight=childDiv.offsetHeight / 2;
x=Math.max(0, Math.min(x - childWidth, parentDiv.offsetWidth - childWidth));
y=Math.max(0, Math.min(y - childHeight, parentDiv.offsetHeight - childHeight));
childDiv.style.transform=`translate(${x}px, ${y}px)`;
childDiv.style.zIndex=99;
});
});
}
addCursorFollowEffect('.testimonial-card', '.testimonial-card-content');