{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"pointer-spotlight-hidden-text-reveal","type":"registry:block","title":"Pointer Spotlight Hidden Text","description":"","dependencies":["framer-motion"],"files":[{"path":"components/we-inc/pointer-spotlight-hidden-text-reveal.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\nimport { useReducedMotion } from \"framer-motion\";\n\nconst TEXT = \"The cellar tour starts after dark. Bring a coat, leave your phone, and taste what the stone keeps cool all year.\";\nconst RADIUS = 170; // spotlight size in pixels\nconst EASE = 0.12; // how quickly the light catches up with the pointer\n\nexport default function PointerSpotlightHiddenTextReveal() {\n  const reduce = useReducedMotion();\n  const rootRef = useRef<HTMLElement>(null);\n  const stageRef = useRef<HTMLDivElement>(null);\n  const [showAll, setShowAll] = useState(false);\n  const open = showAll || !!reduce;\n\n  useEffect(() => {\n    const stage = stageRef.current;\n    const root = rootRef.current;\n    if (!stage || !root || open) return;\n    let frame = 0;\n    let onScreen = true;\n    let target: { x: number; y: number } | null = null;\n    let idleUntil = 0;\n    const cur = { x: stage.clientWidth * 0.3, y: stage.clientHeight * 0.5 };\n    const t0 = performance.now();\n    const step = (now: number) => {\n      const w = stage.clientWidth;\n      const h = stage.clientHeight;\n      const t = (now - t0) / 1000;\n      const goal = target && now < idleUntil\n        ? target\n        : { x: w * (0.5 + 0.38 * Math.sin(t * 0.55)), y: h * (0.5 + 0.32 * Math.sin(t * 0.9 + 1.2)) };\n      cur.x += (goal.x - cur.x) * EASE;\n      cur.y += (goal.y - cur.y) * EASE;\n      stage.style.setProperty(\"--pst-x\", `${cur.x.toFixed(1)}px`);\n      stage.style.setProperty(\"--pst-y\", `${cur.y.toFixed(1)}px`);\n      frame = requestAnimationFrame(step);\n    };\n    const start = () => { if (onScreen && !frame) frame = requestAnimationFrame(step); };\n    const stop = () => { cancelAnimationFrame(frame); frame = 0; };\n    const move = (e: PointerEvent) => {\n      const r = stage.getBoundingClientRect();\n      target = { x: e.clientX - r.left, y: e.clientY - r.top };\n      idleUntil = performance.now() + 2500;\n    };\n    const io = new IntersectionObserver(([e]) => { onScreen = e.isIntersecting; if (onScreen) start(); else stop(); });\n    io.observe(root);\n    stage.addEventListener(\"pointermove\", move);\n    start();\n    return () => { stop(); io.disconnect(); stage.removeEventListener(\"pointermove\", move); };\n  }, [open]);\n\n  return (\n    <section ref={rootRef} className=\"pst-root px-5 py-16 sm:px-10 sm:py-20\">\n      <style>{`\n        .pst-root { background: radial-gradient(100% 80% at 50% 0%, #1b1f17 0%, #11140f 70%); color: #f5e6c4; }\n        .pst-stage { --pst-x: 30%; --pst-y: 50%; position: relative; display: grid; padding: 8px 0; touch-action: pan-y; }\n        .pst-stage > * { grid-area: 1 / 1; }\n        .pst-text { font-family: Georgia, \"Iowan Old Style\", \"Times New Roman\", serif; font-size: clamp(1.7rem, 4.6vw, 3.4rem);\n          line-height: 1.22; letter-spacing: -.015em; margin: 0; }\n        .pst-dim { color: #343a2c; }\n        .pst-lit { color: #f5e6c4; text-shadow: 0 0 24px rgba(245,198,120,.25);\n          -webkit-mask-image: radial-gradient(${RADIUS}px circle at var(--pst-x) var(--pst-y), #000 35%, rgba(0,0,0,.35) 65%, transparent 100%);\n          mask-image: radial-gradient(${RADIUS}px circle at var(--pst-x) var(--pst-y), #000 35%, rgba(0,0,0,.35) 65%, transparent 100%); }\n        .pst-glow { pointer-events: none; background: radial-gradient(${RADIUS * 1.6}px circle at var(--pst-x) var(--pst-y), rgba(245,198,120,.09), transparent 70%); }\n        .pst-stage[data-open] .pst-lit { -webkit-mask-image: none; mask-image: none; }\n        .pst-stage[data-open] .pst-glow { display: none; }\n        @media (hover: none) { .pst-lit { -webkit-mask-image: none; mask-image: none; } .pst-glow { display: none; } }\n        @media (prefers-reduced-motion: reduce) { .pst-lit { -webkit-mask-image: none; mask-image: none; } .pst-glow { display: none; } }\n      `}</style>\n      <div className=\"mx-auto max-w-4xl\">\n        <p className=\"text-sm font-semibold uppercase tracking-[0.2em] text-[#d6a85c]\">Hollow Oak Cellars</p>\n        <div ref={stageRef} className=\"pst-stage mt-6\" data-open={open || undefined}>\n          <h2 className=\"pst-text pst-dim\">{TEXT}</h2>\n          <p className=\"pst-text pst-lit\" aria-hidden=\"true\">{TEXT}</p>\n          <div className=\"pst-glow\" aria-hidden=\"true\" />\n        </div>\n        <div className=\"mt-9 flex flex-wrap items-center gap-3\">\n          <a href=\"#\" className=\"inline-flex min-h-[44px] items-center rounded-full bg-[#d6a85c] px-6 text-sm font-semibold text-[#14170f] transition hover:bg-[#e8bf78] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#d6a85c] focus-visible:ring-offset-2 focus-visible:ring-offset-[#11140f]\">\n            Book a Friday tour\n          </a>\n          <button\n            type=\"button\"\n            aria-pressed={showAll}\n            onClick={() => setShowAll((v) => !v)}\n            className=\"inline-flex min-h-[44px] items-center rounded-full border border-[#5b5440] px-5 text-sm font-medium text-[#f5e6c4] transition hover:border-[#d6a85c] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#d6a85c]\"\n          >\n            {showAll ? \"Return to spotlight\" : \"Show full text\"}\n          </button>\n        </div>\n      </div>\n    </section>\n  );\n}\n"}]}
