# Integrate `BlueprintCard` from Motion Garden

You are helping me add the **BlueprintCard** component to an existing project.
Everything you need is below — full source, dependencies, props and the
behavioural contract. Read it all before writing anything.

- **Component:** BlueprintCard
- **Category:** Micro-interactions
- **Summary:** A technical-drawing card. Dashed envelope, accent rules, corner nodes, and a soft glow that draw in on mount.
- **Reference:** https://motion-garden.netlify.app/components/blueprint-card
- **Full catalog (for you, the agent):** https://motion-garden.netlify.app/llms.txt

## Stack this source assumes

- React 19 with the Next.js App Router (never the `pages/` directory)
- TypeScript, strict
- Tailwind CSS v4, CSS-first config (utilities are inline; no `tailwind.config` needed)

If my project differs, adapt the integration — but do not rewrite the animation math to suit a different stack. Ask me first.

## Dependencies

```bash
bun add clsx tailwind-merge
```

## Design tokens this source uses

Some classes in the source are Motion Garden theme tokens, not stock Tailwind (`text-ink`, `bg-panel`, `font-display` and the like). Without them, parts of the component render unstyled. Add this to my global CSS, after the Tailwind import:

```css
@theme inline {
  --color-panel: var(--sg-panel);
}

:root {
  --sg-panel: #ffffff;
}

.dark {
  --sg-panel: #101215;
}
```

The values are Motion Garden's own light and dark themes. If my project already has tokens for these roles, point the `--sg-*` variables at mine instead and tell me which you mapped. `.dark` assumes class-based dark mode — adapt the selector to how my project switches themes.

## Files to create

2 files — all of them are required. Paths are as shipped; the component may live anywhere in my project, but keep every peer file at the exact path shown so the import aliases resolve.

### 1. `components/registry/blueprint-card/blueprint-card.tsx`

