/******* Do not edit this file *******
Simple Custom CSS and JS - by Silkypress.com
Saved: Aug 08 2026 | 06:01:02 */

(function () {
  "use strict";

  function qs(sel, root) { return (root || document).querySelector(sel); }
  function qsa(sel, root) { return Array.prototype.slice.call((root || document).querySelectorAll(sel)); }

  function initNavbarScroll() {
    var header = qs("#siteHeader") || qs(".nt-header");
    function update() {
      var scrolled = window.scrollY > 8;
      document.body.classList.toggle("nt-scrolled", scrolled);
      if (header) {
        header.classList.toggle("is-scrolled", scrolled);
        header.classList.toggle("nt-is-scrolled", scrolled);
      }
    }
    update();
    window.addEventListener("scroll", update, { passive: true });
  }

  function initMobileMenu() {
    var toggle = qs(".nt-mobile-toggle");
    var panel = qs("#mobileMenu") || qs(".nt-mobile-panel");
    if (!toggle || !panel) return;

    toggle.setAttribute("type", "button");

    toggle.addEventListener("click", function (event) {
      event.preventDefault();
      event.stopPropagation();
      var open = !panel.classList.contains("open");
      panel.classList.toggle("open", open);
      document.body.classList.toggle("nt-menu-open", open);
      toggle.setAttribute("aria-expanded", open ? "true" : "false");
    });

    panel.addEventListener("click", function (event) { event.stopPropagation(); });

    document.addEventListener("click", function (event) {
      if (!panel.contains(event.target) && !toggle.contains(event.target)) {
        panel.classList.remove("open");
        document.body.classList.remove("nt-menu-open");
        toggle.setAttribute("aria-expanded", "false");
      }
    });

    qsa(".nt-mobile-subbutton").forEach(function (button) {
      button.setAttribute("type", "button");
      button.addEventListener("click", function (event) {
        event.preventDefault();
        event.stopPropagation();
        var child = button.nextElementSibling;
        if (!child) return;
        var open = !child.classList.contains("open");
        child.classList.toggle("open", open);
        button.setAttribute("aria-expanded", open ? "true" : "false");
      });
    });
  }

  var subjectDetails = {
    "Reading and Reasoning": "Build reading confidence, comprehension, vocabulary, and reasoning skills through guided practice.",
    "Reading & Reasoning": "Build reading confidence, comprehension, vocabulary, and reasoning skills through guided practice.",
    "Spell It Right": "Fun spelling practice to improve accuracy, vocabulary, and word confidence.",
    "Speak French": "Introductory French speaking practice for everyday confidence.",
    "Speak Igbo": "Cultural language learning with simple speaking activities and guided practice.",
    "Speak Yoruba": "Cultural language learning with simple speaking activities and guided practice.",
    "Math Marathon": "Number practice, speed, and confidence through guided maths challenges.",
    "Science Essentials": "Simple experiments and everyday examples for early discovery.",
    "Creative Writing": "Storytelling, imagination, grammar, and clear writing practice.",
    "Public Speaking 101": "Confidence-building speaking practice for young learners.",
    "Public Speaking": "Confidence-building speaking practice for young learners.",
    "G.I.R.L.S Club": "Confidence, leadership, self-expression, and personal growth.",
    "Money & Business": "Practical money habits and beginner business ideas.",
    "Beginner's Coding": "Basic coding logic through simple, creative activities.",
    "Excel for Beginners": "Spreadsheets, formulas, tables, and practical organisation skills.",
    "Mental Maths": "Quick arithmetic, pattern recognition, and playful problem-solving practice.",
    "Science": "Explore science topics through simple concepts and guided learning."
  };

  function initSubjectSelects() {
    qsa(".nt-clean-subject-select, .nt-subject-select, [data-subject-select]").forEach(function (select) {
      select.addEventListener("change", function () {
        var card = select.closest(".nt-clean-age-card") || select.closest("[data-subject-card]") || select.closest("article");
        var box = card ? (qs(".nt-clean-selected-card", card) || qs("[data-subject-detail]", card)) : null;
        if (!box) return;

        var value = select.value || "";
        var title = qs("h4", box);
        var text = qs("p", box);
        var note = qs("small", box);

        if (title) title.textContent = value || "Choose a class";
        if (text) text.textContent = value ? (subjectDetails[value] || "A focused live class designed to support your child's summer learning goals.") : "Select from the dropdown to see class details.";
        if (note) note.textContent = value ? "Selected class details are shown below." : "No class selected yet.";
        box.classList.toggle("has-selection", Boolean(value));
      });
    });
  }

  function initPriceSelects() {
    qsa(".nt-clean-price-select, .nt-price-select, [data-price-select]").forEach(function (select) {
      select.addEventListener("change", function () {
        var card = select.closest(".nt-clean-price-card") || select.closest("[data-price-card]") || select.closest("article");
        var result = card ? (qs(".nt-clean-price-result", card) || qs("[data-price-result]", card)) : null;
        if (!result) return;

        var option = select.options[select.selectedIndex];
        var country = option ? option.textContent.trim() : "";
        var price = select.value || "";

        result.textContent = price ? (price + (country && country !== "Choose location" ? " · " + country : "")) : "Select a location to view price";
        result.classList.toggle("has-price", Boolean(price));
      });
    });
  }

  function initClickableCards() {
    qsa("[data-click-card]").forEach(function (card) {
      card.addEventListener("click", function () {
        var target = card.getAttribute("data-click-target");
        var detail = target ? qs(target) : qs("[data-card-detail]", card);
        if (!detail) return;
        detail.classList.toggle("open");
      });
    });
  }

  function init() {
    initNavbarScroll();
    initMobileMenu();
    initSubjectSelects();
    initPriceSelects();
    initClickableCards();
  }

  if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init);
  else init();
})();

