{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "grid-horizon",
  "type": "registry:ui",
  "title": "Grid Horizon",
  "author": "Rishabh Bose <https://theb0se.vercel.app/>",
  "description": "Pure CSS 3D perspective synthwave horizon using `perspective(320px) rotateX(64deg)` and `background-position-y` animation for an endless wireframe road effect.",
  "dependencies": [
    "lucide-react",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "components/ui/grid-horizon.tsx",
      "content": "\"use client\";\n\nimport React, { useState } from \"react\";\nimport { Compass } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface GridHorizonProps {\n  /** Forward road scroll speed multiplier (1 = default). Default: 1 */\n  speed?: number;\n  /** Grid line color. Default: \"rgba(236, 72, 153, 0.55)\" */\n  gridColor?: string;\n  /** Horizon sun gradient color. Default: \"#F97316\" */\n  sunColor?: string;\n  /** Grid cell size in pixels. Default: 44 */\n  gridSize?: number;\n  /** Display the retro segmented sun on the horizon. Default: true */\n  showSun?: boolean;\n  /** Optional foreground content */\n  children?: React.ReactNode;\n  className?: string;\n}\n\nexport function GridHorizon({\n  speed = 1,\n  gridColor = \"rgba(236, 72, 153, 0.55)\",\n  sunColor = \"#F97316\",\n  gridSize = 44,\n  showSun = true,\n  children,\n  className,\n}: GridHorizonProps) {\n  const [theme, setTheme] = useState<\"synthwave\" | \"cyber\" | \"mono\">(\n    \"synthwave\"\n  );\n\n  const palettes = {\n    synthwave: {\n      grid: gridColor,\n      sun: sunColor,\n      glow: \"#EC4899\",\n    },\n    cyber: {\n      grid: \"rgba(6, 182, 212, 0.55)\",\n      sun: \"#38BDF8\",\n      glow: \"#06B6D4\",\n    },\n    mono: {\n      grid: \"rgba(255, 255, 255, 0.35)\",\n      sun: \"#FFFFFF\",\n      glow: \"#A3A3A3\",\n    },\n  };\n\n  const active = palettes[theme];\n  const duration = Math.max(0.4, 1.8 / Math.max(0.2, speed));\n\n  return (\n    <div\n      data-fullscreen-scroll\n      className={cn(\n        \"relative flex min-h-[360px] w-full flex-col justify-between overflow-hidden rounded-3xl border border-neutral-800 bg-[#06040F] p-6 text-white shadow-sm\",\n        className\n      )}\n    >\n      <style>{`\n        @keyframes bose-grid-scroll {\n          0% { background-position: 0px 0px; }\n          100% { background-position: 0px ${gridSize}px; }\n        }\n      `}</style>\n\n      {/* Sky Backdrop & Segmented Synthwave Sun */}\n      <div\n        aria-hidden=\"true\"\n        className=\"pointer-events-none absolute inset-x-0 top-0 h-[52%] overflow-hidden bg-gradient-to-b from-[#05030D] via-[#130926] to-[#2E1045]\"\n      >\n        {showSun && (\n          <div\n            style={{\n              background: `linear-gradient(180deg, #FDE047 0%, ${active.sun} 55%, ${active.glow} 100%)`,\n              boxShadow: `0 0 60px ${active.glow}`,\n              WebkitMaskImage:\n                \"repeating-linear-gradient(to bottom, black 0px, black 8px, transparent 8px, transparent 11px)\",\n              maskImage:\n                \"repeating-linear-gradient(to bottom, black 0px, black 8px, transparent 8px, transparent 11px)\",\n            }}\n            className=\"absolute bottom-[-28px] left-1/2 h-36 w-36 -translate-x-1/2 rounded-full\"\n          />\n        )}\n      </div>\n\n      {/* Glowing Horizon Divider Line */}\n      <div\n        aria-hidden=\"true\"\n        style={{\n          background: active.glow,\n          boxShadow: `0 0 24px 3px ${active.glow}`,\n        }}\n        className=\"pointer-events-none absolute inset-x-0 top-[52%] z-10 h-[2px]\"\n      />\n\n      {/* 3D Perspective Infinite Scrolling Grid Plane */}\n      <div\n        aria-hidden=\"true\"\n        style={{ perspective: \"320px\" }}\n        className=\"pointer-events-none absolute inset-x-0 bottom-0 h-[48%] overflow-hidden bg-[#06030E]\"\n      >\n        <div\n          style={{\n            transform: \"rotateX(64deg) scale(2.2)\",\n            transformOrigin: \"top center\",\n            backgroundImage: `linear-gradient(to right, ${active.grid} 1px, transparent 1px), linear-gradient(to bottom, ${active.grid} 1px, transparent 1px)`,\n            backgroundSize: `${gridSize}px ${gridSize}px`,\n            animation: `bose-grid-scroll ${duration}s linear infinite`,\n          }}\n          className=\"h-[220%] w-full\"\n        />\n\n        {/* Distance Fog Fade at Horizon */}\n        <div className=\"absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-[#130926] to-transparent\" />\n      </div>\n\n      {/* Foreground Content */}\n      <div className=\"relative z-20 flex flex-1 flex-col justify-between\">\n        {children ?? (\n          <>\n            <div className=\"flex flex-wrap items-center justify-between gap-2\">\n              <span className=\"inline-flex items-center gap-1.5 rounded-full border border-white/15 bg-black/40 px-3 py-1 font-mono text-[11px] font-medium text-white backdrop-blur-md\">\n                <Compass className=\"h-3.5 w-3.5 text-pink-400\" />\n                Grid Horizon · rotateX(64deg)\n              </span>\n\n              <div className=\"flex items-center gap-1 rounded-full border border-white/15 bg-black/40 p-1 backdrop-blur-md\">\n                {([\"synthwave\", \"cyber\", \"mono\"] as const).map((t) => (\n                  <button\n                    key={t}\n                    type=\"button\"\n                    onClick={() => setTheme(t)}\n                    className={cn(\n                      \"rounded-full px-2.5 py-0.5 font-mono text-[10px] font-semibold uppercase transition-colors\",\n                      theme === t\n                        ? \"bg-white text-black\"\n                        : \"text-white/75 hover:text-white\"\n                    )}\n                  >\n                    {t}\n                  </button>\n                ))}\n              </div>\n            </div>\n\n            <div className=\"my-auto max-w-md py-6\">\n              <h3 className=\"text-2xl font-bold tracking-tight text-white drop-shadow-md sm:text-3xl\">\n                Perspective Grid Horizon\n              </h3>\n              <p className=\"mt-2 text-xs leading-relaxed text-white/85 drop-shadow-xs sm:text-sm\">\n                Pure CSS <code className=\"font-mono\">perspective(320px)</code>{\" \"}\n                plane tilted at 64° with an endless{\" \"}\n                <code className=\"font-mono\">background-position-y</code> loop\n                and a scanline horizon sun.\n              </p>\n            </div>\n\n            <div className=\"font-mono text-[11px] text-white/60\">\n              Pure CSS 3D Transform · Endless Loop · 0 JS Per-Frame Cost\n            </div>\n          </>\n        )}\n      </div>\n    </div>\n  );\n}\n\nexport default GridHorizon;\n",
      "type": "registry:ui",
      "target": "components/ui/grid-horizon.tsx"
    },
    {
      "path": "lib/utils.ts",
      "content": "import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport async function copyToClipboard(text: string): Promise<boolean> {\n  if (typeof window === \"undefined\") return false;\n\n  try {\n    if (navigator.clipboard && window.isSecureContext) {\n      await navigator.clipboard.writeText(text);\n      return true;\n    }\n\n    const textArea = document.createElement(\"textarea\");\n    textArea.value = text;\n    textArea.style.position = \"fixed\";\n    textArea.style.left = \"-999999px\";\n    textArea.style.top = \"-999999px\";\n    document.body.appendChild(textArea);\n    textArea.focus();\n    textArea.select();\n    const succeeded = document.execCommand(\"copy\");\n    textArea.remove();\n    return succeeded;\n  } catch {\n    return false;\n  }\n}\n",
      "type": "registry:lib",
      "target": "lib/utils.ts"
    }
  ]
}
