{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "guild",
  "type": "registry:block",
  "title": "Guild",
  "description": "About & team section block: a mission statement with an oversized stat row rolling in on Tally digit drums, a team grid of seeded generative portraits that rest as an accent duotone and warm to full color on hover or focus with a slide-up bio panel, a Detent department filter that re-flows the grid with layout springs, and a numbered values list whose rules draw in.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://crucibleui.com/r/tally.json",
    "https://crucibleui.com/r/detent.json",
    "https://crucibleui.com/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/default/sections/guild/guild.tsx",
      "type": "registry:block",
      "target": "components/crucible/guild.tsx",
      "content": "\"use client\";\n\nimport { motion, useInView, type Transition, type Variants } from \"motion/react\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Detent } from \"@/components/crucible/detent\";\nimport { useReducedMotion } from \"@/hooks/use-reduced-motion\";\nimport { Tally } from \"@/components/crucible/tally\";\n\n/* ------------------------------------------------------------------ types */\n\n/** One oversized number in the mission stat row. */\nexport interface GuildStat {\n  /** The number that rolls in on view. */\n  value: number;\n  /** Caption under the number, e.g. \"Countries\". */\n  label: React.ReactNode;\n  /** Value the digit drums start from. @default 0 */\n  start?: number;\n  /** Text before the number, e.g. \"$\". */\n  prefix?: string;\n  /** Text after the number, e.g. \"+\" or \"%\". Rendered in the accent color. */\n  suffix?: string;\n  /** Decimal places. @default 0 */\n  decimals?: number;\n  /** Extra Intl.NumberFormat options — e.g. `{ useGrouping: false }` for a year. */\n  formatOptions?: Intl.NumberFormatOptions;\n}\n\n/** A link shown in a person's reveal panel. */\nexport interface GuildLink {\n  /** Visible label, e.g. \"Website\", \"Writing\", \"Email\". */\n  label: string;\n  /** Destination. `mailto:` links get a mail glyph, everything else an arrow. */\n  href: string;\n}\n\n/** A team member card. */\nexport interface GuildPerson {\n  /** Full name. Also seeds the generative portrait — keep it unique. */\n  name: string;\n  /** Job title shown under the name. */\n  role: string;\n  /** Department used by the filter, e.g. \"Design\". */\n  team: string;\n  /** One-line bio revealed on hover / focus / tap. */\n  bio?: string;\n  /** Links revealed with the bio. */\n  links?: GuildLink[];\n  /** Optional photo URL. Omit for a seeded generative portrait with initials. */\n  image?: string;\n}\n\n/** A numbered value in the values list. */\nexport interface GuildValue {\n  /** Short value name. */\n  title: React.ReactNode;\n  /** One or two sentences expanding on it. */\n  description?: React.ReactNode;\n}\n\n/** Imperative verbs exposed through the `ref` prop. */\nexport interface GuildHandle {\n  /** Replay the intro: stats roll again, cards plate back in, rules redraw. */\n  replay: () => void;\n  /** Switch the department filter. Pass `null` for everyone. */\n  setFilter: (team: string | null) => void;\n}\n\nexport interface GuildProps extends Omit<React.ComponentPropsWithoutRef<\"section\">, \"children\" | \"title\"> {\n  /** Small label above the mission statement. Pass `null` to hide. @default \"About us\" */\n  eyebrow?: React.ReactNode;\n  /**\n   * The mission statement, rendered as the section's `<h2>`. Pass `null` to\n   * hide the whole mission part (statement + stats).\n   */\n  mission?: React.ReactNode;\n  /** Supporting copy under the mission statement. Pass `null` to hide. */\n  missionBody?: React.ReactNode;\n  /** Oversized stat row under the mission. Numbers roll in on view. Pass `[]` to hide. */\n  stats?: GuildStat[];\n  /** Heading of the team part. @default \"The people behind the work\" */\n  teamTitle?: React.ReactNode;\n  /** Copy under the team heading. Pass `null` to hide. */\n  teamDescription?: React.ReactNode;\n  /** Team members. Pass `[]` to hide the team part. */\n  people?: GuildPerson[];\n  /** Show the department filter (only rendered when there are 2+ teams). @default true */\n  showFilter?: boolean;\n  /** Label of the \"show everyone\" filter tab. @default \"Everyone\" */\n  allLabel?: string;\n  /** Controlled filter — a team name, or `null` for everyone. */\n  filter?: string | null;\n  /** Initial filter when uncontrolled. @default null (everyone) */\n  defaultFilter?: string | null;\n  /** Fires when the department filter changes (`null` = everyone). */\n  onFilterChange?: (team: string | null) => void;\n  /** Fires when a person's reveal panel is pinned open or closed by click, tap or keyboard. */\n  onPersonToggle?: (person: GuildPerson, open: boolean) => void;\n  /** Heading of the values part. @default \"What we hold to\" */\n  valuesTitle?: React.ReactNode;\n  /** Numbered values list. Pass `[]` to hide. */\n  values?: GuildValue[];\n  /**\n   * Portraits rest as a duotone in this hue and warm to full color on\n   * hover/focus; also tints numerals, rules and focus rings.\n   * @default \"#fda4af\"\n   */\n  accentColor?: string;\n  /** Imperative handle (`replay()`, `setFilter()`). React 19 ref-as-prop. */\n  ref?: React.Ref<GuildHandle>;\n  /** Extra classes for the `<section>` root. */\n  className?: string;\n}\n\n/* --------------------------------------------------------------- defaults */\n\nconst DEFAULT_ACCENT = \"#fda4af\";\nconst ALL = \"_all\";\nconst EASE: [number, number, number, number] = [0.22, 1, 0.36, 1];\nconst SPRING: Transition = { type: \"spring\", stiffness: 260, damping: 30, mass: 0.9 };\nconst INSTANT: Transition = { duration: 0 };\n\nconst DEFAULT_MISSION =\n  \"We build calm, durable software for teams who would rather ship than babysit their tools.\";\nconst DEFAULT_MISSION_BODY =\n  \"A small, distributed company — independent, profitable, and in no hurry to be anything else. We hire slowly, write things down, and keep the product honest.\";\n\nconst DEFAULT_STATS: GuildStat[] = [\n  { value: 2014, start: 1990, label: \"Founded\", formatOptions: { useGrouping: false } },\n  { value: 48, label: \"People on the team\" },\n  { value: 11, label: \"Countries we work from\" },\n  { value: 96, suffix: \"%\", label: \"Still here after two years\" },\n];\n\nconst DEFAULT_PEOPLE: GuildPerson[] = [\n  {\n    name: \"Mara Okafor\",\n    role: \"Co-founder & CEO\",\n    team: \"Operations\",\n    bio: \"Ran logistics for a rail freight network before deciding software could be quieter.\",\n    links: [\n      { label: \"Writing\", href: \"#\" },\n      { label: \"Email\", href: \"mailto:mara@example.com\" },\n    ],\n  },\n  {\n    name: \"Tomas Lindqvist\",\n    role: \"Co-founder & CTO\",\n    team: \"Engineering\",\n    bio: \"Compiler nerd. Still reviews every migration that touches billing.\",\n    links: [\n      { label: \"Website\", href: \"#\" },\n      { label: \"Email\", href: \"mailto:tomas@example.com\" },\n    ],\n  },\n  {\n    name: \"Ines Carvalho\",\n    role: \"Head of Design\",\n    team: \"Design\",\n    bio: \"Draws every flow on paper first; keeps a drawer of retired icons for luck.\",\n    links: [{ label: \"Portfolio\", href: \"#\" }],\n  },\n  {\n    name: \"Priya Raman\",\n    role: \"Product Lead\",\n    team: \"Product\",\n    bio: \"Former support engineer who reads every ticket tagged “confusing”.\",\n    links: [\n      { label: \"Writing\", href: \"#\" },\n      { label: \"Email\", href: \"mailto:priya@example.com\" },\n    ],\n  },\n  {\n    name: \"Kenji Arakawa\",\n    role: \"Staff Engineer\",\n    team: \"Engineering\",\n    bio: \"Makes slow queries fast and fast queries boring. Bakes on Fridays.\",\n    links: [{ label: \"Website\", href: \"#\" }],\n  },\n  {\n    name: \"Leo Brandt\",\n    role: \"Brand Designer\",\n    team: \"Design\",\n    bio: \"Type specimens, posters, and the occasional hand-lettered changelog.\",\n    links: [{ label: \"Portfolio\", href: \"#\" }],\n  },\n  {\n    name: \"Sofia Marchetti\",\n    role: \"People & Culture\",\n    team: \"Operations\",\n    bio: \"Designed our async onboarding — new hires ship in their first week.\",\n    links: [{ label: \"Email\", href: \"mailto:sofia@example.com\" }],\n  },\n  {\n    name: \"Daniel Osei\",\n    role: \"Platform Engineer\",\n    team: \"Engineering\",\n    bio: \"Keeps the deploy pipeline under four minutes and the pager quiet.\",\n    links: [{ label: \"Website\", href: \"#\" }],\n  },\n  {\n    name: \"Hana Kowalski\",\n    role: \"Product Designer\",\n    team: \"Design\",\n    bio: \"Prototypes in code, tests with real customers, sweats the empty states.\",\n    links: [\n      { label: \"Portfolio\", href: \"#\" },\n      { label: \"Email\", href: \"mailto:hana@example.com\" },\n    ],\n  },\n  {\n    name: \"Rafael Duarte\",\n    role: \"Product Manager\",\n    team: \"Product\",\n    bio: \"Turns long customer calls into short, opinionated specs.\",\n    links: [{ label: \"Writing\", href: \"#\" }],\n  },\n  {\n    name: \"Amara Nwosu\",\n    role: \"User Researcher\",\n    team: \"Product\",\n    bio: \"Has interviewed more than four hundred customers and kept every note.\",\n    links: [{ label: \"Writing\", href: \"#\" }],\n  },\n  {\n    name: \"Noor Haddad\",\n    role: \"Finance & Ops\",\n    team: \"Operations\",\n    bio: \"Closes the books in two days and explains them in two paragraphs.\",\n    links: [{ label: \"Email\", href: \"mailto:noor@example.com\" }],\n  },\n];\n\nconst DEFAULT_VALUES: GuildValue[] = [\n  {\n    title: \"Write it down\",\n    description: \"Decisions live in documents, not in meetings. Anyone should be able to catch up on anything.\",\n  },\n  {\n    title: \"Small and finished\",\n    description: \"We would rather ship one complete thing than three promising ones.\",\n  },\n  {\n    title: \"Customers in the room\",\n    description: \"Every team talks to the people who use the product, every single week.\",\n  },\n  {\n    title: \"Leave it calmer\",\n    description: \"Good tools fade into the background. That includes ours — and our process.\",\n  },\n];\n\n/* ---------------------------------------------------------------- helpers */\n\n/** FNV-1a string hash → 32-bit seed. */\nfunction hashString(s: string): number {\n  let h = 0x811c9dc5;\n  for (let i = 0; i < s.length; i++) {\n    h ^= s.charCodeAt(i);\n    h = Math.imul(h, 0x01000193);\n  }\n  return h >>> 0;\n}\n\n/** Seeded PRNG — deterministic on server and client. */\nfunction mulberry32(seed: number) {\n  let a = seed >>> 0;\n  return () => {\n    a = (a + 0x6d2b79f5) >>> 0;\n    let t = a;\n    t = Math.imul(t ^ (t >>> 15), t | 1);\n    t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n  };\n}\n\n/** Soft gradient-blob portrait background, seeded from the person's name. */\nfunction portraitBackground(name: string): string {\n  const rand = mulberry32(hashString(name));\n  const h = Math.floor(rand() * 360);\n  const blob = (dh: number, l: number) => {\n    const x = Math.round(10 + rand() * 80);\n    const y = Math.round(10 + rand() * 80);\n    const r = Math.round(38 + rand() * 30);\n    const hue = (h + dh + 360) % 360;\n    return `radial-gradient(circle at ${x}% ${y}%, hsl(${hue} 62% ${l}% / 0.95) 0%, hsl(${hue} 62% ${l}% / 0) ${r}%)`;\n  };\n  const angle = Math.floor(rand() * 360);\n  return [\n    blob(0, 72),\n    blob(28 + Math.floor(rand() * 30), 60),\n    blob(-30 - Math.floor(rand() * 30), 52),\n    `linear-gradient(${angle}deg, hsl(${(h + 330) % 360} 35% 18%), hsl(${(h + 20) % 360} 38% 30%))`,\n  ].join(\", \");\n}\n\nfunction initialsOf(name: string): string {\n  const parts = name.trim().split(/\\s+/).filter(Boolean);\n  const first = parts[0]?.[0] ?? \"\";\n  const last = parts.length > 1 ? (parts[parts.length - 1]?.[0] ?? \"\") : \"\";\n  return (first + last).toUpperCase();\n}\n\nfunction slug(s: string): string {\n  return (\n    s\n      .toLowerCase()\n      .replace(/[^a-z0-9]+/g, \"-\")\n      .replace(/^-|-$/g, \"\") || \"team\"\n  );\n}\n\n/* ----------------------------------------------------------------- glyphs */\n\nfunction ArrowGlyph({ className }: { className?: string }) {\n  return (\n    <svg aria-hidden viewBox=\"0 0 16 16\" className={className} fill=\"none\">\n      <path d=\"M5.5 10.5l5-5m0 0H6.5m4 0v4\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction MailGlyph({ className }: { className?: string }) {\n  return (\n    <svg aria-hidden viewBox=\"0 0 16 16\" className={className} fill=\"none\">\n      <rect x=\"2.5\" y=\"3.75\" width=\"11\" height=\"8.5\" rx=\"1.75\" stroke=\"currentColor\" strokeWidth=\"1.4\" />\n      <path d=\"M3 4.75l5 3.75 5-3.75\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\n/* ----------------------------------------------------------------- pieces */\n\ninterface CardProps {\n  person: GuildPerson;\n  layoutId: string;\n  panelId: string;\n  open: boolean;\n  /** Entry stagger index (intro) or -1 for \"already on screen, no entry\". */\n  entryIndex: number;\n  inView: boolean;\n  intro: boolean;\n  reducedMotion: boolean;\n  onToggle: (open: boolean) => void;\n}\n\nconst cardVariants: Variants = {\n  hidden: { opacity: 0, y: 16, scale: 0.98 },\n  shown: (delay: number) => ({\n    opacity: 1,\n    y: 0,\n    scale: 1,\n    transition: { ...SPRING, delay },\n  }),\n};\n\nfunction PersonCard({ person, layoutId, panelId, open, entryIndex, inView, intro, reducedMotion, onToggle }: CardProps) {\n  const [hovered, setHovered] = React.useState(false);\n  const toggleRef = React.useRef<HTMLButtonElement>(null);\n  const visible = open || hovered;\n  const background = React.useMemo(() => portraitBackground(person.name), [person.name]);\n  const initials = initialsOf(person.name);\n  const hasPanel = Boolean(person.bio || person.links?.length);\n  const delay = intro ? Math.min(Math.max(entryIndex, 0), 11) * 0.045 : 0;\n\n  return (\n    <motion.li\n      layoutId={layoutId}\n      layout={!reducedMotion}\n      custom={delay}\n      variants={cardVariants}\n      initial={entryIndex < 0 || reducedMotion ? false : \"hidden\"}\n      animate={inView ? \"shown\" : \"hidden\"}\n      transition={reducedMotion ? INSTANT : SPRING}\n      data-open={visible || undefined}\n      className=\"group/card relative flex min-w-0 flex-col\"\n      onPointerEnter={(e) => {\n        if (e.pointerType === \"mouse\") setHovered(true);\n      }}\n      onPointerLeave={(e) => {\n        if (e.pointerType === \"mouse\") setHovered(false);\n      }}\n      onKeyDown={(e) => {\n        if (e.key === \"Escape\" && visible) {\n          e.stopPropagation();\n          setHovered(false);\n          if (open) onToggle(false);\n          toggleRef.current?.focus();\n        }\n      }}\n    >\n      <div className=\"@container/portrait relative aspect-[4/5] w-full overflow-hidden rounded-2xl border border-white/[0.08] bg-neutral-900\">\n        {/* Portrait art: rests as an accent duotone, warms to full color. */}\n        <div\n          aria-hidden\n          className={cn(\n            \"absolute inset-0 grayscale-[1] contrast-[1.05] transition-[filter,transform] duration-700 ease-out\",\n            \"group-focus-within/card:grayscale-0 group-data-[open]/card:grayscale-0\",\n            !reducedMotion && \"group-data-[open]/card:scale-[1.04]\"\n          )}\n          style={{ backgroundImage: background }}\n        >\n          {person.image ? (\n            // eslint-disable-next-line @next/next/no-img-element\n            <img src={person.image} alt=\"\" className=\"absolute inset-0 size-full object-cover\" loading=\"lazy\" />\n          ) : (\n            <span\n              className=\"absolute inset-0 flex items-center justify-center font-semibold tracking-[-0.04em] text-white/85 mix-blend-soft-light select-none\"\n              style={{ fontSize: \"28cqw\" }}\n            >\n              {initials}\n            </span>\n          )}\n        </div>\n        <div\n          aria-hidden\n          className=\"absolute inset-0 mix-blend-color transition-opacity duration-700 ease-out group-focus-within/card:opacity-0 group-data-[open]/card:opacity-0\"\n          style={{ backgroundColor: \"var(--guild-accent)\" }}\n        />\n        <div\n          aria-hidden\n          className=\"absolute inset-0 bg-[radial-gradient(120%_90%_at_50%_20%,transparent_30%,rgba(10,10,10,0.55))] mix-blend-multiply transition-opacity duration-700 ease-out group-focus-within/card:opacity-40 group-data-[open]/card:opacity-40\"\n        />\n        <div\n          aria-hidden\n          className=\"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/45 via-transparent to-transparent\"\n        />\n        {/* Hairline sheen along the top edge. */}\n        <div aria-hidden className=\"pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/25 to-transparent\" />\n\n        <button\n          ref={toggleRef}\n          type=\"button\"\n          aria-expanded={hasPanel ? open : undefined}\n          aria-controls={hasPanel ? panelId : undefined}\n          aria-label={`${person.name}, ${person.role}${hasPanel ? (open ? \" — hide bio\" : \" — show bio\") : \"\"}`}\n          onClick={() => {\n            if (!hasPanel) return;\n            const next = !visible;\n            if (!next) setHovered(false);\n            onToggle(next);\n          }}\n          className=\"absolute inset-0 z-10 cursor-pointer rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--guild-accent)]\"\n        />\n\n        {hasPanel ? (\n          <motion.div\n            id={panelId}\n            inert={!visible}\n            aria-hidden={!visible}\n            initial={false}\n            animate={\n              reducedMotion\n                ? { opacity: visible ? 1 : 0, y: 0 }\n                : { opacity: visible ? 1 : 0, y: visible ? \"0%\" : \"calc(100% + 12px)\" }\n            }\n            transition={reducedMotion ? { duration: 0.15 } : { type: \"spring\", stiffness: 380, damping: 34 }}\n            className=\"absolute inset-x-1.5 bottom-1.5 z-20 rounded-xl border border-white/10 bg-neutral-950/80 p-2.5 shadow-[0_8px_24px_-8px_rgba(0,0,0,0.6)] backdrop-blur-md @[13rem]/portrait:inset-x-2 @[13rem]/portrait:bottom-2 @[13rem]/portrait:p-3\"\n          >\n            {person.bio ? (\n              <p className=\"line-clamp-4 text-pretty text-[11px] leading-snug text-white/75 @[13rem]/portrait:text-xs\">\n                {person.bio}\n              </p>\n            ) : null}\n            {person.links?.length ? (\n              <ul className={cn(\"flex flex-wrap gap-1\", person.bio && \"mt-2\")}>\n                {person.links.map((link) => {\n                  const mail = link.href.startsWith(\"mailto:\");\n                  return (\n                    <li key={link.label + link.href}>\n                      <a\n                        href={link.href}\n                        {...(!mail && /^https?:/.test(link.href) ? { target: \"_blank\", rel: \"noreferrer\" } : {})}\n                        className=\"inline-flex items-center gap-1 rounded-full border border-white/10 bg-white/[0.04] px-2 py-0.5 text-[11px] font-medium text-white/80 transition-colors hover:border-white/25 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--guild-accent)]\"\n                      >\n                        {mail ? <MailGlyph className=\"size-3\" /> : null}\n                        {link.label}\n                        {!mail ? <ArrowGlyph className=\"size-3 opacity-60\" /> : null}\n                        {!mail && /^https?:/.test(link.href) ? <span className=\"sr-only\"> (opens in a new tab)</span> : null}\n                      </a>\n                    </li>\n                  );\n                })}\n              </ul>\n            ) : null}\n          </motion.div>\n        ) : null}\n      </div>\n      <div className=\"mt-3 min-w-0 px-0.5\">\n        <p className=\"truncate text-sm font-medium text-white\">{person.name}</p>\n        <p className=\"mt-0.5 truncate text-xs text-white/50\">{person.role}</p>\n      </div>\n    </motion.li>\n  );\n}\n\n/* ------------------------------------------------------------------- main */\n\n/**\n * Guild — an about & team section block in three optional parts. (1) A\n * mission statement with an oversized stat row whose numbers roll in on\n * Tally digit drums. (2) A team grid of seeded generative portraits — soft\n * gradient blobs and initials — resting as an accent duotone that warms to\n * full color on hover or focus, with a reveal panel that slides up over the\n * portrait carrying a one-line bio and links (Enter/Space or tap pins it,\n * Escape closes). A Detent department filter re-flows the grid with shared\n * layout springs. (3) A numbered values list whose rule lines draw in.\n * Reduced motion shows the final layout with crossfades only.\n */\nexport function Guild({\n  eyebrow = \"About us\",\n  mission = DEFAULT_MISSION,\n  missionBody = DEFAULT_MISSION_BODY,\n  stats = DEFAULT_STATS,\n  teamTitle = \"The people behind the work\",\n  teamDescription = \"A few of the people who design, build and run the product — spread across eleven countries and one shared calendar.\",\n  people = DEFAULT_PEOPLE,\n  showFilter = true,\n  allLabel = \"Everyone\",\n  filter,\n  defaultFilter = null,\n  onFilterChange,\n  onPersonToggle,\n  valuesTitle = \"What we hold to\",\n  values = DEFAULT_VALUES,\n  accentColor = DEFAULT_ACCENT,\n  ref,\n  className,\n  style,\n  ...props\n}: GuildProps) {\n  const reducedMotion = useReducedMotion();\n  const [replayKey, setReplayKey] = React.useState(0);\n  const [innerFilter, setInnerFilter] = React.useState<string | null>(defaultFilter);\n  const activeFilter = filter !== undefined ? filter : innerFilter;\n  const [pinned, setPinned] = React.useState<string | null>(null);\n  const [announcement, setAnnouncement] = React.useState(\"\");\n\n  const uid = React.useId().replace(/[:]/g, \"\");\n  const headingId = `${uid}-heading`;\n\n  const teams = React.useMemo(() => {\n    const seen: string[] = [];\n    for (const p of people) if (!seen.includes(p.team)) seen.push(p.team);\n    return seen;\n  }, [people]);\n\n  const setFilter = React.useCallback(\n    (team: string | null) => {\n      if (filter === undefined) setInnerFilter(team);\n      onFilterChange?.(team);\n      setPinned(null);\n      const count = team ? people.filter((p) => p.team === team).length : people.length;\n      setAnnouncement(`Showing ${count} ${count === 1 ? \"person\" : \"people\"}${team ? ` in ${team}` : \"\"}.`);\n    },\n    [filter, onFilterChange, people]\n  );\n\n  React.useImperativeHandle(\n    ref,\n    () => ({\n      replay: () => {\n        setPinned(null);\n        setReplayKey((k) => k + 1);\n      },\n      setFilter,\n    }),\n    [setFilter]\n  );\n\n  const showMission = mission !== null && mission !== undefined && mission !== false;\n  const showStats = stats.length > 0;\n  const showTeam = people.length > 0;\n  const showValues = values.length > 0;\n  const filterOn = showFilter && teams.length > 1;\n\n  return (\n    <section\n      data-crucible=\"guild\"\n      aria-labelledby={showMission ? headingId : undefined}\n      aria-label={showMission ? undefined : \"About\"}\n      className={cn(\"@container relative isolate w-full overflow-hidden bg-neutral-950 text-white\", className)}\n      style={{ [\"--guild-accent\" as string]: accentColor, ...style }}\n      {...props}\n    >\n      {/* Faint accent bloom + top hairline. */}\n      <div aria-hidden className=\"pointer-events-none absolute inset-x-0 top-0 -z-10 h-[28rem]\">\n        <div className=\"absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent\" />\n        <div\n          className=\"absolute inset-0\"\n          style={{\n            background: `radial-gradient(60% 70% at 20% 0%, color-mix(in srgb, ${accentColor} 10%, transparent), transparent 70%)`,\n          }}\n        />\n      </div>\n\n      <GuildBody\n        key={replayKey}\n        uid={uid}\n        headingId={headingId}\n        reducedMotion={reducedMotion}\n        eyebrow={eyebrow}\n        mission={showMission ? mission : null}\n        missionBody={missionBody}\n        stats={showStats ? stats : []}\n        teamTitle={teamTitle}\n        teamDescription={teamDescription}\n        people={showTeam ? people : []}\n        teams={teams}\n        filterOn={filterOn}\n        allLabel={allLabel}\n        activeFilter={activeFilter}\n        setFilter={setFilter}\n        pinned={pinned}\n        setPinned={(name, open) => {\n          setPinned(open ? name : null);\n          const person = people.find((p) => p.name === name);\n          if (person) onPersonToggle?.(person, open);\n        }}\n        valuesTitle={valuesTitle}\n        values={showValues ? values : []}\n      />\n\n      <p role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n        {announcement}\n      </p>\n    </section>\n  );\n}\n\ninterface BodyProps {\n  uid: string;\n  headingId: string;\n  reducedMotion: boolean;\n  eyebrow: React.ReactNode;\n  mission: React.ReactNode;\n  missionBody: React.ReactNode;\n  stats: GuildStat[];\n  teamTitle: React.ReactNode;\n  teamDescription: React.ReactNode;\n  people: GuildPerson[];\n  teams: string[];\n  filterOn: boolean;\n  allLabel: string;\n  activeFilter: string | null;\n  setFilter: (team: string | null) => void;\n  pinned: string | null;\n  setPinned: (name: string, open: boolean) => void;\n  valuesTitle: React.ReactNode;\n  values: GuildValue[];\n}\n\nfunction GuildBody({\n  uid,\n  headingId,\n  reducedMotion,\n  eyebrow,\n  mission,\n  missionBody,\n  stats,\n  teamTitle,\n  teamDescription,\n  people,\n  teams,\n  filterOn,\n  allLabel,\n  activeFilter,\n  setFilter,\n  pinned,\n  setPinned,\n  valuesTitle,\n  values,\n}: BodyProps) {\n  const missionRef = React.useRef<HTMLDivElement>(null);\n  const teamRef = React.useRef<HTMLDivElement>(null);\n  const valuesRef = React.useRef<HTMLOListElement>(null);\n  const missionInView = useInView(missionRef, { once: true, amount: 0.3 });\n  const teamInView = useInView(teamRef, { once: true, amount: 0.15 });\n  const valuesInView = useInView(valuesRef, { once: true, amount: 0.3 });\n  const mShow = reducedMotion || missionInView;\n  const tShow = reducedMotion || teamInView;\n  const vShow = reducedMotion || valuesInView;\n\n  // Intro window for the grid's staggered plate-in; filter changes after it\n  // only fade newly-entering cards in place.\n  const [gridIntro, setGridIntro] = React.useState(true);\n  React.useEffect(() => {\n    if (!teamInView) return;\n    const t = window.setTimeout(() => setGridIntro(false), 900);\n    return () => window.clearTimeout(t);\n  }, [teamInView]);\n\n  const visiblePeople = React.useMemo(\n    () =>\n      people\n        .map((p, i) => ({ p, i }))\n        .filter(({ p }) => !filterOn || activeFilter === null || p.team === activeFilter),\n    [people, filterOn, activeFilter]\n  );\n\n  // Cards already on screen keep their identity (shared layout); only new ones fade in.\n  // Tracked as state (previous-render pattern) so render stays pure.\n  const [filterHistory, setFilterHistory] = React.useState<{ current: string | null; previous?: string | null }>({\n    current: activeFilter,\n  });\n  if (filterHistory.current !== activeFilter) {\n    setFilterHistory({ current: activeFilter, previous: filterHistory.current });\n  }\n  const previously = React.useMemo(() => {\n    if (filterHistory.previous === undefined) return null;\n    const prev = filterHistory.previous;\n    const set = new Set<number>();\n    people.forEach((p, i) => {\n      if (!filterOn || prev === null || p.team === prev) set.add(i);\n    });\n    return set;\n  }, [filterHistory.previous, people, filterOn]);\n\n  const rise = (delay: number) =>\n    reducedMotion\n      ? // Keep the same `initial` as the motion branch and animate straight to\n        // the resting pose with a plain fade: SSR commits the hidden pose before\n        // the reduced-motion query resolves, and swapping `initial` to `false`\n        // after mount leaves it stuck there.\n        {\n          initial: { opacity: 0, y: 14, filter: \"blur(4px)\" },\n          animate: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n          transition: { duration: 0.2, ease: \"linear\" as const },\n        }\n      : {\n          initial: { opacity: 0, y: 14, filter: \"blur(4px)\" },\n          animate: mShow ? { opacity: 1, y: 0, filter: \"blur(0px)\" } : undefined,\n          transition: { duration: 0.6, ease: EASE, delay },\n        };\n\n  const grid = (\n    <ul\n      aria-label={activeFilter ? `${activeFilter} team` : \"Team\"}\n      className=\"grid grid-cols-2 gap-x-3 gap-y-6 @lg:gap-x-4 @xl:grid-cols-3 @3xl:grid-cols-4 @4xl:gap-x-5\"\n    >\n      {visiblePeople.map(({ p, i }, order) => (\n        <PersonCard\n          key={i}\n          person={p}\n          layoutId={`${uid}-person-${i}`}\n          panelId={`${uid}-bio-${i}`}\n          open={pinned === p.name}\n          entryIndex={previously && previously.has(i) ? -1 : order}\n          inView={tShow}\n          intro={gridIntro && !reducedMotion}\n          reducedMotion={reducedMotion}\n          onToggle={(open) => setPinned(p.name, open)}\n        />\n      ))}\n    </ul>\n  );\n\n  const filterValue = activeFilter === null ? ALL : slug(activeFilter);\n  const tabLabel = (label: string, count: number) => (\n    <span className=\"inline-flex items-center gap-1.5\">\n      {label}\n      <span className=\"text-[11px] tabular-nums text-white/35\">{count}</span>\n    </span>\n  );\n\n  return (\n    <div className=\"mx-auto flex w-full max-w-6xl flex-col gap-16 px-5 py-14 @xl:px-8 @3xl:gap-24 @3xl:py-20\">\n      {mission !== null || stats.length > 0 ? (\n        <div ref={missionRef} className=\"flex flex-col gap-10 @3xl:gap-14\">\n          {mission !== null ? (\n            <div className=\"grid gap-5 @4xl:grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)] @4xl:items-end @4xl:gap-16\">\n              <div className=\"flex flex-col gap-5\">\n                {eyebrow !== null && eyebrow !== undefined ? (\n                  <motion.p\n                    {...rise(0)}\n                    className=\"inline-flex items-center gap-2 self-start text-xs font-medium tracking-[0.14em] text-white/55 uppercase\"\n                  >\n                    <span aria-hidden className=\"size-1.5 rounded-full\" style={{ backgroundColor: \"var(--guild-accent)\" }} />\n                    {eyebrow}\n                  </motion.p>\n                ) : null}\n                <motion.h2\n                  id={headingId}\n                  {...rise(0.06)}\n                  className=\"text-balance text-[1.75rem] leading-[1.12] font-semibold tracking-[-0.025em] text-white @xl:text-4xl @4xl:text-5xl\"\n                >\n                  {mission}\n                </motion.h2>\n              </div>\n              {missionBody !== null && missionBody !== undefined ? (\n                <motion.p {...rise(0.14)} className=\"max-w-md text-pretty text-sm leading-relaxed text-white/55 @xl:text-base\">\n                  {missionBody}\n                </motion.p>\n              ) : null}\n            </div>\n          ) : null}\n\n          {stats.length > 0 ? (\n            <dl\n              className=\"grid border-t border-white/[0.08]\"\n              style={{ gridTemplateColumns: \"repeat(auto-fit, minmax(min(8rem, 100%), 1fr))\" }}\n            >\n              {stats.map((stat, i) => (\n                <motion.div\n                  key={i}\n                  {...rise(0.18 + i * 0.06)}\n                  className=\"relative flex flex-col-reverse gap-1.5 border-b border-white/[0.08] py-5 pr-4 @xl:py-7\"\n                >\n                  <dt className=\"text-xs text-white/50 @xl:text-sm\">{stat.label}</dt>\n                  <dd className=\"flex items-baseline text-4xl font-semibold tracking-[-0.03em] text-white tabular-nums @3xl:text-5xl @5xl:text-6xl\">\n                    {stat.prefix ? <span className=\"mr-0.5 text-white/60\">{stat.prefix}</span> : null}\n                    <Tally\n                      value={stat.value}\n                      start={stat.start ?? 0}\n                      decimals={stat.decimals ?? 0}\n                      formatOptions={stat.formatOptions}\n                      duration={1.2}\n                      delay={0.2 + i * 0.08}\n                      glow={false}\n                    />\n                    {stat.suffix ? (\n                      <span className=\"ml-0.5\" style={{ color: \"var(--guild-accent)\" }}>\n                        {stat.suffix}\n                      </span>\n                    ) : null}\n                  </dd>\n                </motion.div>\n              ))}\n            </dl>\n          ) : null}\n        </div>\n      ) : null}\n\n      {people.length > 0 ? (\n        <div ref={teamRef} className=\"flex flex-col gap-7\">\n          <div className=\"flex max-w-2xl flex-col gap-2\">\n            <h3 className=\"text-xl font-semibold tracking-[-0.015em] text-white @xl:text-2xl\">{teamTitle}</h3>\n            {teamDescription !== null && teamDescription !== undefined ? (\n              <p className=\"text-pretty text-sm leading-relaxed text-white/55\">{teamDescription}</p>\n            ) : null}\n          </div>\n          {filterOn ? (\n            <Detent\n              value={filterValue}\n              onValueChange={(v) => setFilter(v === ALL ? null : (teams.find((t) => slug(t) === v) ?? null))}\n              label=\"Filter by team\"\n              className=\"gap-6\"\n              listClassName=\"max-w-full overflow-x-auto [scrollbar-width:none]\"\n              items={[\n                { value: ALL, label: tabLabel(allLabel, people.length), content: activeFilter === null ? grid : null },\n                ...teams.map((t) => ({\n                  value: slug(t),\n                  label: tabLabel(t, people.filter((p) => p.team === t).length),\n                  content: activeFilter === t ? grid : null,\n                })),\n              ]}\n            />\n          ) : (\n            grid\n          )}\n        </div>\n      ) : null}\n\n      {values.length > 0 ? (\n        <div className=\"grid gap-8 @4xl:grid-cols-[minmax(0,1fr)_minmax(0,2fr)] @4xl:gap-16\">\n          <h3 className=\"text-xl font-semibold tracking-[-0.015em] text-white @xl:text-2xl\">{valuesTitle}</h3>\n          <ol ref={valuesRef} className=\"grid gap-x-10 gap-y-8 @2xl:grid-cols-2\">\n            {values.map((v, i) => (\n              <li key={i} className=\"relative pt-5\">\n                <motion.span\n                  aria-hidden\n                  className=\"absolute inset-x-0 top-0 h-px origin-left\"\n                  style={{\n                    background: `linear-gradient(90deg, var(--guild-accent), color-mix(in srgb, var(--guild-accent) 25%, rgba(255,255,255,0.1)) 40%, rgba(255,255,255,0.08))`,\n                  }}\n                  initial={{ scaleX: 0 }}\n                  animate={vShow ? { scaleX: 1 } : undefined}\n                  transition={reducedMotion ? { duration: 0.2, ease: \"linear\" } : { duration: 0.75, ease: EASE, delay: i * 0.09 }}\n                />\n                <motion.div\n                  className=\"flex gap-4\"\n                  initial={{ opacity: 0, y: 8 }}\n                  animate={vShow ? { opacity: 1, y: 0 } : undefined}\n                  transition={reducedMotion ? { duration: 0.2, ease: \"linear\" } : { duration: 0.5, ease: EASE, delay: 0.12 + i * 0.09 }}\n                >\n                  <span\n                    aria-hidden\n                    className=\"pt-0.5 font-mono text-xs tabular-nums\"\n                    style={{ color: \"var(--guild-accent)\" }}\n                  >\n                    {String(i + 1).padStart(2, \"0\")}\n                  </span>\n                  <div className=\"min-w-0\">\n                    <p className=\"text-base font-medium text-white\">{v.title}</p>\n                    {v.description ? (\n                      <p className=\"mt-1.5 text-pretty text-sm leading-relaxed text-white/55\">{v.description}</p>\n                    ) : null}\n                  </div>\n                </motion.div>\n              </li>\n            ))}\n          </ol>\n        </div>\n      ) : null}\n    </div>\n  );\n}\n"
    }
  ]
}