{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"deck-hero","type":"registry:block","title":"Deck hero","description":"A hero for design studios and agencies, drawn as their design canvas: rulers, layout columns and the work as artboards a collaborator selects one by one.","author":"Hairline UI","dependencies":["lucide-react"],"files":[{"path":"registry/deck-hero.tsx","type":"registry:component","content":"// Hairline UI · deck-hero · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n\"use client\";\n\nimport * as React from \"react\";\nimport { ArrowRight, ArrowUpRight, Menu, X } from \"lucide-react\";\n\n/* ─────────────────────────────────────────────────────────\n * DECK HERO: a studio's first screen, drawn as its design canvas\n *\n *   canvas    rulers along the top and left read the real pixels of\n *             the section; the layout grid's columns sit faintly behind\n *   nav       brand, links and actions laid on the same columns\n *   copy      a large headline whose highlighted words are a selected\n *             text layer, one sentence and the actions\n *   deck      the studio's work as artboards with frame labels, panning\n *             slowly across the canvas. A collaborator's cursor moves to\n *             the next artboard, the selection box follows with its size\n *             tag, the ruler marks its width and the label turns to the\n *             result. Pointing at an artboard selects it and holds the\n *             pan; on phones the deck is a swipeable row.\n * ───────────────────────────────────────────────────────── */\n\nexport interface DeckHeroLink {\n  label: string;\n  href: string;\n}\n\nexport interface DeckHeroAction {\n  label: string;\n  href?: string;\n  onClick?: () => void;\n}\n\nexport interface DeckHeroProject {\n  /** Name on the frame label, e.g. the client. */\n  name: string;\n  /** What it was, e.g. \"Fintech · Website\". */\n  kind?: string;\n  year?: string;\n  /** Shown on the label while the artboard is selected, e.g. \"+31% trial starts\". */\n  result?: string;\n  /** A 16:10 screenshot of the work. */\n  image: string;\n  alt?: string;\n  /** Where the case study lives. */\n  href?: string;\n}\n\nexport interface DeckHeroProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  brand: string;\n  /** Mark beside the name. Defaults to a selected square in the accent. */\n  logo?: React.ReactNode;\n  navLinks?: DeckHeroLink[];\n  navSecondaryAction?: DeckHeroAction;\n  navPrimaryAction?: DeckHeroAction;\n  /** One plain line above the headline. */\n  eyebrow?: string;\n  /** The headline; an array sets the line breaks. */\n  headline: string | string[];\n  /** Words inside the headline drawn as a selected text layer. */\n  highlight?: string;\n  subheadline: string;\n  primaryAction: DeckHeroAction;\n  secondaryAction?: DeckHeroAction;\n  /** The work on the canvas, 3 or more. */\n  projects: DeckHeroProject[];\n  /** Name on the collaborator's cursor. */\n  cursorName?: string;\n  /** Size written under the selection, e.g. \"1440 × 900\". */\n  frameSize?: string;\n  /** \"dark\" (default) or \"light\". Every colour is a --dh-* variable you can override. */\n  tone?: \"dark\" | \"light\";\n  /** Pan the deck and move the selection on its own. */\n  autoPlay?: boolean;\n}\n\nconst TONES: Record<\"dark\" | \"light\", Record<string, string>> = {\n  dark: {\n    \"--dh-canvas\": \"#101113\",\n    \"--dh-ink\": \"#f4f4f5\",\n    \"--dh-ink-2\": \"#a3a3ab\",\n    \"--dh-ink-3\": \"#686870\",\n    \"--dh-rule\": \"rgba(244,244,245,0.08)\",\n    \"--dh-hover\": \"rgba(244,244,245,0.07)\",\n    \"--dh-ruler\": \"#16171a\",\n    \"--dh-tick\": \"rgba(244,244,245,0.22)\",\n    \"--dh-column\": \"rgba(255,77,141,0.035)\",\n    \"--dh-frame\": \"#1b1c1f\",\n    \"--dh-paper\": \"#f4f4f5\",\n    \"--dh-on-paper\": \"#101113\",\n    \"--dh-accent\": \"#ff4d8d\",\n    \"--dh-on-accent\": \"#120a0d\",\n  },\n  light: {\n    \"--dh-canvas\": \"#eff0f2\",\n    \"--dh-ink\": \"#0d0e10\",\n    \"--dh-ink-2\": \"#4c4e55\",\n    \"--dh-ink-3\": \"#8a8c93\",\n    \"--dh-rule\": \"rgba(13,14,16,0.09)\",\n    \"--dh-hover\": \"rgba(13,14,16,0.06)\",\n    \"--dh-ruler\": \"#f8f8f9\",\n    \"--dh-tick\": \"rgba(13,14,16,0.25)\",\n    \"--dh-column\": \"rgba(240,36,110,0.022)\",\n    \"--dh-frame\": \"#e2e3e6\",\n    \"--dh-paper\": \"#0d0e10\",\n    \"--dh-on-paper\": \"#f8f8f9\",\n    \"--dh-accent\": \"#f0246e\",\n    \"--dh-on-accent\": \"#ffffff\",\n  },\n};\n\nconst NO_LINKS: DeckHeroLink[] = [];\nconst RULER = 20;\nconst PAN_SPEED = 18; // px a second\nconst HOLD_MS = 2600; // how long each artboard stays selected\nconst CURSOR_MS = 760;\nconst MORPH_MS = 460;\n\nconst easeInOut = (t: number) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2);\nconst easeOut = (t: number) => 1 - Math.pow(1 - t, 3);\nconst clamp01 = (t: number) => Math.max(0, Math.min(1, t));\n\nfunction useReducedMotion() {\n  const [reduced, setReduced] = React.useState(false);\n  React.useEffect(() => {\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const on = () => setReduced(mq.matches);\n    on();\n    mq.addEventListener(\"change\", on);\n    return () => mq.removeEventListener(\"change\", on);\n  }, []);\n  return reduced;\n}\n\nfunction ActionLink({ action, className, style, children }: { action: DeckHeroAction; className: string; style?: React.CSSProperties; children: React.ReactNode }) {\n  if (action.href)\n    return (\n      <a href={action.href} onClick={action.onClick} className={className} style={style}>\n        {children}\n      </a>\n    );\n  return (\n    <button type=\"button\" onClick={action.onClick} className={className} style={style}>\n      {children}\n    </button>\n  );\n}\n\n/** Four square handles on the corners of a selection. */\nfunction Handles({ size = 7 }: { size?: number }) {\n  const s = { width: size, height: size, background: \"var(--dh-canvas)\", border: \"1.5px solid var(--dh-accent)\" } as React.CSSProperties;\n  const o = -size / 2 - 0.75;\n  return (\n    <>\n      <span className=\"absolute\" style={{ ...s, left: o, top: o }} />\n      <span className=\"absolute\" style={{ ...s, right: o, top: o }} />\n      <span className=\"absolute\" style={{ ...s, left: o, bottom: o }} />\n      <span className=\"absolute\" style={{ ...s, right: o, bottom: o }} />\n    </>\n  );\n}\n\n/** The default logo: a selected square. */\nfunction FrameMark() {\n  return (\n    <span aria-hidden=\"true\" className=\"relative grid size-[18px] shrink-0 place-items-center\">\n      <span className=\"absolute inset-[3px]\" style={{ background: \"var(--dh-accent)\" }} />\n      <span className=\"absolute inset-0\" style={{ border: \"1.5px solid var(--dh-accent)\" }} />\n    </span>\n  );\n}\n\n/** Ticks every 10px, longer every 50 and numbered every 100: the canvas's own ruler, in real pixels. */\nfunction TopRuler({ width, bandRef }: { width: number; bandRef: React.Ref<HTMLSpanElement> }) {\n  const marks = Math.floor(width / 100);\n  return (\n    <div\n      aria-hidden=\"true\"\n      className=\"relative h-[20px] overflow-hidden border-b\"\n      style={{\n        background: \"var(--dh-ruler)\",\n        borderColor: \"var(--dh-rule)\",\n        backgroundImage:\n          \"repeating-linear-gradient(90deg, var(--dh-tick) 0 1px, transparent 1px 10px), repeating-linear-gradient(90deg, var(--dh-tick) 0 1px, transparent 1px 50px)\",\n        backgroundSize: \"100% 4px, 100% 8px\",\n        backgroundPosition: `${RULER}px 100%, ${RULER}px 100%`,\n        backgroundRepeat: \"no-repeat\",\n      }}\n    >\n      <span ref={bandRef} className=\"absolute bottom-0 left-0 h-[20px] w-0 opacity-0\" style={{ background: \"color-mix(in oklab, var(--dh-accent) 22%, transparent)\", borderLeft: \"1px solid var(--dh-accent)\", borderRight: \"1px solid var(--dh-accent)\" }} />\n      {Array.from({ length: marks + 1 }, (_, i) => (\n        <span key={i} className=\"absolute top-[2px] text-[9px] leading-none font-medium tabular-nums\" style={{ left: RULER + i * 100 + 3, color: \"var(--dh-ink-3)\" }}>\n          {i * 100}\n        </span>\n      ))}\n    </div>\n  );\n}\n\nexport function DeckHero({\n  brand,\n  logo,\n  navLinks = NO_LINKS,\n  navSecondaryAction,\n  navPrimaryAction,\n  eyebrow,\n  headline,\n  highlight,\n  subheadline,\n  primaryAction,\n  secondaryAction,\n  projects,\n  cursorName = \"Ana\",\n  frameSize = \"1440 × 900\",\n  tone = \"dark\",\n  autoPlay = true,\n  className = \"\",\n  style,\n  ...rest\n}: DeckHeroProps) {\n  const reduced = useReducedMotion();\n  const [menuOpen, setMenuOpen] = React.useState(false);\n  const [width, setWidth] = React.useState(1280);\n  const [shown, setShown] = React.useState(false);\n  const phone = width < 720;\n\n  const rootRef = React.useRef<HTMLElement>(null);\n  const deckRef = React.useRef<HTMLDivElement>(null);\n  const rowRef = React.useRef<HTMLDivElement>(null);\n  const selRef = React.useRef<HTMLDivElement>(null);\n  const cursorRef = React.useRef<HTMLDivElement>(null);\n  const bandRef = React.useRef<HTMLSpanElement>(null);\n  const cardRefs = React.useRef<(HTMLAnchorElement | HTMLDivElement | null)[]>([]);\n  const hoverRef = React.useRef<number | null>(null);\n\n  const n = projects.length;\n  const copies = phone ? 1 : 3;\n  const cards = React.useMemo(() => Array.from({ length: n * copies }, (_, j) => projects[j % n]), [projects, n, copies]);\n\n  // Card size follows the section: about a third of it on desktop, most of the screen on a phone.\n  const cardW = phone ? Math.round(Math.min(width - 72, 420)) : Math.round(Math.max(300, Math.min(480, width * 0.3)));\n  const cardH = Math.round(cardW * 0.625);\n  const gap = phone ? 16 : 40;\n  const LABEL = 28;\n\n  React.useEffect(() => {\n    const el = rootRef.current;\n    if (!el) return;\n    const ro = new ResizeObserver(([entry]) => setWidth(Math.round(entry.contentRect.width)));\n    ro.observe(el);\n    const id = requestAnimationFrame(() => setShown(true));\n    return () => {\n      ro.disconnect();\n      cancelAnimationFrame(id);\n    };\n  }, []);\n\n  // One loop: pan, the cursor's trip, the selection's morph, the ruler band and the selected label.\n  React.useEffect(() => {\n    const deck = deckRef.current;\n    const row = rowRef.current;\n    const sel = selRef.current;\n    const cursor = cursorRef.current;\n    const band = bandRef.current;\n    if (!deck || !row || !sel || n === 0) return;\n    const step = cardW + gap;\n    const period = n * step;\n    const pad = phone ? 24 : RULER + 40;\n    const moving = autoPlay && !reduced && !phone;\n\n    let offset = 0;\n    let speed = moving ? PAN_SPEED : 0;\n    let k = 0; // the selected artboard, counted along the endless row\n    let nextAt = 0;\n    let from = k;\n    let morphAt = -1e9;\n    let morphMs = MORPH_MS;\n    let cursorFrom = { x: 0, y: 0 };\n    let cursorAt = -1e9;\n    let cursorTo = k;\n    let lastSelected = -1;\n    let raf = 0;\n    let last = 0;\n    let visible = false;\n    let now = 0;\n\n    const target = (idx: number) => ({ x: idx * step + cardW * 0.64, y: LABEL + cardH * 0.56 });\n    const cursorPos = () => {\n      const t = easeInOut(clamp01((now - cursorAt) / CURSOR_MS));\n      const to = target(cursorTo);\n      return { x: cursorFrom.x + (to.x - cursorFrom.x) * t, y: cursorFrom.y + (to.y - cursorFrom.y) * t };\n    };\n    const select = (idx: number, ms: number) => {\n      if (idx === k) return;\n      const t = clamp01((now - morphAt) / morphMs);\n      from = from + (k - from) * easeOut(t); // start from wherever the box is now\n      k = idx;\n      morphAt = now;\n      morphMs = ms;\n    };\n    let pendingSelect = -1;\n\n    const draw = () => {\n      const base = phone ? 0 : offset % period;\n      row.style.transform = phone ? \"\" : `translate3d(${(-base).toFixed(2)}px,0,0)`;\n      const t = easeOut(clamp01((now - morphAt) / morphMs));\n      const at = from + (k - from) * t;\n      const scroll = phone ? row.parentElement?.scrollLeft ?? 0 : 0;\n      const x = pad + at * step - (phone ? scroll : offset);\n      sel.style.transform = `translate3d(${x.toFixed(2)}px,${LABEL}px,0)`;\n      if (band) {\n        band.style.transform = `translate3d(${(x).toFixed(2)}px,0,0)`;\n        band.style.width = `${cardW}px`;\n        band.style.opacity = \"1\";\n      }\n      if (cursor) {\n        const c = cursorPos();\n        cursor.style.transform = `translate3d(${(pad + c.x - offset).toFixed(2)}px,${c.y.toFixed(2)}px,0)`;\n        const o = hoverRef.current === null ? \"1\" : \"0\";\n        if (cursor.style.opacity !== o) cursor.style.opacity = o;\n      }\n      // The selected label: the copy of artboard k that is on screen.\n      const j = phone ? k : k - n * Math.floor(offset / period);\n      if (j !== lastSelected) {\n        cardRefs.current[lastSelected]?.removeAttribute(\"data-selected\");\n        cardRefs.current[j]?.setAttribute(\"data-selected\", \"\");\n        lastSelected = j;\n      }\n    };\n\n    const frame = (time: number) => {\n      const dt = last ? Math.min(0.05, (time - last) / 1000) : 1 / 60;\n      last = time;\n      now = time;\n      const hovering = hoverRef.current !== null;\n      const want = moving && !hovering ? PAN_SPEED : 0;\n      speed += (want - speed) * (1 - Math.exp(-dt * 4));\n      offset += speed * dt;\n      if (!nextAt) nextAt = now + 900;\n      if (hovering) nextAt = Math.max(nextAt, now + 1400);\n      if (moving && !hovering && pendingSelect < 0) {\n        // Every few seconds the cursor goes to the next artboard, then selects it; when the next one would be\n        // off the right edge, it goes back to the first one fully on screen. It also moves on if the\n        // selected artboard is panning out on the left.\n        const left = (i: number) => pad + i * step - offset;\n        if (now >= nextAt || left(k) < RULER) {\n          let cand = k + 1;\n          if (left(cand) + cardW > width - 16) cand = Math.ceil((RULER + 12 - pad + offset) / step);\n          if (cand === k) cand = k + 1;\n          cursorFrom = cursorPos();\n          cursorTo = cand;\n          cursorAt = now;\n          pendingSelect = cand;\n          nextAt = now + CURSOR_MS + HOLD_MS;\n        }\n      }\n      if (pendingSelect >= 0 && now - cursorAt > CURSOR_MS * 0.78) {\n        select(pendingSelect, MORPH_MS);\n        pendingSelect = -1;\n      }\n      draw();\n      raf = requestAnimationFrame(frame);\n    };\n    const start = () => {\n      if (raf || !visible || document.hidden) return;\n      last = 0;\n      raf = requestAnimationFrame(frame);\n    };\n    const stop = () => {\n      cancelAnimationFrame(raf);\n      raf = 0;\n    };\n\n    // Pointing at an artboard selects it at once and holds the pan.\n    const onHover = (e: Event) => {\n      const idx = hoverRef.current;\n      if (idx === null) return;\n      const abs = phone ? idx : idx + n * Math.floor(offset / period);\n      pendingSelect = -1;\n      select(abs, 260);\n      cursorFrom = cursorPos();\n      cursorTo = abs;\n      cursorAt = now;\n      if (!raf) {\n        now = performance.now();\n        draw();\n      }\n      void e;\n    };\n    deck.addEventListener(\"dh-hover\", onHover);\n\n    // Phones: the row scrolls natively; the selection follows the card nearest the left edge.\n    const scroller = row.parentElement;\n    const onScroll = () => {\n      if (!scroller) return;\n      const idx = Math.max(0, Math.min(n - 1, Math.round(scroller.scrollLeft / step)));\n      now = performance.now();\n      select(idx, 220);\n      if (!raf) requestAnimationFrame(() => {\n        now = performance.now();\n        draw();\n        if (now - morphAt < 240) onScroll();\n      });\n    };\n    if (phone) {\n      k = 0;\n      from = 0;\n      scroller?.addEventListener(\"scroll\", onScroll, { passive: true });\n    }\n\n    cursorFrom = target(k);\n    cursorTo = k;\n    now = performance.now();\n    draw();\n\n    const io = new IntersectionObserver(([entry]) => {\n      visible = entry.isIntersecting;\n      if (visible && (moving || hoverRef.current !== null)) start();\n      else if (!visible) stop();\n    });\n    io.observe(deck);\n    // While not panning, the loop still runs briefly after each hover so the morph plays.\n    const kick = () => {\n      if (!moving) {\n        start();\n        window.setTimeout(() => {\n          if (!moving) stop();\n        }, MORPH_MS + 80);\n      }\n    };\n    deck.addEventListener(\"dh-hover\", kick);\n    const onVis = () => (document.hidden ? stop() : moving && start());\n    document.addEventListener(\"visibilitychange\", onVis);\n    return () => {\n      stop();\n      io.disconnect();\n      deck.removeEventListener(\"dh-hover\", onHover);\n      deck.removeEventListener(\"dh-hover\", kick);\n      scroller?.removeEventListener(\"scroll\", onScroll);\n      document.removeEventListener(\"visibilitychange\", onVis);\n      cardRefs.current.forEach((el) => el?.removeAttribute(\"data-selected\"));\n    };\n  }, [n, cardW, cardH, gap, phone, autoPlay, reduced, width]);\n\n  const hover = (j: number | null) => {\n    hoverRef.current = j;\n    if (j !== null) deckRef.current?.dispatchEvent(new Event(\"dh-hover\"));\n  };\n\n  const lines = Array.isArray(headline) ? headline : [headline];\n  const paint = (text: string) => {\n    if (!highlight || !text.includes(highlight)) return text;\n    const i = text.indexOf(highlight);\n    return (\n      <>\n        {text.slice(0, i)}\n        <span className=\"relative inline-block\">\n          {highlight}\n          <span\n            aria-hidden=\"true\"\n            className=\"pointer-events-none absolute -inset-x-[0.08em] top-[0.08em] -bottom-[0.02em]\"\n            style={{\n              border: \"1.5px solid var(--dh-accent)\",\n              opacity: shown || reduced ? 1 : 0,\n              transform: shown || reduced ? \"none\" : \"scale(0.97)\",\n              transition: reduced ? undefined : \"opacity 420ms ease 520ms, transform 520ms cubic-bezier(0.22,1,0.36,1) 520ms\",\n            }}\n          >\n            <Handles size={8} />\n            <span\n              className=\"absolute bottom-full left-[-1.5px] mb-[6px] px-1.5 py-[3px] text-[11px] leading-none font-semibold tracking-normal whitespace-nowrap\"\n              style={{ background: \"var(--dh-accent)\", color: \"var(--dh-on-accent)\", fontFamily: \"var(--dh-text, inherit)\" }}\n            >\n              Text\n            </span>\n          </span>\n        </span>\n        {text.slice(i + highlight.length)}\n      </>\n    );\n  };\n\n  const tones = TONES[tone];\n  const navButton =\n    \"h-9 cursor-pointer items-center rounded-[4px] px-3 text-[14px] font-medium transition-[background-color,transform] duration-150 [touch-action:manipulation] [-webkit-tap-highlight-color:transparent] hover:bg-[var(--dh-hover)] active:translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--dh-accent)]\";\n  const deckH = LABEL + cardH + 44;\n\n  return (\n    <section\n      ref={rootRef}\n      className={`@container relative isolate flex w-full flex-col overflow-hidden ${className}`}\n      style={{ ...tones, background: \"var(--dh-canvas)\", color: \"var(--dh-ink)\", fontFamily: \"var(--dh-text, inherit)\", ...style } as React.CSSProperties}\n      {...rest}\n    >\n      {/* The canvas: ruler on top, ruler down the left, the layout grid's columns behind everything */}\n      <TopRuler width={width} bandRef={bandRef} />\n      <div\n        aria-hidden=\"true\"\n        className=\"absolute top-[20px] bottom-0 left-0 z-20 hidden w-[20px] border-r @min-[720px]:block\"\n        style={{\n          background: \"var(--dh-ruler)\",\n          borderColor: \"var(--dh-rule)\",\n          backgroundImage:\n            \"repeating-linear-gradient(180deg, var(--dh-tick) 0 1px, transparent 1px 10px), repeating-linear-gradient(180deg, var(--dh-tick) 0 1px, transparent 1px 50px)\",\n          backgroundSize: \"4px 100%, 8px 100%\",\n          backgroundPosition: \"100% 0, 100% 0\",\n          backgroundRepeat: \"no-repeat\",\n        }}\n      />\n      <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-x-0 top-[20px] bottom-0 -z-10 px-5 @min-[720px]:pr-10 @min-[720px]:pl-[60px]\">\n        <div className=\"mx-auto grid h-full max-w-[1320px] grid-cols-4 gap-4 @min-[720px]:grid-cols-12 @min-[720px]:gap-6\">\n          {Array.from({ length: 12 }, (_, i) => (\n            <span key={i} className={i >= 4 ? \"hidden @min-[720px]:block\" : \"\"} style={{ background: \"var(--dh-column)\" }} />\n          ))}\n        </div>\n      </div>\n\n      <div className=\"relative px-5 @min-[720px]:pr-10 @min-[720px]:pl-[60px]\">\n        <div className=\"mx-auto max-w-[1320px]\">\n          {/* Nav */}\n          <header className=\"relative z-20 flex h-[68px] items-center gap-6 border-b\" style={{ borderColor: \"var(--dh-rule)\" }}>\n            <a href=\"#\" className=\"flex shrink-0 items-center gap-2.5 text-[17px] font-semibold tracking-[-0.02em]\" style={{ fontFamily: \"var(--dh-display, inherit)\" }}>\n              {logo ?? <FrameMark />}\n              {brand}\n            </a>\n            <nav aria-label=\"Main\" className=\"hidden items-center gap-0.5 @min-[900px]:flex\">\n              {navLinks.map((l) => (\n                <a key={l.href + l.label} href={l.href} className={`${navButton} inline-flex`} style={{ color: \"var(--dh-ink-2)\" }}>\n                  {l.label}\n                </a>\n              ))}\n            </nav>\n            <div className=\"ml-auto flex items-center gap-1.5\">\n              {navSecondaryAction && (\n                <ActionLink action={navSecondaryAction} className={`${navButton} hidden @min-[560px]:inline-flex`} style={{ color: \"var(--dh-ink)\" }}>\n                  {navSecondaryAction.label}\n                </ActionLink>\n              )}\n              {navPrimaryAction && (\n                <ActionLink\n                  action={navPrimaryAction}\n                  className=\"hidden h-9 cursor-pointer items-center gap-1.5 rounded-[4px] px-3.5 text-[14px] font-semibold transition-[opacity,transform] duration-150 [touch-action:manipulation] hover:opacity-90 active:translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--dh-accent)] @min-[440px]:inline-flex\"\n                  style={{ background: \"var(--dh-paper)\", color: \"var(--dh-on-paper)\" }}\n                >\n                  {navPrimaryAction.label}\n                  <ArrowUpRight aria-hidden=\"true\" className=\"size-4\" />\n                </ActionLink>\n              )}\n              {navLinks.length > 0 && (\n                <button\n                  type=\"button\"\n                  aria-label={menuOpen ? \"Close menu\" : \"Open menu\"}\n                  aria-expanded={menuOpen}\n                  onClick={() => setMenuOpen((v) => !v)}\n                  className=\"grid size-9 cursor-pointer place-items-center rounded-[4px] transition-[background-color,transform] duration-150 [touch-action:manipulation] hover:bg-[var(--dh-hover)] active:translate-y-px focus-visible:outline-2 focus-visible:outline-[var(--dh-accent)] @min-[900px]:hidden\"\n                >\n                  {menuOpen ? <X className=\"size-[18px]\" aria-hidden=\"true\" /> : <Menu className=\"size-[18px]\" aria-hidden=\"true\" />}\n                </button>\n              )}\n            </div>\n            {menuOpen && (\n              <nav\n                aria-label=\"Main\"\n                className=\"absolute inset-x-0 top-full z-30 flex flex-col border-b py-3 @min-[900px]:hidden\"\n                style={{ background: \"var(--dh-canvas)\", borderColor: \"var(--dh-rule)\" }}\n              >\n                {navLinks.map((l) => (\n                  <a\n                    key={l.href + l.label}\n                    href={l.href}\n                    onClick={() => setMenuOpen(false)}\n                    className=\"flex h-12 items-center border-b text-[24px] font-semibold tracking-[-0.03em]\"\n                    style={{ borderColor: \"var(--dh-rule)\", fontFamily: \"var(--dh-display, inherit)\" }}\n                  >\n                    {l.label}\n                  </a>\n                ))}\n                <div className=\"mt-4 flex flex-wrap gap-2\">\n                  {navPrimaryAction && (\n                    <ActionLink action={navPrimaryAction} className=\"inline-flex h-11 items-center gap-1.5 rounded-[4px] px-4 text-[15px] font-semibold\" style={{ background: \"var(--dh-paper)\", color: \"var(--dh-on-paper)\" }}>\n                      {navPrimaryAction.label}\n                      <ArrowUpRight aria-hidden=\"true\" className=\"size-4\" />\n                    </ActionLink>\n                  )}\n                  {navSecondaryAction && (\n                    <ActionLink action={navSecondaryAction} className={`${navButton} inline-flex h-11 text-[15px] @min-[560px]:hidden`} style={{ color: \"var(--dh-ink)\" }}>\n                      {navSecondaryAction.label}\n                    </ActionLink>\n                  )}\n                </div>\n              </nav>\n            )}\n          </header>\n\n          {/* Copy */}\n          <div className=\"grid grid-cols-1 gap-x-6 pt-12 pb-10 @min-[720px]:pt-16 @min-[1040px]:grid-cols-12 @min-[1040px]:pt-[84px] @min-[1040px]:pb-14\">\n            <div className=\"@min-[1040px]:col-span-8\">\n              {eyebrow && (\n                <p className=\"mb-6 text-[14px] font-medium\" style={{ color: \"var(--dh-ink-2)\" }}>\n                  {eyebrow}\n                </p>\n              )}\n              <h1\n                className=\"text-[44px] leading-[0.94] font-semibold tracking-[-0.045em] @min-[420px]:text-[52px] @min-[720px]:text-[76px] @min-[1040px]:text-[84px] @min-[1280px]:text-[100px]\"\n                style={{ fontFamily: \"var(--dh-display, inherit)\", fontVariationSettings: \"var(--dh-display-axes, normal)\" }}\n              >\n                {lines.map((t, i) => (\n                  <span key={i} className=\"block\">\n                    {paint(t)}\n                  </span>\n                ))}\n              </h1>\n            </div>\n            <div className=\"mt-8 flex flex-col justify-end @min-[1040px]:col-span-4 @min-[1040px]:mt-0 @min-[1040px]:pb-2\">\n              <p className=\"max-w-[40ch] text-[16px] leading-[1.55] font-medium @min-[720px]:text-[17px]\" style={{ color: \"var(--dh-ink-2)\" }}>\n                {subheadline}\n              </p>\n              <div className=\"mt-7 flex flex-wrap items-center gap-2\">\n                <ActionLink\n                  action={primaryAction}\n                  className=\"group inline-flex h-12 cursor-pointer items-center gap-2 rounded-[4px] px-5 text-[15px] font-semibold transition-transform duration-150 [touch-action:manipulation] [-webkit-tap-highlight-color:transparent] active:translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--dh-ink)]\"\n                  style={{ background: \"var(--dh-accent)\", color: \"var(--dh-on-accent)\" }}\n                >\n                  {primaryAction.label}\n                  <ArrowRight aria-hidden=\"true\" className=\"size-[18px] transition-transform duration-200 group-hover:translate-x-0.5\" />\n                </ActionLink>\n                {secondaryAction && (\n                  <ActionLink action={secondaryAction} className={`${navButton} inline-flex h-12 px-4 text-[15px]`} style={{ color: \"var(--dh-ink)\" }}>\n                    {secondaryAction.label}\n                  </ActionLink>\n                )}\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n\n      {/* The deck: artboards on the canvas */}\n      <div\n        ref={deckRef}\n        className=\"relative mt-auto\"\n        style={{ height: deckH }}\n        onPointerLeave={() => hover(null)}\n      >\n        <div\n          className={phone ? \"absolute inset-0 snap-x snap-mandatory overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\" : \"absolute inset-0 overflow-hidden\"}\n          style={phone ? { scrollPaddingLeft: 24 } : undefined}\n        >\n          <div ref={rowRef} className=\"flex will-change-transform\" style={{ gap, paddingLeft: phone ? 24 : RULER + 40, paddingRight: phone ? 24 : 0 }}>\n            {cards.map((p, j) => {\n              const body = (\n                <>\n                  <span className=\"relative flex h-[28px] items-start justify-between gap-3 text-[13px] leading-none font-medium\">\n                    <span className=\"truncate\" style={{ color: \"var(--dh-ink)\" }}>\n                      {p.name}\n                    </span>\n                    <span className=\"relative shrink-0 text-right\">\n                      <span className=\"block transition-opacity duration-300 [[data-selected]_&]:opacity-0\" style={{ color: \"var(--dh-ink-3)\" }}>\n                        {[p.kind, p.year].filter(Boolean).join(\" · \")}\n                      </span>\n                      {p.result && (\n                        <span className=\"absolute top-0 right-0 block whitespace-nowrap opacity-0 transition-opacity duration-300 [[data-selected]_&]:opacity-100\" style={{ color: \"var(--dh-accent)\" }}>\n                          {p.result}\n                        </span>\n                      )}\n                    </span>\n                  </span>\n                  <span className=\"block overflow-hidden\" style={{ height: cardH, background: \"var(--dh-frame)\", outline: \"1px solid var(--dh-rule)\", outlineOffset: -1 }}>\n                    {/* eslint-disable-next-line @next/next/no-img-element */}\n                    <img src={p.image} alt={p.alt ?? `${p.name}${p.kind ? `, ${p.kind}` : \"\"}`} width={cardW} height={cardH} loading={j < 4 ? \"eager\" : \"lazy\"} draggable={false} className=\"block h-full w-full object-cover object-top select-none\" />\n                  </span>\n                </>\n              );\n              const common = {\n                className: \"block shrink-0 snap-start outline-none focus-visible:[&>span:last-child]:outline-2 focus-visible:[&>span:last-child]:outline-[var(--dh-accent)]\",\n                style: { width: cardW },\n                onPointerEnter: () => hover(j),\n                onFocus: () => hover(j),\n                \"aria-hidden\": !phone && j >= n ? true : undefined,\n                tabIndex: !phone && j >= n ? -1 : undefined,\n              };\n              return p.href ? (\n                <a key={j} href={p.href} ref={(el) => void (cardRefs.current[j] = el)} {...common}>\n                  {body}\n                </a>\n              ) : (\n                <div key={j} ref={(el) => void (cardRefs.current[j] = el)} {...common}>\n                  {body}\n                </div>\n              );\n            })}\n          </div>\n        </div>\n\n        {/* The selection, its size tag, and the collaborator's cursor */}\n        <div ref={selRef} aria-hidden=\"true\" className=\"pointer-events-none absolute top-0 left-0\" style={{ width: cardW, height: cardH, border: \"1.5px solid var(--dh-accent)\" }}>\n          <Handles />\n          <span\n            className=\"absolute top-full left-1/2 mt-[8px] -translate-x-1/2 px-1.5 py-[3px] text-[11px] leading-none font-semibold whitespace-nowrap tabular-nums\"\n            style={{ background: \"var(--dh-accent)\", color: \"var(--dh-on-accent)\" }}\n          >\n            {frameSize}\n          </span>\n        </div>\n        {!phone && !reduced && autoPlay && (\n          <div ref={cursorRef} aria-hidden=\"true\" className=\"pointer-events-none absolute top-0 left-0\" style={{ transition: \"opacity 200ms\" }}>\n            <svg width=\"18\" height=\"20\" viewBox=\"0 0 18 20\" className=\"block\">\n              <path d=\"M1.5 1.5 L16 9 L9.4 10.6 L6.4 17.5 Z\" fill=\"var(--dh-accent)\" stroke=\"var(--dh-canvas)\" strokeWidth=\"1.5\" strokeLinejoin=\"round\" />\n            </svg>\n            <span className=\"absolute top-[17px] left-[12px] px-1.5 py-[3px] text-[11px] leading-none font-semibold whitespace-nowrap\" style={{ background: \"var(--dh-accent)\", color: \"var(--dh-on-accent)\" }}>\n              {cursorName}\n            </span>\n          </div>\n        )}\n      </div>\n    </section>\n  );\n}\n"}],"css":{},"docs":"Docs and live preview: https://hairlineui.com/blocks/deck-hero. MIT licensed: https://hairlineui.com/license#components","meta":{"license":"MIT"}}