{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bg-polar-veil",
  "type": "registry:component",
  "title": "Polar Veil",
  "description": "Aurora curtains made of fine vertical rays that sway and shimmer over a night ridge, with twinkling stars and a light film grain. Pure CSS and SVG, no canvas.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "overlay",
    "background",
    "aurora",
    "night",
    "grain",
    "css",
    "landing"
  ],
  "docs": "https://hyperblur.dev/effects/bg-polar-veil",
  "files": [
    {
      "path": "registry/hyperblur/bg-polar-veil.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/bg-polar-veil.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface BgPolarVeilProps extends React.HTMLAttributes<HTMLDivElement> {\n  colors?: string[];\n  background?: string;\n  stars?: number;\n  grain?: number;\n  horizon?: boolean;\n  speed?: number;\n  children?: React.ReactNode;\n}\n\nconst css = `\n.hb-vd1 { position: absolute; inset: 0; overflow: hidden; pointer-events: none; box-sizing: border-box; background: var(--hb-vd1-bg); isolation: isolate; }\n.hb-vd1 *, .hb-vd1 *::before, .hb-vd1 *::after { box-sizing: border-box; }\n.hb-vd1-sky { position: absolute; inset: 0; background: radial-gradient(130% 80% at 50% 120%, color-mix(in srgb, var(--hb-vd1-c0) 22%, transparent) 0%, transparent 62%), linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 55%); }\n.hb-vd1-star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: var(--o); animation: hb-vd1-twinkle calc(var(--d) * var(--hb-vd1-k)) ease-in-out infinite alternate; animation-delay: var(--dl); }\n.hb-vd1-band { position: absolute; left: -30%; width: 160%; height: 66%; top: var(--top); transform-origin: 50% 100%; mix-blend-mode: screen; opacity: var(--o); animation: hb-vd1-sway calc(var(--d) * var(--hb-vd1-k)) cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate; animation-delay: var(--dl); }\n.hb-vd1-glow { position: absolute; inset: 8% 10% 0; background: radial-gradient(55% 60% at 50% 100%, var(--c) 0%, transparent 72%); filter: blur(26px); opacity: 0.5; animation: hb-vd1-breathe calc(7s * var(--hb-vd1-k)) ease-in-out infinite alternate; animation-delay: var(--dl); }\n.hb-vd1-rays { position: absolute; inset: 0; background: linear-gradient(0deg, transparent 0%, var(--c) 9%, color-mix(in srgb, var(--c) 45%, transparent) 34%, transparent 82%); -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 2px, rgba(0,0,0,0.22) 2px 6px, rgba(0,0,0,0.85) 6px 8px, rgba(0,0,0,0.08) 8px 13px), radial-gradient(50% 100% at 50% 100%, #000 28%, transparent 76%); mask-image: repeating-linear-gradient(90deg, #000 0 2px, rgba(0,0,0,0.22) 2px 6px, rgba(0,0,0,0.85) 6px 8px, rgba(0,0,0,0.08) 8px 13px), radial-gradient(50% 100% at 50% 100%, #000 28%, transparent 76%); -webkit-mask-composite: source-in; mask-composite: intersect; filter: blur(1.2px); animation: hb-vd1-shimmer calc(var(--sd) * var(--hb-vd1-k)) linear infinite; }\n.hb-vd1-ridge { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 24%; display: block; }\n.hb-vd1-grain { position: absolute; inset: 0; width: 100%; height: 100%; display: block; mix-blend-mode: overlay; }\n.hb-vd1-in { position: relative; z-index: 1; width: 100%; height: 100%; pointer-events: auto; font-family: inherit; }\n@keyframes hb-vd1-sway {\n  0% { transform: translateX(-6%) skewX(-9deg) rotate(var(--r)) scaleY(0.9); }\n  50% { transform: translateX(2%) skewX(7deg) rotate(calc(var(--r) * -0.4)) scaleY(1.06); }\n  100% { transform: translateX(7%) skewX(-3deg) rotate(var(--r)) scaleY(0.96); }\n}\n@keyframes hb-vd1-shimmer { from { -webkit-mask-position: 0 0, 0 0; mask-position: 0 0, 0 0; } to { -webkit-mask-position: 130px 0, 0 0; mask-position: 130px 0, 0 0; } }\n@keyframes hb-vd1-breathe { from { opacity: 0.32; } to { opacity: 0.68; } }\n@keyframes hb-vd1-twinkle { from { opacity: var(--o); } to { opacity: 0.08; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-vd1-band, .hb-vd1-glow, .hb-vd1-rays, .hb-vd1-star { animation: none; }\n}\n`;\n\nconst defaultColors = [\"#3cf2b0\", \"#2f7bff\", \"#b26cff\"];\n\nfunction hash(i: number) {\n  let x = Math.imul(i ^ 0x7f4a7c15, 0x9e3779b1);\n  x ^= x >>> 15;\n  x = Math.imul(x, 0x85ebca77);\n  x ^= x >>> 13;\n  return (x >>> 0) / 4294967296;\n}\n\nfunction ridgePath() {\n  const pts: string[] = [];\n  const n = 40;\n  for (let i = 0; i <= n; i++) {\n    const u = i / n;\n    const y = 110 - 46 * Math.sin(u * 3.4 + 0.7) * 0.6 - 38 * hash(i * 3 + 1) * 0.7 - 30 * Math.sin(u * 9.1 + 2) * 0.35;\n    pts.push(`${(u * 1000).toFixed(1)} ${y.toFixed(1)}`);\n  }\n  return `M0 200 L${pts.join(\" L\")} L1000 200 Z`;\n}\n\nconst ridge = ridgePath();\n\nexport function BgPolarVeil({\n  colors = defaultColors,\n  background = \"#04060b\",\n  stars = 46,\n  grain = 0.16,\n  horizon = true,\n  speed = 1,\n  children,\n  className = \"\",\n  style,\n  ...rest\n}: BgPolarVeilProps) {\n  const rawId = React.useId();\n  const id = `hb-vd1-${rawId.replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n  const palette = colors.length ? colors : defaultColors;\n  const k = 1 / Math.max(0.05, speed);\n  const bands = palette.map((c, i) => {\n    const n = palette.length;\n    return {\n      c,\n      top: (4 + (i * 18) / Math.max(1, n - 1) + hash(i + 40) * 6).toFixed(2),\n      r: ((i % 2 ? 1 : -1) * (4 + 6 * hash(i + 50))).toFixed(2),\n      d: (14 + 9 * hash(i + 60)).toFixed(2),\n      sd: (8 + 6 * hash(i + 70)).toFixed(2),\n      dl: (-hash(i + 80) * 20).toFixed(2),\n      o: (0.95 - i * 0.12).toFixed(2),\n    };\n  });\n  const starList = Array.from({ length: Math.max(0, Math.min(200, Math.round(stars))) }, (_, i) => ({\n    x: (hash(i * 4 + 1) * 100).toFixed(2),\n    y: (hash(i * 4 + 2) * 62).toFixed(2),\n    o: (0.25 + 0.6 * hash(i * 4 + 3)).toFixed(2),\n    s: (0.5 + 0.9 * hash(i * 4 + 4)).toFixed(2),\n    d: (2 + 4 * hash(i * 4 + 5)).toFixed(2),\n    dl: (-hash(i * 4 + 6) * 6).toFixed(2),\n  }));\n\n  return (\n    <div\n      className={`hb-vd1 ${className}`}\n      style={{ \"--hb-vd1-bg\": background, \"--hb-vd1-c0\": palette[0], \"--hb-vd1-k\": k.toFixed(3), ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-bg-polar-veil\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vd1-sky\" aria-hidden=\"true\" />\n      {starList.map((s, i) => (\n        <span\n          key={i}\n          className=\"hb-vd1-star\"\n          aria-hidden=\"true\"\n          style={{ left: `${s.x}%`, top: `${s.y}%`, transform: `scale(${s.s})`, \"--o\": s.o, \"--d\": `${s.d}s`, \"--dl\": `${s.dl}s` } as React.CSSProperties}\n        />\n      ))}\n      {bands.map((b, i) => (\n        <div\n          key={i}\n          className=\"hb-vd1-band\"\n          aria-hidden=\"true\"\n          style={{ \"--c\": b.c, \"--top\": `${b.top}%`, \"--r\": `${b.r}deg`, \"--d\": `${b.d}s`, \"--sd\": `${b.sd}s`, \"--dl\": `${b.dl}s`, \"--o\": b.o } as React.CSSProperties}\n        >\n          <div className=\"hb-vd1-glow\" />\n          <div className=\"hb-vd1-rays\" />\n        </div>\n      ))}\n      {horizon ? (\n        <svg className=\"hb-vd1-ridge\" viewBox=\"0 0 1000 200\" preserveAspectRatio=\"none\" aria-hidden=\"true\">\n          <defs>\n            <linearGradient id={`${id}-r`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n              <stop offset=\"0\" stopColor=\"#0b0f18\" />\n              <stop offset=\"1\" stopColor=\"#020306\" />\n            </linearGradient>\n          </defs>\n          <path d={ridge} fill={`url(#${id}-r)`} />\n          <path d={ridge} fill=\"none\" stroke={palette[0]} strokeOpacity=\"0.28\" strokeWidth=\"1.2\" vectorEffect=\"non-scaling-stroke\" />\n        </svg>\n      ) : null}\n      {grain > 0 ? (\n        <svg className=\"hb-vd1-grain\" style={{ opacity: grain }} aria-hidden=\"true\">\n          <filter id={`${id}-g`}>\n            <feTurbulence type=\"fractalNoise\" baseFrequency=\"0.9\" numOctaves=\"2\" stitchTiles=\"stitch\" />\n            <feColorMatrix type=\"saturate\" values=\"0\" />\n          </filter>\n          <rect width=\"100%\" height=\"100%\" filter={`url(#${id}-g)`} />\n        </svg>\n      ) : null}\n      {children ? <div className=\"hb-vd1-in\">{children}</div> : null}\n    </div>\n  );\n}\n"
    }
  ]
}