(function(){var t=document.documentElement;t.classList.add("kutby-js");var e="kutby-color-scheme";function i(a){t.classList.toggle("kutby-dark",a),document.body.classList.toggle("kutby-dark",a),document.querySelectorAll("[data-kutby-theme-toggle]").forEach(function(r){r.setAttribute("aria-pressed",a?"true":"false"),r.setAttribute("aria-label",a?"تبديل إلى الوضع النهاري":"تبديل المظهر")})}try{localStorage.getItem(e)==="dark"&&i(!0)}catch{}document.querySelectorAll("[data-kutby-theme-toggle]").forEach(function(a){a.addEventListener("click",function(){var r=!t.classList.contains("kutby-dark");i(r);try{localStorage.setItem(e,r?"dark":"light")}catch{}})});var n=document.querySelector("[data-kutby-edu-header]");if(n){var s=function(){n.classList.toggle("is-scrolled",window.scrollY>8)};s(),window.addEventListener("scroll",s,{passive:!0})}document.dispatchEvent(new CustomEvent("kutby:ready",{detail:window.kutbyData||{}}))})();(function(){var t=document.querySelector("[data-kutby-nav-toggle]"),e=document.querySelector("[data-kutby-nav]"),i=window.matchMedia("(max-width: 767px)");if(!t||!e)return;function n(a){e.classList.toggle("is-open",a),t.setAttribute("aria-expanded",a?"true":"false"),i.matches?a?e.removeAttribute("hidden"):e.setAttribute("hidden",""):(e.removeAttribute("hidden"),e.classList.remove("is-open"),t.setAttribute("aria-expanded","false"))}function s(){i.matches?e.classList.contains("is-open")||e.setAttribute("hidden",""):(n(!1),e.removeAttribute("hidden"))}s(),t.addEventListener("click",function(){i.matches&&n(!e.classList.contains("is-open"))}),document.addEventListener("keydown",function(a){a.key==="Escape"&&e.classList.contains("is-open")&&(n(!1),t.focus())}),typeof i.addEventListener=="function"?i.addEventListener("change",s):typeof i.addListener=="function"&&i.addListener(s)})();(function(){var t=document.querySelector("[data-kutby-back-to-top]");if(t){var e=function(){var n=window.scrollY>400;t.classList.toggle("is-visible",n)};window.addEventListener("scroll",e,{passive:!0}),e(),t.addEventListener("click",function(){window.scrollTo({top:0,behavior:"smooth"})})}var i=document.querySelectorAll("[data-kutby-newsletter-shell]");i.forEach(function(n){n.addEventListener("submit",function(s){s.preventDefault()})})})();
