{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "poster-crop",
  "title": "Poster Crop",
  "description": "A poster headline crops in tight, line by line, over a ruled blue ground.",
  "dependencies": ["remotion", "@remotion/google-fonts"],
  "files": [
    {
      "path": "registry/remocn/poster-crop/index.tsx",
      "content": "\"use client\";\n\nimport { loadFont as loadBricolage } from \"@remotion/google-fonts/BricolageGrotesque\";\nimport { loadFont as loadMono } from \"@remotion/google-fonts/GeistMono\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type React from \"react\";\nimport { useId } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: display } = loadBricolage(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\nconst { fontFamily: mono } = loadMono(\"normal\", {\n  weights: [\"400\", \"500\"],\n  subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"600\"],\n  subsets: [\"latin\"],\n});\n\nexport interface PosterCropProps {\n  title?: string;\n  kicker?: string;\n  meta?: string;\n  note?: string;\n  logo?: React.ReactNode;\n  accent?: string;\n  theme?: \"dark\" | \"light\";\n  speed?: number;\n}\n\nconst PULL_START = 8;\nconst PULL_END = 104;\n\n/** Bricolage Grotesque 500 advance widths (per 1000 em) for ASCII 32–126. */\nconst BRICOLAGE_500 = [\n  246, 266, 317, 613, 630, 947, 756, 159, 305, 290, 395, 516, 165, 339, 196,\n  354, 656, 320, 583, 595, 595, 600, 646, 494, 646, 641, 207, 188, 516, 516,\n  516, 413, 952, 671, 666, 671, 691, 599, 578, 706, 709, 275, 358, 666, 508,\n  909, 747, 716, 629, 719, 660, 641, 553, 718, 657, 957, 653, 600, 560, 315,\n  342, 300, 547, 578, 283, 567, 618, 555, 617, 570, 380, 589, 608, 260, 266,\n  561, 257, 913, 608, 604, 618, 617, 411, 535, 380, 599, 547, 827, 534, 591,\n  500, 353, 260, 331, 516,\n];\n/** Bricolage Grotesque 500 GPOS kerning (|k| ≥ 30/1000), \"pairValue\". */\nconst KERN_PAIRS = [\n  \"AT-67 AV-83 AW-53 AY-78 Av-52 Aw-37 DX-40 DY-32 EJ32 FA-46 FJ-41 FT40 FY31\",\n  \"Fa-30 F.-59 F,-57 LJ57 LT-74 LV-74 LW-45 LY-87 LZ41 Lv-52 Lw-33 L.42 L,50\",\n  \"OX-38 OY-31 PA-43 PJ-48 P.-60 P,-66 QY-31 Qj40 TA-67 TJ-47 TT44 TW31 TY33\",\n  \"Ta-67 Tc-71 Td-62 Te-71 Tg-67 Tm-30 Tn-30 To-71 Tp-30 Tq-62 Tr-30 Ts-61\",\n  \"T.-62 T,-60 VA-83 VJ-47 VW31 Va-44 Vc-46 Vd-42 Ve-46 Vg-41 Vo-45 Vq-42\",\n  \"Vs-30 V.-60 V,-57 WA-55 WJ-40 WT31 WV31 WW30 W.-39 W,-43 XC-38 XG-39 XO-39\",\n  \"Xc-31 Xe-31 Xo-32 YA-78 YC-33 YG-32 YJ-46 YO-32 YQ-32 YT33 YY38 Ya-62\",\n  \"Yc-62 Yd-57 Ye-62 Yg-55 Ym-33 Yn-33 Yo-61 Yp-33 Yq-57 Yr-33 Ys-45 Yy-31\",\n  \"Y.-75 Y,-72 ZJ40 ZZ31 Z.30 Z,32 aT-62 aV-48 aW-33 aY-60 bT-63 bV-42 bY-59\",\n  \"cT-54 cV-30 cY-45 eT-65 eV-43 eY-57 fA-37 fJ-34 fY32 f.-33 f,-35 gj31 g,48\",\n  \"hT-62 hV-48 hW-31 hY-60 mT-62 mV-48 mW-31 mY-60 nT-62 nV-48 nW-31 nY-60\",\n  \"oT-73 oV-45 oX-33 oY-62 pT-63 pV-42 pY-59 qT-30 qY-33 rA-56 rJ-52 rw30\",\n  \"r.-68 r,-66 sT-58 sV-36 sY-50 t.32 t,32 uT-30 uY-33 vA-52 vJ-44 vw30 v.-41\",\n  \"v,-45 wA-37 wv30 yY-32 .J45 .T-62 .V-60 .W-37 .Y-76 .Z38 .v-40 .z30\",\n].join(\" \");\nconst KERN = new Map(\n  KERN_PAIRS.split(\" \").map((p) => [p.slice(0, 2), Number(p.slice(2)) / 1000]),\n);\nconst TRACK = -0.04;\nconst CAP = 0.66;\nconst BASELINE = 0.83;\nconst LEADING = 0.88;\n\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\ntype Blob = readonly [x: number, y: number, color: string];\n\nconst THEMES = {\n  // gradients.sh \"mesh\": the title is filled with the mesh, stage takes its navy ground.\n  dark: {\n    bg: \"#0A0D24\",\n    key: \"rgba(135,150,238,0.10)\",\n    fg: \"#F1EEF6\",\n    muted: \"#8E93B5\",\n    hair: \"rgba(236,220,242,0.13)\",\n    grain: 0.07,\n    base: \"linear-gradient(165deg, #ECDCF2 0%, #B9B6F0 55%, #8796EE 100%)\",\n    blobs: [\n      [16, 20, \"#ECDCF2\"],\n      [84, 26, \"#8796EE\"],\n      [72, 86, \"#4A5FD0\"],\n      [22, 80, \"#8796EE\"],\n      [52, 48, \"#ECDCF2\"],\n      [92, 62, \"#2E45B7\"],\n    ] as readonly Blob[],\n  },\n  // gradients.sh \"smear\" (light): warm paper ground, the title smeared in ink colours.\n  light: {\n    bg: \"#EFE8DC\",\n    key: \"rgba(255,255,255,0.55)\",\n    fg: \"#1A1714\",\n    muted: \"#7A7166\",\n    hair: \"rgba(26,23,20,0.13)\",\n    grain: 0.05,\n    base: \"linear-gradient(165deg, #F2552C 0%, #E0503A 50%, #C24A5A 100%)\",\n    blobs: [\n      [16, 20, \"#F2552C\"],\n      [84, 26, \"#E889B5\"],\n      [72, 86, \"#E889B5\"],\n      [22, 80, \"#D9462A\"],\n      [52, 48, \"#F7A23B\"],\n      [92, 62, \"#2F6B3F\"],\n    ] as readonly Blob[],\n  },\n} as const;\n\nfunction meshFill(blobs: readonly Blob[], base: string, drift: number) {\n  const layers = blobs.map(([x, y, col], k) => {\n    const a = k * 1.7 + drift * 2.2;\n    const bx = x + Math.cos(a) * 3 * drift;\n    const by = y + Math.sin(a) * 4 * drift;\n    return `radial-gradient(70% 95% at ${bx.toFixed(2)}% ${by.toFixed(2)}%, ${col} 0%, transparent 68%)`;\n  });\n  return [...layers, base].join(\", \");\n}\n\nfunction em(text: string) {\n  let w = 0;\n  let prev = \"\";\n  for (const ch of text) {\n    w += KERN.get(prev + ch) ?? 0;\n    prev = ch;\n    const code = ch.charCodeAt(0);\n    w += (code >= 32 && code < 127 ? BRICOLAGE_500[code - 32] : 600) / 1000;\n    w += TRACK;\n  }\n  return w;\n}\n\nfunction splitLines(title: string) {\n  if (title.includes(\"\\n\")) return title.split(\"\\n\").map((l) => l.trim());\n  const words = title.trim().split(/\\s+/);\n  if (words.length < 2) return [title.trim()];\n  let best = [title.trim()];\n  let bestW = Number.POSITIVE_INFINITY;\n  for (let i = 1; i < words.length; i++) {\n    const a = words.slice(0, i).join(\" \");\n    const b = words.slice(i).join(\" \");\n    const w = Math.max(em(a), em(b));\n    if (w < bestW) {\n      bestW = w;\n      best = [a, b];\n    }\n  }\n  return best;\n}\n\nfunction Grain({ opacity }: { opacity: 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, pointerEvents: \"none\" }}\n      aria-hidden\n    >\n      <filter id={id}>\n        <feTurbulence\n          type=\"fractalNoise\"\n          baseFrequency=\"0.9\"\n          numOctaves={2}\n          seed={11}\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\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\n/** Full logo as on remocn.dev: R mark (0.76em tall, baseline-aligned) + \"emocn\" in Manrope 600, tracking-tight. */\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        textTransform: \"none\",\n        whiteSpace: \"nowrap\",\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\nfunction Line({\n  text,\n  accent,\n}: {\n  text: string;\n  accent: string;\n}): React.ReactNode {\n  const m = /^(.*?)([.!?])$/.exec(text);\n  if (!m) return text;\n  return (\n    <>\n      {m[1]}\n      <span style={{ color: accent }}>{m[2]}</span>\n    </>\n  );\n}\n\nexport function PosterCrop({\n  title = \"Launch films,\\nas code.\",\n  kicker = \"remocn 3.0\",\n  meta = \"Oct 24, 2026\",\n  note = \"Production-ready motion for launch videos. Install a component, drop in your words, render.\",\n  logo,\n  accent = \"#3B5BFD\",\n  theme = \"dark\",\n  speed = 1,\n}: PosterCropProps) {\n  const t = useCurrentFrame() * speed;\n  const { width: W, height: H } = useVideoConfig();\n  const u = H / 720;\n  const c = THEMES[theme];\n\n  const margin = 40 * u;\n  const header = margin + 30 * u;\n  const contentW = W - margin * 2;\n  const lines = splitLines(title);\n  const widest = Math.max(...lines.map(em));\n  const maxBlockH = H - header - margin - 40 * u;\n  const F = Math.min(\n    contentW / (widest + 0.03),\n    maxBlockH / (CAP + LEADING * (lines.length - 1) + 0.06),\n  );\n  const lastBaseline = H - margin - 0.05 * F;\n  const baselines = lines.map(\n    (_, i) => lastBaseline - (lines.length - 1 - i) * LEADING * F,\n  );\n\n  const firstChar = em(lines[0].slice(0, 1));\n  const focus = {\n    x: margin + (firstChar + 0.06) * F,\n    y: baselines[0] - CAP * 0.26 * F,\n  };\n  const s0 = (2.3 * H) / (CAP * F);\n  const pivot = {\n    x: (W / 2 - focus.x * s0) / (1 - s0),\n    y: (H / 2 - focus.y * s0) / (1 - s0),\n  };\n\n  const pull = interpolate(t, [PULL_START, PULL_END], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const push = interpolate(t, [PULL_END, PULL_END + 60], [0, 1], CLAMP);\n  const s = Math.exp(Math.log(s0) * (1 - pull)) * (1 + push * 0.012);\n  const drift = interpolate(t, [0, PULL_START + 30], [1, 0], {\n    ...CLAMP,\n    easing: Easing.bezier(0.33, 0, 0.67, 1),\n  });\n  const dx = drift * 70 * u;\n  const dy = drift * -14 * u;\n  const sx = (x: number) => pivot.x + (x - pivot.x) * s + dx;\n  const sy = (y: number) => pivot.y + (y - pivot.y) * s + dy;\n\n  const hair = Math.max(1, u);\n  const grid = (d: number) =>\n    interpolate(t, [44 + d, 92 + d], [0, 1], { ...CLAMP, easing: EASE_IO });\n  const label = (d: number) =>\n    interpolate(t, [80 + d, 104 + d], [0, 1], { ...CLAMP, easing: EASE_OUT });\n  const columns = 6;\n\n  const blockLeft = margin - 0.03 * F;\n  const blockTop = baselines[0] - BASELINE * F;\n  const blockW = widest * F + 0.1 * F;\n  const blockH = baselines[baselines.length - 1] - BASELINE * F + F - blockTop;\n  const fill = meshFill(c.blobs, c.base, interpolate(t, [0, 140], [0, 1]));\n  const kickerIsBrand = /^remocn\\b/i.test(kicker);\n  const kickerRest = kicker.replace(/^remocn\\s*/i, \"\");\n\n  const labelStyle: React.CSSProperties = {\n    position: \"absolute\",\n    top: sy(margin),\n    fontFamily: mono,\n    fontWeight: 400,\n    fontSize: 13.5 * u * s,\n    lineHeight: 1,\n    letterSpacing: \"0.02em\",\n    textTransform: \"uppercase\",\n    fontVariantNumeric: \"tabular-nums\",\n    whiteSpace: \"nowrap\",\n    display: \"flex\",\n    alignItems: \"baseline\",\n    gap: 9 * u * s,\n  };\n\n  return (\n    <AbsoluteFill style={{ background: c.bg, overflow: \"hidden\" }}>\n      <AbsoluteFill\n        style={{\n          background: `radial-gradient(ellipse 70% 80% at ${(sx(W * 0.3) / W) * 100}% ${(sy(H * 0.6) / H) * 100}%, ${c.key}, transparent 70%)`,\n        }}\n      />\n\n      {Array.from({ length: columns + 1 }, (_, i) => {\n        const x = margin + (contentW / columns) * i;\n        const p = grid(i * 2);\n        const top = sy(header);\n        const bottom = sy(H - margin);\n        return (\n          <div\n            key={`c${i}`}\n            style={{\n              position: \"absolute\",\n              left: sx(x) - hair / 2,\n              top,\n              width: hair,\n              height: Math.max(0, (bottom - top) * p),\n              background: c.hair,\n            }}\n          />\n        );\n      })}\n      <div\n        style={{\n          position: \"absolute\",\n          left: sx(margin),\n          top: sy(header) - hair / 2,\n          width: Math.max(0, (sx(W - margin) - sx(margin)) * grid(0)),\n          height: hair,\n          background: c.hair,\n        }}\n      />\n\n      {lines.map((line, i) => (\n        <div\n          key={`${i}-${line}`}\n          style={{\n            position: \"absolute\",\n            left: sx(blockLeft),\n            top: sy(baselines[i] - BASELINE * F),\n            fontFamily: display,\n            fontWeight: 500,\n            fontSize: F * s,\n            lineHeight: 1,\n            letterSpacing: `${TRACK}em`,\n            whiteSpace: \"pre\",\n            color: \"transparent\",\n            backgroundImage: fill,\n            backgroundSize: `${blockW * s}px ${blockH * s}px`,\n            backgroundPosition: `0px ${-(baselines[i] - BASELINE * F - blockTop) * s}px`,\n            backgroundRepeat: \"no-repeat\",\n            WebkitBackgroundClip: \"text\",\n            backgroundClip: \"text\",\n          }}\n        >\n          <Line text={line} accent={accent} />\n        </div>\n      ))}\n\n      <div\n        style={{\n          ...labelStyle,\n          left: sx(margin),\n          color: c.fg,\n          opacity: label(0),\n          transform: `translateY(${(1 - label(0)) * 8 * u}px)`,\n        }}\n      >\n        {logo ??\n          (kickerIsBrand ? (\n            <RemocnLogo fontSize={17 * u * s} color={c.fg} />\n          ) : null)}\n        <span>{kickerIsBrand && !logo ? kickerRest : kicker}</span>\n      </div>\n      <div\n        style={{\n          ...labelStyle,\n          right: W - sx(W - margin),\n          color: c.muted,\n          opacity: label(4),\n          transform: `translateY(${(1 - label(4)) * 8 * u}px)`,\n        }}\n      >\n        {meta}\n      </div>\n\n      {note ? (\n        <div\n          style={{\n            position: \"absolute\",\n            left: sx(margin + (contentW / columns) * 3 + 12 * u),\n            top: sy(header + 14 * u),\n            width: (contentW / columns) * 2 * s,\n            fontFamily: display,\n            fontWeight: 400,\n            fontSize: 16 * u * s,\n            lineHeight: 1.32,\n            letterSpacing: \"-0.005em\",\n            color: c.muted,\n            textWrap: \"balance\",\n            opacity: label(8),\n            transform: `translateY(${(1 - label(8)) * 8 * u}px)`,\n          }}\n        >\n          {note}\n        </div>\n      ) : null}\n\n      <Grain opacity={c.grain} />\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/poster-crop.tsx"
    }
  ],
  "type": "registry:component"
}