/* V189 hamburger backup */
(function () {
  function ready(fn) {
    if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", fn);
    else fn();
  }

  ready(function () {
    var toggle = document.querySelector(".nt-mobile-toggle");
    var panel = document.getElementById("mobileMenu") || document.querySelector(".nt-mobile-panel");
    if (!toggle || !panel) return;

    function setOpen(open) {
      panel.classList.toggle("open", open);
      document.body.classList.toggle("nt-menu-open", open);
      toggle.setAttribute("aria-expanded", open ? "true" : "false");
    }

    if (!toggle.dataset.v189Bound) {
      toggle.dataset.v189Bound = "true";
      toggle.addEventListener("click", function (event) {
        event.preventDefault();
        event.stopPropagation();
        setOpen(!panel.classList.contains("open"));
      }, true);
    }

    document.querySelectorAll(".nt-mobile-subbutton").forEach(function (button) {
      if (button.dataset.v189Bound) return;
      button.dataset.v189Bound = "true";
      button.addEventListener("click", function (event) {
        event.preventDefault();
        event.stopPropagation();
        var child = button.nextElementSibling;
        if (!child) return;
        var open = !child.classList.contains("open");
        child.classList.toggle("open", open);
        button.setAttribute("aria-expanded", open ? "true" : "false");
      }, true);
    });
  });
})();

