{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "frosted-clear",
  "title": "Frosted Clear",
  "description": "A frosted glass card clears to show a large 10x stat with a kicker.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "files": [
    {
      "path": "registry/remocn/frosted-clear/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/IBMPlexMono\";\nimport { loadFont as loadDisplay } from \"@remotion/google-fonts/Sora\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: mono } = loadFont(\"normal\", {\n  weights: [\"400\"],\n  subsets: [\"latin\"],\n});\nconst { fontFamily: display } = loadDisplay(\"normal\", {\n  weights: [\"400\"],\n  subsets: [\"latin\"],\n});\n\nexport interface FrostedClearProps {\n  title?: string;\n  kicker?: string;\n  accent?: string;\n  theme?: \"dark\" | \"light\";\n  speed?: number;\n}\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_CLEAR = Easing.bezier(0.4, 0, 0.2, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\n// gradients.sh \"mesh\" palette: bg #0a0d24, [#ecdcf2, #8796ee, #2e45b7, #0e1645].\n// It fills the hero number (clip-text) and tints the stage behind the glass.\nconst MESH = [\"#ecdcf2\", \"#8796ee\", \"#2e45b7\", \"#0e1645\"] as const;\n\nconst THEMES = {\n  dark: {\n    bg: \"#0a0d24\",\n    ink: [MESH[0], MESH[1], MESH[1], MESH[2]],\n    ground: 0.5,\n    fg: \"#F3F2EF\",\n    frost: \"rgba(255,255,255,0.055)\",\n    frostGrain: 0.13,\n    rest: \"rgba(255,255,255,0.22)\",\n    glint: \"rgba(255,255,255,0.95)\",\n    sheen: \"rgba(255,255,255,0.1)\",\n    shadow: \"rgba(0,0,0,0.75)\",\n    grain: 0.06,\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    ink: [MESH[1], MESH[2], MESH[2], MESH[3]],\n    ground: 0.16,\n    fg: \"#121214\",\n    frost: \"rgba(255,255,255,0.5)\",\n    frostGrain: 0.09,\n    rest: \"rgba(18,18,20,0.16)\",\n    glint: \"rgba(255,255,255,1)\",\n    sheen: \"rgba(255,255,255,0.7)\",\n    shadow: \"rgba(70,62,48,0.2)\",\n    grain: 0.045,\n  },\n} as const;\n\ntype Palette = (typeof THEMES)[keyof typeof THEMES];\n\nfunction textWidth(s: string, size: number) {\n  let w = 0;\n  for (const ch of s) {\n    if (ch === \" \") w += 0.26;\n    else if (\"iljtfr,.;:!'|1\".includes(ch)) w += 0.4;\n    else if (\"mwMW\".includes(ch)) w += 0.86;\n    else if (ch >= \"A\" && ch <= \"Z\") w += 0.68;\n    else if (ch >= \"0\" && ch <= \"9\") w += 0.64;\n    else w += 0.6;\n    w -= 0.03;\n  }\n  return w * size;\n}\n\nfunction Grain({ opacity, seed }: { opacity: number; seed: number }) {\n  const id = `g${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n  return (\n    <svg\n      width=\"100%\"\n      height=\"100%\"\n      style={{ position: \"absolute\", inset: 0, opacity }}\n      aria-hidden\n    >\n      <filter id={id}>\n        <feTurbulence\n          type=\"fractalNoise\"\n          baseFrequency=\"0.85\"\n          numOctaves={2}\n          seed={seed}\n          stitchTiles=\"stitch\"\n        />\n        <feColorMatrix values=\"0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0 0.5  0 0 0 0.9 0\" />\n      </filter>\n      <rect width=\"100%\" height=\"100%\" filter={`url(#${id})`} />\n    </svg>\n  );\n}\n\nfunction Ground({ t, p, accent }: { t: number; p: Palette; accent: string }) {\n  return (\n    <div\n      style={{\n        position: \"absolute\",\n        inset: 0,\n        opacity: p.ground,\n        background: [\n          `radial-gradient(85% 95% at ${16 + 3 * Math.sin(t / 60)}% 20%, color-mix(in oklab, ${MESH[1]} 55%, transparent) 0%, transparent 68%)`,\n          `radial-gradient(85% 95% at 84% ${26 + 3 * Math.cos(t / 64)}%, color-mix(in oklab, ${MESH[2]} 80%, transparent) 0%, transparent 68%)`,\n          `radial-gradient(85% 95% at 72% 86%, color-mix(in oklab, ${accent} 45%, transparent) 0%, transparent 68%)`,\n          `radial-gradient(85% 95% at 22% 80%, ${MESH[3]} 0%, transparent 68%)`,\n        ].join(\", \"),\n      }}\n    />\n  );\n}\n\nfunction Content({\n  t,\n  title,\n  kicker,\n  p,\n  size,\n  settle,\n}: {\n  t: number;\n  title: string;\n  kicker?: string;\n  p: Palette;\n  size: number;\n  settle: number;\n}) {\n  const { width, height } = useVideoConfig();\n  const u = height / 720;\n  const rise = (d: number) =>\n    interpolate(t, [d, d + 26], [0, 1], { ...CLAMP, easing: EASE_OUT });\n  return (\n    <div\n      style={{\n        position: \"absolute\",\n        left: 0,\n        top: 0,\n        width,\n        height,\n        display: \"flex\",\n        flexDirection: \"column\",\n        alignItems: \"center\",\n        justifyContent: \"center\",\n        transform: `scale(${1 + 0.02 * (1 - settle)})`,\n      }}\n    >\n      {kicker ? (\n        <div\n          style={{\n            fontFamily: mono,\n            fontWeight: 400,\n            fontSize: 19 * u,\n            letterSpacing: \"0.14em\",\n            textTransform: \"uppercase\",\n            color: p.fg,\n            marginBottom: size * 0.06,\n            opacity: rise(0),\n            transform: `translateY(${(1 - rise(0)) * 24 * u}px)`,\n          }}\n        >\n          {kicker}\n        </div>\n      ) : null}\n      <div\n        style={{\n          fontFamily: display,\n          fontWeight: 400,\n          fontSize: size,\n          lineHeight: 1.04,\n          letterSpacing: \"-0.05em\",\n          paddingRight: \"0.06em\",\n          fontVariantNumeric: \"tabular-nums\",\n          backgroundImage: [\n            `radial-gradient(60% 70% at ${22 + 6 * Math.sin(t / 50)}% 18%, ${p.ink[0]} 0%, transparent 70%)`,\n            `radial-gradient(70% 80% at 86% ${30 + 6 * Math.cos(t / 56)}%, ${p.ink[1]} 0%, transparent 72%)`,\n            `radial-gradient(80% 70% at 50% 100%, ${p.ink[3]} 0%, transparent 75%)`,\n            `linear-gradient(${p.ink[2]}, ${p.ink[2]})`,\n          ].join(\", \"),\n          WebkitBackgroundClip: \"text\",\n          backgroundClip: \"text\",\n          color: \"transparent\",\n          whiteSpace: \"pre\",\n          opacity: rise(3),\n          transform: `translateY(${(1 - rise(3)) * 40 * u}px)`,\n        }}\n      >\n        {title}\n      </div>\n    </div>\n  );\n}\n\nexport function FrostedClear({\n  title = \"10×\",\n  kicker = \"Faster renders\",\n  accent = \"#3B5BFD\",\n  theme = \"dark\",\n  speed = 1,\n}: FrostedClearProps) {\n  const t = useCurrentFrame() * speed;\n  const { width, height } = useVideoConfig();\n  const p = THEMES[theme];\n  const u = height / 720;\n\n  const pw = width * 0.74;\n  const ph = height * 0.72;\n  const px = (width - pw) / 2;\n  const py = (height - ph) / 2;\n  const radius = 30 * u;\n  const size = Math.min(\n    290 * u,\n    (pw * 0.78) / Math.max(textWidth(title, 1), 0.1),\n  );\n\n  const ox = pw * 0.5;\n  const oy = ph * 0.55;\n  const feather = 170 * u;\n  const k = EASE_CLEAR(interpolate(t, [28, 92], [0, 1], CLAMP));\n  const r = k * pw * 0.6;\n  const settle = interpolate(t, [52, 96], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n\n  const hole =\n    r > 0.5\n      ? `radial-gradient(circle at ${ox}px ${oy}px, rgba(0,0,0,0) ${Math.max(0, r - feather)}px, #000 ${r + 1}px)`\n      : \"linear-gradient(#000, #000)\";\n  const front = `radial-gradient(circle at ${ox}px ${oy}px, rgba(0,0,0,0) ${Math.max(0, r - feather * 0.85)}px, #000 ${Math.max(0, r - feather * 0.5)}px, rgba(0,0,0,0) ${Math.max(0, r - feather * 0.1)}px)`;\n  const inside = `radial-gradient(circle at ${ox}px ${oy}px, #000 ${Math.max(0, r - feather)}px, rgba(0,0,0,0) ${r}px)`;\n  const glint = interpolate(k, [0.05, 0.2, 0.8, 1], [0, 1, 1, 0], CLAMP);\n  const restAll = interpolate(t, [80, 100], [0, 1], CLAMP);\n\n  const contentProps = { t, title, kicker, p, size, settle };\n  const stroke = Math.max(1, 1.2 * u);\n  const edge = (paint: string, mask: string, opacity: number) => (\n    <svg\n      width={pw}\n      height={ph}\n      style={{\n        position: \"absolute\",\n        left: px,\n        top: py,\n        overflow: \"visible\",\n        opacity,\n        WebkitMaskImage: mask,\n        maskImage: mask,\n      }}\n      aria-hidden\n    >\n      <rect\n        x={stroke / 2}\n        y={stroke / 2}\n        width={pw - stroke}\n        height={ph - stroke}\n        rx={radius}\n        fill=\"none\"\n        stroke={paint}\n        strokeWidth={stroke}\n      />\n    </svg>\n  );\n\n  return (\n    <AbsoluteFill style={{ background: p.bg, overflow: \"hidden\" }}>\n      <Ground t={t} p={p} accent={accent} />\n      <div\n        style={{\n          position: \"absolute\",\n          left: px,\n          top: py,\n          width: pw,\n          height: ph,\n          borderRadius: radius,\n          boxShadow: `0 ${30 * u}px ${80 * u}px ${-30 * u}px ${p.shadow}`,\n        }}\n      />\n      <Content {...contentProps} />\n      <div\n        style={{\n          position: \"absolute\",\n          left: px,\n          top: py,\n          width: pw,\n          height: ph,\n          borderRadius: radius,\n          overflow: \"hidden\",\n          WebkitMaskImage: hole,\n          maskImage: hole,\n        }}\n      >\n        <div\n          style={{\n            position: \"absolute\",\n            left: -px,\n            top: -py,\n            width,\n            height,\n            background: p.bg,\n            filter: `blur(${30 * u}px)`,\n          }}\n        >\n          <Ground t={t} p={p} accent={accent} />\n          <Content {...contentProps} />\n        </div>\n        <div style={{ position: \"absolute\", inset: 0, background: p.frost }} />\n        <Grain opacity={p.frostGrain} seed={4} />\n      </div>\n      <div\n        style={{\n          position: \"absolute\",\n          left: px,\n          top: py,\n          width: pw,\n          height: ph,\n          borderRadius: radius,\n          boxShadow: `inset 0 ${1.5 * u}px 0 ${p.sheen}`,\n        }}\n      />\n      {edge(p.rest, \"linear-gradient(#000, #000)\", 0.45 + 0.55 * restAll)}\n      {edge(p.rest, inside, 1 - restAll)}\n      {edge(p.glint, front, glint)}\n      <Grain opacity={p.grain} seed={9} />\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/frosted-clear.tsx"
    }
  ],
  "type": "registry:component"
}
