{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "brutal",
  "type": "registry:ui",
  "title": "Brutal",
  "description": "A self-contained neo-brutalist theme preset — a flat white card with hard 3px black borders, a solid blur-free offset drop-shadow, chunky mono type, a loud accent block, a stat, a rotated corner sticker, and two buttons. Interactive blocks do the classic brutalist nudge toward their shadow on hover and press. A keyboard-operable radiogroup of accent swatches re-tokens the whole panel live; the palette is fully exposed via presets and colors. Pure CSS — reduced motion pins every block to its raised resting pose.",
  "dependencies": [],
  "registryDependencies": [
    "https://crucibleui.com/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/default/themes/brutal/brutal.tsx",
      "type": "registry:ui",
      "target": "components/crucible/brutal.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { useReducedMotion } from \"@/hooks/use-reduced-motion\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface BrutalPalette {\n  /** Card surface — the flat block everything sits on. */\n  surface: string;\n  /** Panel backdrop behind the card (the mat). */\n  base: string;\n  /** Foreground text (near-black by default). */\n  text: string;\n  /** Muted / secondary text. */\n  muted: string;\n  /** Hard border + drop-shadow color — pure black in classic brutalism. */\n  ink: string;\n  /** The loud accent — filled blocks, primary button, active chip. */\n  accent: string;\n  /** Text/ink drawn on top of the accent (kept high-contrast). */\n  accentText: string;\n}\n\nexport interface BrutalPreset {\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: BrutalPalette;\n}\n\n/** Near-black ink shared by every built-in preset. */\nconst INK = \"#111111\";\n\n/** Loud accents on a white block with black ink — swap the whole vibe with one chip. */\nconst PRESETS: BrutalPreset[] = [\n  {\n    id: \"acid\",\n    label: \"Acid\",\n    palette: {\n      surface: \"#ffffff\",\n      base: \"#f4f1e6\",\n      text: INK,\n      muted: \"#5b5b52\",\n      ink: INK,\n      accent: \"#ffde17\",\n      accentText: INK,\n    },\n  },\n  {\n    id: \"bubble\",\n    label: \"Bubble\",\n    palette: {\n      surface: \"#ffffff\",\n      base: \"#ffe9f3\",\n      text: INK,\n      muted: \"#6b5560\",\n      ink: INK,\n      accent: \"#ff4d97\",\n      accentText: \"#ffffff\",\n    },\n  },\n  {\n    id: \"volt\",\n    label: \"Volt\",\n    palette: {\n      surface: \"#ffffff\",\n      base: \"#e2f6fb\",\n      text: INK,\n      muted: \"#4d5f63\",\n      ink: INK,\n      accent: \"#22d3ee\",\n      accentText: INK,\n    },\n  },\n];\n\nexport interface BrutalProps\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 \"acid\" (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 three built-in accents */\n  presets?: BrutalPreset[];\n  /** Token overrides merged over the active preset — makes any palette reachable. */\n  colors?: Partial<BrutalPalette>;\n  /** Drop-shadow offset in px — the depth of the block. @default 6 */\n  offset?: number;\n  /** Border / shadow thickness in px. @default 3 */\n  border?: number;\n  /** Freeze the tactile press-nudge (also auto-frozen under reduced motion). @default false */\n  paused?: boolean;\n  /** Small mono kicker above the heading. @default \"NO. 03 / SERIES\" */\n  kicker?: string;\n  /** Chunky display heading. @default \"PRESS HARD\" */\n  heading?: string;\n  /** Body line under the heading. @default \"Hard edges, honest shadows. Pick your loud.\" */\n  description?: string;\n  /** Big stat figure. @default \"24\" */\n  statValue?: string;\n  /** Stat unit / label. @default \"SHIPS / DAY\" */\n  statLabel?: string;\n  /** Small corner sticker text. @default \"NEW\" */\n  sticker?: string;\n  /** Filled (accent) button label. @default \"Get it\" */\n  primaryLabel?: string;\n  /** Outline (white) button label. @default \"Later\" */\n  secondaryLabel?: string;\n  /** Accessible label for the panel region. @default \"Neo-brutalist theme preset\" */\n  label?: string;\n  /** Accessible label for the switcher group. @default \"Accent\" */\n  switcherLabel?: string;\n}\n\n/**\n * Brutal — a self-contained neo-brutalist theme preset. A flat white card with\n * hard 3px black borders and a solid, blur-free offset drop-shadow, chunky mono\n * type, a loud accent block, a stat, a rotated corner sticker, and two buttons.\n * Interactive elements do the classic brutalist nudge on hover/press — they\n * shift toward their shadow until they sit flush. A keyboard-operable radiogroup\n * of accent chips re-tokens the whole panel live; the palette is fully exposed\n * via `presets` and `colors`. The nudge is pure CSS transition, so reduced\n * motion (or `paused`) simply pins every block to its raised resting pose.\n */\nexport function Brutal({\n  variant,\n  defaultVariant,\n  onVariantChange,\n  presets,\n  colors,\n  offset = 6,\n  border = 3,\n  paused = false,\n  kicker = \"NO. 03 / SERIES\",\n  heading = \"PRESS HARD\",\n  description = \"Hard edges, honest shadows. Pick your loud.\",\n  statValue = \"24\",\n  statLabel = \"SHIPS / DAY\",\n  sticker = \"NEW\",\n  primaryLabel = \"Get it\",\n  secondaryLabel = \"Later\",\n  label = \"Neo-brutalist theme preset\",\n  switcherLabel = \"Accent\",\n  className,\n  style,\n  ...rest\n}: BrutalProps) {\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(\n    defaultVariant ?? list[0].id\n  );\n  const activeId = isControlled ? variant : internal;\n  const active = list.find((p) => p.id === activeId) ?? list[0];\n  const t: BrutalPalette = { ...active.palette, ...colors };\n\n  // The nudge is a CSS transition on transform + box-shadow. When motion is off\n  // we drop the transition and the hover/active nudge utilities so every block\n  // holds its raised resting pose — never a flat, shadowless frame.\n  const nudge = !reducedMotion && !paused;\n\n  const off = Math.max(0, offset);\n  const bw = Math.max(1, border);\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    \"--br-surface\": t.surface,\n    \"--br-base\": t.base,\n    \"--br-text\": t.text,\n    \"--br-muted\": t.muted,\n    \"--br-ink\": t.ink,\n    \"--br-accent\": t.accent,\n    \"--br-accent-text\": t.accentText,\n    \"--br-off\": `${off}px`,\n    \"--br-off-hover\": `${Math.round(off / 2)}px`,\n    \"--br-bw\": `${bw}px`,\n    background: \"var(--br-base)\",\n  } as React.CSSProperties;\n\n  const focusRing =\n    \"outline-none focus-visible:ring-[3px] focus-visible:ring-[color:var(--br-accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[color:var(--br-surface)]\";\n\n  // Raised block: full offset shadow at rest, nudges toward the shadow on\n  // hover, sits flush on press. Gated so reduced motion holds the raised pose.\n  const raised = cn(\n    \"border-[length:var(--br-bw)] border-[color:var(--br-ink)]\",\n    \"shadow-[var(--br-off)_var(--br-off)_0_0_var(--br-ink)]\",\n    nudge &&\n      cn(\n        \"transition-[transform,box-shadow] duration-100 ease-out\",\n        \"hover:translate-x-[var(--br-off-hover)] hover:translate-y-[var(--br-off-hover)]\",\n        \"hover:shadow-[var(--br-off-hover)_var(--br-off-hover)_0_0_var(--br-ink)]\",\n        \"active:translate-x-[var(--br-off)] active:translate-y-[var(--br-off)]\",\n        \"active:shadow-[0_0_0_0_var(--br-ink)]\"\n      )\n  );\n\n  return (\n    <section\n      aria-label={label}\n      data-crucible=\"brutal\"\n      data-variant={active.id}\n      className={cn(\n        \"relative isolate w-full max-w-sm p-[calc(var(--br-off)+2px)]\",\n        className\n      )}\n      style={{ ...vars, ...style }}\n      {...rest}\n    >\n      {/* The card — a flat block with hard border + solid offset shadow. */}\n      <div\n        className={cn(\n          \"relative flex w-full flex-col gap-4 p-5\",\n          \"border-[length:var(--br-bw)] border-[color:var(--br-ink)]\",\n          \"shadow-[var(--br-off)_var(--br-off)_0_0_var(--br-ink)]\"\n        )}\n        style={{ background: \"var(--br-surface)\", color: \"var(--br-text)\" }}\n      >\n        {/* Rotated corner sticker — decorative flair. */}\n        {sticker ? (\n          <span\n            aria-hidden\n            className=\"absolute -right-3 -top-3 -rotate-6 select-none px-2 py-0.5 font-mono text-[0.62rem] font-black uppercase tracking-widest border-[length:var(--br-bw)] border-[color:var(--br-ink)] shadow-[3px_3px_0_0_var(--br-ink)]\"\n            style={{ background: \"var(--br-accent)\", color: \"var(--br-accent-text)\" }}\n          >\n            {sticker}\n          </span>\n        ) : null}\n\n        {/* Kicker + heading + body */}\n        <div className=\"flex flex-col gap-1.5\">\n          <p\n            className=\"font-mono text-[0.62rem] font-bold uppercase tracking-[0.28em]\"\n            style={{ color: \"var(--br-muted)\" }}\n          >\n            {kicker}\n          </p>\n          <h3\n            className=\"text-4xl font-black uppercase leading-[0.95] tracking-tight\"\n            style={{ color: \"var(--br-text)\" }}\n          >\n            {heading}\n          </h3>\n          <p className=\"text-sm font-medium\" style={{ color: \"var(--br-muted)\" }}>\n            {description}\n          </p>\n        </div>\n\n        {/* Accent stat block + tag row */}\n        <div className=\"flex items-stretch gap-3\">\n          <div\n            className=\"flex items-center gap-2 px-3 py-2 border-[length:var(--br-bw)] border-[color:var(--br-ink)]\"\n            style={{ background: \"var(--br-accent)\", color: \"var(--br-accent-text)\" }}\n          >\n            <span className=\"text-2xl font-black tabular-nums leading-none\">\n              {statValue}\n            </span>\n            <span className=\"font-mono text-[0.58rem] font-bold uppercase leading-tight tracking-wider\">\n              {statLabel}\n            </span>\n          </div>\n        </div>\n\n        {/* Buttons */}\n        <div className=\"flex gap-3\">\n          <button\n            type=\"button\"\n            className={cn(\n              \"px-4 py-2 text-sm font-black uppercase tracking-wide\",\n              raised,\n              focusRing\n            )}\n            style={{ background: \"var(--br-accent)\", color: \"var(--br-accent-text)\" }}\n          >\n            {primaryLabel}\n          </button>\n          <button\n            type=\"button\"\n            className={cn(\n              \"px-4 py-2 text-sm font-black uppercase tracking-wide\",\n              raised,\n              focusRing\n            )}\n            style={{ background: \"var(--br-surface)\", color: \"var(--br-text)\" }}\n          >\n            {secondaryLabel}\n          </button>\n        </div>\n\n        {/* Accent switcher — a real radiogroup with roving focus. Selected chip\n            sits flush (pressed in); the rest stay raised on their shadow. */}\n        <div\n          role=\"radiogroup\"\n          aria-label={switcherLabel}\n          onKeyDown={onSwitcherKey}\n          className=\"mt-1 flex flex-wrap items-center gap-1 border-t-[length:var(--br-bw)] border-dashed border-[color:color-mix(in_srgb,var(--br-ink)_25%,transparent)] pt-4\"\n        >\n          <span\n            aria-hidden\n            className=\"mr-1 font-mono text-[0.6rem] font-bold uppercase tracking-widest\"\n            style={{ color: \"var(--br-muted)\" }}\n          >\n            {switcherLabel}\n          </span>\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                aria-label={p.label}\n                tabIndex={selected ? 0 : -1}\n                onClick={() => select(i)}\n                title={p.label}\n                className={cn(\n                  \"h-7 w-7 border-[length:var(--br-bw)] border-[color:var(--br-ink)]\",\n                  nudge && \"transition-[transform,box-shadow] duration-100 ease-out\",\n                  selected\n                    ? \"translate-x-[3px] translate-y-[3px] shadow-[0_0_0_0_var(--br-ink)]\"\n                    : \"shadow-[3px_3px_0_0_var(--br-ink)]\",\n                  focusRing\n                )}\n                style={{ background: p.palette.accent }}\n              >\n                {/* High-contrast selected marker that survives any accent. */}\n                <span\n                  aria-hidden\n                  className={cn(\n                    \"mx-auto block h-2 w-2 rounded-full border border-[color:var(--br-ink)]\",\n                    selected ? \"opacity-100\" : \"opacity-0\"\n                  )}\n                  style={{ background: \"var(--br-ink)\" }}\n                />\n              </button>\n            );\n          })}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}