/* V190: third page class-card interactions */
(function () {
  const subjectDetails = {
    "Math Marathon": "Number practice, speed, and confidence through guided maths challenges.",
    "Reading and Reasoning": "Build reading confidence, comprehension, vocabulary, and reasoning skills through guided practice.",
    "Reading & Reasoning": "Build reading confidence, comprehension, vocabulary, and reasoning skills through guided practice.",
    "Spell It Right": "Fun spelling practice to improve accuracy, vocabulary, and word confidence.",
    "Speak French": "Introductory French speaking practice for everyday confidence.",
    "Speak Igbo": "Cultural language learning with simple speaking activities and guided practice.",
    "Speak Yoruba": "Cultural language learning with simple speaking activities and guided practice.",
    "Science Essentials": "Simple experiments and everyday examples for early discovery.",
    "Beginner's Coding": "Basic coding logic through simple, creative activities.",
    "Excel for Beginners": "Spreadsheets, formulas, tables, and practical organisation skills.",
    "Mental Maths": "Quick arithmetic, pattern recognition, and playful problem-solving practice.",
    "Creative Writing": "Storytelling, imagination, grammar, and clear writing practice.",
    "Public Speaking 101": "Confidence-building speaking practice for young learners.",
    "Public Speaking": "Confidence-building speaking practice for young learners.",
    "G.I.R.L.S Club": "Confidence, leadership, self-expression, and personal growth.",
    "Money & Business": "Practical money habits and beginner business ideas.",
    "Science": "Explore science topics through simple concepts and guided learning."
  };

  function updateAgeCard(card, course) {
    if (!card || !course) return;
    const detail = card.querySelector("[data-age-detail]");
    if (!detail) return;
    const h4 = detail.querySelector("h4");
    const p = detail.querySelector("p");
    const select = card.querySelector("[data-age-select]");

    if (h4) h4.textContent = course;
    if (p) p.textContent = subjectDetails[course] || "A focused live class designed to support your child's summer learning goals.";
    if (select) {
      const match = Array.from(select.options).find((option) => option.textContent.trim() === course);
      if (match) select.value = match.textContent.trim();
    }
  }

  function initThirdPage() {
    document.querySelectorAll(".nt-figma-age3-card").forEach((card) => {
      const select = card.querySelector("[data-age-select]");
      if (select && !select.dataset.v190Bound) {
        select.dataset.v190Bound = "true";
        select.addEventListener("change", () => {
          if (select.value) updateAgeCard(card, select.value);
        });
      }

      card.querySelectorAll("[data-course]").forEach((button) => {
        if (button.dataset.v190Bound) return;
        button.dataset.v190Bound = "true";
        button.addEventListener("click", () => {
          const course = button.getAttribute("data-course");
          updateAgeCard(card, course);
        });
      });
    });
  }

  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", initThirdPage);
  } else {
    initThirdPage();
  }
})();

/* V192: Figma pricing page interactions */
(function () {
  function initFigmaPricing() {
    document.querySelectorAll(".nt-figma-price4-card").forEach(function (card) {
      var select = card.querySelector("[data-price-select]");
      var result = card.querySelector("[data-price-result]");
      if (!select || !result || select.dataset.v192Bound) return;

      select.dataset.v192Bound = "true";
      select.addEventListener("change", function () {
        var option = select.options[select.selectedIndex];
        var country = option ? option.textContent.trim() : "";
        var price = select.value || "";

        if (price) {
          result.textContent = price + (country && country !== "Choose location" ? " · " + country : "");
          result.classList.add("has-price");
        } else {
          result.textContent = "Select your location to view price";
          result.classList.remove("has-price");
        }
      });
    });
  }

  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", initFigmaPricing);
  } else {
    initFigmaPricing();
  }
})();

