{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"depth-headline","type":"registry:component","title":"Depth Headline","description":"A huge serif headline sits behind a gradient sphere that slides through it for depth.","dependencies":["remotion","@remotion/google-fonts"],"docs":"Needs a Remotion project. If a frame renders black, the component is drawing on a transparent layer: put a background behind it, e.g. <AbsoluteFill style={{ background: \"#faf9f6\" }}><Component /></AbsoluteFill>.","files":[{"path":"components/kuchi/depth-headline.tsx","type":"registry:component","target":"components/kuchi/depth-headline.tsx","content":"/*! Portions Copyright (c) 2026 Remocn. MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\n\nimport { loadFont as loadDisplay } from \"@remotion/google-fonts/Fraunces\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type React from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  Img,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nconst { fontFamily: display } = loadDisplay(\"normal\", {\n  weights: [\"300\", \"400\"],\n  subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n  weights: [\"500\", \"600\"],\n  subsets: [\"latin\"],\n});\nconst sans = manrope.fontFamily;\n\nexport interface DepthHeadlineProps {\n  /** Huge headline set behind the subject. One short word reads best. */\n  title?: string;\n  /** Transparent-PNG cutout that rises in front of the headline. */\n  src?: string;\n  /** Small line at the foot of the frame, after the logo. Pass \"\" to hide. */\n  caption?: string;\n  /** Show the acme logo at the foot of the frame. */\n  showLogo?: boolean;\n  /** Replaces the acme mark at the foot of the frame. */\n  logo?: React.ReactNode;\n  accent?: string;\n  /** Text color of the headline and logo; overrides the theme. */\n  ink?: string;\n  background?: string;\n  /** Typeface for the headline. Load it yourself; Fraunces by default. */\n  fontFamily?: string;\n  fontWeight?: number;\n  /** Frames the subject takes to rise in front of the headline. */\n  riseFrames?: number;\n  /** Size of the headline and subject, around the frame's center. */\n  scale?: number;\n  /** Frames to hold the first frame before anything moves. */\n  delay?: number;\n  /** Playback multiplier. */\n  speed?: number;\n  theme?: \"dark\" | \"light\";\n}\n\nconst THEMES = {\n  dark: {\n    bg: \"#0A0A0B\",\n    fg: \"#F5F4F0\",\n    muted: \"#8A8984\",\n    shadow: \"rgba(0,0,0,0.55)\",\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    fg: \"#0A0A0B\",\n    muted: \"#6E6C67\",\n    shadow: \"rgba(40,32,20,0.22)\",\n  },\n} as const;\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\n/** Fraunces 400 advance per character at display tracking, in em. */\nconst ADVANCE = 0.48;\n\n/** gradients.sh \"mesh\": lilac, periwinkle and deep blue blobs on ink. */\nconst MESH = {\n  bg: \"#0a0d24\",\n  colors: [\"#ecdcf2\", \"#8796ee\", \"#2e45b7\", \"#0e1645\"],\n} as const;\n\n/**\n * The mesh palette as a flat poster orb: deep blue at the crown, lilac light\n * pooling at the base, two blobs drifting a few percent. Lit from below so it\n * reads as colour, not as a shaded ball.\n */\nfunction meshFill(t: number, accent: string) {\n  const [c0, c1, , c3] = MESH.colors;\n  const c2 = accent;\n  const d = Math.sin(t * Math.PI) * 5;\n  return [\n    `radial-gradient(70% 55% at ${38 + d}% 100%, ${c0} 0%, color-mix(in oklab, ${c0} 0%, transparent) 70%)`,\n    `radial-gradient(60% 70% at ${82 - d}% ${62 - d * 0.5}%, color-mix(in oklab, ${c1} 85%, transparent) 0%, transparent 70%)`,\n    `radial-gradient(90% 70% at ${30 + d * 0.6}% 0%, color-mix(in oklab, ${c3} 70%, transparent) 0%, transparent 72%)`,\n    `linear-gradient(180deg, ${c2} 0%, ${c1} 64%, ${c0} 100%)`,\n  ].join(\", \");\n}\n\n\n/** Full logo as on acme.dev: R mark (0.76em tall, baseline-aligned) + \"Acme\" in Manrope 600, tracking-tight. */\nfunction KuchiLogo({ 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      <span>Acme</span>\n    </div>\n  );\n}\n\n/** The foreground at `scale`, around the frame's center; nothing extra at 1. */\nfunction ScaleLayer({\n  scale,\n  children,\n}: {\n  scale: number;\n  children: React.ReactNode;\n}) {\n  if (scale === 1) return children;\n  return (\n    <AbsoluteFill style={{ transform: `scale(${scale})` }}>\n      {children}\n    </AbsoluteFill>\n  );\n}\n\nexport function DepthHeadline({\n  title = \"Studio\",\n  src,\n  caption = \"Studio\",\n  showLogo = true,\n  logo,\n  accent = \"#3B5BFD\",\n  ink,\n  background,\n  fontFamily = display,\n  fontWeight = 400,\n  riseFrames = 44,\n  scale = 1,\n  delay = 0,\n  speed = 1,\n  theme = \"dark\",\n}: DepthHeadlineProps) {\n  const frame = Math.max(0, useCurrentFrame() - delay) * speed;\n  const { width: W, height: H } = useVideoConfig();\n  const c = THEMES[theme];\n  const fg = ink ?? c.fg;\n  const stage =\n    background === \"transparent\" ? \"transparent\" : (background ?? c.bg);\n\n  const size = Math.min(\n    H * 0.56,\n    (W * 0.9) / Math.max(1, title.length * ADVANCE),\n  );\n\n  // Far plane: the headline tracks open and drifts a short distance.\n  const open = interpolate(frame, [0, 54], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n  const tracking = -0.07 + open * 0.035;\n  const headX = (1 - open) * W * 0.045;\n  const headY = (1 - open) * H * 0.035;\n\n  // Near plane: the subject rises from below and covers much more ground.\n  const rise = interpolate(frame, [4, 4 + riseFrames], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n  const subjectY = (1 - rise) * H * 0.78;\n\n  // A slow push after the rise: near plane grows more than far plane.\n  const push = interpolate(frame, [30, 96], [0, 1], {\n    ...CLAMP,\n    easing: EASE_IO,\n  });\n  const headScale = 1 + push * 0.014;\n  const subjectScale = 1 + push * 0.04;\n\n  const captionIn = interpolate(frame, [46, 62], [0, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n\n  const disc = H * 0.48;\n  const headTop = H * 0.42;\n  // Disc top lands in the lower x-height so the word stays legible.\n  const discTop = headTop + size * 0.15;\n\n  return (\n    <AbsoluteFill style={{ backgroundColor: stage, overflow: \"hidden\" }}>\n      <ScaleLayer scale={scale}>\n        <div\n          style={{\n            position: \"absolute\",\n            left: 0,\n            right: 0,\n            top: headTop,\n            textAlign: \"center\",\n            fontFamily,\n            fontWeight,\n            fontSize: size,\n            lineHeight: 1,\n            letterSpacing: `${tracking}em`,\n            color: fg,\n            whiteSpace: \"nowrap\",\n            transform: `translate(${headX}px, calc(-50% + ${headY}px)) scale(${headScale})`,\n            transformOrigin: \"50% 60%\",\n          }}\n        >\n          {title}\n        </div>\n\n        {src ? (\n          <Img\n            src={src}\n            style={{\n              position: \"absolute\",\n              left: \"50%\",\n              bottom: 0,\n              height: H * 0.84,\n              objectFit: \"contain\",\n              transform: `translate(-50%, ${subjectY}px) scale(${subjectScale})`,\n              transformOrigin: \"50% 100%\",\n              filter: `drop-shadow(0 ${H * 0.03}px ${H * 0.05}px ${c.shadow})`,\n            }}\n          />\n        ) : (\n          <div\n            style={{\n              position: \"absolute\",\n              left: (W - disc) / 2,\n              top: discTop,\n              width: disc,\n              height: disc,\n              borderRadius: \"50%\",\n              background: meshFill(frame / 120, accent),\n              transform: `translateY(${subjectY}px) scale(${subjectScale})`,\n              transformOrigin: \"50% 40%\",\n            }}\n          />\n        )}\n\n        {showLogo || caption ? (\n          <div\n            style={{\n              position: \"absolute\",\n              left: H * 0.08,\n              bottom: H * 0.07,\n              display: \"flex\",\n              alignItems: \"baseline\",\n              gap: H * 0.018,\n              opacity: captionIn,\n              transform: `translateY(${(1 - captionIn) * H * 0.01}px)`,\n            }}\n          >\n            {showLogo\n              ? (logo ?? <KuchiLogo fontSize={H * 0.032} color={fg} />)\n              : null}\n            {showLogo && caption ? (\n              <div\n                style={{\n                  width: 1,\n                  height: H * 0.024,\n                  alignSelf: \"center\",\n                  backgroundColor: c.muted,\n                  opacity: 0.6,\n                }}\n              />\n            ) : null}\n            {caption ? (\n              <div\n                style={{\n                  fontFamily: sans,\n                  fontWeight: 500,\n                  fontSize: H * 0.028,\n                  letterSpacing: \"-0.01em\",\n                  lineHeight: 1,\n                  color: c.muted,\n                }}\n              >\n                {caption}\n              </div>\n            ) : null}\n          </div>\n        ) : null}\n      </ScaleLayer>\n    </AbsoluteFill>\n  );\n}\n"}]}