{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"wordmark-cut","type":"registry:component","title":"Wordmark Cut","description":"Wordmark reveal end card: a huge brand name with a hard cut to a close-up. A wordmark twice the width of the frame, cooling from a lit gradient to ink while it settles, and then a hard cut onto its last letters and the dot — 1.71× nearer, with a shallow depth of field the wide shot does not have, which is the only thing that says the second shot is closer rather than just bigger.","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>. Pass mode=\"dark\" for dark frames.","registryDependencies":["https://kuchi.kalarislabs.com/r/kuchi-ui.json"],"files":[{"path":"components/kuchi/wordmark-cut.tsx","type":"registry:component","target":"components/kuchi/wordmark-cut.tsx","content":"/*! Portions Copyright (c) 2026 Sri Nath (snap-cn). MIT License. See THIRD_PARTY_LICENSES. */\n\"use client\";\r\n\r\nimport { loadFont as loadSans } from \"@remotion/google-fonts/Inter\";\r\nimport {\r\n  AbsoluteFill,\r\n  interpolate,\r\n  useCurrentFrame,\r\n  useVideoConfig,\r\n} from \"remotion\";\r\nimport {\r\n  mixOklch,\r\n  resolveFont,\r\n  type KuchiTheme,\r\n  useKuchiTheme,\r\n} from \"@/lib/kuchi-ui\";\r\n\r\n/**\r\n * A wordmark twice the width of the frame, cooling from a lit gradient to ink,\r\n * cut closer onto its last letters and the dot.\r\n *\r\n * Two shots and a hard cut between them. The wide one holds the front of the\r\n * word, rides an exponential settle up into place while the light on the type\r\n * cools out, and then starts drifting left — accelerating, so the cut\r\n * lands on a frame that is already moving. The close one is 1.71× nearer, holds\r\n * the *end* of the word, springs into place, waits, and pushes in. The dot never\r\n * cools: it is the one thing in the piece that keeps the gradient, and the close\r\n * shot is framed on it.\r\n *\r\n * Beat by beat, measured off the reference at 30fps:\r\n *\r\n * | beat | seconds | what moves |\r\n * | --- | --- | --- |\r\n * | settle | 0 – 0.8 | the word rises 50px, exponentially |\r\n * | cool | 0.36 – 1.03 | the light on the type goes to ink, linearly |\r\n * | drift | 0.66 – 1.20 | the word slides 21px left, accelerating |\r\n * | **cut** | 1.20 | 245px type → 419px type, front of the word → end of it |\r\n * | spring | 1.20 – 1.45 | the close shot lands, overshooting 5px |\r\n * | hold | 1.45 – 1.63 | nothing moves |\r\n * | push | 1.63 – 2.20 | 1 → 1.30, still accelerating at the last frame |\r\n *\r\n * The two shots are not one continuous move with a jump in it — the wide one is\r\n * *accelerating* left when it ends and the close one is *decelerating* when it\r\n * begins. It is the same camera on the same word, twice, and the cut is what\r\n * makes the second one read as closer rather than as bigger.\r\n *\r\n * The wide shot has no depth of field and the close one does — sharp in the\r\n * middle of the frame, six pixels of blur by the corners. That is not a mistake\r\n * to be tidied away: it is the only thing in the piece that says the second shot\r\n * is *nearer* rather than the same shot at a larger point size, and it was\r\n * measured, one edge at a time, before it was believed. A 't' stem 1px sharp at\r\n * mid-frame and 15px soft at its own ascender tip is not something a font does.\r\n */\r\n\r\nconst { fontFamily: SANS } = loadSans(\"normal\", {\r\n  weights: [\"500\"],\r\n  subsets: [\"latin\"],\r\n});\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   Geometry, in the reference's own 712×398 pixels\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\nexport const REF_W = 712;\r\nexport const REF_H = 398;\r\n\r\n/** When the wide shot becomes the close one. */\r\nexport const CUT = 1.2;\r\n\r\n/**\r\n * The two framings.\r\n *\r\n * `size` is a point size and `baseline` is where the baseline sits, both in\r\n * reference px. The wide shot anchors the word's **left** edge 42px off the\r\n * frame — its first letter is cut, which is what makes the type read as bigger\r\n * than the frame rather than merely large. The close shot anchors the **dot**,\r\n * because the dot is what it is framed on and because anchoring the right-hand\r\n * end is the only way to place a line of unknown width without measuring it.\r\n *\r\n * 419 / 245 = 1.71, read off the stem widths: 25.5px of stem in the wide shot\r\n * and 41 in the close one. Cap heights would have been easier and are not\r\n * available — the wide shot's baseline is 10px below the bottom of the frame.\r\n */\r\nexport const WIDE = { size: 245, inkTop: 224, left: -42 };\r\nexport const CLOSE = { size: 419, dot: { x: 418.5, y: 259.2 } };\r\n\r\n/**\r\n * How tall the word's ink is, as a fraction of the point size — and therefore\r\n * how far the point size has to open up.\r\n *\r\n * The reference's word is \"Product.\": a cap, two ascenders, letters that reach\r\n * 0.75em above the baseline. A wordmark that is all x-height reaches 0.546em,\r\n * and set at the same point size it sits in the frame like a caption. So the\r\n * *ink* is what the two framings are measured against and the point size follows\r\n * from it — which is what a designer does when the word changes, and the only\r\n * rule that survives not knowing the word.\r\n *\r\n * At 0.75 this returns the reference's own 245 and 419 unchanged.\r\n */\r\nexport function inkRatio(word: string): number {\r\n  // 0.556, not the 0.546 x-height: round lowercase overshoots it by 0.01em, and\r\n  // three pixels of overshoot is three pixels of framing.\r\n  return /[A-Z0-9bdfhiklt]/.test(word) ? 0.75 : 0.556;\r\n}\r\n\r\nexport function sizeFor(shot: \"wide\" | \"close\"): number {\r\n  return shot === \"wide\" ? WIDE.size : CLOSE.size;\r\n}\r\n\r\n/**\r\n * Where each shot puts the baseline, in reference px.\r\n *\r\n * Neither shot has a fixed one, and they are anchored on opposite things. The\r\n * wide shot is framed on the **top of the ink** — 224, a little over half way\r\n * down — so a word with no ascenders sits where \"Product.\"'s cap sits rather\r\n * than 50px lower, floating in the page. The close shot is framed on the\r\n * **dot**, because that is what it is a shot of; the baseline is then wherever\r\n * the dot's own radius puts it.\r\n *\r\n * For \"Product.\" both come out at the reference's own numbers, 408 and 308.\r\n */\r\nexport function baselineFor(shot: \"wide\" | \"close\", word: string): number {\r\n  return shot === \"wide\"\r\n    ? WIDE.inkTop + inkRatio(word) * WIDE.size\r\n    : CLOSE.dot.y + (DOT.size * CLOSE.size) / 2;\r\n}\r\n\r\n/**\r\n * The dot, as a fraction of the point size.\r\n *\r\n * 0.234em — two and a half times a real period, and round rather than square.\r\n * It sits *on* the baseline (centre one radius above it) and follows the word\r\n * after a 0.06em gap.\r\n */\r\nexport const DOT = { size: 0.2348, gap: 0.06 };\r\n\r\n/**\r\n * Where the baseline sits inside a `line-height: 1` box, as a fraction of the\r\n * point size.\r\n *\r\n * Inter's ascent and descent are 0.9688 and 0.2422, so a 1em line box carries\r\n * half-leading of −0.1055em and puts the baseline 0.8633em down. Everything here\r\n * is positioned from a baseline, because that is the only line in a piece of\r\n * type that a camera can be aimed at.\r\n */\r\nexport const BASELINE_IN_BOX = 0.8633;\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   Curves — every number below was read off the reference's own frames\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\nfunction knots(\r\n  ts: readonly number[],\r\n  vs: readonly number[],\r\n  t: number,\r\n): number {\r\n  return interpolate(t, ts as number[], vs as number[], {\r\n    extrapolateLeft: \"clamp\",\r\n    extrapolateRight: \"clamp\",\r\n  });\r\n}\r\n\r\n/**\r\n * The wide shot's rise, in reference px.\r\n *\r\n * Read off the top row of ink: 274 down to 224 and then nothing. It is very\r\n * nearly `50·exp(−t/0.19)` and it is knots anyway, because the first tenth of a\r\n * second decays faster than the rest and a single exponential is 6px wrong\r\n * there — which on a settle this small is an eighth of the whole move.\r\n *\r\n * 50px is where the reference *was* when the capture starts, not where its\r\n * entrance began; that happened about 0.2s earlier, off the front of the clip.\r\n * Extrapolating the exponential backwards would put the word 140px low at t=0,\r\n * and inventing 90px of entrance nobody has seen is not matching a reference.\r\n */\r\nexport const RISE_T = [0, 0.058, 0.158, 0.258, 0.392, 0.525, 0.825, 1.2];\r\nexport const RISE_V = [50, 31, 20, 13, 7, 3, 0, 0];\r\n\r\nexport function rise(t: number): number {\r\n  return knots(RISE_T, RISE_V, t);\r\n}\r\n\r\n/**\r\n * The wide shot's drift, in reference px.\r\n *\r\n * Zero until 0.66 and then a `^3.08` ease-in that has covered 21px by the last\r\n * frame the recording caught and 27 by the cut — an acceleration, not a slide,\r\n * so the fastest frame of it is the one the cut takes. Fitted rather than\r\n * knotted: the power law is inside 2px of all sixteen measured frames, and a\r\n * curve whose whole job is to be still accelerating when it is interrupted is\r\n * better written as the thing it is than as a table that stops.\r\n *\r\n * The span runs to the cut, not to the end of the measurements. Ending it at\r\n * 1.16 froze the drift for the last frame before the cut, which is the one frame\r\n * it must not be still on.\r\n */\r\nexport const DRIFT = {\r\n  start: 0.66,\r\n  span: CUT - 0.66,\r\n  distance: 26.8,\r\n  power: 3.08,\r\n};\r\n\r\nexport function drift(t: number): number {\r\n  const u = Math.min(1, Math.max(0, (t - DRIFT.start) / DRIFT.span));\r\n  return -DRIFT.distance * u ** DRIFT.power;\r\n}\r\n\r\n/**\r\n * How much light is left on the type, 0…1.\r\n *\r\n * Held at 0.455 for a third of a second and then straight down to nothing by\r\n * 1.03 — measured as the red channel of the glyph cores, which is a clean\r\n * readout because the gradient holds R at 255 across its whole length and only\r\n * G moves. So R/255 *is* the strength, at any point along the word.\r\n *\r\n * It never reaches full strength inside the clip. Like the rise, the reference\r\n * is already partway through this beat when the capture starts.\r\n */\r\nexport const WARM_T = [0, 0.358, 0.458, 0.592, 0.858, 1.017, 1.025, 1.2];\r\nexport const WARM_V = [0.455, 0.451, 0.404, 0.314, 0.106, 0.016, 0, 0];\r\n\r\nexport function warmth(t: number): number {\r\n  return knots(WARM_T, WARM_V, t);\r\n}\r\n\r\n/**\r\n * The close shot, tracked on the dot — the one object in it with an edge on\r\n * every side and a colour nothing else shares.\r\n *\r\n * Its area gives the scale to a hundredth of a percent (a 98px disc is 7,600\r\n * pixels; a centroid on that many is worth a fiftieth of a pixel), which is why\r\n * the push below is knots off a measurement rather than a spring anybody tuned.\r\n *\r\n * Times are from the cut, not from the start of the piece.\r\n */\r\nexport const B_T = [0, 0.333, 0.533, 0.708, 0.808, 0.875, 0.933, 0.967, 1];\r\nexport const B_SCALE = [\r\n  0.9995, 0.9989, 1.0159, 1.0556, 1.0986, 1.1398, 1.1994, 1.2402, 1.2971,\r\n];\r\nexport const B_DX_T = [0, 0.133, 0.3, 0.775, 0.967, 1];\r\nexport const B_DX = [6.46, 1.96, 0.12, -1.43, -4.08, -5.07];\r\n/**\r\n * The vertical is the one axis with an overshoot in it: down 18px, 5px past the\r\n * mark, and back. The horizontal has none. Two different settles on one object\r\n * is not something to average out — it is what stops the landing reading as a\r\n * slide.\r\n */\r\nexport const B_DY_T = [\r\n  0, 0.108, 0.133, 0.2, 0.267, 0.433, 0.533, 0.775, 0.933, 1,\r\n];\r\nexport const B_DY = [\r\n  13.83, 2.7, -1.09, -4.48, -4.53, -0.32, -0.35, -3.27, -5.13, -7.03,\r\n];\r\n\r\nexport function closeScale(t: number): number {\r\n  return knots(B_T, B_SCALE, Math.max(0, t - CUT));\r\n}\r\nexport function closeOffset(t: number): { x: number; y: number } {\r\n  const u = Math.max(0, t - CUT);\r\n  return { x: knots(B_DX_T, B_DX, u), y: knots(B_DY_T, B_DY, u) };\r\n}\r\n\r\n/**\r\n * The close shot's depth of field.\r\n *\r\n * Sharp out to about 170px from the middle of the frame and fully soft by 215,\r\n * with a σ of 6. Measured as the 10–90 width of a glyph edge against its\r\n * distance from the centre: 1px at 92, 3px at 124, 3px at 165, 7px at 192,\r\n * 15px at 205 and 16px at 310. It is a late, steep falloff — a wide aperture,\r\n * not a vignette — and guessing 120 → 230 for it left the letter next to the dot\r\n * eight pixels soft where the reference has one.\r\n *\r\n * The wide shot has none of it, at every edge it has, which is the check that\r\n * this is a lens and not the encoder.\r\n */\r\nexport const FOCUS = { sigma: 6, inner: 170, outer: 215 };\r\n\r\n/* ─────────────────────────────────────────────────────────────────────────\r\n   Component\r\n   ───────────────────────────────────────────────────────────────────────── */\r\n\r\nexport interface WordmarkCutProps {\r\n  /** The wordmark. A trailing \".\" is dropped — the dot is drawn, not typed. */\r\n  word?: string;\r\n  /**\r\n   * The dot's gradient, and the light the type cools out of. Both ends of one\r\n   * ramp: the dot paints it at full strength and the type at `warm`, so they\r\n   * cannot drift apart.\r\n   *\r\n   * Defaults to the design system's own `primary` lifted to a cyan. The\r\n   * reference's is `#ff6100 → #fff100`, which is its brand and not ours.\r\n   */\r\n  dotFrom?: string;\r\n  dotTo?: string;\r\n  /** How much light the type carries at its hottest, 0…1. */\r\n  warm?: number;\r\n  /** Design-system token overrides. */\r\n  theme?: Partial<KuchiTheme>;\r\n  mode?: \"light\" | \"dark\";\r\n  /**\r\n   * The face this scene paints its word in — a label from `fonts.ts` or a CSS\r\n   * family you have loaded yourself. Overrides `theme.fontFamily`.\r\n   */\r\n  fontFamily?: string;\r\n  /** 1 is the measured speed. */\r\n  speed?: number;\r\n}\r\n\r\nexport function WordmarkCut({\r\n  word = \"kuchi.\",\r\n  dotFrom = \"#3072db\",\r\n  dotTo = \"#4fd8f5\",\r\n  warm = 1,\r\n  theme,\r\n  mode,\r\n  fontFamily,\r\n  speed = 1,\r\n}: WordmarkCutProps) {\r\n  const frame = useCurrentFrame();\r\n  const { fps, width, height } = useVideoConfig();\r\n  const t = (frame * speed) / fps;\r\n\r\n  const th = useKuchiTheme(theme, mode);\r\n  const face = resolveFont(fontFamily ?? th.fontFamily) ?? SANS;\r\n\r\n  const k = Math.min(width / REF_W, height / REF_H);\r\n  const ox = (width - REF_W * k) / 2;\r\n  const oy = (height - REF_H * k) / 2;\r\n\r\n  const text = word.replace(/\\.+$/, \"\");\r\n  const close = t >= CUT;\r\n  const heat = close ? 0 : warmth(t) * warm;\r\n  // The reference cools to a flat black; this cools to the palette's ink, which\r\n  // is #141414 and not #000, so the last few frames of the beat sit a shade\r\n  // short of it. That is the trade the design system asks for, and it is the\r\n  // whole of the difference between the two.\r\n  const from = mixOklch(dotFrom, th.foreground, 1 - heat);\r\n  const to = mixOklch(dotTo, th.foreground, 1 - heat);\r\n\r\n  const line = (\r\n    <Line\r\n      dotFrom={dotFrom}\r\n      dotTo={dotTo}\r\n      face={face}\r\n      from={from}\r\n      baseline={baselineFor(close ? \"close\" : \"wide\", text)}\r\n      size={sizeFor(close ? \"close\" : \"wide\")}\r\n      text={text}\r\n      to={to}\r\n      wide={!close}\r\n    />\r\n  );\r\n\r\n  const pivot = CLOSE.dot;\r\n  const offset = closeOffset(t);\r\n  // The *blurred* copy is the one that gets masked, and it sits on top. Mask\r\n  // the sharp copy instead and the blurred one's spill shows all round the\r\n  // letters that are supposed to be in focus — a halo on every glyph, which is\r\n  // not a shallow depth of field, it is a glow.\r\n  const mask = `radial-gradient(circle ${FOCUS.outer}px at ${REF_W / 2}px ${REF_H / 2}px, transparent 0%, transparent ${Math.round((100 * FOCUS.inner) / FOCUS.outer)}%, #000 100%)`;\r\n\r\n  return (\r\n    <AbsoluteFill\r\n      style={{\r\n        backgroundColor: th.background,\r\n        fontFamily: face,\r\n        // The type is under a moving scale for the whole close shot; hinting\r\n        // would re-snap every stem on every frame and the letterforms boil.\r\n        textRendering: \"geometricPrecision\",\r\n        overflow: \"hidden\",\r\n      }}\r\n    >\r\n      <div\r\n        style={{\r\n          position: \"absolute\",\r\n          left: ox,\r\n          top: oy,\r\n          width: REF_W,\r\n          height: REF_H,\r\n          overflow: \"hidden\",\r\n          transform: `scale(${k})`,\r\n          transformOrigin: \"0 0\",\r\n        }}\r\n      >\r\n        {close ? (\r\n          <>\r\n            {/* Two copies of one line: the sharp one underneath, the soft one\r\n                over it through a radial hole. The mask is on the\r\n                *untransformed* layer, because a depth of field belongs to the\r\n                lens and not to the thing being filmed — masking inside the\r\n                camera transform would drag the focal plane along with the\r\n                push. */}\r\n            <Camera offset={offset} pivot={pivot} scale={closeScale(t)}>\r\n              {line}\r\n            </Camera>\r\n            <div\r\n              style={{\r\n                position: \"absolute\",\r\n                inset: 0,\r\n                maskImage: mask,\r\n                WebkitMaskImage: mask,\r\n              }}\r\n            >\r\n              <Camera\r\n                blur={FOCUS.sigma}\r\n                offset={offset}\r\n                pivot={pivot}\r\n                scale={closeScale(t)}\r\n              >\r\n                {line}\r\n              </Camera>\r\n            </div>\r\n          </>\r\n        ) : (\r\n          <div\r\n            style={{\r\n              position: \"absolute\",\r\n              inset: 0,\r\n              transform: `translate(${drift(t)}px, ${rise(t)}px)`,\r\n            }}\r\n          >\r\n            {line}\r\n          </div>\r\n        )}\r\n      </div>\r\n    </AbsoluteFill>\r\n  );\r\n}\r\n\r\n/** The close shot's camera: scale about the dot, then put the dot where it goes. */\r\nfunction Camera({\r\n  blur,\r\n  children,\r\n  offset,\r\n  pivot,\r\n  scale,\r\n}: {\r\n  blur?: number;\r\n  children: React.ReactNode;\r\n  offset: { x: number; y: number };\r\n  pivot: { x: number; y: number };\r\n  scale: number;\r\n}) {\r\n  return (\r\n    <div\r\n      style={{\r\n        position: \"absolute\",\r\n        inset: 0,\r\n        transform: `translate(${offset.x}px, ${offset.y}px) scale(${scale})`,\r\n        transformOrigin: `${pivot.x}px ${pivot.y}px`,\r\n        filter: blur ? `blur(${blur}px)` : undefined,\r\n      }}\r\n    >\r\n      {children}\r\n    </div>\r\n  );\r\n}\r\n\r\n/**\r\n * The word and its dot, as one nowrap row.\r\n *\r\n * Anchored by the left edge in the wide shot and by the **dot** in the close one\r\n * — `right` rather than `left`, so a line of unknown width lands with its dot on\r\n * the mark without anyone having to measure the text first. Measuring it would\r\n * mean `delayRender`, and a title that cannot draw its first frame until a font\r\n * has loaded is a worse trade than a layout rule that never needs to know.\r\n */\r\nfunction Line({\r\n  baseline,\r\n  dotFrom,\r\n  dotTo,\r\n  face,\r\n  from,\r\n  size,\r\n  text,\r\n  to,\r\n  wide,\r\n}: {\r\n  baseline: number;\r\n  dotFrom: string;\r\n  dotTo: string;\r\n  face: string;\r\n  from: string;\r\n  size: number;\r\n  text: string;\r\n  to: string;\r\n  wide: boolean;\r\n}) {\r\n  const d = DOT.size * size;\r\n  const top = baseline - BASELINE_IN_BOX * size;\r\n  const anchored = wide\r\n    ? { left: WIDE.left }\r\n    : { right: REF_W - (CLOSE.dot.x + d / 2) };\r\n  return (\r\n    <div\r\n      style={{\r\n        position: \"absolute\",\r\n        top,\r\n        ...anchored,\r\n        display: \"flex\",\r\n        alignItems: \"flex-end\",\r\n        whiteSpace: \"nowrap\",\r\n        fontFamily: face,\r\n      }}\r\n    >\r\n      <span\r\n        style={{\r\n          fontSize: size,\r\n          fontWeight: 500,\r\n          lineHeight: 1,\r\n          // −0.02em. Measured: Inter's own advances put the reference's fifth\r\n          // stem 20px right of where it sits, and the drift is even across the\r\n          // word — which is tracking, not a different face.\r\n          letterSpacing: -0.02 * size,\r\n          // The light runs across the *word*, not across the frame: the\r\n          // reference's ramp covers a shade more than one screen width and the\r\n          // word is a shade wider than one, which is the same thing said twice.\r\n          backgroundImage: `linear-gradient(90deg, ${from}, ${to})`,\r\n          WebkitBackgroundClip: \"text\",\r\n          backgroundClip: \"text\",\r\n          color: \"transparent\",\r\n        }}\r\n      >\r\n        {text}\r\n      </span>\r\n      <span\r\n        style={{\r\n          marginLeft: DOT.gap * size,\r\n          marginBottom: (1 - BASELINE_IN_BOX) * size,\r\n          width: d,\r\n          height: d,\r\n          borderRadius: \"50%\",\r\n          // 198deg: measured at 18° off vertical, the light end up and to the\r\n          // right. The dot is the one thing in the piece that never cools.\r\n          backgroundImage: `linear-gradient(198deg, ${dotTo}, ${dotFrom})`,\r\n          flexShrink: 0,\r\n        }}\r\n      />\r\n    </div>\r\n  );\r\n}\r\n\r\nexport default WordmarkCut;\r\n"}]}