/* V197: custom Page 3 dropdowns that open downward */
(function () {
  const subjectDetails = {
    "Math Marathon": "Number practice, speed, and confidence through guided maths challenges.",
    "Reading and Reasoning": "Build reading confidence, comprehension, vocabulary, and reasoning skills through guided practice.",
    "Reading & Reasoning": "Build reading confidence, comprehension, vocabulary, and reasoning skills through guided practice.",
    "Spell It Right": "Fun spelling practice to improve accuracy, vocabulary, and word confidence.",
    "Speak French": "Introductory French speaking practice for everyday confidence.",
    "Speak Igbo": "Cultural language learning with simple speaking activities and guided practice.",
    "Speak Yoruba": "Cultural language learning with simple speaking activities and guided practice.",
    "Science Essentials": "Simple experiments and everyday examples for early discovery.",
    "Beginner's Coding": "Basic coding logic through simple, creative activities.",
    "Excel for Beginners": "Spreadsheets, formulas, tables, and practical organisation skills.",
    "Mental Maths": "Quick arithmetic, pattern recognition, and playful problem-solving practice.",
    "Creative Writing": "Storytelling, imagination, grammar, and clear writing practice.",
    "Public Speaking 101": "Confidence-building speaking practice for young learners.",
    "Public Speaking": "Confidence-building speaking practice for young learners.",
    "G.I.R.L.S Club": "Confidence, leadership, self-expression, and personal growth.",
    "Money & Business": "Practical money habits and beginner business ideas.",
    "Science": "Explore science topics through simple concepts and guided learning."
  };

  function updateAgeCard(card, course) {
    if (!card || !course) return;
    const detail = card.querySelector("[data-age-detail]");
    if (!detail) return;

    const title = detail.querySelector("h4");
    const text = detail.querySelector("p");
    if (title) title.textContent = course;
    if (text) text.textContent = subjectDetails[course] || "A focused live class designed to support your child's summer learning goals.";
  }

  function closeAll(except) {
    document.querySelectorAll("[data-age-dropdown].open").forEach((drop) => {
      if (drop !== except) drop.classList.remove("open");
    });
  }

  function initCustomAgeDropdowns() {
    document.querySelectorAll("[data-age-dropdown]").forEach((dropdown) => {
      if (dropdown.dataset.v197Bound) return;
      dropdown.dataset.v197Bound = "true";

      const trigger = dropdown.querySelector("[data-age-trigger]");
      const label = trigger ? trigger.querySelector("span") : null;
      const card = dropdown.closest(".nt-figma-age3-card");

      if (trigger) {
        trigger.addEventListener("click", (event) => {
          event.preventDefault();
          event.stopPropagation();
          const willOpen = !dropdown.classList.contains("open");
          closeAll(dropdown);
          dropdown.classList.toggle("open", willOpen);
        });
      }

      dropdown.querySelectorAll("[data-dropdown-course]").forEach((button) => {
        button.addEventListener("click", (event) => {
          event.preventDefault();
          event.stopPropagation();

          const course = button.getAttribute("data-dropdown-course");
          if (label) label.textContent = course;
          dropdown.querySelectorAll("[data-dropdown-course]").forEach((btn) => btn.classList.remove("selected"));
          button.classList.add("selected");
          dropdown.classList.remove("open");

          updateAgeCard(card, course);
        });
      });
    });

    document.addEventListener("click", () => closeAll(null));
    document.addEventListener("keydown", (event) => {
      if (event.key === "Escape") closeAll(null);
    });
  }

  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", initCustomAgeDropdowns);
  } else {
    initCustomAgeDropdowns();
  }
})();

/* V210: safe scroll reveal animations, excluding the first page */
(function () {
  function initSafeScrollReveals() {
    const selectors = [
      ".nt-figma-offer2-header",
      ".nt-figma-offer2-card",
      ".nt-figma-bridge4-header",
      ".nt-figma-bridge4-card",
      ".nt-figma-age3-header",
      ".nt-figma-age3-card",
      ".nt-figma-price4-header",
      ".nt-figma-price4-card",
      ".nt-figma-price4-batches"
    ];

    const items = [];
    selectors.forEach((selector) => {
      document.querySelectorAll(selector).forEach((el) => {
        if (!el.closest(".nt-figma-hero")) items.push(el);
      });
    });

    items.forEach((el) => {
      el.classList.add("nt-reveal");

      if (el.matches(".nt-figma-offer2-card, .nt-figma-bridge4-card, .nt-figma-age3-card, .nt-figma-price4-card")) {
        el.classList.add("nt-reveal-scale");
      }

      if (el.matches(".nt-figma-offer2-header, .nt-figma-bridge4-header, .nt-figma-age3-header, .nt-figma-price4-header")) {
        el.classList.add("nt-reveal-left");
      }

      const parent = el.parentElement;
      const index = parent ? Array.prototype.indexOf.call(parent.children, el) : 0;
      el.style.setProperty("--nt-reveal-delay", Math.min(index * 70, 280) + "ms");
    });

    if (!("IntersectionObserver" in window)) {
      items.forEach((el) => el.classList.add("nt-in-view"));
      return;
    }

    const observer = new IntersectionObserver((entries) => {
      entries.forEach((entry) => {
        if (entry.isIntersecting) {
          entry.target.classList.add("nt-in-view");
          observer.unobserve(entry.target);
        }
      });
    }, {
      threshold: 0.12,
      rootMargin: "0px 0px -6% 0px"
    });

    items.forEach((el) => observer.observe(el));
  }

  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", initSafeScrollReveals);
  } else {
    initSafeScrollReveals();
  }
})();

