function r(){if(typeof window>"u")return;const e={threshold:.1,rootMargin:"0px 0px -50px 0px"},t=new IntersectionObserver(n=>{n.forEach(d=>{d.isIntersecting&&d.target.classList.add("in-view")})},e);return document.querySelectorAll(".animate-on-scroll").forEach(n=>t.observe(n)),t}function i(){return typeof localStorage<"u"&&localStorage.getItem("theme")?localStorage.getItem("theme"):window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function s(e){localStorage.setItem("theme",e),c(e)}function c(e){document.documentElement.setAttribute("data-theme",e);const t=document.querySelector('meta[name="theme-color"]');t&&t.setAttribute("content",e==="dark"?"#0f172a":"#ffffff")}function a(){const e=i();c(e),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t=>{localStorage.getItem("theme")||c(t.matches?"dark":"light")})}function m(){const t=i()==="light"?"dark":"light";return s(t),t}document.addEventListener("DOMContentLoaded",()=>{a(),r()});document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("mobile-menu-button"),t=document.getElementById("mobile-menu"),o=document.getElementById("mobile-menu-icon"),n=document.getElementById("mobile-close-icon");e&&t&&o&&n&&(e.addEventListener("click",()=>{const d=e.getAttribute("aria-expanded")==="true";e.setAttribute("aria-expanded",(!d).toString()),t.classList.toggle("hidden"),o.classList.toggle("hidden"),n.classList.toggle("hidden")}),document.addEventListener("click",d=>{!e.contains(d.target)&&!t.contains(d.target)&&(e.setAttribute("aria-expanded","false"),t.classList.add("hidden"),o.classList.remove("hidden"),n.classList.add("hidden"))}))});document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("theme-toggle"),t=document.getElementById("theme-toggle-light-icon"),o=document.getElementById("theme-toggle-dark-icon");if(!e||!t||!o)return;function n(){i()==="dark"?(t.classList.add("hidden"),o.classList.remove("hidden")):(t.classList.remove("hidden"),o.classList.add("hidden"))}n(),e.addEventListener("click",()=>{m(),n()}),new MutationObserver(()=>{n()}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})});
