{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"horizon-light-footer","type":"registry:component","title":"Horizon Light Footer","description":"A footer whose giant wordmark is lit from below by a horizon that is also a signal: a latency trace lit where the pointer is, with a request pulse that runs it every few seconds and lights the letters as it passes.","dependencies":[],"registryDependencies":[],"files":[{"path":"components/viberdy/horizon-light-footer.tsx","content":"\"use client\";\n\nimport { useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from \"react\";\nimport type { CSSProperties } from \"react\";\n\n/**\n * HorizonLightFooter — a footer lit from below by a horizon that is a signal.\n *\n * Link columns, a status pill and a legal line sit above the brand as a\n * giant lowercase wordmark cropped by the bottom edge. Along the crop runs\n * a faint latency trace. Its brightest point, with the light it throws up\n * the letters, tracks the pointer (and swings on a slow 40-second cycle when\n * the pointer is away). Every few seconds a request pulse runs the trace\n * from left to right and lights the letters as it passes beneath them.\n *\n * Part of the Dark Precision kit: OLED black, 1px hairlines, one cool accent\n * used only as light (default #4fd1ff; also mint, amber, white or any\n * #rrggbb). Fonts come from CSS variables with Geist fallbacks. Respects\n * prefers-reduced-motion. No dependencies beyond React.\n * Needs Tailwind v4 (on v3.4, add the @tailwindcss/container-queries plugin).\n */\n\nconst SANS = 'var(--font-sans, \"Geist\", \"Inter\", ui-sans-serif, system-ui, sans-serif)';\n\nconst MONO = 'var(--font-mono, \"Geist Mono\", ui-monospace, \"SFMono-Regular\", Menlo, Consolas, monospace)';\n\nconst GROUND = \"#050505\";\n\nconst INK = \"rgba(255,255,255,0.92)\";\n\nconst INK_2 = \"rgba(255,255,255,0.6)\";\n\nconst INK_3 = \"rgba(255,255,255,0.38)\";\n\nconst LINE_2 = \"rgba(255,255,255,0.14)\";\n\nconst HEX = /^#[0-9a-fA-F]{6}$/;\n\nexport const DP_ACCENTS = {\n  ice: \"#4fd1ff\",\n  mint: \"#5ef2c1\",\n  amber: \"#ffb45e\",\n  white: \"#f2f4f7\",\n} as const;\n\nfunction own<T extends object>(map: T, key: string): key is Extract<keyof T, string> {\n  return Object.prototype.hasOwnProperty.call(map, key);\n}\n\n/** A named accent or a #rrggbb hex; anything else falls back to ice. */\nfunction accentHex(value: string): string {\n  if (own(DP_ACCENTS, value)) return DP_ACCENTS[value];\n  return HEX.test(value) ? value : DP_ACCENTS.ice;\n}\n\nfunction rgbOf(hex: string): [number, number, number] {\n  const n = parseInt(hex.slice(1), 16);\n  return [(n >> 16) & 255, (n >> 8) & 255, n & 255];\n}\n\nfunction rgba(hex: string, a: number): string {\n  const [r, g, b] = rgbOf(hex);\n  return `rgba(${r},${g},${b},${a})`;\n}\n\n/** Links: strip tabs and newlines, refuse backslashes, allow http(s), mailto, tel and same-site paths. */\nfunction safeHref(raw: string): string {\n  const v = raw.replace(/[\\t\\n\\r]/g, \"\").trim();\n  if (!v || v.includes(\"\\\\\")) return \"#\";\n  if (/^(https?:|mailto:|tel:)/i.test(v)) return v;\n  if (/^[/#?]/.test(v) && !/^\\/\\//.test(v)) return v;\n  return \"#\";\n}\n\nfunction subscribeMotion(cb: () => void) {\n  const m = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n  m.addEventListener(\"change\", cb);\n  return () => m.removeEventListener(\"change\", cb);\n}\n\n/** True when the visitor asked for reduced motion. False on the server. */\nfunction useReducedMotion(): boolean {\n  return useSyncExternalStore(\n    subscribeMotion,\n    () => window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches,\n    () => false,\n  );\n}\n\n/** A small seeded random generator, so the lattice is the same on every load. */\nfunction mulberry32(seed: number) {\n  let a = seed >>> 0;\n  return () => {\n    a = (a + 0x6d2b79f5) >>> 0;\n    let t = a;\n    t = Math.imul(t ^ (t >>> 15), t | 1);\n    t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n  };\n}\n\n// revert-layer keeps an element's own rounded corners when a host page's focus rule flattens them.\nconst FOCUS_CSS = \".dp-scope :focus-visible,.dp-scope:focus-visible{outline:2px solid var(--dp-accent);outline-offset:3px;border-radius:revert-layer}\";\n\n/** The accent as the CSS variables the focus ring and the keyframes read. */\nfunction accentVars(hex: string): CSSProperties {\n  const [r, g, b] = rgbOf(hex);\n  return { \"--dp-accent\": hex, \"--dp-accent-rgb\": `${r} ${g} ${b}` } as CSSProperties;\n}\n\nexport type DpLink = { label: string; href: string };\n\nfunction Mark({ accent, size = 18 }: { accent: string; size?: number }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 18 18\" fill=\"none\" aria-hidden>\n      <circle cx=\"9\" cy=\"9\" r=\"6.75\" stroke=\"rgba(255,255,255,0.7)\" strokeWidth=\"1.25\" />\n      <circle cx=\"9\" cy=\"9\" r=\"2\" fill=\"rgba(255,255,255,0.92)\" />\n      <circle cx=\"13.8\" cy=\"4.2\" r=\"1.7\" fill={accent} />\n    </svg>\n  );\n}\n\n/** A quiet latency trace across the width: a near-flat line with a few request spikes, seeded. */\nfunction signalPoints(w: number, h: number): { d: string; len: number } {\n  const rnd = mulberry32(4051);\n  const spikes: { x: number; hgt: number; half: number }[] = [];\n  const count = Math.max(3, Math.round(w / 170));\n  for (let i = 0; i < count; i++) {\n    spikes.push({ x: w * ((i + 0.3 + rnd() * 0.4) / count), hgt: 5 + rnd() * (h - 9), half: 5 + rnd() * 8 });\n  }\n  let d = \"\";\n  let len = 0;\n  let px = 0;\n  let py = h - 0.5;\n  for (let x = 0; x <= w; x += 4) {\n    let y = Math.sin(x * 0.045) * 0.6 + (rnd() - 0.5) * 0.9;\n    for (const s of spikes) {\n      const k = 1 - Math.abs(x - s.x) / s.half;\n      if (k > 0) y += s.hgt * k * k;\n    }\n    const yy = h - 0.5 - Math.max(0, y);\n    if (x === 0) d = `M0 ${yy.toFixed(1)}`;\n    else {\n      d += ` L${x} ${yy.toFixed(1)}`;\n      len += Math.hypot(x - px, yy - py);\n    }\n    px = x;\n    py = yy;\n  }\n  return { d, len };\n}\n\nexport type HorizonLightFooterProps = {\n  brand: string;\n  columns: { title: string; links: DpLink[] }[];\n  status?: string;\n  legal?: string;\n  accent?: string;\n  wordmark?: boolean;\n  /** Seconds between request pulses along the horizon; 0 turns them off. */\n  pulse?: number;\n};\n\n/**\n * A footer whose giant wordmark is lit from below by a horizon that is also a\n * signal: a faint latency trace runs along the crop. The brightest point of\n * the horizon tracks the pointer (and swings slowly on a 40s cycle when the\n * pointer is away), lighting the trace and the letters above it. Every few\n * seconds a request pulse runs the trace from left to right and lights the\n * letters as it passes beneath them: the last hop landing.\n */\nexport function HorizonLightFooter({ brand, columns, status, legal, accent = \"ice\", wordmark = true, pulse = 10 }: HorizonLightFooterProps) {\n  const acc = accentHex(accent);\n  const reduced = useReducedMotion();\n  const ref = useRef<HTMLElement>(null);\n  const bandRef = useRef<HTMLDivElement>(null);\n  const [w, setW] = useState(0);\n  const gid = useId().replace(/[^a-zA-Z0-9]/g, \"\");\n  const H = 30;\n  const sig = useMemo(() => (w > 0 ? signalPoints(w, H) : null), [w]);\n\n  useEffect(() => {\n    const band = bandRef.current;\n    if (!band) return;\n    const ro = new ResizeObserver(() => setW(band.offsetWidth));\n    ro.observe(band);\n    return () => ro.disconnect();\n  }, [wordmark]);\n\n  useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const stops = Array.from(el.querySelectorAll<SVGStopElement>(\"stop[data-at]\"));\n    const runner = el.querySelectorAll<SVGPathElement>(\"path[data-pulse]\");\n    const len = sig ? sig.len : 0;\n    let x = 0.5;\n    let target = 0.5;\n    let last = 0;\n    let lastMove = -1e9;\n    let raf = 0;\n    let running = false;\n    let visible = false;\n    let clock = 0;\n    let since = pulse > 0 ? pulse - 2 : 0;\n    let travel = -1;\n    const TRAVEL = 2.6;\n    const DASH = 70;\n    const paint = () => {\n      el.style.setProperty(\"--hx\", (x * 100).toFixed(2) + \"%\");\n      for (const s of stops) {\n        const at = Math.min(1, Math.max(0, x + Number(s.dataset.at)));\n        s.setAttribute(\"offset\", at.toFixed(4));\n      }\n      const p = travel < 0 ? -1 : travel / TRAVEL;\n      const alpha = p < 0 ? 0 : Math.sin(Math.min(1, p) * Math.PI) * 0.75;\n      el.style.setProperty(\"--px\", (Math.max(0, p) * 100).toFixed(2) + \"%\");\n      el.style.setProperty(\"--pa\", alpha.toFixed(3));\n      runner.forEach((r) => {\n        const d = Number(r.dataset.pulse);\n        const s = p < 0 ? -DASH : p * (len + DASH);\n        r.style.strokeDasharray = d + \" \" + (len + 400);\n        r.style.strokeDashoffset = String(d - s);\n      });\n    };\n    const tick = (now: number) => {\n      const dt = last ? Math.min(0.05, (now - last) / 1000) : 0;\n      last = now;\n      clock += dt;\n      if (now - lastMove > 2500) target = reduced ? 0.5 : 0.5 + 0.3 * Math.sin((clock * 2 * Math.PI) / 40);\n      x += (target - x) * (1 - Math.exp(-dt * 3.5));\n      if (!reduced && pulse > 0 && len > 0) {\n        if (travel >= 0) {\n          travel += dt;\n          if (travel > TRAVEL) travel = -1;\n        } else {\n          since += dt;\n          if (since >= pulse) {\n            since = 0;\n            travel = 0;\n          }\n        }\n      }\n      paint();\n      if (visible && (!reduced || Math.abs(target - x) > 0.0005)) raf = requestAnimationFrame(tick);\n      else {\n        running = false;\n        last = 0;\n      }\n    };\n    const kick = () => {\n      if (running || !visible || document.hidden) return;\n      running = true;\n      raf = requestAnimationFrame(tick);\n    };\n    const onMove = (e: PointerEvent) => {\n      const r = el.getBoundingClientRect();\n      target = Math.min(1, Math.max(0, (e.clientX - r.left) / (r.width || 1)));\n      lastMove = e.timeStamp;\n      kick();\n    };\n    const onVis = () => {\n      if (!document.hidden) kick();\n    };\n    const io = new IntersectionObserver((entries) => {\n      visible = entries[entries.length - 1].isIntersecting;\n      if (visible) kick();\n    });\n    io.observe(el);\n    paint();\n    el.addEventListener(\"pointermove\", onMove);\n    document.addEventListener(\"visibilitychange\", onVis);\n    return () => {\n      cancelAnimationFrame(raf);\n      io.disconnect();\n      el.removeEventListener(\"pointermove\", onMove);\n      document.removeEventListener(\"visibilitychange\", onVis);\n    };\n  }, [reduced, pulse, sig]);\n\n  return (\n    <footer ref={ref} className=\"dp-scope @container relative overflow-hidden\" style={{ ...accentVars(acc), background: GROUND, fontFamily: SANS, \"--hx\": \"50%\", \"--px\": \"0%\", \"--pa\": \"0\" } as CSSProperties}>\n      <style>{FOCUS_CSS}</style>\n      <div className=\"mx-auto max-w-[1120px] px-6 pt-20\">\n        <div className=\"grid grid-cols-2 gap-x-6 gap-y-10 @3xl:grid-cols-[1.4fr_repeat(4,1fr)]\">\n          <div className=\"col-span-2 @3xl:col-span-1\">\n            <div className=\"flex items-center gap-2.5\">\n              <Mark accent={acc} />\n              <span className=\"text-[15px] font-semibold tracking-[-0.01em]\" style={{ color: INK }}>\n                {brand}\n              </span>\n            </div>\n            {status && (\n              <p className=\"mt-5 inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-[12px]\" style={{ color: INK_2, boxShadow: `inset 0 0 0 1px ${LINE_2}` }}>\n                <span className=\"h-1.5 w-1.5 rounded-full\" style={{ background: acc, boxShadow: `0 0 8px ${acc}` }} />\n                {status}\n              </p>\n            )}\n          </div>\n          {columns.map((c) => (\n            <nav key={c.title} aria-label={c.title}>\n              <p className=\"text-[12px] uppercase tracking-[0.12em]\" style={{ fontFamily: MONO, color: INK_3 }}>\n                {c.title}\n              </p>\n              <ul className=\"mt-4 space-y-2.5\">\n                {c.links.map((l) => (\n                  <li key={l.label}>\n                    <a href={safeHref(l.href)} className=\"text-[14px] transition-colors hover:text-white\" style={{ color: INK_2 }}>\n                      {l.label}\n                    </a>\n                  </li>\n                ))}\n              </ul>\n            </nav>\n          ))}\n        </div>\n        {legal && (\n          <p className=\"mt-16 text-[12px]\" style={{ fontFamily: MONO, color: INK_3 }}>\n            {legal}\n          </p>\n        )}\n      </div>\n      {wordmark && (\n        <div ref={bandRef} aria-hidden className=\"relative mt-6 select-none overflow-hidden\" style={{ height: \"clamp(80px, 17cqw, 230px)\" }}>\n          <div\n            className=\"absolute inset-x-0 bottom-0 h-[70%]\"\n            style={{ background: `radial-gradient(38% 100% at var(--hx) 100%, ${rgba(acc, 0.28)}, ${rgba(acc, 0.06)} 55%, transparent 80%)`, filter: \"blur(8px)\" }}\n          />\n          <p\n            className=\"absolute inset-x-0 text-center font-semibold leading-none\"\n            style={{\n              bottom: \"-0.2em\",\n              fontSize: \"clamp(110px, 25cqw, 340px)\",\n              letterSpacing: \"-0.065em\",\n              color: \"transparent\",\n              backgroundImage: `radial-gradient(16% 60% at var(--px) 100%, rgb(255 255 255 / var(--pa)), transparent 70%), radial-gradient(34% 70% at var(--hx) 100%, rgba(255,255,255,0.95), ${rgba(acc, 0.45)} 38%, transparent 72%), linear-gradient(0deg, rgba(255,255,255,0.14), rgba(255,255,255,0.025) 70%)`,\n              WebkitBackgroundClip: \"text\",\n              backgroundClip: \"text\",\n            }}\n          >\n            {brand.toLowerCase()}\n          </p>\n          {sig && (\n            <svg className=\"absolute bottom-0 left-0 overflow-visible\" width={w} height={H}>\n              <defs>\n                <linearGradient id={gid} gradientUnits=\"userSpaceOnUse\" x1=\"0\" y1=\"0\" x2={w} y2=\"0\">\n                  <stop data-at=\"-0.2\" offset=\"0.3\" stopColor={acc} stopOpacity=\"0\" />\n                  <stop data-at=\"-0.07\" offset=\"0.43\" stopColor={acc} stopOpacity=\"0.8\" />\n                  <stop data-at=\"0\" offset=\"0.5\" stopColor=\"#ffffff\" stopOpacity=\"1\" />\n                  <stop data-at=\"0.07\" offset=\"0.57\" stopColor={acc} stopOpacity=\"0.8\" />\n                  <stop data-at=\"0.2\" offset=\"0.7\" stopColor={acc} stopOpacity=\"0\" />\n                </linearGradient>\n              </defs>\n              <path d={sig.d} fill=\"none\" stroke=\"rgba(255,255,255,0.14)\" strokeWidth=\"1\" />\n              <path d={sig.d} fill=\"none\" stroke={`url(#${gid})`} strokeWidth=\"1.25\" />\n              {!reduced && pulse > 0 && (\n                <>\n                  <path data-pulse=\"70\" d={sig.d} fill=\"none\" stroke={acc} strokeWidth=\"4\" strokeLinecap=\"round\" style={{ opacity: 0.35, filter: \"blur(3px)\", strokeDasharray: \"0 99999\" }} />\n                  <path data-pulse=\"40\" d={sig.d} fill=\"none\" stroke={acc} strokeWidth=\"1.5\" strokeLinecap=\"round\" style={{ strokeDasharray: \"0 99999\" }} />\n                  <path data-pulse=\"8\" d={sig.d} fill=\"none\" stroke=\"#ffffff\" strokeWidth=\"1.75\" strokeLinecap=\"round\" style={{ strokeDasharray: \"0 99999\" }} />\n                </>\n              )}\n            </svg>\n          )}\n          <div className=\"absolute inset-x-0 -bottom-1 h-2\" style={{ background: `radial-gradient(18% 100% at var(--hx) 50%, ${rgba(acc, 0.7)}, transparent 70%)`, filter: \"blur(4px)\" }} />\n        </div>\n      )}\n    </footer>\n  );\n}\n","type":"registry:component","target":"components/viberdy/horizon-light-footer.tsx"}],"meta":{"tier":"free","tags":["footer","section","wordmark","light","pointer","dark","saas"],"href":"https://viberdy.dev/library/horizon-light-footer","aiPrompt":"Build a React + Tailwind footer, `HorizonLightFooter({ brand, columns, status, legal, accent, wordmark, pulse })`, on #050505.\n\nTop: a brand mark and name with a status pill (an accent dot with a glow), then link columns (mono uppercase titles, links in white 60% brightening on hover), each a nav with an aria-label, and a mono legal line. Bottom (aria-hidden): a band about 17cqw tall with overflow hidden holding the brand in lowercase at about 25cqw, 600 weight, -0.065em tracking, bottom -0.2em so the page crops it, with transparent colour and background-clip: text over three layers: a pulse light (radial at var(--px) 100%, white at var(--pa) alpha), the pointer light (radial at var(--hx) 100%: white 95%, accent 45% at 38%, transparent at 72%) and a linear gradient from white 14% at the bottom to 2.5% higher up. Under it, a blurred accent haze at var(--hx).\n\nThe horizon is a signal: measure the band's width and draw an SVG latency trace along its bottom (points every 4px; a near-flat line with slight noise plus a seeded handful of triangular request spikes up to about 25px). Stroke it in white 14%, then again with a userSpaceOnUse linear gradient whose five stops (transparent, accent, white, accent, transparent) sit around the pointer position, updating their offsets every frame. Three more copies of the trace carry the request pulse (dashes of 70, 40 and 8px: blurred accent glow, accent core, white head), positioned by strokeDashoffset from the pulse's progress so their heads stay aligned.\n\nMotion in one rAF loop, only while visible: --hx eases toward the pointer's x (after 2.5s without movement it swings as 0.5 + 0.3 * sin(2 * pi * t / 40)); every `pulse` seconds a pulse travels the trace in 2.6s, driving the dash offsets, --px and --pa (sin-shaped, peaking at 0.75) so the letters brighten above it. Reduced motion: no swing, no pulse; the light still follows the pointer.\n\nDark Precision grammar: ground #050505, surfaces #0b0b0d and #121215, hairlines white 6% at rest and 14% lit (drawn as inset box-shadows or SVG strokes, never border colours), ink white 92/60/38%, one cool accent used only as light (default #4fd1ff; mint #5ef2c1, amber #ffb45e, white #f2f4f7 or any #rrggbb, validated against /^#[0-9a-fA-F]{6}$/), Geist never heavier than 600 with tight tracking, Geist Mono only for captions and data, fonts through CSS variables with fallbacks (var(--font-sans, \"Geist\", ...)). Morphs use cubic-bezier(0.16, 1, 0.3, 1); ambient loops are 30s or slower. Keyframes live in a small static <style> the component renders itself (nothing interpolated into it; the accent reaches it as --dp-accent and --dp-accent-rgb variables), plus a focus ring rule scoped to a .dp-scope class with border-radius: revert-layer. Respect prefers-reduced-motion. No dependencies beyond React.","license":"https://viberdy.dev/license"}}