{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "card",
  "title": "Card",
  "description": "A content card with a scanlined media slot. Set cipher on an interactive card to decode its title on hover.",
  "dependencies": [
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/card.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ArrowUpRight, Check, ChevronRight } from \"lucide-react\"\nimport { playCipherText } from \"@/registry/cyber/lib/cipher\"\nimport \"@/registry/cyber/ui/cyber/card.css\"\n\n// A small content card: a still in a cut frame, a title, a line of meta, a\n// few words and a foot.\n//\n// Give it `href` or `onClick` and the whole card is one target: it gains the\n// raised tab of a key, lights on hover with the kit's state language, and a\n// band scans down its still as the pointer arrives. The link or button is a\n// layer over the card named by the title, so a screen reader hears the\n// title alone, and keys in the footer stay separately pressable.\n//\n// - `media`: what goes in the frame at the top: an <svg>, an <img>.\n// - `meta`: the line under the title, in mono: a place, a maker, a count.\n// - `pressed`: with `onClick`, makes the card a toggle and holds it lit,\n//   with a check where its arrow was.\n// - `disabled`: with `onClick`, hatches the card and stops the press.\n// - `cipher`: on an interactive card, decode the title as the pointer enters.\n// - `level`: the title's heading level, 3 by default.\nfunction Card({\n  title,\n  meta,\n  media,\n  footer,\n  href,\n  onClick,\n  pressed,\n  disabled,\n  cipher = false,\n  level = 3,\n  children,\n  ...props\n}: Omit<React.ComponentProps<\"article\">, \"title\" | \"onClick\"> & {\n  title: string\n  meta?: React.ReactNode\n  media?: React.ReactNode\n  footer?: React.ReactNode\n  href?: string\n  onClick?: (event: React.MouseEvent<HTMLElement>) => void\n  pressed?: boolean\n  disabled?: boolean\n  cipher?: boolean\n  level?: 2 | 3 | 4 | 5 | 6\n}) {\n  const id = React.useId()\n  const Heading = `h${level}` as \"h3\"\n  const interactive = href != null || onClick != null\n  const headingRef = React.useRef<HTMLHeadingElement>(null)\n  const cipherEnabled = cipher && interactive && !disabled\n  React.useEffect(() => {\n    const heading = headingRef.current\n    const card = heading?.closest(\"article\")\n    if (!cipherEnabled || !heading || !card) return\n\n    let cancel: (() => void) | undefined\n    const stop = () => {\n      cancel?.()\n      cancel = undefined\n    }\n    const listeners = new AbortController()\n    const options = { signal: listeners.signal }\n    card.addEventListener(\"pointerenter\", event => {\n      if (event.pointerType === \"touch\" || !matchMedia(\"(hover: hover)\").matches) return\n      stop()\n      cancel = playCipherText(heading)\n    }, options)\n    card.addEventListener(\"pointerleave\", stop, options)\n    card.addEventListener(\"pointercancel\", stop, options)\n    card.addEventListener(\"pointerdown\", stop, options)\n    return () => {\n      listeners.abort()\n      stop()\n    }\n  }, [cipherEnabled, level, title])\n\n  return (\n    <article\n      data-kit=\"card\"\n      data-frame={interactive ? \"notch br\" : \"br\"}\n      data-frame-focus={interactive ? \"within\" : undefined}\n      data-press-flash={interactive ? \"\" : undefined}\n      data-interactive={interactive ? \"\" : undefined}\n      data-pressed={pressed ? \"\" : undefined}\n      data-disabled={disabled ? \"\" : undefined}\n      {...props}\n    >\n      {href != null ? (\n        <a data-kit=\"card-action\" href={href} onClick={onClick} aria-labelledby={id} />\n      ) : onClick != null ? (\n        <button type=\"button\" data-kit=\"card-action\" onClick={onClick} disabled={disabled} aria-pressed={pressed} aria-labelledby={id} />\n      ) : null}\n      {media != null && (\n        <div data-kit=\"card-media\" data-frame=\"br\" data-scanlines=\"\">\n          {media}\n        </div>\n      )}\n      <div data-kit=\"card-body\">\n        <div data-kit=\"card-head\">\n          <Heading ref={headingRef} id={id} data-kit=\"card-title\">\n            {title}\n          </Heading>\n          {interactive && (\n            <span data-kit=\"card-mark\" aria-hidden>\n              {pressed ? <Check /> : href != null ? <ArrowUpRight /> : <ChevronRight />}\n            </span>\n          )}\n        </div>\n        {meta != null && <p data-kit=\"card-meta\">{meta}</p>}\n        {children != null && <div data-kit=\"card-text\">{children}</div>}\n      </div>\n      {footer != null && <footer data-kit=\"card-footer\">{footer}</footer>}\n    </article>\n  )\n}\n\nexport { Card }\n",
      "type": "registry:ui",
      "target": "@ui/card.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/card.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* A card that only shows something is a quiet frame, on the decorative\n     line. One that can be pressed follows the kit's state language, like a\n     key, and has a key's raised tab:\n       idle     line 70%, panel fill\n       hover    line 100%, fill 10%\n       down     fill 40%, flashing to 70% as it lands (data-press-flash)\n       pressed  (a toggle that's on) line 100%, fill 40%, bright ink, a check\n       disabled hatched */\n  [data-skin=\"cyber\"] [data-kit=\"card\"] {\n    --frame-cut: var(--cy-cut);\n    --frame-line: var(--cy-line-deco);\n    --frame-fill: var(--cy-panel-a);\n    /* Frame variables inherit, and a surface behind may have set one. */\n    --frame-image: none;\n    --frame-notch-x: 40px;\n    --frame-notch: 5px;\n\n    display: flex;\n    flex-direction: column;\n    width: 100%;\n    min-width: 0;\n    text-align: start;\n    transition:\n      background-color var(--cy-t-fast) linear,\n      border-color var(--cy-t-fast) linear;\n\n    &[data-interactive] {\n      --frame-line: var(--cy-line-ctl);\n    }\n\n    @media (hover: hover) {\n      &[data-interactive]:hover:not([data-disabled]) {\n        --frame-line: var(--cy-line-hot);\n        --frame-fill: var(--cy-fill-hover);\n      }\n    }\n\n    &:is([data-pressed], :has(> [data-kit=\"card-action\"]:active)):not([data-disabled]) {\n      --frame-line: var(--cy-line-hot);\n      --frame-fill: var(--cy-fill-active);\n    }\n\n    &[data-disabled] {\n      --frame-line: var(--cy-line-deco);\n      --frame-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--cy-line-deco) 5px 6px);\n    }\n  }\n\n  /* The link or button: an empty layer over the whole card, named by the\n     title. Its own focus ring would fall outside the frame and be clipped,\n     so the frame draws it instead (data-frame-focus=\"within\"). */\n  [data-skin=\"cyber\"] [data-kit=\"card-action\"] {\n    position: absolute;\n    inset: 0;\n    z-index: 1;\n    padding: 0;\n    border: 0;\n    background: none;\n    cursor: pointer;\n\n    &:disabled {\n      cursor: not-allowed;\n    }\n  }\n\n  /* The still. Whatever is put in it fills the frame. */\n  [data-skin=\"cyber\"] [data-kit=\"card-media\"] {\n    --frame-cut: var(--cy-cut);\n    --frame-line: var(--cy-line-deco);\n    --frame-fill: var(--cy-void);\n    --frame-image: none;\n\n    flex: none;\n    margin: 6px 6px 0;\n    aspect-ratio: 16 / 9;\n    overflow: hidden;\n    color: var(--cy-accent);\n\n    & > :is(svg, img, video, canvas) {\n      display: block;\n      width: 100%;\n      height: 100%;\n      object-fit: cover;\n    }\n\n    /* The scan: a bright edge with a trail above it, parked out of sight.\n       It crosses once as the pointer or the keyboard arrives. Below FX\n       \"full\" it stays hidden. */\n    &::before {\n      content: \"\";\n      position: absolute;\n      inset: 0;\n      z-index: 1;\n      pointer-events: none;\n      background: linear-gradient(\n        to bottom,\n        transparent 40%,\n        color-mix(in srgb, var(--cy-signal) 12%, transparent) 94%,\n        color-mix(in srgb, var(--cy-signal) 75%, transparent) 98%,\n        transparent\n      );\n      opacity: 0;\n    }\n\n    @media (prefers-reduced-motion: no-preference) {\n      [data-kit=\"card\"][data-interactive]:has(:focus-visible) > &::before {\n        opacity: var(--cy-fx);\n        animation: var(--cy-fx-scan) 560ms linear both;\n      }\n      @media (hover: hover) {\n        [data-kit=\"card\"][data-interactive]:hover:not([data-disabled]) > &::before {\n          opacity: var(--cy-fx);\n          animation: var(--cy-fx-scan) 560ms linear both;\n        }\n      }\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"card-body\"] {\n    flex: 1 1 auto;\n    display: grid;\n    align-content: start;\n    gap: 4px;\n    min-width: 0;\n    padding: 10px 12px 12px;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"card-head\"] {\n    display: flex;\n    align-items: flex-start;\n    justify-content: space-between;\n    gap: 8px;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"card-title\"] {\n    min-width: 0;\n    font-size: var(--cy-text-md);\n    font-weight: 600;\n    line-height: 1.25;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    overflow-wrap: anywhere;\n    text-wrap: balance;\n    color: var(--cy-ink);\n\n    [data-kit=\"card\"][data-pressed] & {\n      color: var(--cy-ink-hi);\n    }\n    [data-kit=\"card\"][data-disabled] & {\n      color: var(--cy-ink-mute);\n    }\n  }\n\n  /* What a press does, as a glyph: an arrow out for a link, a chevron for\n     an action, and a check, in the signal color, while a toggle is on. */\n  [data-skin=\"cyber\"] [data-kit=\"card-mark\"] {\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: 18px;\n    height: 18px;\n    color: var(--cy-ink);\n\n    & svg {\n      width: 14px;\n      height: 14px;\n    }\n\n    [data-kit=\"card\"][data-pressed] & {\n      color: var(--cy-signal);\n    }\n    [data-kit=\"card\"][data-disabled] & {\n      color: var(--cy-ink-mute);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"card-meta\"] {\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-xs);\n    line-height: 1.4;\n    letter-spacing: 0.04em;\n    text-transform: uppercase;\n    color: var(--cy-ink-mute);\n\n    /* On the lit fill of a card that's pressed in, muted ink is too faint. */\n    [data-kit=\"card\"][data-pressed]:not([data-disabled]) & {\n      color: var(--cy-ink-hi);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"card-text\"] {\n    margin-block-start: 4px;\n    font-size: var(--cy-text-sm);\n    line-height: 1.4;\n    color: var(--cy-ink-hi);\n    text-wrap: pretty;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"card-footer\"] {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    justify-content: space-between;\n    gap: 6px 10px;\n    min-height: 32px;\n    padding: 6px 12px 8px;\n    border-block-start: 1px solid var(--cy-line-deco);\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-xs);\n    letter-spacing: 0.04em;\n    text-transform: uppercase;\n    color: var(--cy-ink-mute);\n\n    [data-kit=\"card\"][data-pressed]:not([data-disabled]) & {\n      border-block-start-color: var(--cy-line-ctl);\n      color: var(--cy-ink-hi);\n    }\n\n    /* Keys in the foot of a pressable card sit above its layer. */\n    & :is(a, button, input, select, [tabindex]) {\n      z-index: 2;\n    }\n    & :is(a, button, input, select, [tabindex]):not([data-frame]) {\n      position: relative;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/card.css"
    }
  ],
  "type": "registry:ui"
}