/* V236 — rebuilt second-page animation: reveal + tap-to-open cards */
document.addEventListener('DOMContentLoaded', function () {
  const section = document.querySelector('.nt-figma-offer-v236');
  if (!section) return;

  const show = function () { section.classList.add('is-visible'); };

  if ('IntersectionObserver' in window) {
    const obs = new IntersectionObserver(function(entries){
      entries.forEach(function(entry){
        if (entry.isIntersecting) {
          show();
          obs.unobserve(entry.target);
        }
      });
    }, { threshold: 0.18 });
    obs.observe(section);
    setTimeout(show, 1200);
  } else {
    show();
  }

  const cards = section.querySelectorAll('.nt-figma-feature-v236');
  cards.forEach(function(card){
    card.addEventListener('click', function () {
      cards.forEach(function(other){ if (other !== card) other.classList.remove('is-active'); });
      card.classList.toggle('is-active');
    });

    card.addEventListener('keydown', function (e) {
      if (e.key === 'Enter' || e.key === ' ') {
        e.preventDefault();
        cards.forEach(function(other){ if (other !== card) other.classList.remove('is-active'); });
        card.classList.toggle('is-active');
      }
    });
  });
});

/* V239 — reveal animation for rebuilt old How It Works section */
document.addEventListener('DOMContentLoaded', function () {
  const section = document.querySelector('.nt-compact-bridge-v124');
  if (!section) return;

  const show = function () { section.classList.add('is-visible'); };

  if ('IntersectionObserver' in window) {
    const obs = new IntersectionObserver(function(entries){
      entries.forEach(function(entry){
        if (entry.isIntersecting) {
          show();
          obs.unobserve(entry.target);
        }
      });
    }, { threshold: 0.16 });
    obs.observe(section);
    setTimeout(show, 1200);
  } else {
    show();
  }
});

