Wrap the grid you already have: a thumbnail grows into the full view, zooms where you aim, and shrinks back into its hole when you close.
pnpm dlx shadcn@latest add "https://hairlineui.com/r/image-viewer.json"