```tsx
"use client";

import { useEffect, useState } from "react";
import { cn } from "@/lib/utils";

export interface BlueprintCardProps {
	accentColor?: string;
	dashed?: boolean;
	dotSize?: number;
	glowIntensity?: number;
	animated?: boolean;
	duration?: number;
	reducedMotion?: boolean;
	className?: string;
	children: React.ReactNode;
}

const INSET = 16;

const DOT_POSITIONS: [string, string][] = [
	[`${INSET}px`, `${INSET}px`],
	[`calc(100% - ${INSET}px)`, `${INSET}px`],
	[`${INSET}px`, `calc(100% - ${INSET}px)`],
	[`calc(100% - ${INSET}px)`, `calc(100% - ${INSET}px)`],
];

export default function BlueprintCard({
	accentColor = "#a855f7",
	dashed = true,
	dotSize = 4,
	glowIntensity = 0.15,
	animated = true,
	duration = 0.6,
	reducedMotion = false,
	className,
	children,
}: BlueprintCardProps) {
	const skip = !animated || reducedMotion;
	const [drawn, setDrawn] = useState(skip);

	useEffect(() => {
		if (skip) {
			setDrawn(true);
			return;
		}
		const raf = requestAnimationFrame(() => setDrawn(true));
		return () => cancelAnimationFrame(raf);
	}, [skip]);

	const line = `color-mix(in srgb, ${accentColor} 90%, transparent)`;
	const ease = "cubic-bezier(0.22, 0.61, 0.36, 1)";
	const transition = (prop: string, delay: number) =>
		skip ? undefined : `${prop} ${duration}s ${ease} ${delay}s`;

	return (
		<div
			className={cn("relative backdrop-blur-md", className)}
			style={{
				border: `1px ${dashed ? "dashed" : "solid"} color-mix(in srgb, ${accentColor} 35%, transparent)`,
				background: `color-mix(in srgb, ${accentColor} 4%, transparent)`,
			}}
		>
			{(["top", "bottom"] as const).map((edge, i) => (
				<div
					key={edge}
					className="absolute inset-x-0 h-px"
					style={{
						[edge]: INSET,
						background: line,
						transformOrigin: i === 0 ? "left" : "right",
						transform: `scaleX(${drawn ? 1 : 0})`,
						transition: transition("transform", 0.1),
					}}
				/>
			))}
			{(["left", "right"] as const).map((edge) => (
				<div
					key={edge}
					className="absolute inset-y-0 w-px"
					style={{
						[edge]: INSET,
						background: line,
						transformOrigin: "top",
						transform: `scaleY(${drawn ? 1 : 0})`,
						transition: transition("transform", 0.25),
					}}
				/>
			))}
			{DOT_POSITIONS.map(([left, top], i) => (
				<span
					key={i}
					className="absolute rounded-full"
					style={{
						left,
						top,
						width: dotSize,
						height: dotSize,
						marginLeft: -dotSize / 2,
						marginTop: -dotSize / 2,
						background: accentColor,
						boxShadow: `0 0 0 ${Math.max(4, dotSize * 1.5)}px var(--sg-panel, #101014)`,
						transform: `scale(${drawn ? 1 : 0})`,
						transition: transition("transform", 0.45 + i * 0.08),
					}}
				/>
			))}
			<div
				className="pointer-events-none absolute inset-0 blur-sm"
				style={{
					background: `linear-gradient(to bottom, transparent 55%, color-mix(in srgb, ${accentColor} ${glowIntensity * 100}%, transparent))`,
					opacity: drawn ? 1 : 0,
					transition: transition("opacity", 0.6),
				}}
			/>
			<div
				className="relative z-10"
				style={{
					padding: INSET * 2,
					opacity: drawn ? 1 : 0,
					transition: transition("opacity", 0.4),
				}}
			>
				{children}
			</div>
		</div>
	);
}
```

### 2. `lib/utils.ts` — peer util, required

```tsx
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}
```


## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `accentColor` | `string (hex)` | `"#a855f7"` | Accent color for the frame, nodes, and glow. |
| `dashed` | `boolean` | `true` | Dashed outer border; solid when off. |
| `dotSize` | `number` | `4` | Diameter of the corner nodes. Range 2–10 px. |
| `glowIntensity` | `number` | `0.15` | Strength of the bottom gradient glow. Range 0–0.5. |
| `animated` | `boolean` | `true` | Draw the frame in on mount. |
| `duration` | `number` | `0.6` | Draw-in animation duration. Range 0.2–5 s. Ignored while `animated` is `false`. |

## Usage

```tsx
import BlueprintCard from "@/components/registry/blueprint-card/blueprint-card";

<BlueprintCard
  accentColor="#a855f7"
  dashed={true}
  dotSize={4}
  glowIntensity={0.15}
  animated={true}
  duration={0.6}
/>
```

The import path matches the file path above; change it if you move the component. Every value shown is the documented default — pass only what you actually want to change. The snippet lists the tunable props only: if the component's props type in the source requires others (content, handlers, data), pass those too.

## Integration rules

- Keep the `"use client"` directive. This is a client component and will not render as a Server Component.
- It fills its parent. Give the wrapper an explicit height (or a definite grid area) — against a height-auto parent it collapses to nothing.
- It takes a `reducedMotion` prop and quiesces when true. Wire it to a `prefers-reduced-motion` listener rather than hardcoding `false`.
- `lib/utils.ts` is required, not optional. It exports the `cn` helper the component imports from `@/lib/utils` — keep it at that path, or rewrite every `cn` import to wherever you already keep yours. If your project is shadcn-based you almost certainly have this file already; keep yours and drop mine.

## Your task

1. Tell me where in my project this should live and why.
2. Create the files above verbatim.
3. Add the design tokens to my global CSS, or map them to tokens I already have.
4. Wire the component into the place I point you at, with sensible props for that context.
5. Flag anything in my setup that conflicts with the stack assumptions above.

Do not restyle the component or alter the animation math unless I ask.
