let mmDropdowns=gsap.matchMedia();mmDropdowns.add("(max-width: 991px)",()=>{const cleanupFns = [];const instances=[];document.querySelectorAll(".puppies-filter-fieldset").forEach((fieldset)=>{const legend=fieldset.querySelector(".puppies-filter-legend");const wrap=fieldset.querySelector(".puppies-filter-checkboxes-wrap");if(!legend || !wrap) return;gsap.set(wrap,{height:0,overflow:"hidden"});const tween=gsap.fromTo(wrap,{height:0},{height:"auto",duration:0.35,ease:"power1.inOut",paused:true},);const instance={fieldset,tween,isOpen:false};const open=()=>{instances.forEach((inst)=>{if(inst !== instance && inst.isOpen)closeInstance(inst);});fieldset.classList.add("is-open");tween.play();instance.isOpen=true;};const closeInstance=(inst)=>{inst.fieldset.classList.remove("is-open");inst.tween.reverse();inst.isOpen = false;};const close=()=>closeInstance(instance);const onLegendClick=(e)=>{e.stopPropagation();instance.isOpen ? close() : open();};const onDocumentClick=(e)=>{if(instance.isOpen && !fieldset.contains(e.target))close();};legend.addEventListener("click",onLegendClick);document.addEventListener("click",onDocumentClick);instances.push(instance);cleanupFns.push(()=>{legend.removeEventListener("click",onLegendClick);document.removeEventListener("click",onDocumentClick);tween.kill();gsap.set(wrap,{clearProps:"height,overflow"});fieldset.classList.remove("is-open");});});return()=>cleanupFns.forEach((fn)=>fn());});