/* V249 — background moving objects for Page 2 and Page 3 only */
document.addEventListener('DOMContentLoaded', function () {
  function startMovingObjects(sectionSelector, canvasSelector, options) {
    const section = document.querySelector(sectionSelector);
    const canvas = section ? section.querySelector(canvasSelector) : null;
    if (!section || !canvas) return;

    const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
    if (reduceMotion) return;

    const ctx = canvas.getContext('2d');
    if (!ctx) return;

    let dpr = Math.min(window.devicePixelRatio || 1, 2);
    let width = 0;
    let height = 0;
    let rafId = 0;
    let active = false;

    const resize = function () {
      const rect = section.getBoundingClientRect();
      width = Math.max(320, Math.floor(rect.width));
      height = Math.max(options.minHeight || 520, Math.floor(rect.height));
      canvas.width = Math.floor(width * dpr);
      canvas.height = Math.floor(height * dpr);
      canvas.style.width = width + 'px';
      canvas.style.height = height + 'px';
      ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
    };

    const glow = function (x, y, radius, start, end) {
      const g = ctx.createRadialGradient(x, y, 0, x, y, radius);
      g.addColorStop(0, start);
      g.addColorStop(1, end);
      ctx.fillStyle = g;
      ctx.beginPath();
      ctx.arc(x, y, radius, 0, Math.PI * 2);
      ctx.fill();
    };

    const flow = function (offset, time, stroke, dot, lineWidth) {
      const amp = (options.amp || 24) + offset * 5;
      const baseY = height * ((options.base || 0.18) + offset * (options.spacing || 0.14));
      const freq = 0.0085 + offset * 0.0011;
      const speed = 0.00075 + offset * 0.00008;

      ctx.beginPath();
      for (let x = -20; x <= width + 20; x += 8) {
        const y =
          baseY +
          Math.sin(x * freq + time * speed + offset * 1.65) * amp +
          Math.cos(x * freq * 0.52 + time * speed * 1.2 + offset) * amp * 0.36;
        if (x === -20) ctx.moveTo(x, y);
        else ctx.lineTo(x, y);
      }

      ctx.strokeStyle = stroke;
      ctx.lineWidth = lineWidth;
      ctx.stroke();

      const dotX = ((time * (0.032 + offset * 0.004)) % (width + 180)) - 90;
      const dotY =
        baseY +
        Math.sin(dotX * freq + time * speed + offset * 1.65) * amp +
        Math.cos(dotX * freq * 0.52 + time * speed * 1.2 + offset) * amp * 0.36;

      ctx.fillStyle = dot;
      ctx.shadowColor = dot;
      ctx.shadowBlur = 10;
      ctx.beginPath();
      ctx.arc(dotX, dotY, 4.2, 0, Math.PI * 2);
      ctx.fill();
      ctx.shadowBlur = 0;
    };

    const tinyDots = function (time) {
      const colors = [
        'rgba(97,220,213,0.60)',
        'rgba(246,29,184,0.52)',
        'rgba(107,40,217,0.50)',
        'rgba(255,191,87,0.48)'
      ];

      for (let i = 0; i < (options.dots || 26); i++) {
        const x = (i * 137 + time * (0.010 + (i % 4) * 0.002)) % (width + 80) - 40;
        const y = (height * 0.1) + ((i * 71 + Math.sin(time * 0.0006 + i) * 24) % (height * 0.78));
        ctx.fillStyle = colors[i % colors.length];
        ctx.beginPath();
        ctx.arc(x, y, 2.1 + (i % 3) * 0.55, 0, Math.PI * 2);
        ctx.fill();
      }
    };

    const render = function (time) {
      if (!active) return;
      ctx.clearRect(0, 0, width, height);

      glow(width * 0.15, height * 0.22, 160, 'rgba(97,220,213,0.16)', 'rgba(97,220,213,0)');
      glow(width * 0.84, height * 0.20, 180, 'rgba(246,29,184,0.14)', 'rgba(246,29,184,0)');
      glow(width * 0.50, height * 0.78, 220, 'rgba(107,40,217,0.10)', 'rgba(107,40,217,0)');
      glow(width * 0.68, height * 0.58, 145, 'rgba(255,191,87,0.12)', 'rgba(255,191,87,0)');

      flow(0, time, 'rgba(97,220,213,0.30)', 'rgba(97,220,213,0.92)', 2.1);
      flow(1, time, 'rgba(107,40,217,0.24)', 'rgba(107,40,217,0.90)', 2.1);
      flow(2, time, 'rgba(246,29,184,0.26)', 'rgba(246,29,184,0.90)', 2.1);
      flow(3, time, 'rgba(255,191,87,0.18)', 'rgba(255,191,87,0.86)', 1.8);
      tinyDots(time);

      rafId = requestAnimationFrame(render);
    };

    const start = function () {
      if (active) return;
      active = true;
      resize();
      rafId = requestAnimationFrame(render);
    };

    const stop = function () {
      active = false;
      if (rafId) cancelAnimationFrame(rafId);
    };

    if ('IntersectionObserver' in window) {
      const obs = new IntersectionObserver(function (entries) {
        entries.forEach(function (entry) {
          if (entry.isIntersecting) start();
          else stop();
        });
      }, { threshold: 0.08 });
      obs.observe(section);
    } else {
      start();
    }

    window.addEventListener('resize', resize);
  }

  startMovingObjects('.nt-figma-offer-v236', '.nt-offer-shader-bg-v249', {
    minHeight: 520,
    amp: 24,
    base: 0.18,
    spacing: 0.14,
    dots: 28
  });

  startMovingObjects('.nt-figma-age3-content, .nt-age-content-v108', '.nt-age-shader-bg-v249', {
    minHeight: 620,
    amp: 27,
    base: 0.16,
    spacing: 0.13,
    dots: 30
  });
});
