// Show menu
const navMenu = document.getElementById("nav-menu");
const navToggle = document.getElementById("nav-toggle");
const navClose = document.getElementById("nav-close");

// Validate if const exists

if (navToggle) {
  navToggle.addEventListener("click", () => {
    navMenu.classList.add("show-menu");
  });
}

//Menu hidden
// alidate if const exists

if (navClose) {
  navClose.addEventListener("click", () => {
    navMenu.classList.remove("show-menu");
  });
}

// Remove menu mobile
const navLink = document.querySelectorAll(".nav-link");

const linkAction = () => {
  const navMenu = document.getElementById("nav-menu");

  navMenu.classList.remove("show-menu");
};

navLink.forEach((n) => n.addEventListener("click", linkAction));

// GSAP animation
gsap.from('.home-frame', 1.5, { opacity: 0, y: -300, delay: 0.2 });
gsap.from('.home-sphere', 1.5, { opacity: 0, x: -300, delay: 0.3 });
gsap.from('.home-triangle', 1.5, { opacity: 0, x: 300, delay: 0.6 });
gsap.from('.home-r', 1.5, { opacity: 0, y: -300, delay: 0.8 });
gsap.from('.home-l', 1.5, { opacity: 0, y: 300, delay: 0.8 });


if (window.innerWidth <= 766) {
    gsap.from('.home-content', 1.5, { opacity: 0, y: -300, delay: 0.8 });
    gsap.from('.home-title img', 1.5, { opacity: 0, x: 100, delay: 1.3 });
} else {
    gsap.from('.home-content', 1.5, { opacity: 0, x: -300, delay: 0.8 });
    gsap.from('.home-title img', 1.5, { opacity: 0, x: 300, delay: 1.2 });
}
