/* ===== Projects Isotope Filtering ===== */
$(document).ready(function () {

  var $container = $('.projects .box-container'); // Container holding project items

  // Initialize Isotope
  $container.isotope({
    filter: '*', // Show all items initially
    animationOptions: {
      duration: 750,    // Animation duration in ms
      easing: 'linear', // Animation easing
      queue: false      // Do not queue animations
    }
  });

  // Handle filter tab clicks
  $('.projects .tab-buttons li').click(function () {
    $('.projects .tab-buttons .active').removeClass('active'); // Remove active from previous tab
    $(this).addClass('active');                                 // Set clicked tab as active

    var selector = $(this).attr('data-filter'); // Get filter selector
    $container.isotope({
      filter: selector,                         // Apply filter
      animationOptions: {
        duration: 750,    // Animation duration in ms
        easing: 'linear', // Animation easing
        queue: false      // Do not queue animations
      }
    });
    return false;
  });

  /* ===== Projects Lightbox ===== */
  $(".projects").magnificPopup({
    delegate: ".view",   // Selector for items to open in popup
    type: "image",       // Content type
    removalDelay: 500,   // Delay removal for animation
    gallery: {
      enabled: true      // Enable gallery navigation
    }
  });

});
