openAt(0)} className="max-h-96 w-full" />
);
} else if (count === 2) {
grid = (
{visible.map((img, i) => (
openAt(i)} />
))}
);
} else if (count === 3) {
grid = (
openAt(0)} className="row-span-2" />
openAt(1)} />
openAt(2)} />
);
} else {
// 4+ → 2×2, last visible tile carries the "+N" overlay when collapsed.
grid = (
{visible.map((img, i) => {
const isLast = i === visible.length - 1;
return (
openAt(i)}
overlayCount={isLast && hiddenCount > 0 ? hiddenCount : undefined}
/>
);
})}
);
}
return (
<>
{grid}
>
);
}