/**
* Theme Name: YITH Proteo Child
* Description: This is a child theme of YITH Proteo, generated by YITH_Proteo_Wizard.
* Author: <a href="https://yithemes.com">YITH</a>
* Template: yith-proteo
* Version: 1.3.0
*/
<?php
add_action('wp_footer', function () {
    if (!is_page(7425)) return;
    ?>
    <script id="keystone-v3-js">
(function () {
  "use strict";

  function initKeystoneV3() {
    const root = document.querySelector(".ks3");
    if (!root || root.dataset.ready === "1") return;
    root.dataset.ready = "1";

    const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
    const hover = window.matchMedia("(hover:hover) and (pointer:fine)").matches;

    if (hover && !reduce) {
      root.addEventListener("pointermove", function (event) {
        const rect = root.getBoundingClientRect();
        const x = event.clientX - rect.left;
        const y = event.clientY - rect.top;
        const nx = x / rect.width - .5;
        const ny = y / rect.height - .5;

        root.style.setProperty("--ks3-x", x + "px");
        root.style.setProperty("--ks3-y", y + "px");

        const workspace = root.querySelector(".ks3-workspace");
        if (workspace) {
          workspace.style.transform =
            "translate3d(" + (nx * 13) + "px," + (ny * 10) + "px,0)";
        }
      });

      root.addEventListener("pointerleave", function () {
        const workspace = root.querySelector(".ks3-workspace");
        if (workspace) workspace.style.transform = "";
      });
    }

    root.querySelectorAll('a[href^="#"]').forEach(function (link) {
      link.addEventListener("click", function (event) {
        const target = document.querySelector(link.getAttribute("href"));
        if (!target) return;
        event.preventDefault();
        target.scrollIntoView({
          behavior: reduce ? "auto" : "smooth",
          block: "start"
        });
      });
    });
  }

  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", initKeystoneV3, { once: true });
  } else {
    initKeystoneV3();
  }

  window.addEventListener("load", initKeystoneV3, { once: true });
})();
    </script>
    <?php
}, 99);
