{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "line-relief",
  "title": "Line Relief",
  "description": "Huge LAUNCH lettering is relief-ruled by stacked horizontal lines over a dusk gradient.",
  "dependencies": ["remotion"],
  "files": [
    {
      "path": "registry/remocn/line-relief/index.tsx",
      "content": "\"use client\";\n\nimport { useId, useMemo } from \"react\";\nimport {\n  AbsoluteFill,\n  Easing,\n  interpolate,\n  useCurrentFrame,\n  useVideoConfig,\n} from \"remotion\";\n\nexport interface LineReliefProps {\n  word?: string;\n  accent?: string;\n  speed?: number;\n  theme?: \"dark\" | \"light\";\n}\n\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_RISE = Easing.bezier(0.45, 0, 0.25, 1);\nconst CLAMP = {\n  extrapolateLeft: \"clamp\",\n  extrapolateRight: \"clamp\",\n} as const;\n\n// gradients.sh \"horizon\" palette (dusk band: #b4553a, #c98f8a, #6f8fb0,\n// #3a1f33, #dfe8ff) as the ground: night sky at the top (tinted by the accent),\n// dusk glow at the bottom. The lines stay neutral so the relief reads cleanly.\nconst THEMES = {\n  dark: {\n    bg: \"#050405\",\n    fg: \"#F3F2EF\",\n    sky: [\n      [0, \"accent\", 0.1],\n      [0.36, \"#0b0912\", 0],\n      [0.64, \"#26141f\", 0],\n      [0.87, \"#72372a\", 0],\n      [1, \"#b4553a\", 0],\n    ],\n    line: 0.36,\n    lift: 0.95,\n    grain: 0.06,\n  },\n  light: {\n    bg: \"#F5F4F0\",\n    fg: \"#121214\",\n    sky: [\n      [0, \"accent\", 0.08],\n      [0.18, \"#e9ecef\", 0],\n      [0.55, \"#F5F4F0\", 0],\n      [0.84, \"#ecd6cf\", 0],\n      [1, \"#e2b4a2\", 0],\n    ],\n    line: 0.34,\n    lift: 0.92,\n    grain: 0.045,\n  },\n} as const;\n\nfunction mix(a: string, b: string, k: number) {\n  const ch = (h: string, i: number) =>\n    Number.parseInt(h.slice(1 + i * 2, 3 + i * 2), 16);\n  if (!/^#[0-9a-fA-F]{6}$/.test(a) || !/^#[0-9a-fA-F]{6}$/.test(b)) return a;\n  return `rgb(${[0, 1, 2].map((i) => Math.round(ch(a, i) + (ch(b, i) - ch(a, i)) * k)).join(\",\")})`;\n}\n\nconst LINES = 40;\nconst SAMPLES = 260;\nconst GROW = [6, 40] as const;\nconst SWEEP_DELAY = 16;\nconst SETTLE = [84, 108] as const;\nconst REVEAL = [88, 112] as const;\nconst GAP = 1.7;\nconst STROKE = 0.5;\n\ntype Pt = [number, number];\ntype Glyph = { w: number; strokes: Pt[][] };\n\nfunction arc(\n  cx: number,\n  cy: number,\n  rx: number,\n  ry: number,\n  from: number,\n  to: number,\n): Pt[] {\n  const n = Math.max(6, Math.ceil(Math.abs(to - from) / 12));\n  return Array.from({ length: n + 1 }, (_, i) => {\n    const a = ((from + ((to - from) * i) / n) * Math.PI) / 180;\n    return [cx + rx * Math.cos(a), cy + ry * Math.sin(a)] as Pt;\n  });\n}\n\nconst GLYPHS: Record<string, Glyph> = {\n  A: {\n    w: 4.4,\n    strokes: [\n      [\n        [0, 6],\n        [2.2, 0],\n        [4.4, 6],\n      ],\n      [\n        [0.8, 4],\n        [3.6, 4],\n      ],\n    ],\n  },\n  B: {\n    w: 4.1,\n    strokes: [\n      [\n        [0, 0],\n        [0, 6],\n      ],\n      [[0, 0], ...arc(2.4, 1.5, 1.5, 1.5, -90, 90), [0, 3]],\n      [[0, 3], ...arc(2.6, 4.5, 1.5, 1.5, -90, 90), [0, 6]],\n    ],\n  },\n  C: { w: 4.4, strokes: [arc(2.5, 3, 2.5, 3, -45, -315)] },\n  D: {\n    w: 4.2,\n    strokes: [\n      [\n        [0, 0],\n        [0, 6],\n      ],\n      [[0, 0], ...arc(1.4, 3, 2.8, 3, -90, 90), [0, 6]],\n    ],\n  },\n  E: {\n    w: 3.8,\n    strokes: [\n      [\n        [3.8, 0],\n        [0, 0],\n        [0, 6],\n        [3.8, 6],\n      ],\n      [\n        [0, 3],\n        [3.2, 3],\n      ],\n    ],\n  },\n  F: {\n    w: 3.8,\n    strokes: [\n      [\n        [3.8, 0],\n        [0, 0],\n        [0, 6],\n      ],\n      [\n        [0, 3],\n        [3.2, 3],\n      ],\n    ],\n  },\n  G: { w: 5, strokes: [[...arc(2.5, 3, 2.5, 3, -45, -360), [2.8, 3]]] },\n  H: {\n    w: 4.2,\n    strokes: [\n      [\n        [0, 0],\n        [0, 6],\n      ],\n      [\n        [4.2, 0],\n        [4.2, 6],\n      ],\n      [\n        [0, 3],\n        [4.2, 3],\n      ],\n    ],\n  },\n  I: {\n    w: 0,\n    strokes: [\n      [\n        [0, 0],\n        [0, 6],\n      ],\n    ],\n  },\n  J: {\n    w: 3.4,\n    strokes: [[[3.4, 0], [3.4, 4.3], ...arc(1.7, 4.3, 1.7, 1.7, 0, 180)]],\n  },\n  K: {\n    w: 4,\n    strokes: [\n      [\n        [0, 0],\n        [0, 6],\n      ],\n      [\n        [4, 0],\n        [0, 3.8],\n      ],\n      [\n        [1.4, 2.5],\n        [4, 6],\n      ],\n    ],\n  },\n  L: {\n    w: 3.6,\n    strokes: [\n      [\n        [0, 0],\n        [0, 6],\n        [3.6, 6],\n      ],\n    ],\n  },\n  M: {\n    w: 5.2,\n    strokes: [\n      [\n        [0, 6],\n        [0, 0],\n        [2.6, 4.2],\n        [5.2, 0],\n        [5.2, 6],\n      ],\n    ],\n  },\n  N: {\n    w: 4.2,\n    strokes: [\n      [\n        [0, 6],\n        [0, 0],\n        [4.2, 6],\n        [4.2, 0],\n      ],\n    ],\n  },\n  O: { w: 5.2, strokes: [arc(2.6, 3, 2.6, 3, 0, 360)] },\n  P: {\n    w: 4,\n    strokes: [\n      [\n        [0, 6],\n        [0, 0],\n        [2.3, 0],\n        ...arc(2.3, 1.65, 1.65, 1.65, -90, 90),\n        [0, 3.3],\n      ],\n    ],\n  },\n  Q: {\n    w: 5.2,\n    strokes: [\n      arc(2.6, 3, 2.6, 3, 0, 360),\n      [\n        [3.3, 4.3],\n        [5.2, 6.2],\n      ],\n    ],\n  },\n  R: {\n    w: 4.1,\n    strokes: [\n      [\n        [0, 6],\n        [0, 0],\n        [2.3, 0],\n        ...arc(2.3, 1.65, 1.65, 1.65, -90, 90),\n        [0, 3.3],\n      ],\n      [\n        [2.2, 3.3],\n        [4.1, 6],\n      ],\n    ],\n  },\n  S: {\n    w: 4,\n    strokes: [\n      [...arc(2, 1.5, 1.9, 1.5, -25, -270), ...arc(2, 4.5, 2, 1.5, -90, 155)],\n    ],\n  },\n  T: {\n    w: 4.4,\n    strokes: [\n      [\n        [0, 0],\n        [4.4, 0],\n      ],\n      [\n        [2.2, 0],\n        [2.2, 6],\n      ],\n    ],\n  },\n  U: {\n    w: 4.2,\n    strokes: [[[0, 0], ...arc(2.1, 3.9, 2.1, 2.1, 180, 0), [4.2, 0]]],\n  },\n  V: {\n    w: 4.6,\n    strokes: [\n      [\n        [0, 0],\n        [2.3, 6],\n        [4.6, 0],\n      ],\n    ],\n  },\n  W: {\n    w: 6,\n    strokes: [\n      [\n        [0, 0],\n        [1.5, 6],\n        [3, 1.4],\n        [4.5, 6],\n        [6, 0],\n      ],\n    ],\n  },\n  X: {\n    w: 4.2,\n    strokes: [\n      [\n        [0, 0],\n        [4.2, 6],\n      ],\n      [\n        [4.2, 0],\n        [0, 6],\n      ],\n    ],\n  },\n  Y: {\n    w: 4.4,\n    strokes: [\n      [\n        [0, 0],\n        [2.2, 3.2],\n        [4.4, 0],\n      ],\n      [\n        [2.2, 3.2],\n        [2.2, 6],\n      ],\n    ],\n  },\n  Z: {\n    w: 4,\n    strokes: [\n      [\n        [0, 0],\n        [4, 0],\n        [0, 6],\n        [4, 6],\n      ],\n    ],\n  },\n  \"0\": { w: 4, strokes: [arc(2, 3, 2, 3, 0, 360)] },\n  \"1\": {\n    w: 2,\n    strokes: [\n      [\n        [0, 1.3],\n        [2, 0],\n        [2, 6],\n      ],\n    ],\n  },\n  \"2\": { w: 4, strokes: [[...arc(2, 2, 2, 2, -165, 25), [0, 6], [4, 6]]] },\n  \"3\": {\n    w: 4,\n    strokes: [\n      [...arc(2, 1.5, 1.8, 1.5, -160, 90), ...arc(2, 4.5, 2, 1.5, -90, 160)],\n    ],\n  },\n  \"4\": {\n    w: 4.2,\n    strokes: [\n      [\n        [3.2, 6],\n        [3.2, 0],\n        [0, 4.3],\n        [4.2, 4.3],\n      ],\n    ],\n  },\n  \"5\": {\n    w: 4,\n    strokes: [\n      [[3.7, 0], [0.4, 0], [0.2, 2.7], ...arc(2, 4.1, 2, 1.9, -125, 150)],\n    ],\n  },\n  \"6\": {\n    w: 4,\n    strokes: [\n      arc(2, 4.1, 2, 1.9, 0, 360),\n      [\n        [0.05, 3.9],\n        [0.7, 1.5],\n        [1.9, 0.2],\n        [3.4, 0],\n      ],\n    ],\n  },\n  \"7\": {\n    w: 4,\n    strokes: [\n      [\n        [0, 0],\n        [4, 0],\n        [1.4, 6],\n      ],\n    ],\n  },\n  \"8\": {\n    w: 4,\n    strokes: [arc(2, 1.45, 1.75, 1.45, 0, 360), arc(2, 4.4, 2, 1.6, 0, 360)],\n  },\n  \"9\": {\n    w: 4,\n    strokes: [\n      arc(2, 1.9, 2, 1.9, 0, 360),\n      [\n        [3.95, 2.1],\n        [3.3, 4.5],\n        [2.1, 5.8],\n        [0.6, 6],\n      ],\n    ],\n  },\n  \".\": {\n    w: 0,\n    strokes: [\n      [\n        [0, 5.95],\n        [0, 6],\n      ],\n    ],\n  },\n  \"!\": {\n    w: 0,\n    strokes: [\n      [\n        [0, 0],\n        [0, 4],\n      ],\n      [\n        [0, 5.95],\n        [0, 6],\n      ],\n    ],\n  },\n  \"-\": {\n    w: 2.8,\n    strokes: [\n      [\n        [0, 3.2],\n        [2.8, 3.2],\n      ],\n    ],\n  },\n  \"+\": {\n    w: 3.6,\n    strokes: [\n      [\n        [0, 3],\n        [3.6, 3],\n      ],\n      [\n        [1.8, 1.2],\n        [1.8, 4.8],\n      ],\n    ],\n  },\n};\n\nfunction layoutWord(word: string) {\n  const segs: Array<[Pt, Pt]> = [];\n  const paths: Pt[][] = [];\n  let x = 0;\n  const chars = word.toUpperCase().split(\"\");\n  chars.forEach((ch, i) => {\n    if (ch === \" \") {\n      x += 2.6;\n      return;\n    }\n    const g = GLYPHS[ch];\n    if (!g) return;\n    for (const stroke of g.strokes) {\n      const moved = stroke.map(([px, py]) => [px + x, py] as Pt);\n      paths.push(moved);\n      for (let k = 1; k < moved.length; k++)\n        segs.push([moved[k - 1], moved[k]]);\n    }\n    x += g.w + (i < chars.length - 1 ? GAP : 0);\n  });\n  return { segs, paths, width: Math.max(1, x) };\n}\n\nfunction segDist(px: number, py: number, [a, b]: [Pt, Pt]) {\n  const dx = b[0] - a[0];\n  const dy = b[1] - a[1];\n  const l2 = dx * dx + dy * dy;\n  const k =\n    l2 === 0\n      ? 0\n      : Math.max(0, Math.min(1, ((px - a[0]) * dx + (py - a[1]) * dy) / l2));\n  const ex = px - (a[0] + k * dx);\n  const ey = py - (a[1] + k * dy);\n  return Math.sqrt(ex * ex + ey * ey);\n}\n\nconst smooth = (a: number, b: number, x: number) => {\n  const k = Math.min(1, Math.max(0, (x - a) / (b - a)));\n  return k * k * (3 - 2 * k);\n};\n\nfunction hash(n: number) {\n  const s = Math.sin(n * 127.1 + 311.7) * 43758.5453;\n  return s - Math.floor(s);\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={17}\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\nexport function LineRelief({\n  word = \"LAUNCH\",\n  accent = \"#3B5BFD\",\n  speed = 1,\n  theme = \"dark\",\n}: LineReliefProps) {\n  const t = useCurrentFrame() * speed;\n  const { width, height } = useVideoConfig();\n  const u = height / 720;\n  const p = THEMES[theme];\n  const sky = p.sky.map(\n    ([o, c, k]) =>\n      [o, c === \"accent\" ? mix(p.sky[1][1], accent, k) : c] as const,\n  );\n  const id = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n\n  const left = width * 0.08;\n  const right = width * 0.92;\n  const top = height * 0.2;\n  const bottom = height * 0.84;\n  const fieldW = right - left;\n  const step = (bottom - top) / (LINES - 1);\n\n  const glyphs = useMemo(() => layoutWord(word), [word]);\n  const unit = Math.min((fieldW * 0.8) / glyphs.width, (height * 0.3) / 6);\n  const wordX = left + (fieldW - glyphs.width * unit) / 2;\n  const wordY = (top + bottom) / 2 - 3 * unit + step * 0.5;\n  const lift = step * 2.5;\n\n  const field = useMemo(() => {\n    const rows: number[][] = [];\n    for (let j = 0; j < LINES; j++) {\n      const gy = (top + j * step - wordY) / unit;\n      const row: number[] = [];\n      for (let i = 0; i <= SAMPLES; i++) {\n        const gx = (left + (fieldW * i) / SAMPLES - wordX) / unit;\n        let d = Number.POSITIVE_INFINITY;\n        if (gx > -2 && gx < glyphs.width + 2 && gy > -2 && gy < 8) {\n          for (const s of glyphs.segs) d = Math.min(d, segDist(gx, gy, s));\n        }\n        row.push(1 - smooth(0.05, 0.95, d));\n      }\n      rows.push(row);\n    }\n    return rows;\n  }, [glyphs, left, fieldW, top, step, unit, wordX, wordY]);\n\n  const settle = interpolate(t, SETTLE, [0, 1], { ...CLAMP, easing: EASE_IO });\n  const reveal = interpolate(t, REVEAL, [0, 1], { ...CLAMP, easing: EASE_OUT });\n  const enter = interpolate(t, [0, 12], [0.45, 1], {\n    ...CLAMP,\n    easing: EASE_OUT,\n  });\n  const sec = t / 30;\n\n  const lines = field.map((row, j) => {\n    const base = top + j * step;\n    const ring = Math.abs(j - (LINES - 1) / 2);\n    const reach = interpolate(t, [ring * 0.12, ring * 0.12 + 20], [0.2, 1], {\n      ...CLAMP,\n      easing: EASE_OUT,\n    });\n    let d = \"\";\n    let hi = \"\";\n    let inHi = false;\n    let maxLift = 0;\n    for (let i = 0; i <= SAMPLES; i++) {\n      const xn = i / SAMPLES;\n      if (xn > reach + 0.0001) continue;\n      const grow = interpolate(\n        t,\n        [GROW[0] + xn * SWEEP_DELAY, GROW[1] + xn * SWEEP_DELAY],\n        [0, 1],\n        {\n          ...CLAMP,\n          easing: EASE_RISE,\n        },\n      );\n      const h = row[i] * grow * (1 - settle);\n      maxLift = Math.max(maxLift, h);\n      const drift =\n        1.2 *\n          u *\n          Math.sin(xn * 19 + sec * 1.6 + j * 0.7 + hash(j) * 6) *\n          (1 - settle) +\n        0.8 * u * Math.sin(xn * 47 - sec * 2.3 + j * 1.3);\n      const y = base - lift * h - drift * (1 - h);\n      const pt = `${(left + xn * fieldW).toFixed(2)} ${y.toFixed(2)}`;\n      d += `${d ? \"L\" : \"M\"}${pt}`;\n      const on = row[i] > 0.015;\n      if (on) hi += `${inHi ? \"L\" : \"M\"}${pt}`;\n      inHi = on;\n    }\n    const x0 = left;\n    const x1 =\n      left +\n      Math.min(1, Math.floor(reach * SAMPLES + 0.0001) / SAMPLES) * fieldW;\n    return {\n      d,\n      fill: `${d} L${x1.toFixed(2)} ${(base + step * 0.6).toFixed(2)} L${x0.toFixed(2)} ${(base + step * 0.6).toFixed(2)} Z`,\n      hi,\n      maxLift,\n      j,\n    };\n  });\n\n  const wordPaths = glyphs.paths.map((path) =>\n    path\n      .map(\n        ([gx, gy], k) =>\n          `${k ? \"L\" : \"M\"}${(wordX + gx * unit).toFixed(2)} ${(wordY + gy * unit).toFixed(2)}`,\n      )\n      .join(\" \"),\n  );\n  const strokeW = STROKE * unit;\n  const wordShift = (1 - reveal) * -lift * 0.45;\n\n  return (\n    <AbsoluteFill style={{ background: p.bg, overflow: \"hidden\" }}>\n      <svg\n        width={width}\n        height={height}\n        style={{ position: \"absolute\", inset: 0 }}\n        aria-hidden\n      >\n        <defs>\n          <linearGradient\n            id={`${id}d`}\n            gradientUnits=\"userSpaceOnUse\"\n            x1={0}\n            y1={0}\n            x2={0}\n            y2={height}\n          >\n            {sky.map(([o, c]) => (\n              <stop key={o} offset={o} stopColor={c} />\n            ))}\n          </linearGradient>\n          <linearGradient id={`${id}e`} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"0\">\n            <stop offset=\"0\" stopColor=\"#fff\" stopOpacity={0} />\n            <stop offset=\"0.07\" stopColor=\"#fff\" stopOpacity={1} />\n            <stop offset=\"0.93\" stopColor=\"#fff\" stopOpacity={1} />\n            <stop offset=\"1\" stopColor=\"#fff\" stopOpacity={0} />\n          </linearGradient>\n          <mask\n            id={`${id}m`}\n            maskUnits=\"userSpaceOnUse\"\n            x={0}\n            y={0}\n            width={width}\n            height={height}\n          >\n            <rect\n              x={left}\n              y={0}\n              width={fieldW}\n              height={height}\n              fill={`url(#${id}e)`}\n            />\n            <g transform={`translate(0 ${wordShift})`} opacity={reveal}>\n              {wordPaths.map((d) => (\n                <path\n                  key={d}\n                  d={d}\n                  fill=\"none\"\n                  stroke=\"#000\"\n                  strokeWidth={strokeW + step * 1.3}\n                  strokeLinecap=\"round\"\n                  strokeLinejoin=\"round\"\n                />\n              ))}\n            </g>\n          </mask>\n        </defs>\n        <rect width={width} height={height} fill={`url(#${id}d)`} />\n        <g mask={`url(#${id}m)`} opacity={enter}>\n          {lines.map((l) => (\n            <g key={l.j}>\n              <path d={l.fill} fill={`url(#${id}d)`} />\n              <path\n                d={l.d}\n                fill=\"none\"\n                stroke={p.fg}\n                strokeOpacity={p.line}\n                strokeWidth={1.3 * u}\n                strokeLinejoin=\"round\"\n              />\n              {l.hi && l.maxLift > 0.001 && (\n                <path\n                  d={l.hi}\n                  fill=\"none\"\n                  stroke={p.fg}\n                  strokeOpacity={\n                    (p.lift - p.line) * Math.min(1, l.maxLift * 1.4)\n                  }\n                  strokeWidth={1.3 * u}\n                  strokeLinejoin=\"round\"\n                />\n              )}\n            </g>\n          ))}\n        </g>\n        <g\n          transform={`translate(0 ${wordShift})`}\n          opacity={reveal}\n          style={{ filter: `blur(${(1 - reveal) * 6 * u}px)` }}\n        >\n          {wordPaths.map((d) => (\n            <path\n              key={d}\n              d={d}\n              fill=\"none\"\n              stroke={p.fg}\n              strokeWidth={strokeW}\n              strokeLinecap=\"round\"\n              strokeLinejoin=\"round\"\n            />\n          ))}\n        </g>\n      </svg>\n\n      <AbsoluteFill\n        style={{\n          background: `radial-gradient(ellipse 80% 80% at 50% 50%, transparent 60%, ${p.bg} 100%)`,\n          opacity: 0.6,\n          pointerEvents: \"none\",\n        }}\n      />\n      <Grain opacity={p.grain} />\n    </AbsoluteFill>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/remocn/line-relief.tsx"
    }
  ],
  "type": "registry:component"
}
