{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "giant-mark-backdrop",
  "title": "Giant Mark Backdrop",
  "description": "A huge wordmark scrolls behind a floating prompt card on a warm paper ground.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "registryDependencies": ["@remocn/gsh"],
  "files": [
    {
      "path": "registry/remocn/giant-mark-backdrop/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont as loadInstrument } from \"@remotion/google-fonts/InstrumentSans\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n  AbsoluteFill,\n  continueRender,\n  delayRender,\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 manrope = loadManrope(\"normal\", {\n  weights: [\"600\"],\n  subsets: [\"latin\"],\n});\nconst instrument = loadInstrument(\"normal\", {\n  weights: [\"400\"],\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\nconst R_W = 124.06;\nconst R_H = 134.26;\nconst EM = 100;\nconst R_WE = (0.76 * R_W) / R_H;\nconst GAP_E = 0.04;\nconst TRACK = -0.025;\nconst WORD = \"emocn\";\n\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\nconst FLOOD = Easing.bezier(0.83, 0, 0.17, 1);\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst BALLOON = { mass: 1, damping: 20, stiffness: 110 };\n\nconst B = {\n  mark: -3,\n  type: 6,\n  typeStep: 3,\n  flood: 40,\n  floodLen: 16,\n  balloon: 42,\n  card: 54,\n  prompt: 66,\n  promptEnd: 94,\n  send: 100,\n  end: 126,\n};\n\nexport const GIANT_MARK_BACKDROP_DURATION = B.end;\n\nconst mix = (a: number, b: number, t: number) => a + (b - a) * t;\n\nfunction useWordWidth() {\n  const [version, setVersion] = useState(0);\n  const [handle] = useState(() =>\n    delayRender(\"giant-mark-backdrop: measuring\"),\n  );\n  const released = useRef(false);\n  useEffect(() => {\n    let live = true;\n    const bump = () => {\n      if (live) setVersion((v) => v + 1);\n    };\n    document.fonts.addEventListener(\"loadingdone\", bump);\n    Promise.all([\n      manrope.waitUntilDone(),\n      instrument.waitUntilDone(),\n      document.fonts.load(`600 ${EM}px \"${manrope.fontFamily}\"`),\n    ])\n      .catch(() => undefined)\n      .then(() => {\n        bump();\n        if (!released.current) {\n          released.current = true;\n          continueRender(handle);\n        }\n      });\n    return () => {\n      live = false;\n      document.fonts.removeEventListener(\"loadingdone\", bump);\n    };\n  }, [handle]);\n  return useMemo(() => measureWord(version), [version]);\n}\n\nfunction measureWord(_version: number) {\n  const ctx = document.createElement(\"canvas\").getContext(\"2d\");\n  if (!ctx) return 2.95;\n  ctx.font = `600 ${EM}px \"${manrope.fontFamily}\"`;\n  return ctx.measureText(WORD).width / EM + TRACK * WORD.length;\n}\n\ntype Palette = {\n  mark: string;\n  word: string;\n  floodBg: string;\n  giant: string;\n  giantMark: string;\n  grain: number;\n  panel: string;\n  ink: string;\n  muted: string;\n  faint: string;\n  hairline: string;\n  highlight: string;\n  row: string;\n  shadow: string;\n  send: string;\n  accent: string;\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n  backdrop: string;\n};\n\nconst THEMES: Record<\"dark\" | \"light\", Palette> = {\n  dark: {\n    mark: \"#4a6bff\",\n    word: \"#f3f4f8\",\n    floodBg: \"#f1ece3\",\n    giant: \"#3b5bfd\",\n    giantMark: \"#3b5bfd\",\n    grain: 0.07,\n    panel: \"#ffffff\",\n    ink: \"#15161c\",\n    muted: \"rgba(21,22,28,0.56)\",\n    faint: \"rgba(21,22,28,0.34)\",\n    hairline: \"rgba(20,22,40,0.09)\",\n    highlight: \"inset 0 1px 0 rgba(255,255,255,1)\",\n    row: \"rgba(24,28,52,0.05)\",\n    shadow: \"54,44,30\",\n    send: \"#15161c\",\n    accent: \"#3b5bfd\",\n    ground: \"velvet-hour\",\n    groundParams: undefined,\n    backdrop: \"#03040b\",\n  },\n  light: {\n    mark: \"#2f4ff0\",\n    word: \"#14161d\",\n    floodBg: \"#2a47ea\",\n    giant: \"#f2eee6\",\n    giantMark: \"#f2eee6\",\n    grain: 0.09,\n    panel: \"#ffffff\",\n    ink: \"#15161c\",\n    muted: \"rgba(21,22,28,0.56)\",\n    faint: \"rgba(21,22,28,0.34)\",\n    hairline: \"rgba(20,22,40,0.08)\",\n    highlight: \"inset 0 1px 0 rgba(255,255,255,1)\",\n    row: \"rgba(24,28,52,0.05)\",\n    shadow: \"8,16,70\",\n    send: \"#15161c\",\n    accent: \"#2f4ff0\",\n    ground: \"glasswork\",\n    groundParams: undefined,\n    backdrop: \"#f3f2ef\",\n  },\n};\n\nfunction Icon({ d, size, color }: { d: string; size: number; color: string }) {\n  return (\n    <svg viewBox=\"0 0 24 24\" width={size} height={size} aria-hidden>\n      <path\n        d={d}\n        fill=\"none\"\n        stroke={color}\n        strokeWidth=\"1.5\"\n        strokeLinecap=\"round\"\n        strokeLinejoin=\"round\"\n      />\n    </svg>\n  );\n}\n\nconst ICONS = {\n  plus: \"M12 5v14M5 12h14\",\n  clip: \"M15.5 7.5l-6.4 6.4a2 2 0 002.8 2.8l7-7a4 4 0 00-5.6-5.6l-7 7a6 6 0 008.5 8.5l5.2-5.2\",\n  styles:\n    \"M12 4a8 8 0 100 16c1.1 0 1.6-.8 1.3-1.7-.4-1.1.3-2.3 1.5-2.3H17a3 3 0 003-3c0-5-3.6-9-8-9zM7.5 12.5h.01M9.5 8h.01M14.5 8h.01\",\n  mic: \"M12 4a2.5 2.5 0 012.5 2.5v5a2.5 2.5 0 01-5 0v-5A2.5 2.5 0 0112 4zM6.5 11a5.5 5.5 0 0011 0M12 16.5V20\",\n  send: \"M12 19V5M6 11l6-6 6 6\",\n};\n\nfunction Wordmark({\n  word,\n  frame,\n  typed,\n}: {\n  word: string;\n  frame: number;\n  typed: boolean;\n}) {\n  const chars = Array.from(WORD);\n  return (\n    <text\n      x={(R_WE + GAP_E) * EM}\n      y={0}\n      fill={word}\n      style={{\n        fontFamily: manrope.fontFamily,\n        fontWeight: 600,\n        fontSize: EM,\n        letterSpacing: `${TRACK}em`,\n      }}\n    >\n      {chars.map((c, i) => {\n        const t = typed\n          ? 1\n          : interpolate(\n              frame,\n              [B.type + i * B.typeStep, B.type + i * B.typeStep + 3],\n              [0, 1],\n              CLAMP,\n            );\n        return (\n          <tspan key={`${c}-${i.toString()}`} fillOpacity={t}>\n            {c}\n          </tspan>\n        );\n      })}\n    </text>\n  );\n}\n\nexport interface GiantMarkBackdropProps {\n  theme?: \"dark\" | \"light\";\n  accent?: string;\n  prompt?: string;\n  placeholder?: string;\n  ground?: GshPresetId;\n  groundParams?: Partial<GradientParams>;\n}\n\nexport function GiantMarkBackdrop({\n  theme = \"dark\",\n  accent,\n  prompt = \"Make a launch film for our v2 release\",\n  placeholder = \"Describe your launch film\",\n  ground,\n  groundParams,\n}: GiantMarkBackdropProps) {\n  const frame = useCurrentFrame();\n  const { width: W, height: H, fps } = useVideoConfig();\n  const base = THEMES[theme];\n  const c = accent ? { ...base, accent, mark: accent } : base;\n  const tall = H > W * 1.1;\n  const u = tall ? W / 600 : H / 720;\n  const wordW = useWordWidth();\n  const TW = R_WE + GAP_E + wordW;\n\n  const F0 = tall ? W * 0.2 : W * 0.112;\n  const F1 = tall ? W * 1.12 : W / 1.75;\n  const a0 = { x: TW / 2, y: -0.38 };\n  const a1 = { x: R_WE + GAP_E + wordW * 0.43, y: -0.265 };\n  const s0 = { x: W / 2, y: H / 2 };\n  const s1 = { x: tall ? W * 0.5 : W / 2, y: tall ? H * 0.5 : H * 0.36 };\n\n  const markIn = spring({ frame: frame - B.mark, fps, config: CHIP });\n  const balloon = spring({ frame: frame - B.balloon, fps, config: BALLOON });\n  const pushA = interpolate(frame, [0, B.balloon], [1, 1.04], CLAMP);\n  const pushB = interpolate(frame, [B.balloon + 12, B.end], [1, 1.07], {\n    ...CLAMP,\n    easing: Easing.bezier(0.33, 0, 0.4, 1),\n  });\n  const F = F0 * (F1 / F0) ** balloon * mix(pushA, 1, balloon) * pushB;\n  const ax = mix(a0.x, a1.x, balloon);\n  const ay = mix(a0.y, a1.y, balloon);\n  const sx = mix(s0.x, s1.x, balloon);\n  const sy = mix(s0.y, s1.y, balloon);\n  const markScale = 0.78 + 0.22 * markIn;\n  const k = F / EM;\n  const rot = tall ? -90 * balloon : 0;\n  const logoTransform = `translate(${sx.toFixed(2)} ${sy.toFixed(2)}) rotate(${rot.toFixed(3)}) scale(${k.toFixed(5)}) translate(${(-ax * EM).toFixed(3)} ${(-ay * EM).toFixed(3)})`;\n  const markTransform = `translate(${(R_WE * EM) / 2} ${-0.38 * EM}) scale(${markScale.toFixed(4)}) translate(${(-R_WE * EM) / 2} ${0.38 * EM})`;\n\n  const flood = interpolate(frame, [B.flood, B.flood + B.floodLen], [0, 1], {\n    ...CLAMP,\n    easing: FLOOD,\n  });\n  const fcx = W * 0.5;\n  const fcy = H * 1.2;\n  const reach = Math.hypot(W * 0.5, fcy) * 1.02;\n  const fr = mix(H * 0.2, reach, flood);\n  const clip = `circle(${fr.toFixed(2)}px at ${fcx.toFixed(2)}px ${fcy.toFixed(2)}px)`;\n\n  const card = spring({ frame: frame - B.card, fps, config: CARD });\n  const typedN = Math.floor(\n    interpolate(frame, [B.prompt, B.promptEnd], [0, prompt.length], CLAMP),\n  );\n  const done = typedN >= prompt.length;\n  const caretOn = !done || Math.floor((frame - B.promptEnd) / 8) % 2 === 0;\n  const send = spring({ frame: frame - B.send, fps, config: CHIP });\n  const sendOn = frame >= B.send;\n  const cardW = tall ? W * 0.88 : W * 0.56;\n  const cardH = tall ? H * 0.16 : H * 0.29;\n  const cardX = (W - cardW) / 2;\n  const cardY = tall ? H * 0.53 : H * 0.49;\n  const cardPush = pushB;\n  const fs = (tall ? 27 : 24) * u;\n  const small = (tall ? 21 : 17) * u;\n  const br = 20 * u;\n  const pad = 18 * u;\n\n  const svgLogo = (mark: string, word: string, typed: boolean, id: string) => (\n    <svg\n      width={W}\n      height={H}\n      style={{ position: \"absolute\", left: 0, top: 0 }}\n      aria-hidden\n      key={id}\n    >\n      <g transform={logoTransform}>\n        <g\n          transform={markTransform}\n          opacity={interpolate(markIn, [0, 0.3], [0, 1], CLAMP)}\n        >\n          <path\n            d={REMOCN_R_PATH}\n            fill={mark}\n            transform={`translate(0 ${-0.76 * EM}) scale(${(0.76 * EM) / R_H})`}\n          />\n        </g>\n        <Wordmark word={word} frame={frame} typed={typed} />\n      </g>\n    </svg>\n  );\n\n  return (\n    <AbsoluteFill style={{ backgroundColor: c.backdrop, overflow: \"hidden\" }}>\n      {flood < 1 ? (\n        <AbsoluteFill>\n          <GshGround\n            preset={ground ?? (groundParams ? undefined : c.ground)}\n            params={groundParams ?? (ground ? undefined : c.groundParams)}\n            timeOffset={5}\n            timeScale={0.7}\n          />\n          {svgLogo(c.mark, c.word, false, \"outer\")}\n        </AbsoluteFill>\n      ) : null}\n      <AbsoluteFill\n        style={{\n          clipPath: flood > 0 ? clip : \"circle(0px at 50% 120%)\",\n          WebkitClipPath: flood > 0 ? clip : \"circle(0px at 50% 120%)\",\n          backgroundColor: c.floodBg,\n        }}\n      >\n        {svgLogo(c.giantMark, c.giant, false, \"inner\")}\n        <svg\n          width={W}\n          height={H}\n          style={{ position: \"absolute\", left: 0, top: 0, opacity: c.grain }}\n          aria-hidden\n        >\n          <filter id=\"giant-mark-grain\">\n            <feTurbulence\n              type=\"fractalNoise\"\n              baseFrequency=\"0.9\"\n              numOctaves={2}\n              seed={3}\n            />\n            <feColorMatrix type=\"saturate\" values=\"0\" />\n          </filter>\n          <rect width={W} height={H} filter=\"url(#giant-mark-grain)\" />\n        </svg>\n      </AbsoluteFill>\n      <div\n        style={{\n          position: \"absolute\",\n          left: cardX,\n          top: cardY,\n          width: cardW,\n          height: cardH,\n          borderRadius: 22 * u,\n          backgroundColor: c.panel,\n          boxShadow: `inset 0 0 0 1px ${c.hairline}, ${c.highlight}, 0 2px 4px rgba(${c.shadow},0.1), 0 18px 40px rgba(${c.shadow},0.18), 0 50px 110px rgba(${c.shadow},0.26)`,\n          fontFamily: instrument.fontFamily,\n          color: c.ink,\n          opacity: interpolate(card, [0, 0.25], [0, 1], CLAMP),\n          transformOrigin: `${W / 2 - cardX}px ${s1.y - cardY}px`,\n          transform: `translateY(${((1 - card) * H * 0.32).toFixed(2)}px) scale(${cardPush.toFixed(4)})`,\n        }}\n      >\n        <div\n          style={{\n            position: \"absolute\",\n            left: pad + 4 * u,\n            right: pad + 4 * u,\n            top: pad + 2 * u,\n            fontSize: fs,\n            fontWeight: 400,\n            letterSpacing: \"-0.01em\",\n            lineHeight: 1.32,\n            color: typedN > 0 ? c.ink : c.faint,\n          }}\n        >\n          {typedN > 0 ? prompt.slice(0, typedN) : placeholder}\n          <span\n            style={{\n              display: \"inline-block\",\n              width: Math.max(2, 2 * u),\n              height: fs * 1.05,\n              marginLeft: 2 * u,\n              verticalAlign: \"-0.18em\",\n              backgroundColor: c.accent,\n              opacity: caretOn ? 1 : 0,\n            }}\n          />\n        </div>\n        <div\n          style={{\n            position: \"absolute\",\n            left: pad,\n            right: pad,\n            bottom: pad,\n            height: br * 2,\n            display: \"flex\",\n            alignItems: \"center\",\n            gap: 8 * u,\n            fontSize: small,\n            color: c.muted,\n          }}\n        >\n          <div\n            style={{\n              width: 36 * u,\n              height: 36 * u,\n              borderRadius: 99,\n              boxShadow: `inset 0 0 0 1px ${c.hairline}`,\n              display: \"flex\",\n              alignItems: \"center\",\n              justifyContent: \"center\",\n            }}\n          >\n            <Icon d={ICONS.plus} size={17 * u} color={c.muted} />\n          </div>\n          {[\n            { label: \"Attach\", icon: ICONS.clip },\n            { label: \"Styles\", icon: ICONS.styles },\n          ].map((chip) => (\n            <div\n              key={chip.label}\n              style={{\n                display: \"flex\",\n                alignItems: \"center\",\n                gap: 6 * u,\n                padding: `${7 * u}px ${12 * u}px`,\n                borderRadius: 99,\n                boxShadow: `inset 0 0 0 1px ${c.hairline}`,\n              }}\n            >\n              <Icon d={chip.icon} size={15 * u} color={c.muted} />\n              {chip.label}\n            </div>\n          ))}\n          <div style={{ flex: 1 }} />\n          <Icon d={ICONS.mic} size={19 * u} color={c.muted} />\n          <div\n            style={{\n              width: br * 2,\n              height: br * 2,\n              borderRadius: 99,\n              backgroundColor: sendOn ? c.accent : done ? c.send : c.row,\n              display: \"flex\",\n              alignItems: \"center\",\n              justifyContent: \"center\",\n              transform: `scale(${(1 + 0.14 * Math.sin(Math.min(1, send) * Math.PI)).toFixed(4)})`,\n              boxShadow: done\n                ? \"inset 0 1px 0 rgba(255,255,255,0.22)\"\n                : `inset 0 0 0 1px ${c.hairline}`,\n            }}\n          >\n            <Icon\n              d={ICONS.send}\n              size={18 * u}\n              color={done ? \"#ffffff\" : c.faint}\n            />\n          </div>\n        </div>\n      </div>\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/giant-mark-backdrop.tsx"
    }
  ],
  "type": "registry:component"
}
