{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"ultra-site-footer","type":"registry:component","title":"Ultra Site Footer","description":"A footer whose huge closing line gets bolder as the reader turns contrast up, with their own six values drawn as a hexagon they can reset.","dependencies":[],"registryDependencies":[],"files":[{"path":"components/viberdy/ultra-site-footer.tsx","content":"\"use client\";\n\nimport { useLayoutEffect, useMemo, useSyncExternalStore } from \"react\";\nimport type { CSSProperties } from \"react\";\n\n/**\n * UltraSiteFooter — a closing line whose weight follows the reader's contrast, their own hexagon, and the links.\n *\n * The closing line is set huge in Google Sans Flex, its weight running 460\n * to 640 with contrast (and its grade and roundness with it). Under it the\n * page's goal and a quieter link, then a card that draws the reader's six\n * values as the kit's hexagon, says whether they follow the system or are\n * saved on this device, and resets them. Columns of real links close it.\n *\n* Part of the Ultra kit: an adaptive style whose grammar is the viewer. Every\n * Ultra asset reads six live values (contrast, warmth, light, density, motion,\n * focus) from one shared tuning and re-forms its tone, edges, density and\n * tempo to match: move any Ultra control and every Ultra asset on the page\n * follows. Values the viewer sets are saved on the device (localStorage\n * key ultra:v1); the rest follow the system (prefers-contrast,\n * prefers-reduced-motion, prefers-color-scheme) and the time of day. Nothing\n * is sent anywhere. Every colour is solved for APCA contrast at runtime, so no\n * tuning can make text illegible. Springs are critically damped (no\n * overshoot) and motion 0 swaps states. Type through var(--font-ultra)\n * (Google Sans Flex, whose GRAD and ROND axes follow contrast) over Geist.\n * Paste it as its own file: it carries its own copy of the small engine, and\n * copies on one page share a single store through Symbol.for.\n */\n\n/** The six values every Ultra asset reads. Each runs 0..1. */\nexport type UAxis = \"contrast\" | \"warmth\" | \"density\" | \"motion\" | \"focus\" | \"light\";\n\nexport type UAxes = Record<UAxis, number>;\n\n/** Dial order, clockwise from the top. */\nconst U_AXES: UAxis[] = [\"contrast\", \"warmth\", \"light\", \"density\", \"motion\", \"focus\"];\n\n/** What the server renders and what an asset shows before the store boots. */\nconst U_DEFAULTS: UAxes = { contrast: 0.45, warmth: 0.3, light: 0.1, density: 0.4, motion: 0.45, focus: 0.35 };\n\n/** The exposure band no text can sit on (ground L 0.46..0.66): light snaps out of it. */\nconst U_LIGHT_GAP: [number, number] = [0.46, 0.54];\n\nconst uClamp = (v: number, a = 0, b = 1) => (v < a ? a : v > b ? b : v);\n\nconst uLerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\nconst uSmooth = (a: number, b: number, x: number) => {\n  const t = uClamp((x - a) / (b - a));\n  return t * t * (3 - 2 * t);\n};\n\n/** Nearest safe exposure: anything inside the unsafe band goes to its closer edge. */\nfunction uSafeLight(v: number): number {\n  const [a, b] = U_LIGHT_GAP;\n  if (v <= a || v >= b) return uClamp(v);\n  return v - a < b - v ? a : b;\n}\n\ninterface UStore {\n  v: 1;\n  /** The values the viewer pinned (dragged). Only these are saved. */\n  pinned: Partial<UAxes>;\n  /** Values derived from the system (prefers-*) and the clock. */\n  auto: UAxes;\n  /** Which auto values the system decided (those beat an author's seed). */\n  sys: { contrast: boolean; motion: boolean };\n  /** The author's starting look for values the viewer has not set. */\n  seed: Partial<UAxes>;\n  /** pinned over auto: what assets read. A new object on every change. */\n  snap: UAxes;\n  listeners: Set<() => void>;\n  booted: boolean;\n  /** The one goal on screen: the first claimant wins the filled accent. */\n  goals: string[];\n  /** Shared pointer, for gaze-driven assets. Written by one passive listener. */\n  gaze: { x: number; y: number; speed: number; t: number; live: boolean };\n}\n\nconst U_KEY = \"ultra:v1\";\n\nfunction uStore(): UStore {\n  const g = globalThis as unknown as Record<symbol, UStore | undefined>;\n  const sym = Symbol.for(\"viberdy.ultra.v1\");\n  let s = g[sym];\n  if (!s) {\n    s = {\n      v: 1,\n      pinned: {},\n      auto: { ...U_DEFAULTS },\n      sys: { contrast: false, motion: false },\n      seed: {},\n      snap: { ...U_DEFAULTS },\n      listeners: new Set(),\n      booted: false,\n      goals: [],\n      gaze: { x: -1, y: -1, speed: 0, t: 0, live: false },\n    };\n    g[sym] = s;\n  }\n  return s;\n}\n\nfunction uEmit(s: UStore) {\n  const seed = { ...s.seed };\n  if (s.sys.contrast) delete seed.contrast;\n  if (s.sys.motion) delete seed.motion;\n  s.snap = { ...s.auto, ...seed, ...s.pinned };\n  s.snap.light = uSafeLight(s.snap.light);\n  s.listeners.forEach((fn) => fn());\n}\n\nfunction uMedia(q: string): boolean {\n  return typeof window !== \"undefined\" && typeof window.matchMedia === \"function\" && window.matchMedia(q).matches;\n}\n\n/** Auto values: system preferences first, then the clock (read at boot and when the tab returns, never on a timer). */\nfunction uAuto(): UAxes {\n  const a: UAxes = { ...U_DEFAULTS };\n  if (uMedia(\"(prefers-contrast: more)\")) a.contrast = 0.95;\n  else if (uMedia(\"(prefers-contrast: less)\")) a.contrast = 0.12;\n  if (uMedia(\"(prefers-reduced-motion: reduce)\")) a.motion = 0;\n  if (uMedia(\"(pointer: coarse)\")) a.density = 0.25;\n  const h = new Date().getHours() + new Date().getMinutes() / 60;\n  // Warmth rises through the evening and lowers the light with it: a warm tint alone\n  // does not cut the evening's short-wave load, dimming does (RPI LRC, 2018).\n  const evening = h >= 17 ? uSmooth(17, 21, h) : h < 8 ? 1 - uSmooth(6, 8, h) : 0;\n  a.warmth = uLerp(0.3, 0.82, evening);\n  const paper = uMedia(\"(prefers-color-scheme: light)\");\n  a.light = paper ? uLerp(0.86, 0.7, evening) : uLerp(0.12, 0.04, evening);\n  return a;\n}\n\nfunction uLoad(): Partial<UAxes> {\n  try {\n    const raw = window.localStorage.getItem(U_KEY);\n    if (!raw) return {};\n    const data = JSON.parse(raw) as { v?: number; p?: Record<string, unknown> };\n    if (data.v !== 1 || !data.p) return {};\n    const out: Partial<UAxes> = {};\n    for (const k of U_AXES) {\n      const v = data.p[k];\n      if (typeof v === \"number\" && Number.isFinite(v)) out[k] = uClamp(v);\n    }\n    return out;\n  } catch {\n    return {};\n  }\n}\n\nfunction uSave(s: UStore) {\n  try {\n    window.localStorage.setItem(U_KEY, JSON.stringify({ v: 1, p: s.pinned }));\n  } catch {\n    // storage blocked: the tuning still works for this visit\n  }\n}\n\nfunction uSys(s: UStore) {\n  s.sys = {\n    contrast: uMedia(\"(prefers-contrast: more)\") || uMedia(\"(prefers-contrast: less)\"),\n    motion: uMedia(\"(prefers-reduced-motion: reduce)\"),\n  };\n}\n\nfunction uBoot() {\n  const s = uStore();\n  if (s.booted || typeof window === \"undefined\") return;\n  s.booted = true;\n  s.auto = uAuto();\n  uSys(s);\n  s.pinned = uLoad();\n  // A shared setup (#u=c7w3l2...: one letter per value and a base-36 digit) is read once.\n  const shared = /[#&]u=([a-z0-9]{2,12})/i.exec(window.location.hash);\n  if (shared && shared[1]) {\n    const code = shared[1].toLowerCase();\n    for (let i = 0; i + 1 < code.length; i += 2) {\n      const axis = U_AXES.find((k) => k[0] === code[i]);\n      const v = parseInt(code[i + 1] ?? \"\", 36);\n      if (axis && Number.isFinite(v)) s.pinned[axis] = uClamp(v / 35);\n    }\n    uSave(s);\n  }\n  uEmit(s);\n  const refresh = () => {\n    s.auto = uAuto();\n    uSys(s);\n    uEmit(s);\n  };\n  for (const q of [\"(prefers-contrast: more)\", \"(prefers-contrast: less)\", \"(prefers-reduced-motion: reduce)\", \"(prefers-color-scheme: light)\"]) {\n    window.matchMedia(q).addEventListener(\"change\", refresh);\n  }\n  document.addEventListener(\"visibilitychange\", () => {\n    if (document.visibilityState === \"visible\") refresh();\n  });\n  window.addEventListener(\"storage\", (e) => {\n    if (e.key !== U_KEY) return;\n    s.pinned = uLoad();\n    uEmit(s);\n  });\n  const gz = s.gaze;\n  window.addEventListener(\n    \"pointermove\",\n    (e) => {\n      const dt = Math.max(1, e.timeStamp - gz.t);\n      const d = gz.live ? Math.hypot(e.clientX - gz.x, e.clientY - gz.y) : 0;\n      gz.speed = gz.speed * 0.7 + ((d / dt) * 1000) * 0.3;\n      gz.x = e.clientX;\n      gz.y = e.clientY;\n      gz.t = e.timeStamp;\n      gz.live = true;\n    },\n    { passive: true },\n  );\n  document.documentElement.addEventListener(\"pointerleave\", () => {\n    gz.live = false;\n  });\n}\n\n/**\n * The author's starting look for values the viewer has not set (they win\n * over the clock, never over a system preference for reduced motion or more\n * contrast, and never over the viewer). Not saved.\n */\nexport function seedUltra(values: Partial<UAxes>) {\n  const s = uStore();\n  const next: Partial<UAxes> = { ...s.seed };\n  let changed = false;\n  for (const k of U_AXES) {\n    const v = values[k];\n    if (typeof v === \"number\" && Number.isFinite(v) && next[k] !== uClamp(v)) {\n      next[k] = uClamp(v);\n      changed = true;\n    }\n  }\n  if (!changed) return;\n  s.seed = next;\n  uEmit(s);\n}\n\n/** Forget every pinned value. */\nexport function resetUltra() {\n  const s = uStore();\n  s.pinned = {};\n  uSave(s);\n  uEmit(s);\n}\n\nfunction uSubscribe(fn: () => void) {\n  const s = uStore();\n  s.listeners.add(fn);\n  uBoot();\n  return () => {\n    s.listeners.delete(fn);\n  };\n}\n\nconst uSnap = () => uStore().snap;\n\nconst uServerSnap = () => U_DEFAULTS;\n\n/**\n * The tuning, live. `tune` pins values for this instance only (a demo, a\n * fixed brand moment); they are never saved. `bounds` lets an author limit\n * the expressive direction only: motion, density and focus can be capped,\n * contrast can be floored, warmth and light can be ranged. The way back to\n * calm (motion 0, contrast 1, density 0, focus 0) can never be bounded.\n * `seed` is the author's starting look (see seedUltra).\n */\nexport function useUltra(tune?: Partial<UAxes>, bounds?: Partial<Record<UAxis, [number, number]>>, seed?: Partial<UAxes>): UAxes {\n  const snap = useSyncExternalStore(uSubscribe, uSnap, uServerSnap);\n  const seedKey = JSON.stringify(seed ?? null);\n  useLayoutEffect(() => {\n    const v = JSON.parse(seedKey) as Partial<UAxes> | null;\n    if (v) seedUltra(v);\n  }, [seedKey]);\n  // Compared by value, so inline objects do not churn.\n  const tuneKey = JSON.stringify(tune ?? null);\n  const boundsKey = JSON.stringify(bounds ?? null);\n  return useMemo(() => {\n    const tune = JSON.parse(tuneKey) as Partial<UAxes> | null;\n    const bounds = JSON.parse(boundsKey) as Partial<Record<UAxis, [number, number]>> | null;\n    const out: UAxes = { ...snap };\n    if (tune) {\n      for (const k of U_AXES) {\n        const v = tune[k];\n        if (typeof v === \"number\" && Number.isFinite(v)) out[k] = uClamp(v);\n      }\n    }\n    if (bounds) {\n      for (const k of U_AXES) {\n        const b = bounds[k];\n        if (!b) continue;\n        let [lo, hi] = b;\n        if (k === \"motion\" || k === \"density\" || k === \"focus\") lo = 0;\n        if (k === \"contrast\") hi = 1;\n        out[k] = uClamp(out[k], Math.min(lo, hi), Math.max(lo, hi));\n      }\n    }\n    out.light = uSafeLight(out.light);\n    return out;\n  }, [snap, tuneKey, boundsKey]);\n}\n\ntype URgb = [number, number, number];\n\nfunction uOklab(L: number, a: number, b: number): URgb {\n  const l_ = L + 0.3963377774 * a + 0.2158037573 * b;\n  const m_ = L - 0.1055613458 * a - 0.0638541728 * b;\n  const s_ = L - 0.0894841775 * a - 1.291485548 * b;\n  const l = l_ * l_ * l_;\n  const m = m_ * m_ * m_;\n  const s = s_ * s_ * s_;\n  const lin: URgb = [\n    4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,\n    -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,\n    -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,\n  ];\n  return lin.map((x) => {\n    const v = uClamp(x);\n    return Math.round((v <= 0.0031308 ? 12.92 * v : 1.055 * Math.pow(v, 1 / 2.4) - 0.055) * 255);\n  }) as URgb;\n}\n\nfunction uOklch(L: number, C: number, h: number): URgb {\n  const r = (h * Math.PI) / 180;\n  return uOklab(L, C * Math.cos(r), C * Math.sin(r));\n}\n\nconst uHex = (c: URgb) => \"#\" + c.map((v) => v.toString(16).padStart(2, \"0\")).join(\"\");\n\nfunction uY(c: URgb): number {\n  return 0.2126729 * Math.pow(c[0] / 255, 2.4) + 0.7151522 * Math.pow(c[1] / 255, 2.4) + 0.072175 * Math.pow(c[2] / 255, 2.4);\n}\n\n/** APCA-W3 0.0.98G lightness contrast (signed: negative = light text on dark). */\nfunction uApca(text: URgb, bg: URgb): number {\n  let yt = uY(text);\n  let yb = uY(bg);\n  if (yt < 0.022) yt += Math.pow(0.022 - yt, 1.414);\n  if (yb < 0.022) yb += Math.pow(0.022 - yb, 1.414);\n  if (Math.abs(yb - yt) < 0.0005) return 0;\n  if (yb > yt) {\n    const s = (Math.pow(yb, 0.56) - Math.pow(yt, 0.57)) * 1.14;\n    return s < 0.1 ? 0 : (s - 0.027) * 100;\n  }\n  const s = (Math.pow(yb, 0.65) - Math.pow(yt, 0.62)) * 1.14;\n  return s > -0.1 ? 0 : (s + 0.027) * 100;\n}\n\n/** The warmth tint: a straight line in OKLab from slate to amber, neutral at 0.5 (never a hue walk through green). */\nfunction uTint(w: number, mag: number): [number, number] {\n  return [uLerp(-0.0048, 0.0055, w) * mag, uLerp(-0.0132, 0.015, w) * mag];\n}\n\nfunction uCol(L: number, w: number, mag: number): URgb {\n  const [a, b] = uTint(w, mag);\n  return uOklab(L, a, b);\n}\n\n/** Find the ink lightness that reaches |Lc| = target on this ground (bisection, 24 steps). */\nfunction uSolve(bg: URgb, target: number, dark: boolean, w: number): URgb {\n  let lo = 0.02;\n  let hi = 0.995;\n  for (let i = 0; i < 24; i++) {\n    const m = (lo + hi) / 2;\n    const lc = Math.abs(uApca(uCol(m, w, 0.6), bg));\n    if (dark) {\n      if (lc < target) lo = m;\n      else hi = m;\n    } else if (lc < target) hi = m;\n    else lo = m;\n  }\n  return uCol((lo + hi) / 2, w, 0.6);\n}\n\n/** The accent's hue: a calm, low-chroma blue-violet, clear of every other kit's saturated blue. */\nconst U_HUE = 262;\n\nexport interface UTokens {\n  dark: boolean;\n  /** Ground lightness (OKLab L), for shaders. */\n  groundL: number;\n  ground: string;\n  s1: string;\n  s2: string;\n  well: string;\n  ink1: string;\n  ink2: string;\n  ink3: string;\n  hair: string;\n  /** Hairline alpha: edges only appear as contrast rises past 0.55. */\n  edge: number;\n  acc: string;\n  onAcc: string;\n  /** 4px base unit, scaled by density. */\n  unit: number;\n  body: number;\n  lh: number;\n  /** Critically damped spring stiffness; 0 means no motion (swap states). */\n  k: number;\n  /** The gaze aperture in px, from focus. */\n  aperture: number;\n  grad: number;\n  rond: number;\n  /** Ground and ink as linear-ish triples (0..1 sRGB) for canvases and shaders. */\n  groundRgb: URgb;\n  inkRgb: URgb;\n  accRgb: URgb;\n}\n\nconst uTokenCache = new Map<string, UTokens>();\n\n/** Every colour, size and tempo an Ultra asset uses, derived from the six values. No asset holds a fixed hex. */\nexport function ultraTokens(x: UAxes, hue = U_HUE): UTokens {\n  const q = (v: number) => Math.round(v * 200) / 200;\n  const key = [x.contrast, x.warmth, x.light, x.density, x.motion, x.focus].map(q).join(\",\") + \":\" + hue;\n  const hit = uTokenCache.get(key);\n  if (hit) return hit;\n  const c = q(x.contrast);\n  const w = q(x.warmth);\n  const lt = uSafeLight(q(x.light));\n  const d = q(x.density);\n  const m = q(x.motion);\n  const f = q(x.focus);\n  const dark = lt < 0.5;\n  // Exposure moves the ground within its room; contrast deepens it a little.\n  const gL = dark\n    ? uLerp(0.15, 0.3, lt / U_LIGHT_GAP[0]) - 0.03 * (c - 0.45)\n    : uLerp(0.89, 0.975, (lt - U_LIGHT_GAP[1]) / (1 - U_LIGHT_GAP[1])) + 0.012 * (c - 0.45);\n  const step = dark ? uLerp(0.03, 0.05, c) : uLerp(0.022, 0.04, c);\n  const g = uCol(gL, w, 1);\n  const s1 = uCol(dark ? gL + step : Math.min(0.995, gL + step * 0.7), w, dark ? 1 : 0.6);\n  const s2 = uCol(dark ? gL + step * 2 : Math.min(0.998, gL + step * 1.2), w, dark ? 1 : 0.5);\n  const well = uCol(gL - step * 0.8, w, 1);\n  const ink1 = uSolve(g, uLerp(75, 95, c), dark, w);\n  const ink2 = uSolve(g, uLerp(60, 72, c), dark, w);\n  const ink3 = uSolve(g, uLerp(52, 60, c), dark, w);\n  const hair = uSolve(g, uLerp(30, 45, c), dark, w);\n  const acc = dark ? uOklch(uLerp(0.84, 0.88, c), 0.09, hue) : uOklch(uLerp(0.5, 0.44, c), 0.14, hue);\n  // A label on the fill: solved, never pure black or white.\n  const onAcc = uSolve(acc, dark ? 70 : 78, !dark, w);\n  const t: UTokens = {\n    dark,\n    groundL: gL,\n    ground: uHex(g),\n    s1: uHex(s1),\n    s2: uHex(s2),\n    well: uHex(well),\n    ink1: uHex(ink1),\n    ink2: uHex(ink2),\n    ink3: uHex(ink3),\n    hair: uHex(hair),\n    edge: uClamp((c - 0.55) / 0.45),\n    acc: uHex(acc),\n    onAcc: uHex(onAcc),\n    unit: 4 * uLerp(1.18, 0.82, d),\n    body: uLerp(17, 15, d),\n    lh: uLerp(1.62, 1.45, d),\n    k: m < 0.02 ? 0 : uLerp(190, 560, m),\n    aperture: uLerp(560, 170, f),\n    grad: dark ? uLerp(40, 0, c) : uLerp(70, 30, c),\n    rond: uLerp(45, 8, c),\n    groundRgb: g,\n    inkRgb: ink1,\n    accRgb: acc,\n  };\n  uTokenCache.set(key, t);\n  return t;\n}\n\n/** The tokens as CSS custom properties on an asset root. Children read var(--u-*). */\nexport function ultraVars(t: UTokens): CSSProperties {\n  return {\n    \"--u-ground\": t.ground,\n    \"--u-s1\": t.s1,\n    \"--u-s2\": t.s2,\n    \"--u-well\": t.well,\n    \"--u-ink1\": t.ink1,\n    \"--u-ink2\": t.ink2,\n    \"--u-ink3\": t.ink3,\n    \"--u-hair\": t.hair,\n    \"--u-edge\": String(t.edge),\n    \"--u-acc\": t.acc,\n    \"--u-on-acc\": t.onAcc,\n    \"--u-unit\": t.unit.toFixed(2) + \"px\",\n    \"--u-body\": t.body.toFixed(2) + \"px\",\n    \"--u-lh\": t.lh.toFixed(3),\n    // Signature layer: one tempo (0ms at motion 0), the shadow and glow colours, the caught-light edge.\n    \"--u-dur\": (t.k ? Math.round(uLerp(980, 520, (t.k - 190) / 370)) : 0) + \"ms\",\n    \"--u-shade\": t.dark ? \"rgba(0,0,0,.5)\" : \"rgba(28,32,52,.14)\",\n    \"--u-glow\": \"color-mix(in oklab, \" + t.acc + \" \" + (t.dark ? 55 : 42) + \"%, transparent)\",\n    \"--u-lit\": t.dark ? \"rgba(255,255,255,.075)\" : \"rgba(255,255,255,.92)\",\n    colorScheme: t.dark ? \"dark\" : \"light\",\n    color: t.ink1,\n    fontFamily: 'var(--font-ultra, \"Google Sans Flex\", \"Geist\", ui-sans-serif, system-ui, sans-serif)',\n    fontVariationSettings: '\"GRAD\" ' + t.grad.toFixed(0) + ', \"ROND\" ' + t.rond.toFixed(0),\n  } as CSSProperties;\n}\n\n/**\n * The kit's signature layer, shared by every Ultra asset and timed by --u-dur\n * (the viewer's motion value; 0ms at motion 0 and under reduced motion, so\n * every entrance lands at once):\n *   .u-rise   a blur-and-rise entrance, staggered by --u-i\n *   .u-draw   a stroke that draws itself in (set pathLength=\"1\")\n *   .u-glass  a lifted surface: tinted gradient, caught-light top edge, soft shadow\n *   .u-lamp   a light and a lit edge that follow the pointer (--mx/--my, set on pointermove)\n *   .u-cta    the page's one goal: an accent glow, a lift and a sheen on hover\n */\nconst U_FX =\n  \"@keyframes u-rise{from{opacity:0;transform:translateY(.55em);filter:blur(6px)}}\" +\n  \"@keyframes u-draw{from{stroke-dashoffset:1}}\" +\n  \"@keyframes u-sheen{from{transform:translateX(-130%) skewX(-18deg)}to{transform:translateX(330%) skewX(-18deg)}}\" +\n  \"@keyframes u-spin{to{transform:rotate(1turn)}}\" +\n  \".u-scope .u-rise{animation:u-rise var(--u-dur) cubic-bezier(.16,1,.3,1) both;animation-delay:calc(var(--u-i,0) * var(--u-dur) * .09)}\" +\n  \".u-scope .u-draw{stroke-dasharray:1;stroke-dashoffset:0;animation:u-draw calc(var(--u-dur) * 2) cubic-bezier(.65,0,.35,1) both;animation-delay:calc(var(--u-i,0) * var(--u-dur) * .05)}\" +\n  \".u-scope .u-glass{background:linear-gradient(180deg,var(--u-s2),var(--u-s1) 62%);box-shadow:inset 0 1px 0 var(--u-lit),inset 0 0 0 1px color-mix(in oklab,var(--u-hair) calc(16% + var(--u-edge) * 60%),transparent),0 1px 2px var(--u-shade),0 30px 64px -34px var(--u-shade)}\" +\n  \".u-scope .u-lamp{position:relative;isolation:isolate}\" +\n  \".u-scope .u-lamp::before,.u-scope .u-lamp::after{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity calc(var(--u-dur) * .5)}\" +\n  \".u-scope .u-lamp::before{z-index:-1;background:radial-gradient(var(--u-lamp-r,240px) circle at var(--mx,50%) var(--my,50%),color-mix(in oklab,var(--u-acc) 13%,transparent),transparent 70%)}\" +\n  \".u-scope .u-lamp::after{padding:1px;background:radial-gradient(180px circle at var(--mx,50%) var(--my,50%),color-mix(in oklab,var(--u-acc) 85%,transparent),transparent 70%);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude}\" +\n  \".u-scope .u-lamp:hover::before,.u-scope .u-lamp:hover::after{opacity:1}\" +\n  \".u-scope .u-cta{position:relative;overflow:hidden;isolation:isolate;box-shadow:inset 0 1px 0 rgba(255,255,255,.4),0 0 0 1px color-mix(in oklab,var(--u-acc) 80%,transparent),0 10px 28px -10px var(--u-glow);transition:transform calc(var(--u-dur) * .45) cubic-bezier(.16,1,.3,1),box-shadow calc(var(--u-dur) * .45)}\" +\n  \".u-scope .u-cta:hover{transform:translateY(-1px);box-shadow:inset 0 1px 0 rgba(255,255,255,.4),0 0 0 1px var(--u-acc),0 16px 40px -10px var(--u-glow)}\" +\n  \".u-scope .u-cta:active{transform:translateY(0) scale(.98)}\" +\n  \".u-scope .u-cta::after{content:'';position:absolute;inset:0 auto 0 0;width:42%;pointer-events:none;background:linear-gradient(90deg,transparent,rgba(255,255,255,.5),transparent);transform:translateX(-130%) skewX(-18deg)}\" +\n  \".u-scope .u-cta:hover::after{animation:u-sheen calc(var(--u-dur) * 1.3) cubic-bezier(.16,1,.3,1)}\" +\n  \".u-scope .u-arr{transition:transform calc(var(--u-dur) * .45) cubic-bezier(.16,1,.3,1)}.u-scope .u-cta:hover .u-arr{transform:translateX(3px)}\" +\n  \"@media (prefers-reduced-motion:reduce){.u-scope .u-rise,.u-scope .u-draw,.u-scope .u-cta::after{animation:none!important}.u-scope .u-cta{transition:none}}\";\n\n/**\n * The kit's scoped CSS: the one focus ring (the accent, 2px, offset 3px, the\n * element's own radius), tabular figures, and transitions off for elements a\n * frame loop writes. Rendered once per asset; identical text dedupes in React 19.\n */\nconst U_CSS =\n  \".u-scope :focus-visible{outline:2px solid var(--u-acc)!important;outline-offset:3px!important;border-radius:revert-layer!important}\" +\n  \".u-scope .u-num{font-variant-numeric:tabular-nums}\" +\n  \".u-scope [data-u-live]{transition:none!important}\" +\n  U_FX;\n\n/**\n * The scrolling box an element lives in: the nearest ancestor that actually\n * scrolls, or null for the window. Resolved on every frame, because a box only\n * becomes a scroller once its content is taller than it.\n */\nfunction uScrollParent(el: Element | null): HTMLElement | null {\n  let n = el?.parentElement ?? null;\n  while (n && n !== document.body && n !== document.documentElement) {\n    const oy = getComputedStyle(n).overflowY;\n    if ((oy === \"auto\" || oy === \"scroll\" || oy === \"overlay\") && n.scrollHeight > n.clientHeight + 1) return n;\n    n = n.parentElement;\n  }\n  return null;\n}\n\n/** Links built from props: https, http, mailto, same-site paths and anchors only (tabs and newlines stripped, backslashes refused). */\nfunction uSafeHref(href: string): string {\n  const h = href.replace(/[\\t\\n\\r]/g, \"\").trim();\n  if (!h || h.includes(String.fromCharCode(92))) return \"#\";\n  if (h.startsWith(\"#\") || (h.startsWith(\"/\") && !h.startsWith(\"//\"))) return h;\n  return /^(https?:|mailto:)/i.test(h) ? h : \"#\";\n}\n\n/** Scroll whatever scrolls `el` to a same-page anchor; falls back to the browser for anything else. */\nfunction uGo(e: { currentTarget: HTMLAnchorElement; preventDefault: () => void }) {\n  const href = e.currentTarget.getAttribute(\"href\") ?? \"\";\n  if (!href.startsWith(\"#\") || href.length < 2) return;\n  const root = e.currentTarget.closest(\"[data-u-site]\") ?? document;\n  const target = root.querySelector<HTMLElement>('[data-u-anchor=\"' + href.slice(1) + '\"]');\n  if (!target) return;\n  e.preventDefault();\n  const sp = uScrollParent(target);\n  const smooth: ScrollBehavior = uStore().snap.motion < 0.02 ? \"auto\" : \"smooth\";\n  if (sp) sp.scrollTo({ top: sp.scrollTop + target.getBoundingClientRect().top - sp.getBoundingClientRect().top, behavior: smooth });\n  else window.scrollTo({ top: window.scrollY + target.getBoundingClientRect().top, behavior: smooth });\n}\n\n/** Each value's own hue, for rays, meters and the spectrum: one colour per value, read clockwise like the dial. */\nconst U_AXIS_HUE: Record<UAxis, number> = { contrast: 262, warmth: 55, light: 95, density: 160, motion: 205, focus: 315 };\n\n/** A value's colour, at the lightness that reads on this ground. */\nfunction uAxisColor(axis: UAxis, dark: boolean): string {\n  return uHex(uOklch(dark ? 0.82 : 0.58, dark ? 0.11 : 0.15, U_AXIS_HUE[axis]));\n}\n\n/** viberdy's V, as a solid mark that takes the current colour. */\nfunction UVMark({ size = 28, className }: { size?: number; className?: string }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 32 32\" aria-hidden className={className}>\n      <rect width=\"32\" height=\"32\" rx=\"9\" fill=\"currentColor\" />\n      <path d=\"M9 10.5 L15.2 22.5 L16.8 22.5 L23 10.5 L19.6 10.5 L16 18.2 L12.4 10.5 Z\" fill=\"var(--u-ground)\" />\n    </svg>\n  );\n}\n\n/** The kit's arrow: slides on a .u-cta hover. */\nfunction UArrow() {\n  return (\n    <svg className=\"u-arr\" width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden>\n      <path d=\"M2 7h9M7.5 3.5L11 7l-3.5 3.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\n/** Which values the viewer pinned, as a stable string (\"contrast,light\"); \"\" on the server. */\nfunction useUltraPinned(): Set<UAxis> {\n  const key = useSyncExternalStore(\n    uSubscribe,\n    () => U_AXES.filter((k) => typeof uStore().pinned[k] === \"number\").join(\",\"),\n    () => \"\",\n  );\n  return useMemo(() => new Set((key ? key.split(\",\") : []) as UAxis[]), [key]);\n}\n\n/** A point on axis i of a hexagon (clockwise from 12 o'clock), rounded so server and browser agree. */\nfunction adPoint(i: number, r: number, cx: number, cy: number): [number, number] {\n  const a = (-90 + i * 60) * (Math.PI / 180);\n  return [Math.round((cx + Math.cos(a) * r) * 100) / 100, Math.round((cy + Math.sin(a) * r) * 100) / 100];\n}\n\nexport interface UNavLink {\n  label: string;\n  href: string;\n}\n\nexport interface UFooterColumn {\n  title: string;\n  links: UNavLink[];\n}\n\nconst UF_COLUMNS: UFooterColumn[] = [\n  {\n    title: \"Product\",\n    links: [\n      { label: \"Library\", href: \"/library\" },\n      { label: \"Styles\", href: \"/styles\" },\n      { label: \"Pricing\", href: \"/pricing\" },\n    ],\n  },\n  {\n    title: \"Ultra\",\n    links: [\n      { label: \"Aura Dial\", href: \"/library/aura-dial\" },\n      { label: \"Density Ledger\", href: \"/library/density-ledger\" },\n      { label: \"Ultra Pill Nav\", href: \"/library/ultra-pill-nav\" },\n    ],\n  },\n  {\n    title: \"viberdy\",\n    links: [\n      { label: \"About\", href: \"/about\" },\n      { label: \"Terms\", href: \"/terms\" },\n      { label: \"Privacy\", href: \"/privacy\" },\n    ],\n  },\n];\n\n/** The reader's hexagon, drawn small: the same shape as the dial and the prism. */\nfunction UHexGlyph({ axes, size = 44 }: { axes: UAxes; size?: number }) {\n  const tk = ultraTokens(axes);\n  const c = size / 2;\n  const pts = U_AXES.map((ax, i) => adPoint(i, c * uLerp(0.3, 0.92, axes[ax]), c, c).join(\",\")).join(\" \");\n  return (\n    <svg width={size} height={size} viewBox={\"0 0 \" + size + \" \" + size} aria-hidden>\n      <polygon points={U_AXES.map((_, i) => adPoint(i, c * 0.92, c, c).join(\",\")).join(\" \")} fill=\"none\" stroke={tk.hair} strokeOpacity={0.5} />\n      <polygon points={pts} fill={tk.acc} fillOpacity={0.25} stroke={tk.acc} strokeWidth={1.5} strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nexport interface UltraSiteFooterProps {\n  brand?: string;\n  call?: string;\n  promise?: string;\n  cta?: { label: string; href: string };\n  secondary?: { label: string; href: string } | null;\n  columns?: UFooterColumn[];\n  legal?: string;\n  className?: string;\n}\n\n/**\n * UltraSiteFooter — a closing line whose weight follows the reader's contrast, their own hexagon with a reset, and the links.\n */\nexport function UltraSiteFooter({\n  brand = \"viberdy\",\n  call = \"Fits the reader.\",\n  promise = \"Premium React components in every style, built to be pasted.\",\n  cta = { label: \"Get the Ultra kit\", href: \"/styles/ultra\" },\n  secondary = { label: \"Browse the library\", href: \"/library\" },\n  columns = UF_COLUMNS,\n  legal = \"© 2026 viberdy. All rights reserved.\",\n  className = \"\",\n}: UltraSiteFooterProps) {\n  const axes = useUltra();\n  const tk = ultraTokens(axes);\n  const pinned = useUltraPinned();\n  // The closing line's weight follows contrast: 460 soft to 640 crisp, on Google Sans Flex's wght axis.\n  const wght = Math.round(uLerp(460, 640, axes.contrast));\n  return (\n    <footer className={\"u-scope @container relative w-full overflow-hidden \" + className} style={{ ...ultraVars(tk), background: tk.ground }}>\n      <style>{U_CSS}</style>\n      <div aria-hidden className=\"pointer-events-none absolute inset-x-0 top-0 h-px\" style={{ background: \"linear-gradient(90deg, transparent, \" + U_AXES.map((ax) => uAxisColor(ax, tk.dark)).join(\", \") + \", transparent)\", opacity: 0.6 }} />\n      <div className=\"mx-auto flex w-full max-w-[1180px] flex-col gap-14 px-5 pb-10 pt-24 @3xl:px-10 @3xl:pt-32\">\n        <div className=\"flex flex-col gap-8\">\n          <p\n            className=\"m-0 text-[clamp(52px,12cqw,168px)] leading-[0.92] tracking-[-0.045em]\"\n            style={{ color: tk.ink1, fontVariationSettings: '\"wght\" ' + wght + ', \"GRAD\" ' + tk.grad.toFixed(0) + ', \"ROND\" ' + tk.rond.toFixed(0), transition: tk.k ? \"font-variation-settings 400ms cubic-bezier(.16,1,.3,1)\" : undefined }}\n          >\n            {call}\n          </p>\n          <div className=\"flex flex-wrap items-center gap-5\">\n            <a href={uSafeHref(cta.href)} onClick={uGo} className=\"u-cta inline-flex h-12 items-center gap-2 rounded-full px-6 text-[15px] font-medium no-underline\" style={{ background: tk.acc, color: tk.onAcc }}>\n              {cta.label}\n              <UArrow />\n            </a>\n            {secondary ? (\n              <a href={uSafeHref(secondary.href)} onClick={uGo} className=\"text-[15px] underline decoration-1 underline-offset-4\" style={{ color: tk.ink2 }}>\n                {secondary.label}\n              </a>\n            ) : null}\n          </div>\n        </div>\n        <div className=\"grid gap-10 @3xl:grid-cols-[1.3fr_1fr_1fr_1fr]\">\n          <div className=\"flex flex-col gap-4\">\n            <span className=\"flex items-center gap-2 text-[16px] font-[620] tracking-[-0.02em]\" style={{ color: tk.ink1 }}>\n              <UVMark size={28} />\n              {brand}\n            </span>\n            <p className=\"m-0 max-w-[34ch] text-[14px] leading-[1.55]\" style={{ color: tk.ink2 }}>\n              {promise}\n            </p>\n            <div className=\"u-glass mt-2 flex w-fit items-center gap-3 rounded-[18px] py-2 pl-2 pr-4\">\n              <UHexGlyph axes={axes} />\n              <div className=\"flex flex-col gap-0.5\">\n                <span className=\"text-[12.5px] font-medium\" style={{ color: tk.ink1 }}>\n                  Your tuning\n                </span>\n                <span className=\"text-[12px]\" style={{ color: tk.ink3 }}>\n                  {pinned.size ? \"Saved on this device only.\" : \"Following your system.\"}\n                </span>\n              </div>\n              {pinned.size ? (\n                <button type=\"button\" onClick={resetUltra} className=\"ml-2 cursor-pointer border-0 bg-transparent p-0 text-[12.5px] font-medium underline decoration-1 underline-offset-4\" style={{ color: tk.ink2, font: \"inherit\" }}>\n                  Reset\n                </button>\n              ) : null}\n            </div>\n          </div>\n          {columns.map((col) => (\n            <nav key={col.title} aria-label={col.title} className=\"flex flex-col gap-3\">\n              <p className=\"m-0 text-[12.5px] font-medium\" style={{ color: tk.ink3 }}>\n                {col.title}\n              </p>\n              {col.links.map((l) => (\n                <a key={l.href + l.label} href={uSafeHref(l.href)} onClick={uGo} className=\"w-fit text-[14.5px] no-underline hover:underline hover:decoration-1 hover:underline-offset-4\" style={{ color: tk.ink2 }}>\n                  {l.label}\n                </a>\n              ))}\n            </nav>\n          ))}\n        </div>\n        <p className=\"m-0 text-[12.5px]\" style={{ color: tk.ink3 }}>\n          {legal}\n        </p>\n      </div>\n    </footer>\n  );\n}\n","type":"registry:component","target":"components/viberdy/ultra-site-footer.tsx"}],"meta":{"tier":"free","tags":["footer","variable font","adaptive","personalization","links","dark mode","light mode"],"href":"https://viberdy.dev/library/ultra-site-footer","aiPrompt":"Add the Ultra \"UltraSiteFooter\" to this app: a closing footer whose big call (\"Fits the reader.\") is set in a variable font whose weight follows the reader's contrast value, with one filled button, a quiet secondary link, columns of links, and a small card showing the reader's own tuning as a hexagon (the six values as its corners). The card says whether the page is following the system or values saved on this device, and a reset hands every value back to the system.\n\nHow to use it:\n- `<UltraSiteFooter brand=\"Your brand\" />` at the end of the page.\n- Props: `call` (the big line), `promise` (the line under the brand), `cta` and `secondary` ({ label, href }; `secondary={null}` drops it), `columns` (`[{ title, links: [{ label, href }] }]`) and `legal` (the bottom line).\n- Every href goes through `uSafeHref`. Only link to pages that exist.\n- On a phone (container under 768px) the brand and the columns stack and the call scales to the width.\n- Reduced motion: nothing in it depends on motion.","license":"https://viberdy.dev/license"}}