{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "achievement-pop",
  "title": "Achievement Pop",
  "description": "Stacked achievement toasts unlock one by one, the last a rare gradient-filled card.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "registryDependencies": ["@remocn/gsh"],
  "files": [
    {
      "path": "registry/remocn/achievement-pop/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont as loadGeist } from \"@remotion/google-fonts/Geist\";\nimport { loadFont as loadMono } from \"@remotion/google-fonts/GeistMono\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  spring,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\nimport type { GradientParams } from \"@/lib/remocn/gsh/gradient-engine\";\nimport { GshGround } from \"@/lib/remocn/gsh/gsh-ground\";\nimport type { GshPresetId } from \"@/lib/remocn/gsh/presets\";\n\nconst { fontFamily: geist } = loadGeist(\"normal\", {\n  weights: [\"300\", \"400\"],\n  subsets: [\"latin\"],\n});\nconst { fontFamily: mono } = loadMono(\"normal\", {\n  weights: [\"400\"],\n  subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"600\"],\n  subsets: [\"latin\"],\n});\n\nconst REMOCN_R_PATH =\n  \"M 0.01 0.81 C 0.01 1.73, 0.36 2.79, 1.09 4.13 C 4.91 11.04, 13.45 17.16, 21.7 18.9 C 22.94 19.16, 23.18 19.16, 51.39 19.27 C 76.07 19.36, 80.02 19.4, 81.32 19.57 C 89.89 20.69, 96.2 24.68, 99.38 31.01 C 103.19 38.56, 102.53 50.1, 97.91 57.07 C 94.66 61.96, 89.68 64.99, 83.26 66 C 82.81 66.07, 70.18 66.83, 55.2 67.69 C 24.82 69.43, 27.03 69.23, 24.18 70.4 C 19.9 72.15, 14.84 75.7, 10.65 79.89 C 4.86 85.68, 1.3 91.91, 0.25 98.13 C 0.12 98.85, 0.08 103.13, 0.04 116.66 L 0 134.26 9.5 134.26 L 19 134.26 19.05 119.41 C 19.1 103.27, 19.08 103.82, 19.82 101.04 C 21.79 93.65, 27.86 88.75, 36.45 87.63 C 37.23 87.53, 39.41 87.5, 43.57 87.53 C 50.12 87.59, 50.75 87.65, 53.22 88.45 C 56.61 89.56, 59.67 91.86, 62.02 95.07 C 62.52 95.76, 69.35 103.85, 77.2 113.07 C 85.04 122.28, 91.63 130.04, 91.85 130.32 C 92.07 130.59, 92.5 131.34, 92.82 131.97 C 93.52 133.35, 94.11 133.93, 95.06 134.13 C 95.5 134.23, 98.97 134.26, 106.36 134.23 L 117.01 134.19 100.82 113.07 C 91.91 101.45, 84.52 91.78, 84.39 91.57 C 83.36 89.89, 83.66 87.53, 85.09 86 C 85.79 85.25, 86.36 84.94, 88.07 84.38 C 96.18 81.72, 104.15 76.62, 109.97 70.36 C 120.59 58.93, 124.06 44.32, 119.44 30.43 C 114.59 15.81, 101.93 4.02, 87.64 0.83 C 83.93 0.01, 88.09 0.08, 41.85 0.04 L 0.01 0 0.01 0.81 Z\";\n\nfunction RemocnLogo({ fontSize, color }: { fontSize: number; color: string }) {\n  return (\n    <div\n      style={{\n        display: \"flex\",\n        alignItems: \"baseline\",\n        color,\n        fontFamily: manrope.fontFamily,\n        fontWeight: 600,\n        fontSize,\n        letterSpacing: \"-0.025em\",\n        lineHeight: 1,\n      }}\n    >\n      <svg\n        viewBox=\"0 0 124.06 134.26\"\n        style={{ height: \"0.76em\", width: \"auto\" }}\n        aria-hidden\n      >\n        <path fill=\"currentColor\" d={REMOCN_R_PATH} />\n      </svg>\n      <span style={{ marginLeft: \"0.04em\" }}>emocn</span>\n    </div>\n  );\n}\n\nexport type AchievementIcon = \"trophy\" | \"bolt\" | \"star\";\n\nexport interface Achievement {\n  label: string;\n  title: string;\n  points: number;\n  icon?: AchievementIcon;\n}\n\nexport interface AchievementPopProps {\n  achievements?: Achievement[];\n  accent?: string;\n  theme?: \"dark\" | \"light\";\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n  speed?: number;\n}\n\nconst BEATS = {\n  starts: [4, 34, 58],\n  open: 6,\n  shiftLead: 6,\n  poster: 30,\n  logo: 10,\n} as const;\n\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst HEAVY = { mass: 1, damping: 26, stiffness: 120 };\nconst MORPH = { damping: 200 };\n\nconst KILN = [\"#5C0A02\", \"#E2340C\", \"#FF9A3A\", \"#FFE9C7\"] as const;\nconst RARE_FILL = `linear-gradient(104deg, #2A0903 0%, ${KILN[0]} 30%, #A8260A 68%, ${KILN[1]} 100%)`;\n\nconst DARK_GROUND: Partial<GradientParams> = {\n  colors: [\"#2A0601\", \"#7A1404\", \"#E2340C\", \"#FF9A3A\"],\n};\n\nconst LIGHT_GROUND: Partial<GradientParams> = {\n  kind: \"mist\",\n  colors: [\"#F08A4B\", \"#F7C39A\", \"#F3E3D3\", \"#7A2E12\"],\n  background: \"#F2EEE8\",\n  speed: 0.8,\n  loopSeconds: 14,\n  scale: 0.8,\n  warp: 0.4,\n  blur: 0.65,\n  grain: 0.3,\n  seed: 4,\n};\n\nconst THEMES = {\n  dark: {\n    base: \"#060201\",\n    scrim:\n      \"radial-gradient(64% 58% at 50% 44%, rgba(6,3,2,0.7) 0%, rgba(6,3,2,0) 100%)\",\n    pill: \"#141112\",\n    depth:\n      \"inset 0 1px 0 rgba(255,255,255,0.07), 0 0 0 1px rgba(255,255,255,0.08), 0 18px 40px -14px rgba(0,0,0,0.7)\",\n    badge: \"#1D191A\",\n    ring: \"rgba(255,255,255,0.12)\",\n    ink: \"#F4F1EC\",\n    dim: \"#9A928C\",\n    rule: \"rgba(255,255,255,0.1)\",\n    flash: KILN[3],\n    logo: \"#1A0803\",\n  },\n  light: {\n    base: \"#F2EEE8\",\n    scrim:\n      \"radial-gradient(64% 58% at 50% 44%, rgba(246,243,238,0.7) 0%, rgba(246,243,238,0.2) 100%)\",\n    pill: \"#FFFFFF\",\n    depth:\n      \"0 0 0 1px rgba(40,24,12,0.06), 0 1px 3px rgba(40,24,12,0.06), 0 16px 32px -14px rgba(90,40,10,0.22)\",\n    badge: \"#F6F3EE\",\n    ring: \"rgba(40,24,12,0.1)\",\n    ink: \"#17120F\",\n    dim: \"#857B73\",\n    rule: \"rgba(40,24,12,0.1)\",\n    flash: KILN[1],\n    logo: \"#17120F\",\n  },\n} as const;\n\nfunction Icon({\n  name,\n  size,\n  color,\n}: {\n  name: AchievementIcon;\n  size: number;\n  color: string;\n}) {\n  const common = {\n    fill: \"none\",\n    stroke: color,\n    strokeWidth: 1.5,\n    strokeLinecap: \"round\" as const,\n    strokeLinejoin: \"round\" as const,\n  };\n  return (\n    <svg viewBox=\"0 0 24 24\" width={size} height={size} aria-hidden>\n      {name === \"trophy\" ? (\n        <g {...common}>\n          <path d=\"M7.5 4h9v4.5a4.5 4.5 0 0 1-9 0V4Z\" />\n          <path d=\"M7.5 6H5.2a2 2 0 0 0 0 4h2.6M16.5 6h2.3a2 2 0 0 1 0 4h-2.6\" />\n          <path d=\"M12 13v4M9 20h6M10 17h4\" />\n        </g>\n      ) : name === \"bolt\" ? (\n        <path {...common} d=\"M13.5 3 6 13.4h5.4L10.5 21 18 10.6h-5.4L13.5 3Z\" />\n      ) : (\n        <path\n          {...common}\n          d=\"M12 3.6l2.6 5.3 5.8.8-4.2 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.2-4.1 5.8-.8L12 3.6Z\"\n        />\n      )}\n    </svg>\n  );\n}\n\nexport function AchievementPop({\n  achievements = [\n    {\n      label: \"Unlocked · 64% of makers\",\n      title: \"Shipped in one day\",\n      points: 100,\n      icon: \"trophy\",\n    },\n    {\n      label: \"Unlocked · 23% of makers\",\n      title: \"Zero keyframes by hand\",\n      points: 50,\n      icon: \"bolt\",\n    },\n    {\n      label: \"Rare · 1.8% of makers\",\n      title: \"Launch video shipped\",\n      points: 250,\n      icon: \"star\",\n    },\n  ],\n  theme = \"dark\",\n  ground,\n  groundParams,\n  speed = 1,\n}: AchievementPopProps) {\n  const t = useCurrentFrame() * speed;\n  const { width: W, height: H, fps } = useVideoConfig();\n  const tall = H > W;\n  const dark = theme === \"dark\";\n  const c = THEMES[theme];\n  const u = tall ? (W * 0.88) / 820 : Math.min(W / 1280, H / 720);\n  const resolvedGround: GshPresetId | undefined =\n    ground ?? (groundParams ? undefined : dark ? \"kiln\" : undefined);\n  const resolvedParams = groundParams ?? (dark ? DARK_GROUND : LIGHT_GROUND);\n\n  const list = achievements.slice(0, BEATS.starts.length);\n  const n = list.length;\n  const starts = BEATS.starts.slice(0, n);\n  const lastStart = starts[n - 1] ?? BEATS.starts[0];\n\n  const ph = 116 * u;\n  const D = ph;\n  const pw = 820 * u;\n  const gap = ph + 20 * u;\n  const cy = tall ? 0.4 * H : 0.46 * H;\n\n  const sp = (from: number, config: Partial<typeof CARD>, dur?: number) =>\n    spring({\n      frame: t - from,\n      fps,\n      config,\n      durationInFrames: dur,\n    });\n\n  const kf =\n    1 + starts.slice(1).reduce((a, s) => a + sp(s - BEATS.shiftLead, CARD), 0);\n  const posterAt = lastStart + BEATS.poster;\n  const poster = sp(posterAt, HEAVY);\n  const stackK = interpolate(kf, [1, 2, 3], [1.26, 1.1, 1], CLAMP);\n  const groupK = stackK * interpolate(poster, [0, 1], [1, tall ? 1.04 : 1.12]);\n  const logoP = interpolate(\n    t,\n    [posterAt + BEATS.logo, posterAt + BEATS.logo + 14],\n    [0, 1],\n    { ...CLAMP, easing: ENTER },\n  );\n\n  const total = list.reduce(\n    (a, item, i) =>\n      a +\n      item.points *\n        interpolate(t, [starts[i] + 10, starts[i] + 22], [0, 1], {\n          ...CLAMP,\n          easing: ENTER,\n        }),\n    0,\n  );\n  const totalIn = interpolate(t, [starts[0] + 8, starts[0] + 22], [0, 1], {\n    ...CLAMP,\n    easing: ENTER,\n  });\n\n  return (\n    <AbsoluteFill style={{ background: c.base, overflow: \"hidden\" }}>\n      <GshGround\n        preset={resolvedGround}\n        params={resolvedParams}\n        timeOffset={dark ? 5 : 3}\n        timeScale={0.45}\n      />\n      <AbsoluteFill style={{ background: c.scrim }} />\n\n      <div\n        style={{\n          position: \"absolute\",\n          inset: 0,\n          transform: `scale(${groupK})`,\n          transformOrigin: `50% ${(cy / H) * 100}%`,\n        }}\n      >\n        {list.map((a, i) => {\n          const s = starts[i];\n          if (t < s) return null;\n          const rare = i === n - 1 && n > 1;\n          const y = cy + (i - (kf - 1) / 2) * gap;\n          const pop = sp(s, CHIP);\n          const badgeK = 0.5 + 0.5 * pop;\n          const open = sp(s + BEATS.open, MORPH, 16);\n          const pillW = D + (pw - D) * open;\n          const left = W / 2 - pillW / 2;\n          const textP = interpolate(\n            t,\n            [s + BEATS.open + 4, s + BEATS.open + 16],\n            [0, 1],\n            { ...CLAMP, easing: ENTER },\n          );\n          const ptsP = interpolate(\n            t,\n            [s + BEATS.open + 8, s + BEATS.open + 20],\n            [0, 1],\n            { ...CLAMP, easing: ENTER },\n          );\n          const flashP = interpolate(t, [s + 2, s + 16], [0, 1], {\n            ...CLAMP,\n            easing: ENTER,\n          });\n          const sheen = interpolate(\n            t,\n            [s + BEATS.open + 14, s + BEATS.open + 32],\n            [0, 1],\n            { ...CLAMP, easing: Easing.bezier(0.65, 0, 0.35, 1) },\n          );\n          const ink = rare ? \"#FFF4E8\" : c.ink;\n          const dim = rare ? \"rgba(255,233,199,0.72)\" : c.dim;\n          const bx = left + D / 2;\n          const R = D / 2;\n          const appear = interpolate(t, [s, s + 3], [0, 1], CLAMP);\n          return (\n            <div key={`${a.title}-${s}`}>\n              <div\n                style={{\n                  position: \"absolute\",\n                  left,\n                  top: y - ph / 2,\n                  width: pillW,\n                  height: ph,\n                  borderRadius: ph / 2,\n                  overflow: \"hidden\",\n                  background: rare ? RARE_FILL : c.pill,\n                  boxShadow: rare\n                    ? `inset 0 1px 0 rgba(255,233,199,0.28), 0 0 0 1px rgba(255,154,58,0.28), 0 22px 48px -14px rgba(120,24,4,${dark ? 0.8 : 0.45})`\n                    : c.depth,\n                  opacity: appear,\n                }}\n              >\n                {rare && sheen > 0 && sheen < 1 ? (\n                  <div\n                    style={{\n                      position: \"absolute\",\n                      top: 0,\n                      bottom: 0,\n                      width: 160 * u,\n                      left: interpolate(sheen, [0, 1], [-200 * u, pw + 40 * u]),\n                      background:\n                        \"linear-gradient(100deg, transparent 0%, rgba(255,233,199,0.32) 50%, transparent 100%)\",\n                      transform: \"skewX(-20deg)\",\n                    }}\n                  />\n                ) : null}\n                <div\n                  style={{\n                    position: \"absolute\",\n                    left: D + 22 * u,\n                    top: 0,\n                    bottom: 0,\n                    display: \"flex\",\n                    flexDirection: \"column\",\n                    justifyContent: \"center\",\n                    gap: 10 * u,\n                    opacity: textP,\n                    transform: `translateX(${(1 - textP) * -24 * u}px)`,\n                    whiteSpace: \"nowrap\",\n                  }}\n                >\n                  <div\n                    style={{\n                      fontFamily: mono,\n                      fontWeight: 400,\n                      fontSize: 17 * u,\n                      lineHeight: 1,\n                      letterSpacing: \"0.04em\",\n                      textTransform: \"uppercase\",\n                      color: dim,\n                    }}\n                  >\n                    {a.label}\n                  </div>\n                  <div\n                    style={{\n                      fontFamily: geist,\n                      fontWeight: 400,\n                      fontSize: 40 * u,\n                      lineHeight: 1,\n                      letterSpacing: \"-0.03em\",\n                      color: ink,\n                    }}\n                  >\n                    {a.title}\n                  </div>\n                </div>\n                <div\n                  style={{\n                    position: \"absolute\",\n                    left: pw - 220 * u,\n                    width: 180 * u,\n                    top: 0,\n                    bottom: 0,\n                    display: \"flex\",\n                    alignItems: \"center\",\n                    justifyContent: \"flex-end\",\n                    gap: 8 * u,\n                    opacity: ptsP,\n                    transform: `translateX(${(1 - ptsP) * -16 * u}px)`,\n                    whiteSpace: \"nowrap\",\n                  }}\n                >\n                  <span\n                    style={{\n                      fontFamily: geist,\n                      fontWeight: 300,\n                      fontSize: 40 * u,\n                      lineHeight: 1,\n                      letterSpacing: \"-0.03em\",\n                      fontVariantNumeric: \"tabular-nums\",\n                      color: ink,\n                    }}\n                  >\n                    +{a.points}\n                  </span>\n                  <span\n                    style={{\n                      fontFamily: mono,\n                      fontWeight: 400,\n                      fontSize: 17 * u,\n                      letterSpacing: \"0.04em\",\n                      color: dim,\n                      transform: `translateY(${4 * u}px)`,\n                    }}\n                  >\n                    XP\n                  </span>\n                </div>\n              </div>\n\n              {flashP > 0 && flashP < 1 ? (\n                <svg\n                  width={W}\n                  height={H}\n                  style={{\n                    position: \"absolute\",\n                    inset: 0,\n                    overflow: \"visible\",\n                  }}\n                  aria-hidden\n                >\n                  <circle\n                    cx={bx}\n                    cy={y}\n                    r={R * interpolate(flashP, [0, 1], [0.9, 1.7])}\n                    fill=\"none\"\n                    stroke={rare ? KILN[2] : c.flash}\n                    strokeWidth={interpolate(flashP, [0, 1], [5, 0.5]) * u}\n                    opacity={(1 - flashP) * 0.9}\n                  />\n                </svg>\n              ) : null}\n\n              <div\n                style={{\n                  position: \"absolute\",\n                  left: bx - R,\n                  top: y - R,\n                  width: D,\n                  height: D,\n                  transform: `scale(${badgeK})`,\n                  opacity: appear,\n                }}\n              >\n                <div\n                  style={{\n                    position: \"absolute\",\n                    inset: 10 * u,\n                    borderRadius: \"50%\",\n                    background: rare ? \"rgba(255,233,199,0.12)\" : c.badge,\n                    boxShadow: rare\n                      ? \"inset 0 0 0 1px rgba(255,233,199,0.45)\"\n                      : `inset 0 0 0 1px ${c.ring}`,\n                    display: \"flex\",\n                    alignItems: \"center\",\n                    justifyContent: \"center\",\n                  }}\n                >\n                  <Icon name={a.icon ?? \"trophy\"} size={40 * u} color={ink} />\n                </div>\n              </div>\n            </div>\n          );\n        })}\n      </div>\n\n      {tall ? (\n        <div\n          style={{\n            position: \"absolute\",\n            left: 0,\n            right: 0,\n            top: 0.66 * H,\n            display: \"flex\",\n            flexDirection: \"column\",\n            alignItems: \"center\",\n            gap: 18 * u,\n            opacity: totalIn,\n            transform: `translateY(${(1 - totalIn) * 24 * u}px)`,\n          }}\n        >\n          <div\n            style={{\n              fontFamily: mono,\n              fontWeight: 400,\n              fontSize: 20 * u,\n              letterSpacing: \"0.06em\",\n              textTransform: \"uppercase\",\n              color: c.dim,\n            }}\n          >\n            Launch week\n          </div>\n          <div\n            style={{\n              fontFamily: geist,\n              fontWeight: 300,\n              fontSize: 170 * u,\n              lineHeight: 1,\n              letterSpacing: \"-0.05em\",\n              fontVariantNumeric: \"tabular-nums\",\n              color: c.ink,\n            }}\n          >\n            {Math.round(total)}\n            <span\n              style={{ fontSize: 56 * u, letterSpacing: \"0\", color: c.dim }}\n            >\n              {\" \"}\n              XP\n            </span>\n          </div>\n        </div>\n      ) : null}\n\n      <div\n        style={{\n          position: \"absolute\",\n          left: 0,\n          width: W,\n          top: tall ? 0.88 * H : 0.885 * H,\n          display: \"flex\",\n          justifyContent: \"center\",\n          opacity: logoP,\n          transform: `translateY(${(1 - logoP) * 14 * u}px)`,\n        }}\n      >\n        <RemocnLogo fontSize={30 * u} color={c.logo} />\n      </div>\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/achievement-pop.tsx"
    }
  ],
  "type": "registry:component"
}
