const observer = new IntersectionObserver((entries) => {
  entries.forEach(entry => {
    if (entry.isIntersecting) {
      // entering viewport → animate in
      entry.target.classList.add('in-view');
    } else {
      // leaving viewport → reset so it animates again
      entry.target.classList.remove('in-view');
    }
  });
}, { threshold: 0.3 });

document.querySelectorAll('.cmn-heading h2').forEach(el => {
  observer.observe(el);
});

// about-left-js-section


// HEADER-JS

 const btn = document.getElementById('hamburger');
  const menu = document.getElementById('mobileMenu');
  const overlay = document.getElementById('drawerOverlay');
  const closeBtn = document.getElementById('drawerClose');

  function openDrawer() {
    menu.classList.add('open');
    overlay.classList.add('open');
    btn.classList.add('open');
    btn.setAttribute('aria-expanded', 'true');
    document.body.style.overflow = 'hidden';
  }

  function closeDrawer() {
    menu.classList.remove('open');
    overlay.classList.remove('open');
    btn.classList.remove('open');
    btn.setAttribute('aria-expanded', 'false');
    document.body.style.overflow = '';
  }

  btn.addEventListener('click', () => {
    menu.classList.contains('open') ? closeDrawer() : openDrawer();
  });
  closeBtn.addEventListener('click', closeDrawer);
  overlay.addEventListener('click', closeDrawer);

  // ABOUT-JS
   const tabs = document.querySelectorAll('.tab-btn');
  tabs.forEach(btn => {
    btn.addEventListener('click', () => {
      tabs.forEach(b => b.classList.remove('active'));
      btn.classList.add('active');
      document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
      document.getElementById('tab-' + btn.dataset.tab).classList.add('active');
    });
  });

  // pop-up-form-js
   function openForm() {
            document.getElementById("enrollForm").style.display = "flex";
        }

        function closeForm() {
            document.getElementById("enrollForm").style.display = "none";
        }

  // banner-slider-js
$('.banner-slider').slick({
  dots:false,
  arrows: false,
  autoplay: true,
  autoplaySpeed: 2500,
  speed: 800,
  infinite: true
});

  // services-slider-js
   $('.services-slider').slick({
    slidesToShow: 3,
    slidesToScroll: 1,
    autoplay: true,
    autoplaySpeed: 3500,
    speed: 600,
    dots: true,
    infinite: true,
    pauseOnHover: true,
    cssEase: 'cubic-bezier(0.4, 0, 0.2, 1)',
    prevArrow: `<button class="slick-prev slick-arrow">
      <span class="arr-icon">
        <svg viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path d="M11 14L6 9L11 4" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
        </svg>
      </span>
    </button>`,
    nextArrow: `<button class="slick-next slick-arrow">
      <span class="arr-icon">
        <svg viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path d="M7 4L12 9L7 14" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
        </svg>
      </span>
    </button>`,
    responsive: [
      {
        breakpoint:1200,
        settings: { slidesToShow: 2 }
      },
      {
        breakpoint: 1024,
        settings: { slidesToShow: 2 }
      },
      {
        breakpoint: 640,
        settings: { slidesToShow: 1, arrows: false }
      }
    ]
  });
// testimonials-js
  $('.testimonial-slider').slick({
    dots: true,
  arrows: false,
  autoplay: true,
  autoplaySpeed: 3000,
  speed: 800,

  fade: true,        // 🔥 enable fade
  cssEase: 'linear'  // smooth transition
});

// Gallery-sec
  Fancybox.bind("[data-fancybox='gallery']", {
    Thumbs: false,
    Toolbar: {
      display: ["close"]
    },
    animated: true,
  });


