(function ($) { 'use strict'; document.documentElement.classList.remove('no-js'); document.documentElement.classList.add('js'); var reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; function initStickyHeader() { var header = document.querySelector('#header'); if (!header) return; function updateHeader() { header.classList.toggle('sticky', window.scrollY > 1); } updateHeader(); window.addEventListener('scroll', updateHeader, { passive: true }); } function initAnimations() { if (!window.AOS || typeof window.AOS.init !== 'function') return; window.AOS.init({ duration: reducedMotion ? 0 : 700, once: true, disable: reducedMotion }); } function initVideoLightbox() { if (!$.fn || typeof $.fn.colorbox !== 'function') return; $('.youtube').colorbox({ iframe: true, innerWidth: 960, innerHeight: 585, maxWidth: '95%', maxHeight: '90%' }); } function initNavigation() { var panel = document.querySelector('#fragrance-navigation'); if (!panel || !window.bootstrap || !window.bootstrap.Offcanvas) return; panel.querySelectorAll('a[href*="#"]').forEach(function (link) { link.addEventListener('click', function () { var instance = window.bootstrap.Offcanvas.getInstance(panel); if (instance) instance.hide(); }); }); } function initRfqPrefill() { var field = document.querySelector('[data-rfq-product-field]'); if (!field) return; document.querySelectorAll('[data-rfq-product]').forEach(function (trigger) { trigger.addEventListener('click', function () { field.value = trigger.dataset.rfqProduct || ''; }); }); } $(function () { initStickyHeader(); initAnimations(); initVideoLightbox(); initNavigation(); initRfqPrefill(); }); })(jQuery);