/* Product Shot Prompt Pack — progressive enhancement only. The page works fully with JS disabled; each feature is an isolated IIFE guarded on capability + element presence. No external calls, no analytics. */ (function () { "use strict"; var root = document.documentElement; if (root.classList.contains("no-js")) root.classList.remove("no-js"); })(); /* 1. Sticky header shrink-on-scroll */ (function stickyHeader() { var header = document.querySelector("header.hero-nav"); if (!header || !("IntersectionObserver" in window)) return; var sentinel = document.createElement("div"); sentinel.style.cssText = "position:absolute;top:120px;height:1px;width:1px;pointer-events:none;"; document.body.prepend(sentinel); new IntersectionObserver(function (entries) { header.dataset.compact = entries[0].isIntersecting ? "false" : "true"; }, { threshold: 0 }).observe(sentinel); })(); /* 2. FAQ accordion — semantic
already works; this just keeps one open */ (function faqAccordion() { var items = document.querySelectorAll("details.faq-item"); if (!items.length) return; items.forEach(function (item) { item.addEventListener("toggle", function () { if (!item.open) return; items.forEach(function (other) { if (other !== item) other.open = false; }); }); }); })(); /* 3. Section fade-in */ (function sectionFadeIn() { if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return; if (!("IntersectionObserver" in window)) return; var observer = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { entry.target.dataset.visible = "true"; observer.unobserve(entry.target); } }); }, { threshold: 0.12 }); document.querySelectorAll("main > section").forEach(function (s) { observer.observe(s); }); })(); /* 4. Smooth scroll for in-page anchors */ (function smoothScroll() { document.querySelectorAll('a[href^="#"]').forEach(function (a) { a.addEventListener("click", function (e) { var href = a.getAttribute("href"); if (!href || href === "#") return; var target = document.querySelector(href); if (!target) return; e.preventDefault(); var behavior = window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth"; target.scrollIntoView({ behavior: behavior, block: "start" }); target.setAttribute("tabindex", "-1"); target.focus({ preventScroll: true }); }); }); })(); /* 5. CTA click tracking hook — buyer wires up their own analytics later */ (function ctaTracking() { document.addEventListener("click", function (e) { var link = e.target.closest("a[href], button"); if (!link || !link.matches(".btn-primary, .btn-secondary")) return; var region = link.closest("section, header, footer"); var section = region && region.tagName ? region.tagName.toLowerCase() : "unknown"; var label = (link.textContent || "").trim(); if (typeof window.plausible === "function") { window.plausible("cta_click", { props: { section: section, label: label } }); } else if (Array.isArray(window.dataLayer)) { window.dataLayer.push({ event: "cta_click", section: section, label: label }); } }); })(); /* 6. Sticky CTA (mobile) — shows once hero CTA scrolls away, hides at pricing/FAQ */ (function stickyCta() { var bar = document.getElementById("sticky-cta"); if (!bar || !("IntersectionObserver" in window)) return; var hero = document.querySelector("header.hero-nav .btn-primary, .hero .btn-primary"); var pricing = document.getElementById("pricing"); var faq = document.getElementById("faq"); if (!hero) return; var setVisible = function (v) { if (v && bar.hasAttribute("hidden")) bar.removeAttribute("hidden"); bar.dataset.visible = v ? "true" : "false"; }; new IntersectionObserver(function (entries) { setVisible(!entries[0].isIntersecting); }, { threshold: 0 }).observe(hero); var hideRegions = [pricing, faq].filter(Boolean); if (hideRegions.length) { var hideObserver = new IntersectionObserver(function (entries) { if (entries.some(function (e) { return e.isIntersecting; })) setVisible(false); }, { threshold: 0.1 }); hideRegions.forEach(function (el) { hideObserver.observe(el); }); } })();