{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pastel",
  "type": "registry:ui",
  "title": "Pastel",
  "description": "A self-contained soft-pastel theme preset — a generously rounded card with heading, body, stat, tag, and buttons in a low-contrast candy palette over a dreamy tinted gradient, with soft shadows, drifting color orbs, and optional grain. A keyboard-operable radiogroup of hue chips (Mint / Peach / Lavender / Sky) re-tokens the whole panel live; the orbs pin to a calm static pose under reduced motion.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://crucibleui.com/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/default/themes/pastel/pastel.tsx",
      "type": "registry:ui",
      "target": "components/crucible/pastel.tsx",
      "content": "\"use client\";\n\nimport { motion } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { useReducedMotion } from \"@/hooks/use-reduced-motion\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface PastelPalette {\n  /** Outer soft gradient — top stop. */\n  base: string;\n  /** Outer soft gradient — bottom stop. */\n  baseAlt: string;\n  /** Card surface fill. */\n  surface: string;\n  /** Nested surface (stat, input, chips) fill. */\n  surfaceSoft: string;\n  /** Primary accent — filled button, active chip, stat figure. */\n  primary: string;\n  /** Text/icon color that sits on `primary`. */\n  onPrimary: string;\n  /** Secondary accent — tints the second floating orb. */\n  accent: string;\n  /** Heading + body text. */\n  text: string;\n  /** Muted / secondary text. */\n  muted: string;\n  /** Hairline borders around the card and nested surfaces. */\n  border: string;\n}\n\nexport interface PastelPreset {\n  /** Stable id used for controlled selection and React keys. */\n  id: string;\n  /** Chip label shown in the switcher. */\n  label: string;\n  /** Token set applied when this preset is active. */\n  palette: PastelPalette;\n}\n\n/** Built-in hue families — a candy spread across cool + warm pastels. */\nconst PRESETS: PastelPreset[] = [\n  {\n    id: \"mint\",\n    label: \"Mint\",\n    palette: {\n      base: \"#eafbf3\",\n      baseAlt: \"#d6f3e8\",\n      surface: \"#f7fffb\",\n      surfaceSoft: \"#e9f9f1\",\n      primary: \"#4fd1a5\",\n      onPrimary: \"#ffffff\",\n      accent: \"#8fe0cd\",\n      text: \"#2f5d4f\",\n      muted: \"#6f9488\",\n      border: \"#cfeee1\",\n    },\n  },\n  {\n    id: \"peach\",\n    label: \"Peach\",\n    palette: {\n      base: \"#fff2ec\",\n      baseAlt: \"#ffe1d3\",\n      surface: \"#fff9f6\",\n      surfaceSoft: \"#ffece3\",\n      primary: \"#ff9e7d\",\n      onPrimary: \"#ffffff\",\n      accent: \"#ffc7a6\",\n      text: \"#6b3f34\",\n      muted: \"#a9776a\",\n      border: \"#ffd8c7\",\n    },\n  },\n  {\n    id: \"lavender\",\n    label: \"Lavender\",\n    palette: {\n      base: \"#f3effc\",\n      baseAlt: \"#e6ddfa\",\n      surface: \"#faf8ff\",\n      surfaceSoft: \"#efe9fc\",\n      primary: \"#a78bfa\",\n      onPrimary: \"#ffffff\",\n      accent: \"#c9b8fb\",\n      text: \"#4a3d6b\",\n      muted: \"#8073a6\",\n      border: \"#ded3f5\",\n    },\n  },\n  {\n    id: \"sky\",\n    label: \"Sky\",\n    palette: {\n      base: \"#ecf5ff\",\n      baseAlt: \"#d7eaff\",\n      surface: \"#f6fbff\",\n      surfaceSoft: \"#e6f2ff\",\n      primary: \"#6cb8f6\",\n      onPrimary: \"#ffffff\",\n      accent: \"#a3d3f9\",\n      text: \"#33506b\",\n      muted: \"#6f92ac\",\n      border: \"#cee6fb\",\n    },\n  },\n];\n\nexport interface PastelProps\n  extends Omit<React.ComponentPropsWithoutRef<\"section\">, \"onChange\"> {\n  /** Controlled active preset id (matches a preset's `id`). */\n  variant?: string;\n  /** Initial preset id when uncontrolled. @default \"mint\" (first preset) */\n  defaultVariant?: string;\n  /** Fires with the next preset id whenever the switcher changes. */\n  onVariantChange?: (id: string) => void;\n  /** Override the built-in preset set (chips + palettes). @default the four built-in hue families */\n  presets?: PastelPreset[];\n  /** Token overrides merged over the active preset — makes any palette reachable. */\n  colors?: Partial<PastelPalette>;\n  /** Orb-drift speed multiplier. @default 1 */\n  speed?: number;\n  /** Floating-orb opacity/presence multiplier. @default 1 */\n  intensity?: number;\n  /** Freeze the orbs at their resting pose. @default false */\n  paused?: boolean;\n  /** Subtle film grain over the card. @default true */\n  grain?: boolean;\n  /** Small pill above the heading. @default \"Just for you\" */\n  tagline?: string;\n  /** Rounded display heading. @default \"Sweet spot\" */\n  heading?: string;\n  /** Body line under the heading. @default \"Soft surfaces, gentle color. Pick a hue.\" */\n  description?: string;\n  /** Stat figure. @default \"24\" */\n  statValue?: string;\n  /** Stat unit / label. @default \"day streak\" */\n  statLabel?: string;\n  /** Small outline tag. @default \"cozy\" */\n  tag?: string;\n  /** Filled button label. @default \"Get started\" */\n  primaryLabel?: string;\n  /** Soft button label. @default \"Maybe later\" */\n  secondaryLabel?: string;\n  /** Accessible label for the panel region. @default \"Soft pastel theme preset\" */\n  label?: string;\n  /** Accessible label for the switcher group. @default \"Hue family\" */\n  switcherLabel?: string;\n}\n\ninterface Orb {\n  left: number;\n  top: number;\n  size: number;\n  hue: \"primary\" | \"accent\";\n  dx: number;\n  dy: number;\n  dur: number;\n  delay: number;\n}\n\n/** Deterministic PRNG so the orb scatter matches on server and client. */\nfunction mulberry32(seed: number): () => number {\n  let a = seed >>> 0;\n  return () => {\n    a |= 0;\n    a = (a + 0x6d2b79f5) | 0;\n    let t = Math.imul(a ^ (a >>> 15), 1 | a);\n    t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n  };\n}\n\n/** Tiny fractal-noise tile for the optional grain — static, so SSR-safe. */\nconst GRAIN_URL =\n  \"url(\\\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\\\")\";\n\n/**\n * Pastel — a self-contained soft-pastel theme preset. A generously rounded card\n * with a heading, body, stat, tag, and two buttons, painted in a low-contrast\n * candy palette over a dreamy tinted gradient, with soft shadows and a couple of\n * gently drifting color orbs behind the content. A keyboard-operable radiogroup\n * of hue chips (Mint / Peach / Lavender / Sky) re-tokens the whole panel live;\n * the palette is fully exposed via `presets` and `colors`. Reduced motion (and\n * `paused`) pins the orbs to a calm static pose — no drift, never a blank frame.\n */\nexport function Pastel({\n  variant,\n  defaultVariant,\n  onVariantChange,\n  presets,\n  colors,\n  speed = 1,\n  intensity = 1,\n  paused = false,\n  grain = true,\n  tagline = \"Just for you\",\n  heading = \"Sweet spot\",\n  description = \"Soft surfaces, gentle color. Pick a hue.\",\n  statValue = \"24\",\n  statLabel = \"day streak\",\n  tag = \"cozy\",\n  primaryLabel = \"Get started\",\n  secondaryLabel = \"Maybe later\",\n  label = \"Soft pastel theme preset\",\n  switcherLabel = \"Hue family\",\n  className,\n  style,\n  ...rest\n}: PastelProps) {\n  const reducedMotion = useReducedMotion();\n\n  const list = presets && presets.length > 0 ? presets : PRESETS;\n  const isControlled = variant !== undefined;\n  const [internal, setInternal] = React.useState(defaultVariant ?? list[0].id);\n  const activeId = isControlled ? variant : internal;\n  const active = list.find((p) => p.id === activeId) ?? list[0];\n  const t: PastelPalette = { ...active.palette, ...colors };\n\n  const spd = Math.max(0.1, speed);\n  const amt = Math.max(0, intensity);\n  const still = reducedMotion || paused;\n\n  const orbs = React.useMemo<Orb[]>(() => {\n    const rnd = mulberry32(0x9a57);\n    return [\n      { hue: \"primary\" as const, base: 0 },\n      { hue: \"accent\" as const, base: 1 },\n      { hue: \"primary\" as const, base: 2 },\n    ].map(({ hue }) => ({\n      hue,\n      left: 8 + rnd() * 64,\n      top: 6 + rnd() * 60,\n      size: 120 + rnd() * 90,\n      dx: (rnd() * 2 - 1) * 22,\n      dy: (rnd() * 2 - 1) * 18,\n      dur: 9 + rnd() * 6,\n      delay: rnd() * 2.5,\n    }));\n  }, []);\n\n  const activeIdx = Math.max(\n    0,\n    list.findIndex((p) => p.id === activeId)\n  );\n  const chipRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n  const select = React.useCallback(\n    (i: number) => {\n      const next = list[i];\n      if (!next) return;\n      if (!isControlled) setInternal(next.id);\n      onVariantChange?.(next.id);\n    },\n    [list, isControlled, onVariantChange]\n  );\n\n  const onSwitcherKey = React.useCallback(\n    (e: React.KeyboardEvent<HTMLDivElement>) => {\n      let next = activeIdx;\n      switch (e.key) {\n        case \"ArrowRight\":\n        case \"ArrowDown\":\n          next = (activeIdx + 1) % list.length;\n          break;\n        case \"ArrowLeft\":\n        case \"ArrowUp\":\n          next = (activeIdx - 1 + list.length) % list.length;\n          break;\n        case \"Home\":\n          next = 0;\n          break;\n        case \"End\":\n          next = list.length - 1;\n          break;\n        default:\n          return;\n      }\n      e.preventDefault();\n      select(next);\n      chipRefs.current[next]?.focus();\n    },\n    [activeIdx, list, select]\n  );\n\n  const vars = {\n    \"--pp\": t.primary,\n    \"--pon\": t.onPrimary,\n    \"--pacc\": t.accent,\n    \"--psurface\": t.surface,\n    \"--psoft\": t.surfaceSoft,\n    \"--ptext\": t.text,\n    \"--pmuted\": t.muted,\n    \"--pborder\": t.border,\n    background: `linear-gradient(160deg, ${t.base} 0%, ${t.baseAlt} 100%)`,\n  } as React.CSSProperties;\n\n  const focusRing =\n    \"outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--pp)] focus-visible:ring-offset-2 focus-visible:ring-offset-[color:var(--psurface)]\";\n\n  return (\n    <section\n      aria-label={label}\n      data-crucible=\"pastel\"\n      data-variant={active.id}\n      className={cn(\"relative isolate w-full max-w-sm\", className)}\n      style={style}\n      {...rest}\n    >\n      <div\n        className=\"relative isolate flex w-full flex-col overflow-hidden rounded-3xl p-1.5\"\n        style={{\n          ...vars,\n          boxShadow:\n            \"0 1px 2px rgba(60,50,90,0.06), 0 18px 40px -18px rgba(80,70,120,0.35)\",\n        }}\n      >\n        {/* Drifting soft orbs — decorative. */}\n        <div aria-hidden className=\"pointer-events-none absolute inset-0 z-0\">\n          {orbs.map((o, i) => (\n            <motion.span\n              key={`orb-${i}`}\n              className=\"absolute rounded-full\"\n              style={{\n                left: `${o.left}%`,\n                top: `${o.top}%`,\n                width: o.size,\n                height: o.size,\n                background: `radial-gradient(circle at 40% 38%, ${\n                  o.hue === \"primary\" ? \"var(--pp)\" : \"var(--pacc)\"\n                }, transparent 68%)`,\n                opacity: Math.min(1, 0.5 * amt),\n                filter: \"blur(26px)\",\n              }}\n              animate={\n                still\n                  ? { x: 0, y: 0 }\n                  : { x: [0, o.dx, 0], y: [0, o.dy, 0] }\n              }\n              transition={\n                still\n                  ? { duration: 0 }\n                  : {\n                      duration: o.dur / spd,\n                      delay: o.delay,\n                      repeat: Infinity,\n                      ease: \"easeInOut\",\n                    }\n              }\n            />\n          ))}\n        </div>\n\n        {/* Card surface. */}\n        <div\n          className=\"relative z-10 flex flex-col gap-4 rounded-[1.15rem] p-5\"\n          style={{\n            background: \"color-mix(in srgb, var(--psurface) 82%, transparent)\",\n            border: \"1px solid var(--pborder)\",\n            boxShadow: \"inset 0 1px 0 rgba(255,255,255,0.7)\",\n            backdropFilter: \"blur(6px)\",\n            WebkitBackdropFilter: \"blur(6px)\",\n          }}\n        >\n          <div className=\"flex flex-col gap-2\">\n            <span\n              className=\"w-fit rounded-full px-2.5 py-0.5 text-[0.65rem] font-semibold\"\n              style={{\n                background: \"var(--psoft)\",\n                color: \"var(--pp)\",\n                border: \"1px solid var(--pborder)\",\n              }}\n            >\n              {tagline}\n            </span>\n            <h3\n              className=\"text-2xl font-bold leading-tight tracking-tight\"\n              style={{ color: \"var(--ptext)\" }}\n            >\n              {heading}\n            </h3>\n            <p\n              className=\"text-sm leading-relaxed\"\n              style={{ color: \"var(--pmuted)\" }}\n            >\n              {description}\n            </p>\n          </div>\n\n          {/* Stat + tag */}\n          <div className=\"flex items-center gap-3\">\n            <div\n              className=\"flex items-baseline gap-1.5 rounded-2xl px-3 py-2\"\n              style={{\n                background: \"var(--psoft)\",\n                border: \"1px solid var(--pborder)\",\n              }}\n            >\n              <span\n                className=\"text-2xl font-bold tabular-nums\"\n                style={{ color: \"var(--pp)\" }}\n              >\n                {statValue}\n              </span>\n              <span\n                className=\"text-[0.7rem] font-medium\"\n                style={{ color: \"var(--pmuted)\" }}\n              >\n                {statLabel}\n              </span>\n            </div>\n            <span\n              className=\"ml-auto rounded-full px-3 py-1 text-xs font-semibold\"\n              style={{\n                color: \"var(--pp)\",\n                border: \"1px solid color-mix(in srgb, var(--pp) 45%, transparent)\",\n              }}\n            >\n              {tag}\n            </span>\n          </div>\n\n          {/* Buttons */}\n          <div className=\"flex gap-2.5\">\n            <button\n              type=\"button\"\n              className={cn(\n                \"rounded-2xl px-4 py-2.5 text-sm font-semibold transition-transform active:scale-[0.97]\",\n                focusRing\n              )}\n              style={{\n                background: \"var(--pp)\",\n                color: \"var(--pon)\",\n                boxShadow:\n                  \"0 8px 18px -8px color-mix(in srgb, var(--pp) 75%, transparent)\",\n              }}\n            >\n              {primaryLabel}\n            </button>\n            <button\n              type=\"button\"\n              className={cn(\n                \"rounded-2xl px-4 py-2.5 text-sm font-semibold transition-colors active:scale-[0.97]\",\n                focusRing\n              )}\n              style={{\n                background: \"var(--psoft)\",\n                color: \"var(--ptext)\",\n                border: \"1px solid var(--pborder)\",\n              }}\n            >\n              {secondaryLabel}\n            </button>\n          </div>\n\n          {/* Hue switcher — a real radiogroup with roving focus. */}\n          <div\n            role=\"radiogroup\"\n            aria-label={switcherLabel}\n            onKeyDown={onSwitcherKey}\n            className=\"mt-0.5 flex flex-wrap gap-2\"\n          >\n            {list.map((p, i) => {\n              const selected = p.id === active.id;\n              return (\n                <button\n                  key={p.id}\n                  ref={(el) => {\n                    chipRefs.current[i] = el;\n                  }}\n                  type=\"button\"\n                  role=\"radio\"\n                  aria-checked={selected}\n                  tabIndex={selected ? 0 : -1}\n                  onClick={() => select(i)}\n                  className={cn(\n                    \"flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-semibold transition-transform active:scale-[0.97]\",\n                    focusRing\n                  )}\n                  style={\n                    selected\n                      ? {\n                          background: \"var(--pp)\",\n                          color: \"var(--pon)\",\n                          boxShadow:\n                            \"0 4px 12px -4px color-mix(in srgb, var(--pp) 70%, transparent)\",\n                        }\n                      : {\n                          background: \"var(--psoft)\",\n                          color: \"var(--pmuted)\",\n                          border: \"1px solid var(--pborder)\",\n                        }\n                  }\n                >\n                  <span\n                    aria-hidden\n                    className=\"h-2 w-2 rounded-full\"\n                    style={{\n                      background: p.palette.primary,\n                      boxShadow: selected\n                        ? \"0 0 0 2px rgba(255,255,255,0.65)\"\n                        : \"none\",\n                    }}\n                  />\n                  {p.label}\n                </button>\n              );\n            })}\n          </div>\n        </div>\n\n        {/* Optional film grain over the whole card. */}\n        {grain && (\n          <div\n            aria-hidden\n            className=\"pointer-events-none absolute inset-0 z-20 rounded-3xl mix-blend-soft-light\"\n            style={{ backgroundImage: GRAIN_URL, opacity: 0.05 }}\n          />\n        )}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}