{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "frieze",
  "type": "registry:ui",
  "title": "Frieze",
  "description": "A calm, always-on brand marquee / logo cloud. Loops horizontally or vertically, reversible, with gradient edge-fade masks, a hairline baseline, an optional 3D-perspective tilt, and per-mark lift-on-hover. Pure CSS at constant velocity, pause-on-hover.",
  "dependencies": [],
  "registryDependencies": [
    "https://crucibleui.com/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/default/utility/frieze/frieze.tsx",
      "type": "registry:ui",
      "target": "components/crucible/frieze.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { useReducedMotion } from \"@/hooks/use-reduced-motion\";\n\nexport interface FriezeProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\"> {\n  /**\n   * The marks to display — logos, wordmarks, SVG glyphs, anything. Each direct\n   * child becomes one lift-on-hover item. The set is duplicated internally for\n   * a seamless loop; only the first copy is exposed to assistive tech.\n   */\n  children: React.ReactNode;\n  /** Loop axis. @default \"horizontal\" */\n  orientation?: \"horizontal\" | \"vertical\";\n  /** Reverse the travel direction (right / down instead of left / up). @default false */\n  reverse?: boolean;\n  /**\n   * Travel speed in pixels per second — held constant regardless of content\n   * length or viewport size (duration is derived from the measured track).\n   * @default 40\n   */\n  speed?: number;\n  /** Space between marks, in pixels. @default 48 */\n  gap?: number;\n  /** Halt the strip while it (or one of its marks) is hovered/focused. @default true */\n  pauseOnHover?: boolean;\n  /** Width of the gradient edge-fade masks, in pixels, so marks dissolve at the boundary. @default 64 */\n  fade?: number;\n  /**\n   * Copies of the children set laid end to end within one looping half. Bump\n   * it when the mark set is too short to fill the viewport. @default 2\n   */\n  repeat?: number;\n  /** Angle the strip in 3D space for a receding logo-wall look. @default false */\n  perspective?: boolean;\n  /** Tilt angle in degrees when `perspective` is on. @default 18 */\n  tilt?: number;\n  /** Resting opacity of each mark before it lifts to full on hover. @default 0.55 */\n  restOpacity?: number;\n  /** Draw the hairline architectural baseline that grounds the strip. @default true */\n  baseline?: boolean;\n}\n\nconst PERSPECTIVE_DISTANCE = 1400;\n\nconst STYLES = `\n@keyframes crucible-frieze-x { to { transform: translateX(calc(-50% - var(--frieze-gap, 0px) / 2)); } }\n@keyframes crucible-frieze-y { to { transform: translateY(calc(-50% - var(--frieze-gap, 0px) / 2)); } }\n[data-crucible=\"frieze\"] .frieze-track {\n  animation-name: var(--frieze-name);\n  animation-duration: var(--frieze-duration, 40s);\n  animation-timing-function: linear;\n  animation-iteration-count: infinite;\n  animation-direction: var(--frieze-dir, normal);\n}\n[data-crucible=\"frieze\"][data-paused=\"true\"] .frieze-track { animation-play-state: paused; }\n[data-crucible=\"frieze\"][data-pause-on-hover=\"true\"]:hover .frieze-track,\n[data-crucible=\"frieze\"][data-pause-on-hover=\"true\"]:focus-within .frieze-track { animation-play-state: paused; }\n[data-crucible=\"frieze\"] .frieze-item {\n  opacity: var(--frieze-rest, 0.55);\n  transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;\n}\n[data-crucible=\"frieze\"] .frieze-item:hover,\n[data-crucible=\"frieze\"] .frieze-item:focus-within {\n  opacity: 1;\n  transform: scale(1.05);\n}\n@media (prefers-reduced-motion: reduce) {\n  [data-crucible=\"frieze\"] .frieze-track { animation: none !important; }\n}\n`;\n\n/**\n * Frieze — the calm, always-on brand marquee every landing page needs: a\n * logo cloud that loops horizontally or vertically, reversible, with gradient\n * edge-fade masks so marks dissolve at the boundary and a hairline baseline\n * grounding the strip like an architectural frieze.\n *\n * Crucible signature: marks ride at a hushed reduced opacity and an individual\n * item lifts to full presence on hover (never the whole strip), the loop halts\n * on hover/focus so a mark can be caught, and an optional 3D-perspective tilt\n * angles the whole plane in space. Pure CSS transform loop at a constant\n * pixels-per-second velocity — distinct from a velocity-reactive marquee.\n * Pauses offscreen and on hidden tabs; under reduced motion it freezes to a\n * static, fully-legible wrapped row.\n */\nexport function Frieze({\n  children,\n  orientation = \"horizontal\",\n  reverse = false,\n  speed = 40,\n  gap = 48,\n  pauseOnHover = true,\n  fade = 64,\n  repeat = 2,\n  perspective = false,\n  tilt = 18,\n  restOpacity = 0.55,\n  baseline = true,\n  className,\n  style,\n  ...props\n}: FriezeProps) {\n  const reducedMotion = useReducedMotion();\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const trackRef = React.useRef<HTMLUListElement>(null);\n  const [duration, setDuration] = React.useState<number | null>(null);\n  const [active, setActive] = React.useState(true);\n\n  const isHorizontal = orientation === \"horizontal\";\n  const items = React.Children.toArray(children);\n  const safeRepeat = Math.max(1, Math.floor(repeat));\n\n  // Pause the CSS loop when scrolled out of view or the tab is hidden — a\n  // paused animation resumes from the same frame, so there is never a jump.\n  React.useEffect(() => {\n    const el = rootRef.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") return;\n    let inView = true;\n    let tabVisible = !document.hidden;\n    const update = () => setActive(inView && tabVisible);\n    const io = new IntersectionObserver(\n      ([entry]) => {\n        inView = entry.isIntersecting;\n        update();\n      },\n      { threshold: 0 }\n    );\n    io.observe(el);\n    const onVisibility = () => {\n      tabVisible = !document.hidden;\n      update();\n    };\n    document.addEventListener(\"visibilitychange\", onVisibility);\n    return () => {\n      io.disconnect();\n      document.removeEventListener(\"visibilitychange\", onVisibility);\n    };\n  }, []);\n\n  // Derive the loop duration from the measured track so velocity stays constant\n  // regardless of how much content is present. Not a rAF loop — the observer is\n  // idle until a resize, and tears down on unmount.\n  React.useEffect(() => {\n    const track = trackRef.current;\n    if (!track) return;\n    const measure = () => {\n      const total = isHorizontal ? track.scrollWidth : track.scrollHeight;\n      // One looping half advances by (total + gap) / 2; time = distance / speed.\n      const advance = (total + gap) / 2;\n      const next = speed > 0 ? advance / speed : 0;\n      setDuration(next > 0 ? next : null);\n    };\n    measure();\n    const ro = new ResizeObserver(measure);\n    ro.observe(track);\n    return () => ro.disconnect();\n  }, [isHorizontal, gap, speed, safeRepeat, children]);\n\n  // Static, legible frame for reduced-motion users: a wrapped, full-opacity row.\n  if (reducedMotion) {\n    return (\n      <div\n        ref={rootRef}\n        data-crucible=\"frieze\"\n        className={cn(\"relative\", isHorizontal ? \"w-full\" : \"h-full\", className)}\n        style={style}\n        {...props}\n      >\n        <style>{STYLES}</style>\n        <ul\n          className=\"m-0 flex list-none flex-wrap items-center justify-center p-0\"\n          style={{ gap: `${gap}px` }}\n        >\n          {items.map((node, i) => (\n            <li key={i} className=\"flex shrink-0 items-center justify-center\">\n              {node}\n            </li>\n          ))}\n        </ul>\n        {baseline && (\n          <div\n            aria-hidden\n            className=\"pointer-events-none absolute inset-x-0 bottom-0 h-px\"\n            style={{\n              background:\n                \"linear-gradient(to right, transparent, rgba(255,255,255,0.18), transparent)\",\n            }}\n          />\n        )}\n      </div>\n    );\n  }\n\n  const perHalf = items.length * safeRepeat;\n  const all = Array.from({ length: perHalf * 2 }, (_, i) => items[i % items.length]);\n\n  const maskImage = isHorizontal\n    ? `linear-gradient(to right, transparent 0, #000 ${fade}px, #000 calc(100% - ${fade}px), transparent 100%)`\n    : `linear-gradient(to bottom, transparent 0, #000 ${fade}px, #000 calc(100% - ${fade}px), transparent 100%)`;\n\n  const viewportTransform = perspective\n    ? isHorizontal\n      ? `rotateY(${tilt}deg)`\n      : `rotateX(${tilt}deg)`\n    : undefined;\n\n  const trackStyle = {\n    \"--frieze-name\": isHorizontal ? \"crucible-frieze-x\" : \"crucible-frieze-y\",\n    \"--frieze-dir\": reverse ? \"reverse\" : \"normal\",\n    \"--frieze-gap\": `${gap}px`,\n    \"--frieze-rest\": String(restOpacity),\n    ...(duration ? { \"--frieze-duration\": `${duration}s` } : null),\n    gap: `${gap}px`,\n  } as React.CSSProperties;\n\n  // The edge-fade mask lives on the static viewport, not the moving track — a\n  // mask on the track would travel with it and fade the track's own ends\n  // instead of the strip's boundary.\n  const viewportStyle: React.CSSProperties = {\n    maskImage,\n    WebkitMaskImage: maskImage,\n    ...(viewportTransform ? { transform: viewportTransform } : null),\n  };\n\n  return (\n    <div\n      ref={rootRef}\n      data-crucible=\"frieze\"\n      data-paused={!active}\n      data-pause-on-hover={pauseOnHover}\n      className={cn(\"relative\", isHorizontal ? \"w-full\" : \"h-full\", className)}\n      style={perspective ? { perspective: `${PERSPECTIVE_DISTANCE}px`, ...style } : style}\n      {...props}\n    >\n      <style>{STYLES}</style>\n      <div\n        className={cn(\n          \"relative overflow-hidden\",\n          isHorizontal ? \"w-full\" : \"h-full\"\n        )}\n        style={viewportStyle}\n      >\n        <ul\n          ref={trackRef}\n          className={cn(\n            \"frieze-track m-0 flex list-none p-0 will-change-transform\",\n            isHorizontal ? \"w-max flex-row items-center\" : \"h-max flex-col items-center\"\n          )}\n          style={trackStyle}\n        >\n          {all.map((node, i) => (\n            <li\n              key={i}\n              aria-hidden={i >= items.length || undefined}\n              // Loop copies are presentation only: keep any links inside them\n              // out of the tab order as well as the accessibility tree.\n              inert={i >= items.length || undefined}\n              className=\"frieze-item flex shrink-0 items-center justify-center\"\n            >\n              {node}\n            </li>\n          ))}\n        </ul>\n        {baseline && (\n          <div\n            aria-hidden\n            className={cn(\n              \"pointer-events-none absolute\",\n              isHorizontal ? \"inset-x-0 bottom-0 h-px\" : \"inset-y-0 left-0 w-px\"\n            )}\n            style={{\n              background: isHorizontal\n                ? \"linear-gradient(to right, transparent, rgba(255,255,255,0.18), transparent)\"\n                : \"linear-gradient(to bottom, transparent, rgba(255,255,255,0.18), transparent)\",\n            }}\n          />\n        )}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}