---
title: "Mixed Gallery · UI SDK — StyleX Blocks"
description: "Asymmetric mixed-aspect bento gallery pairing panoramic wide plates, tall portrait specimens, and square studies with a segmented discipline filter and keyboard-navigable lightbox dialog."
url: "https://stylexblocks.com/block/ui-sdk/mixed-gallery/"
agent:
  instructions: "Use this search API to find relevant components and blocks across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://stylexblocks.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Mixed Gallery block

Asymmetric mixed-aspect bento gallery pairing panoramic wide plates, tall portrait specimens, and square studies with a segmented discipline filter and keyboard-navigable lightbox dialog.

- Behavior engine: UI SDK
- Category: [Content](https://stylexblocks.com/blocks/content.md)
- Built with: [Badge](https://stylexblocks.com/components/ui-sdk/badge.md), [Button](https://stylexblocks.com/components/ui-sdk/button.md), [Center](https://stylexblocks.com/components/ui-sdk/center.md), [Dialog](https://stylexblocks.com/components/ui-sdk/dialog.md), [Grid](https://stylexblocks.com/components/ui-sdk/grid.md), [Heading](https://stylexblocks.com/components/ui-sdk/heading.md), [Icon](https://stylexblocks.com/components/ui-sdk/icon.md), [Icon Button](https://stylexblocks.com/components/ui-sdk/icon-button.md), [Kbd](https://stylexblocks.com/components/ui-sdk/kbd.md), [Section](https://stylexblocks.com/components/ui-sdk/section.md), [Segment Group](https://stylexblocks.com/components/ui-sdk/segment-group.md), [Separator](https://stylexblocks.com/components/ui-sdk/separator.md), [Stack](https://stylexblocks.com/components/ui-sdk/stack.md), [Text](https://stylexblocks.com/components/ui-sdk/text.md)
- HTML page: https://stylexblocks.com/block/ui-sdk/mixed-gallery/

## Install

Configure the project once (sets the behavior engine and import aliases):

```sh
npx stylexblocks init --style ui-sdk
```

Then add the item as source you own:

```sh
npx stylexblocks add mixed-gallery
```

Equivalent: `npx shadcn add @stylexblocks/mixed-gallery`. Registry item JSON: https://stylexblocks.com/r/ui-sdk/mixed-gallery.json

## Usage

```tsx
import { MixedGallery } from "#components/blocks/ui-sdk/mixed-gallery.tsx";

export function Example() {
  return (
    <div style={{ minHeight: "100dvh" }}>
      <MixedGallery />
    </div>
  );
}
```

## Source

`components/blocks/ui-sdk/mixed-gallery.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { useCallback, useEffect, useMemo, useState } from "react";
import { Badge } from "#components/ui/ui-sdk/badge.tsx";
import { Button } from "#components/ui/ui-sdk/button.tsx";
import { Center, Circle } from "#components/ui/ui-sdk/center.tsx";
import { Dialog } from "#components/ui/ui-sdk/dialog.tsx";
import { Grid } from "#components/ui/ui-sdk/grid.tsx";
import { Heading } from "#components/ui/ui-sdk/heading.tsx";
import { Icon } from "#components/ui/ui-sdk/icon.tsx";
import { IconButton } from "#components/ui/ui-sdk/icon-button.tsx";
import { Kbd } from "#components/ui/ui-sdk/kbd.tsx";
import { Section } from "#components/ui/ui-sdk/section.tsx";
import { SegmentGroup } from "#components/ui/ui-sdk/segment-group.tsx";
import { Separator } from "#components/ui/ui-sdk/separator.tsx";
import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";
import { Text } from "#components/ui/ui-sdk/text.tsx";
import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";
import { semanticRadii } from "@stylexblocks/ui/semantic-tokens/radii.stylex.ts";
import { semanticShadows } from "@stylexblocks/ui/semantic-tokens/shadows.stylex.ts";
import { durations } from "@stylexblocks/ui/tokens/durations.stylex.ts";
import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";
import { lineHeights } from "@stylexblocks/ui/tokens/line-heights.stylex.ts";
import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";

export type MixedGalleryCategory = "all" | "print" | "materials" | "editions";

export type MixedGalleryFormat = "wide" | "portrait" | "square";

export interface MixedGalleryItem {
  id: string;
  plate: string;
  title: string;
  category: Exclude<MixedGalleryCategory, "all">;
  categoryLabel: string;
  format: MixedGalleryFormat;
  formatLabel: string;
  medium: string;
  stock: string;
  dimensions: string;
  edition: string;
  year: string;
  notes: string;
  src: string;
  alt: string;
}

const DEFAULT_GALLERY_ITEMS: ReadonlyArray<MixedGalleryItem> = [
  {
    id: "vermilion-indigo-overprint",
    plate: "FM-01",
    title: "Vermilion & Indigo Overprint Sheet",
    category: "print",
    categoryLabel: "Print",
    format: "wide",
    formatLabel: "Wide 2:1",
    medium: "Two-drum risograph proof",
    stock: "Munken Lynx 240 gsm cotton rag",
    dimensions: "420 × 210 mm",
    edition: "Edition of 80 · Proof #14",
    year: "2025",
    notes:
      "Registration press sheet studying soy-ink transparency where bright vermilion arches overlap deep cobalt halftone fields to yield plum tertiary tones.",
    src: "/images/blocks/mixed-gallery/vermilion-indigo-overprint.webp",
    alt: "Wide risograph overprint proof sheet with vermilion circles and deep indigo arches intersecting on archival cream paper with registration marks",
  },
  {
    id: "belgian-linen-weave",
    plate: "FM-02",
    title: "Unbleached Belgian Linen Weave",
    category: "materials",
    categoryLabel: "Materials",
    format: "portrait",
    formatLabel: "Portrait 1:2",
    medium: "Plain-weave raw flax bookcloth",
    stock: "380 gsm wet-spun flax on kozo backing",
    dimensions: "180 × 360 mm",
    edition: "Swatch Folio B · Sample 04",
    year: "2025",
    notes:
      "Vertical swatch card comparing warp tension and slub frequency between raw wet-spun Belgian flax and calendered bookbinding cloth under raking studio light.",
    src: "/images/blocks/mixed-gallery/belgian-linen-weave.webp",
    alt: "Tall vertical raw Belgian linen bookcloth specimen pinned with a brass tack onto a dark charcoal drafting board, showing woven grain and frayed selvedge",
  },
  {
    id: "kettle-stitch-monograph",
    plate: "FM-03",
    title: "Exposed Kettle-Stitch Monograph",
    category: "editions",
    categoryLabel: "Editions",
    format: "square",
    formatLabel: "Square 1:1",
    medium: "Smyth-sewn open-spine dummy",
    stock: "1.8 mm millboard & 120 gsm cream laid",
    dimensions: "210 × 210 mm",
    edition: "Edition of 120 · Dummy #03",
    year: "2024",
    notes:
      "Square open-spine binding study joining six folded signatures of cream laid text paper with waxed ochre linen thread so spreads open completely flat.",
    src: "/images/blocks/mixed-gallery/kettle-stitch-monograph.webp",
    alt: "Overhead view of a square open-spine monograph with exposed folded paper signatures bound in waxed ochre kettle-stitch linen thread",
  },
  {
    id: "forma-grotesk-specimen",
    plate: "FM-04",
    title: "Lead Type Specimen: Forma 48pt",
    category: "print",
    categoryLabel: "Print",
    format: "square",
    formatLabel: "Square 1:1",
    medium: "Letterpress relief broadside",
    stock: "Crane Lettra 300 gsm pearl cotton",
    dimensions: "240 × 240 mm",
    edition: "Edition of 60 · Proof #09",
    year: "2024",
    notes:
      "Deep-impression letterpress study struck from foundry metal forms and brass rules, measuring ink squeeze and counter-form balance on soft cotton rag.",
    src: "/images/blocks/mixed-gallery/forma-grotesk-specimen.webp",
    alt: "Square Swiss-grid letterpress specimen sheet featuring bold black geometric letterforms and red hairline baseline guides on pearl cotton paper",
  },
  {
    id: "deckle-paper-tower",
    plate: "FM-05",
    title: "Blind-Embossed Paper Waterfall",
    category: "editions",
    categoryLabel: "Editions",
    format: "portrait",
    formatLabel: "Portrait 1:2",
    medium: "Six-grade archival rag & kozo set",
    stock: "90–350 gsm cotton, kozo, and hemp",
    dimensions: "190 × 380 mm",
    edition: "Archive Box II · Set 07",
    year: "2025",
    notes:
      "Stepped vertical cascade of six archival paper stocks, each struck with a concentric circular blind emboss to test fiber resilience and shadow relief.",
    src: "/images/blocks/mixed-gallery/deckle-paper-tower.webp",
    alt: "Tall vertical stepped stack of six archival paper sheets from warm ivory to deep slate, each embossed with concentric circular rings",
  },
  {
    id: "celadon-iron-glaze-tiles",
    plate: "FM-06",
    title: "Reduction-Fired Celadon & Iron Tiles",
    category: "materials",
    categoryLabel: "Materials",
    format: "square",
    formatLabel: "Square 1:1",
    medium: "Cone 10 stoneware glaze matrix",
    stock: "Speckled buff clay & wood-ash glaze",
    dimensions: "220 × 220 mm",
    edition: "Kiln Log 18 · Tray 02",
    year: "2025",
    notes:
      "Nine-tile ceramic glaze test grid charting iron oxide concentration from translucent sea-green celadon through tenmoku rust to matte charred basalt.",
    src: "/images/blocks/mixed-gallery/celadon-iron-glaze-tiles.webp",
    alt: "Square 3-by-3 tray of beveled stoneware ceramic test tiles glazed in pale celadon, ochre ash, iron rust, slate blue, and charcoal",
  },
  {
    id: "patinated-brass-foils",
    plate: "FM-07",
    title: "Patinated Brass & Copper Foils",
    category: "materials",
    categoryLabel: "Materials",
    format: "square",
    formatLabel: "Square 1:1",
    medium: "Hot-foil stamping shim archive",
    stock: "0.4 mm cartridge brass & verdigris copper",
    dimensions: "200 × 200 mm",
    edition: "Metal Archive · Plate 11",
    year: "2024",
    notes:
      "Metallurgical surface study comparing specular sheen and oxidation behavior across brushed brass, satin copper, oil-rubbed bronze, and turquoise verdigris.",
    src: "/images/blocks/mixed-gallery/patinated-brass-foils.webp",
    alt: "Four geometric metallic foil plates—brushed brass circle, satin copper square, ribbed bronze block, and oxidized verdigris semicircle—set on a dark tray",
  },
  {
    id: "mineral-pigment-spectrum",
    plate: "FM-08",
    title: "Chromatic Mineral Pigment Spectrum",
    category: "print",
    categoryLabel: "Print",
    format: "wide",
    formatLabel: "Wide 2:1",
    medium: "Ten-band silkscreen ink drawdown",
    stock: "Somerset Satin 300 gsm & linseed varnish",
    dimensions: "480 × 240 mm",
    edition: "Edition of 50 · Pull #06",
    year: "2026",
    notes:
      "Panoramic knife-drawdown card mapping opacity, satin sheen, and undertone warmth across ten hand-mulled mineral pigments from raw ochre to lamp black.",
    src: "/images/blocks/mixed-gallery/mineral-pigment-spectrum.webp",
    alt: "Wide archival pigment drawdown sheet showing ten vertical silkscreen ink bands transitioning from bone white and ochre through terracotta, sage, indigo, and lamp black",
  },
];

const CATEGORY_OPTIONS: ReadonlyArray<{
  value: MixedGalleryCategory;
  label: string;
}> = [
  { value: "all", label: "All" },
  { value: "print", label: "Print" },
  { value: "materials", label: "Materials" },
  { value: "editions", label: "Editions" },
];

const TABLET = "@container mixed-gallery (max-width: 860px)";
const COMPACT = "@container mixed-gallery (max-width: 560px)";

const styles = stylex.create({
  root: {
    backgroundColor: semanticColors.bg,
    color: semanticColors.fg,
    containerName: "mixed-gallery",
    containerType: "inline-size",
    fontFamily: fonts.body,
    minHeight: "100%",
    paddingBlock: {
      default: spacing._12,
      [COMPACT]: spacing._8,
    },
    paddingInline: {
      default: spacing._6,
      [COMPACT]: spacing._4,
    },
    width: "100%",
  },
  content: {
    maxWidth: "75rem",
    width: "100%",
  },
  header: {
    textAlign: "center",
  },
  headline: {
    marginBlock: 0,
    maxWidth: "24ch",
    textAlign: "center",
    textWrap: "balance",
  },
  description: {
    maxWidth: "58ch",
    textWrap: "balance",
  },
  filterBar: {
    maxWidth: "100%",
    overflowX: "auto",
    paddingBlock: spacing._0_5,
  },
  gallerySection: {
    width: "100%",
  },
  // Asymmetric mixed-aspect bento grid: 3 columns on desktop with wide 2x1
  // panoramic heroes, tall 1x2 portrait sheets, and 1x1 square specimens.
  // Collapses to a balanced 2-column bento on tablet and 1 column on mobile.
  bentoGrid: {
    gridTemplateColumns: {
      default: "repeat(3, minmax(0, 1fr))",
      [TABLET]: "repeat(2, minmax(0, 1fr))",
      [COMPACT]: "minmax(0, 1fr)",
    },
    width: "100%",
  },
  // Balanced grid used when viewing a filtered subset so plates never leave
  // awkward orphan spans.
  filteredGridThree: {
    gridTemplateColumns: {
      default: "repeat(3, minmax(0, 1fr))",
      [TABLET]: "repeat(2, minmax(0, 1fr))",
      [COMPACT]: "minmax(0, 1fr)",
    },
    width: "100%",
  },
  filteredGridTwo: {
    gridTemplateColumns: {
      default: "repeat(2, minmax(0, 1fr))",
      [COMPACT]: "minmax(0, 1fr)",
    },
    width: "100%",
  },
  tileButton: {
    "--tile-img-scale": {
      default: "1",
      ":hover": "1.035",
      ":focus-visible": "1.035",
    },
    "--tile-cue-opacity": {
      default: "0.78",
      ":hover": "1",
      ":focus-visible": "1",
    },
    appearance: "none",
    backgroundColor: semanticColors.bgMuted,
    borderColor: {
      default: semanticColors.border,
      ":hover": semanticColors.borderEmphasized,
      ":focus-visible": semanticColors.accentBorder,
    },
    borderRadius: semanticRadii.panelLg,
    borderStyle: "solid",
    borderWidth: "1px",
    boxShadow: {
      default: semanticShadows.xs,
      ":hover": semanticShadows.md,
    },
    color: "#faf8f5",
    cursor: "pointer",
    display: "block",
    fontFamily: "inherit",
    minHeight: 0,
    minWidth: 0,
    outlineColor: {
      default: null,
      ":focus-visible": semanticColors.accentFocusRing,
    },
    outlineOffset: {
      default: null,
      ":focus-visible": "2px",
    },
    outlineStyle: {
      default: "none",
      ":focus-visible": "solid",
    },
    outlineWidth: {
      default: 0,
      ":focus-visible": "2px",
    },
    overflow: "hidden",
    paddingBlock: 0,
    paddingInline: 0,
    position: "relative",
    textAlign: "left",
    transform: {
      default: "translateY(0px)",
      ":hover": "translateY(-2px)",
    },
    transitionDuration: durations.moderate,
    transitionProperty: "border-color, box-shadow, transform",
    transitionTimingFunction: "cubic-bezier(0.2, 0, 0, 1)",
    width: "100%",
  },
  tileWide: {
    aspectRatio: {
      default: "2 / 1",
      [TABLET]: "16 / 9",
      [COMPACT]: "3 / 2",
    },
    gridColumnEnd: {
      default: "span 2",
      [COMPACT]: "auto",
    },
  },
  tilePortrait: {
    aspectRatio: {
      default: "auto",
      [TABLET]: "1 / 1",
      [COMPACT]: "4 / 5",
    },
    gridRowEnd: {
      default: "span 2",
      [TABLET]: "auto",
    },
    height: {
      default: "100%",
      [TABLET]: "auto",
    },
  },
  tileSquare: {
    aspectRatio: {
      default: "1 / 1",
      [COMPACT]: "4 / 3",
    },
  },
  tileFiltered: {
    aspectRatio: "4 / 3",
  },
  tileImage: {
    bottom: 0,
    display: "block",
    height: "100%",
    left: 0,
    objectFit: "cover",
    position: "absolute",
    right: 0,
    top: 0,
    transform: "scale(var(--tile-img-scale, 1))",
    transitionDuration: durations.slow,
    transitionProperty: "transform",
    transitionTimingFunction: "cubic-bezier(0.2, 0, 0, 1)",
    width: "100%",
  },
  tileTopBar: {
    left: spacing._3_5,
    pointerEvents: "none",
    position: "absolute",
    right: spacing._3_5,
    top: spacing._3_5,
    zIndex: 1,
  },
  platePill: {
    backdropFilter: "blur(8px)",
    backgroundColor: "rgba(18, 17, 16, 0.68)",
    borderColor: "rgba(255, 255, 255, 0.16)",
    borderRadius: semanticRadii.indicatorSm,
    borderStyle: "solid",
    borderWidth: "1px",
    color: "#faf8f5",
    paddingBlock: spacing._0_5,
    paddingInline: spacing._1_5,
  },
  inspectCue: {
    backdropFilter: "blur(8px)",
    backgroundColor: "rgba(18, 17, 16, 0.56)",
    borderColor: "rgba(255, 255, 255, 0.16)",
    borderStyle: "solid",
    borderWidth: "1px",
    color: "#faf8f5",
    height: "1.75rem",
    opacity: "var(--tile-cue-opacity, 0.78)",
    transitionDuration: durations.moderate,
    transitionProperty: "opacity",
    width: "1.75rem",
  },
  tileOverlay: {
    backgroundImage:
      "linear-gradient(to top, rgba(16, 15, 14, 0.84) 0%, rgba(16, 15, 14, 0.44) 55%, rgba(16, 15, 14, 0) 100%)",
    bottom: 0,
    left: 0,
    paddingBottom: spacing._3_5,
    paddingInline: spacing._4,
    paddingTop: spacing._10,
    pointerEvents: "none",
    position: "absolute",
    right: 0,
    zIndex: 1,
  },
  tileTitle: {
    color: "#faf8f5",
  },
  tileMedium: {
    color: "rgba(250, 248, 245, 0.8)",
  },
  tileFormat: {
    color: "rgba(250, 248, 245, 0.66)",
    flexShrink: 0,
  },
  // Lightbox dialog styles
  dialogContent: {
    borderColor: semanticColors.border,
    borderStyle: "solid",
    borderWidth: "1px",
    maxWidth: "min(56rem, calc(100vw - 2rem))",
    overflow: "hidden",
    width: "calc(100% - 2rem)",
  },
  dialogHeader: {
    alignItems: "flex-start",
    display: "flex",
    gap: spacing._4,
    justifyContent: "space-between",
    paddingBlock: spacing._4,
    paddingInline: spacing._5,
  },
  dialogCloseButton: {
    position: "static",
    right: "auto",
    top: "auto",
  },
  dialogBody: {
    display: "flex",
    flexDirection: "column",
    gap: spacing._4,
    paddingBlock: 0,
    paddingInline: spacing._5,
  },
  lightboxMat: {
    backgroundColor: semanticColors.bgMuted,
    borderColor: semanticColors.borderSubtle,
    borderRadius: semanticRadii.panel,
    borderStyle: "solid",
    borderWidth: "1px",
    height: "min(52dvh, 26rem)",
    overflow: "hidden",
    paddingBlock: spacing._4,
    paddingInline: spacing._4,
    width: "100%",
  },
  lightboxImage: {
    borderRadius: semanticRadii.control,
    boxShadow: semanticShadows.md,
    display: "block",
    maxHeight: "100%",
    maxWidth: "100%",
    objectFit: "contain",
  },
  lightboxMetaGrid: {
    gridTemplateColumns: {
      default: "minmax(0, 1.35fr) minmax(0, 1fr)",
      "@media (max-width: 680px)": "minmax(0, 1fr)",
    },
    paddingBottom: spacing._4,
  },
  lightboxNotes: {
    lineHeight: lineHeights.md,
    marginBlock: 0,
  },
  specList: {
    marginBlock: 0,
  },
  specValue: {
    marginInlineStart: 0,
  },
  dialogFooter: {
    alignItems: "center",
    display: "flex",
    flexWrap: "wrap",
    gap: spacing._3,
    justifyContent: "space-between",
    paddingBlock: spacing._3_5,
    paddingInline: spacing._5,
  },
  kbdHints: {
    display: {
      default: "inline-flex",
      "@media (max-width: 640px)": "none",
    },
  },
  counterText: {
    minWidth: "4.5rem",
  },
});

export interface MixedGalleryProps extends StyleOverrideProps {
  /** Optional eyebrow pill displayed above the display heading. */
  eyebrow?: string;
  /** Primary display heading for the archive gallery. */
  title?: string;
  /** Supporting curatorial introduction below the heading. */
  description?: string;
  /** Initial active category filter. */
  defaultCategory?: MixedGalleryCategory;
  /** Custom gallery plates; defaults to the Studio Forma Material & Print Archive. */
  items?: ReadonlyArray<MixedGalleryItem>;
  /** Called when a gallery plate is opened in the lightbox. */
  onSelectItem?: (item: MixedGalleryItem) => void;
}

/**
 * MixedGallery — asymmetric mixed-aspect bento gallery pairing panoramic wide
 * plates, tall vertical portrait specimens, and square studies with a segmented
 * category filter and a keyboard-navigable lightbox dialog.
 */
export function MixedGallery({
  eyebrow = "Studio Forma · Material & Print Archive",
  title = "Tactile studies in pigment, weave, and press",
  description = "Eight archival specimen plates pairing risograph overprints, raw linen weaves, reduction-fired glazes, and hand-sewn paper dummies across mixed aspect ratios.",
  defaultCategory = "all",
  items = DEFAULT_GALLERY_ITEMS,
  onSelectItem,
  palette,
  style,
}: MixedGalleryProps) {
  const [category, setCategory] =
    useState<MixedGalleryCategory>(defaultCategory);
  const [activeId, setActiveId] = useState<string | null>(null);

  const filteredItems = useMemo(
    () =>
      category === "all"
        ? items
        : items.filter((item) => item.category === category),
    [category, items],
  );

  const activeIndex = useMemo(
    () =>
      activeId === null
        ? -1
        : filteredItems.findIndex((item) => item.id === activeId),
    [activeId, filteredItems],
  );

  const activeItem = activeIndex >= 0 ? filteredItems[activeIndex] : null;

  const countsByCategory = useMemo(() => {
    const counts: Record<MixedGalleryCategory, number> = {
      all: items.length,
      print: 0,
      materials: 0,
      editions: 0,
    };
    for (const item of items) {
      counts[item.category] += 1;
    }
    return counts;
  }, [items]);

  const handleOpenItem = useCallback(
    (item: MixedGalleryItem) => {
      setActiveId(item.id);
      onSelectItem?.(item);
    },
    [onSelectItem],
  );

  const handleStep = useCallback(
    (delta: -1 | 1) => {
      if (filteredItems.length <= 1 || activeIndex < 0) return;
      const nextIndex =
        (activeIndex + delta + filteredItems.length) % filteredItems.length;
      const nextItem = filteredItems[nextIndex];
      if (nextItem) {
        setActiveId(nextItem.id);
        onSelectItem?.(nextItem);
      }
    },
    [activeIndex, filteredItems, onSelectItem],
  );

  const handleCategoryChange = useCallback((nextValue: string) => {
    if (
      nextValue === "all" ||
      nextValue === "print" ||
      nextValue === "materials" ||
      nextValue === "editions"
    ) {
      setCategory(nextValue);
      setActiveId(null);
    }
  }, []);

  useEffect(() => {
    if (!activeItem) return;
    const handleKeyDown = (event: KeyboardEvent) => {
      if (event.metaKey || event.ctrlKey || event.altKey) return;
      if (event.key === "ArrowLeft") {
        event.preventDefault();
        handleStep(-1);
      } else if (event.key === "ArrowRight") {
        event.preventDefault();
        handleStep(1);
      }
    };
    window.addEventListener("keydown", handleKeyDown);
    return () => window.removeEventListener("keydown", handleKeyDown);
  }, [activeItem, handleStep]);

  const isBentoLayout = category === "all";
  const gridStyle = isBentoLayout
    ? styles.bentoGrid
    : filteredItems.length === 2
      ? styles.filteredGridTwo
      : styles.filteredGridThree;

  return (
    <VStack align="center" gap="0" palette={palette} style={[styles.root, style]}>
      <VStack render={<main />} gap="8" style={styles.content}>
        <VStack render={<header />} align="center" gap="5" style={styles.header}>
          <VStack align="center" gap="3">
            {eyebrow ? (
              <Badge variant="subtle" size="md">
                {eyebrow}
              </Badge>
            ) : null}
            <Heading render={<h1 />} size="5xl" style={styles.headline}>
              {title}
            </Heading>
            <Text
              variant="muted"
              size="md"
              align="center"
              style={styles.description}
            >
              {description}
            </Text>
          </VStack>

          <Center style={styles.filterBar}>
            <SegmentGroup.Root
              size="sm"
              value={category}
              onValueChange={handleCategoryChange}
              aria-label="Filter archive plates by discipline"
            >
              {CATEGORY_OPTIONS.map((option) => (
                <SegmentGroup.Item key={option.value} value={option.value}>
                  <span>{option.label}</span>
                  <Text
                    render={<span />}
                    variant="mono"
                    size="xs"
                    tone="subtle"
                    tabular="true"
                  >
                    {countsByCategory[option.value]}
                  </Text>
                </SegmentGroup.Item>
              ))}
            </SegmentGroup.Root>
          </Center>
        </VStack>

        <Section.Root
          aria-label="Studio Forma mixed-aspect specimen gallery"
          style={styles.gallerySection}
        >
          <Section.Body>
            <Grid gap="4" style={gridStyle}>
              {filteredItems.map((item) => {
                const formatStyle = !isBentoLayout
                  ? styles.tileFiltered
                  : item.format === "wide"
                    ? styles.tileWide
                    : item.format === "portrait"
                      ? styles.tilePortrait
                      : styles.tileSquare;

                return (
                  <button
                    key={item.id}
                    type="button"
                    onClick={() => handleOpenItem(item)}
                    aria-label={`Inspect ${item.plate}: ${item.title} (${item.medium})`}
                    {...stylex.props(styles.tileButton, formatStyle)}
                  >
                    <img
                      src={item.src}
                      alt={item.alt}
                      loading="lazy"
                      {...stylex.props(styles.tileImage)}
                    />

                    <HStack
                      render={<span />}
                      gap="0"
                      justify="between"
                      style={styles.tileTopBar}
                    >
                      <Text
                        render={<span />}
                        variant="mono"
                        size="2xs"
                        tabular="true"
                        style={styles.platePill}
                      >
                        {item.plate}
                      </Text>
                      <Circle
                        render={<span aria-hidden="true" />}
                        size="sm"
                        style={styles.inspectCue}
                      >
                        <Icon
                          size="xs"
                          viewBox="0 0 20 20"
                          fill="none"
                          stroke="currentColor"
                          strokeWidth="1.75"
                          strokeLinecap="round"
                          strokeLinejoin="round"
                        >
                          <path d="M12.5 3.5h4v4" />
                          <path d="M7.5 16.5h-4v-4" />
                          <path d="M16.5 3.5 11.5 8.5" />
                          <path d="M3.5 16.5 8.5 11.5" />
                        </Icon>
                      </Circle>
                    </HStack>

                    <VStack
                      render={<span />}
                      gap="0.5"
                      style={styles.tileOverlay}
                    >
                      <Text
                        render={<span />}
                        variant="label"
                        size="sm"
                        truncate="true"
                        style={styles.tileTitle}
                      >
                        {item.title}
                      </Text>
                      <HStack
                        render={<span />}
                        align="baseline"
                        gap="2"
                        justify="between"
                      >
                        <Text
                          render={<span />}
                          size="xs"
                          truncate="true"
                          style={styles.tileMedium}
                        >
                          {item.medium}
                        </Text>
                        <Text
                          render={<span />}
                          variant="mono"
                          size="2xs"
                          tabular="true"
                          style={styles.tileFormat}
                        >
                          {item.formatLabel}
                        </Text>
                      </HStack>
                    </VStack>
                  </button>
                );
              })}
            </Grid>
          </Section.Body>
        </Section.Root>
      </VStack>

      <Dialog.Root
        open={activeItem !== null}
        onOpenChange={(nextOpen) => {
          if (!nextOpen) setActiveId(null);
        }}
        size="xl"
        placement="center"
      >
        <Dialog.Backdrop />
        <Dialog.Content style={styles.dialogContent}>
          {activeItem ? (
            <>
              <Dialog.Header style={styles.dialogHeader}>
                <VStack gap="1.5">
                  <HStack wrap="wrap" gap="1.5">
                    <Badge variant="subtle" size="sm">
                      {activeItem.plate}
                    </Badge>
                    <Badge variant="outline" size="sm">
                      {activeItem.categoryLabel}
                    </Badge>
                    <Badge variant="surface" size="sm">
                      {activeItem.formatLabel}
                    </Badge>
                  </HStack>
                  <Dialog.Title>{activeItem.title}</Dialog.Title>
                </VStack>

                <Dialog.Close
                  render={
                    <IconButton
                      variant="ghost"
                      size="sm"
                      aria-label="Close lightbox"
                    />
                  }
                  style={styles.dialogCloseButton}
                >
                  <Icon
                    size="sm"
                    viewBox="0 0 20 20"
                    fill="none"
                    stroke="currentColor"
                    strokeWidth="1.75"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                    aria-hidden="true"
                  >
                    <path d="M5 5l10 10" />
                    <path d="M15 5 5 15" />
                  </Icon>
                </Dialog.Close>
              </Dialog.Header>

              <Dialog.Body style={styles.dialogBody}>
                <Center style={styles.lightboxMat}>
                  <img
                    src={activeItem.src}
                    alt={activeItem.alt}
                    {...stylex.props(styles.lightboxImage)}
                  />
                </Center>

                <Grid gap="4" style={styles.lightboxMetaGrid}>
                  <VStack gap="1.5">
                    <Text variant="label" size="sm">
                      {activeItem.medium}
                    </Text>
                    <Dialog.Description style={styles.lightboxNotes}>
                      {activeItem.notes}
                    </Dialog.Description>
                  </VStack>

                  <Grid
                    render={<dl />}
                    columns="1"
                    gap="2"
                    style={styles.specList}
                  >
                    <HStack align="baseline" gap="3" justify="between">
                      <Text render={<dt />} variant="subtle" size="xs">
                        Stock
                      </Text>
                      <Text
                        render={<dd />}
                        variant="mono"
                        size="xs"
                        align="end"
                        tabular="true"
                        style={styles.specValue}
                      >
                        {activeItem.stock}
                      </Text>
                    </HStack>
                    <HStack align="baseline" gap="3" justify="between">
                      <Text render={<dt />} variant="subtle" size="xs">
                        Dimensions
                      </Text>
                      <Text
                        render={<dd />}
                        variant="mono"
                        size="xs"
                        align="end"
                        tabular="true"
                        style={styles.specValue}
                      >
                        {activeItem.dimensions}
                      </Text>
                    </HStack>
                    <HStack align="baseline" gap="3" justify="between">
                      <Text render={<dt />} variant="subtle" size="xs">
                        Edition
                      </Text>
                      <Text
                        render={<dd />}
                        variant="mono"
                        size="xs"
                        align="end"
                        tabular="true"
                        style={styles.specValue}
                      >
                        {activeItem.edition}
                      </Text>
                    </HStack>
                    <HStack align="baseline" gap="3" justify="between">
                      <Text render={<dt />} variant="subtle" size="xs">
                        Year
                      </Text>
                      <Text
                        render={<dd />}
                        variant="mono"
                        size="xs"
                        align="end"
                        tabular="true"
                        style={styles.specValue}
                      >
                        {activeItem.year}
                      </Text>
                    </HStack>
                  </Grid>
                </Grid>
              </Dialog.Body>

              <Separator decorative />

              <Dialog.Footer style={styles.dialogFooter}>
                <HStack gap="1.5" style={styles.kbdHints}>
                  <Kbd size="sm">←</Kbd>
                  <Kbd size="sm">→</Kbd>
                  <Text render={<span />} variant="subtle" size="xs">
                    Navigate plates
                  </Text>
                </HStack>

                <HStack gap="2">
                  <Button
                    variant="surface"
                    size="sm"
                    disabled={filteredItems.length <= 1}
                    onClick={() => handleStep(-1)}
                  >
                    <Icon
                      size="sm"
                      viewBox="0 0 20 20"
                      fill="none"
                      stroke="currentColor"
                      strokeWidth="1.75"
                      strokeLinecap="round"
                      strokeLinejoin="round"
                      aria-hidden="true"
                    >
                      <path d="M12.5 5 7.5 10l5 5" />
                    </Icon>
                    Previous
                  </Button>

                  <Text
                    render={<span aria-live="polite" />}
                    variant="mono"
                    size="xs"
                    tone="muted"
                    align="center"
                    tabular="true"
                    style={styles.counterText}
                  >
                    {String(activeIndex + 1).padStart(2, "0")} /{" "}
                    {String(filteredItems.length).padStart(2, "0")}
                  </Text>

                  <Button
                    variant="surface"
                    size="sm"
                    disabled={filteredItems.length <= 1}
                    onClick={() => handleStep(1)}
                  >
                    Next
                    <Icon
                      size="sm"
                      viewBox="0 0 20 20"
                      fill="none"
                      stroke="currentColor"
                      strokeWidth="1.75"
                      strokeLinecap="round"
                      strokeLinejoin="round"
                      aria-hidden="true"
                    >
                      <path d="M7.5 5l5 5-5 5" />
                    </Icon>
                  </Button>
                </HStack>
              </Dialog.Footer>
            </>
          ) : null}
        </Dialog.Content>
      </Dialog.Root>
    </VStack>
  );
}
```

Credit: Inspired by [Mixed Gallery](https://astryx.atmeta.com/playground?template=mixed-gallery) from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.)
