---
title: "Product Detail · UI SDK — StyleX Blocks"
description: "Two-column storefront product detail layout pairing a multi-angle interactive photo gallery with a sticky buy box, live anodized finish swatches, color-temperature edition controls, quantity stepper, collapsible specifications accordion, and filterable customer reviews."
url: "https://stylexblocks.com/block/ui-sdk/product-detail/"
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/"
---

# Product Detail block

Two-column storefront product detail layout pairing a multi-angle interactive photo gallery with a sticky buy box, live anodized finish swatches, color-temperature edition controls, quantity stepper, collapsible specifications accordion, and filterable customer reviews.

- Behavior engine: UI SDK
- Category: [Content](https://stylexblocks.com/blocks/content.md)
- Built with: [Accordion](https://stylexblocks.com/components/ui-sdk/accordion.md), [Aspect Ratio](https://stylexblocks.com/components/ui-sdk/aspect-ratio.md), [Avatar](https://stylexblocks.com/components/ui-sdk/avatar.md), [Badge](https://stylexblocks.com/components/ui-sdk/badge.md), [Breadcrumb](https://stylexblocks.com/components/ui-sdk/breadcrumb.md), [Button](https://stylexblocks.com/components/ui-sdk/button.md), [Card](https://stylexblocks.com/components/ui-sdk/card.md), [Color Swatch](https://stylexblocks.com/components/ui-sdk/color-swatch.md), [Data List](https://stylexblocks.com/components/ui-sdk/data-list.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), [Number Input](https://stylexblocks.com/components/ui-sdk/number-input.md), [Progress](https://stylexblocks.com/components/ui-sdk/progress.md), [Rating Group](https://stylexblocks.com/components/ui-sdk/rating-group.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), [Status](https://stylexblocks.com/components/ui-sdk/status.md), [Text](https://stylexblocks.com/components/ui-sdk/text.md), [Toast](https://stylexblocks.com/components/ui-sdk/toast.md)
- HTML page: https://stylexblocks.com/block/ui-sdk/product-detail/

## 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 product-detail
```

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

## Usage

```tsx
import { ProductDetail } from "#components/blocks/ui-sdk/product-detail.tsx";

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

## Source

`components/blocks/ui-sdk/product-detail.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { useCallback, useId, useMemo, useRef, useState } from "react";
import { Accordion } from "#components/ui/ui-sdk/accordion.tsx";
import { AspectRatio } from "#components/ui/ui-sdk/aspect-ratio.tsx";
import { Avatar } from "#components/ui/ui-sdk/avatar.tsx";
import { Badge } from "#components/ui/ui-sdk/badge.tsx";
import { Breadcrumb } from "#components/ui/ui-sdk/breadcrumb.tsx";
import { Button } from "#components/ui/ui-sdk/button.tsx";
import { Card } from "#components/ui/ui-sdk/card.tsx";
import { ColorSwatch } from "#components/ui/ui-sdk/color-swatch.tsx";
import { DataList } from "#components/ui/ui-sdk/data-list.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 { NumberInput } from "#components/ui/ui-sdk/number-input.tsx";
import { Progress } from "#components/ui/ui-sdk/progress.tsx";
import { RatingGroup } from "#components/ui/ui-sdk/rating-group.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 { Status } from "#components/ui/ui-sdk/status.tsx";
import { Text } from "#components/ui/ui-sdk/text.tsx";
import { Toast, Toaster } from "#components/ui/ui-sdk/toast.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 {
  accentPalette,
  amberPalette,
  greenPalette,
  redPalette,
} from "@stylexblocks/ui/themes/palettes.ts";
import { durations } from "@stylexblocks/ui/tokens/durations.stylex.ts";
import { fontSizes } from "@stylexblocks/ui/tokens/font-sizes.stylex.ts";
import { fontWeights } from "@stylexblocks/ui/tokens/font-weights.stylex.ts";
import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";
import { lineHeights } from "@stylexblocks/ui/tokens/line-heights.stylex.ts";
import { radii } from "@stylexblocks/ui/tokens/radii.stylex.ts";
import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";

// ── Types ─────────────────────────────────────────────────────────────────────

export type ProductFinishId = "sand" | "slate" | "forest";

export type ProductEditionId = "warm-2700k" | "studio-3000k" | "tunable-pro";

export type ProductGalleryAngleId =
  | "hero"
  | "profile"
  | "optics"
  | "dimmer"
  | "ambient"
  | "exploded";

export interface ProductFinishOption {
  id: ProductFinishId;
  label: string;
  materialNote: string;
  skuCode: string;
}

export interface ProductEditionOption {
  id: ProductEditionId;
  label: string;
  shortLabel: string;
  skuCode: string;
  kelvinNote: string;
  opticsSummary: string;
  priceDelta: number;
}

export interface ProductReview {
  id: string;
  author: string;
  initials: string;
  role: string;
  date: string;
  rating: number;
  finish: ProductFinishId;
  editionLabel: string;
  verified: boolean;
  title: string;
  body: string;
  helpfulCount: number;
}

export interface AddToBagPayload {
  sku: string;
  name: string;
  finish: ProductFinishId;
  edition: ProductEditionId;
  quantity: number;
  unitPrice: number;
  totalPrice: number;
}

export interface ProductDetailProps extends StyleOverrideProps {
  /** Studio or storefront brand displayed in the breadcrumb and eyebrow. */
  brand?: string;
  /** Primary product title. */
  name?: string;
  /** Concise subtitle or edition descriptor shown beneath the title. */
  subtitle?: string;
  /** Base product price in USD before edition upgrades. */
  basePrice?: number;
  /** Compare-at retail price in USD before edition upgrades. */
  originalPrice?: number;
  /** Lead product description copy. */
  description?: string;
  /** Initially selected anodized finish. */
  initialFinish?: ProductFinishId;
  /** Initially selected color-temperature edition. */
  initialEdition?: ProductEditionId;
  /** Called when the user adds the configured product to the bag. */
  onAddToBag?: (payload: AddToBagPayload) => void;
  /** Called when the user saves or removes the product from their wishlist. */
  onToggleWishlist?: (saved: boolean) => void;
}

// ── Demo Data ─────────────────────────────────────────────────────────────────

const FINISHES: readonly ProductFinishOption[] = [
  {
    id: "sand",
    label: "Sand",
    materialNote: "Bead-blasted warm limestone anodized aluminum",
    skuCode: "SND",
  },
  {
    id: "slate",
    label: "Slate",
    materialNote: "Hard-anodized architectural graphite matte",
    skuCode: "SLT",
  },
  {
    id: "forest",
    label: "Forest",
    materialNote: "Deep mineral pine satin anodization",
    skuCode: "FOR",
  },
];

const EDITIONS: readonly ProductEditionOption[] = [
  {
    id: "warm-2700k",
    label: "2700K Warm",
    shortLabel: "2700K",
    skuCode: "27K",
    kelvinNote: "Fixed 2700K evening warmth tuned for reading and quiet studio work.",
    opticsSummary: "CRI 97+ · R9 > 92 · 640 lm",
    priceDelta: 0,
  },
  {
    id: "studio-3000k",
    label: "3000K Studio",
    shortLabel: "3000K",
    skuCode: "30K",
    kelvinNote: "Balanced 3000K neutral white calibrated for color-accurate drafting.",
    opticsSummary: "CRI 97+ · R9 > 94 · 680 lm",
    priceDelta: 0,
  },
  {
    id: "tunable-pro",
    label: "Tunable Pro",
    shortLabel: "2200–4000K",
    skuCode: "TUN",
    kelvinNote: "Stepless 2200K–4000K dual-channel array with warm-dim memory (+$40).",
    opticsSummary: "CRI 98+ · R9 > 96 · 740 lm",
    priceDelta: 40,
  },
];

interface GalleryAngleMeta {
  id: ProductGalleryAngleId;
  label: string;
  caption: string;
}

const GALLERY_ANGLES: readonly GalleryAngleMeta[] = [
  {
    id: "hero",
    label: "Studio hero",
    caption: "Three-quarter studio elevation on honed travertine",
  },
  {
    id: "profile",
    label: "Side elevation",
    caption: "Orthographic silhouette · 415 mm H × 310 mm reach",
  },
  {
    id: "optics",
    label: "Optical head",
    caption: "Micro-prismatic glare-free diffuser & chamfered bezel",
  },
  {
    id: "dimmer",
    label: "Rotary dimmer",
    caption: "Knurled solid aluminum plinth dial with 1%–100% dimming",
  },
  {
    id: "ambient",
    label: "Desk ambient",
    caption: "Evening beam cut-off on walnut studio workbench",
  },
  {
    id: "exploded",
    label: "In the box",
    caption: "Lamp assembly, 2.4 m linen cord, PD adapter & hex key",
  },
];

const RATING_BREAKDOWN = [
  { stars: 5, count: 118, percent: 83 },
  { stars: 4, count: 18, percent: 13 },
  { stars: 3, count: 4, percent: 3 },
  { stars: 2, count: 1, percent: 1 },
  { stars: 1, count: 1, percent: 1 },
] as const;

const REVIEWS: readonly ProductReview[] = [
  {
    id: "rev-1",
    author: "Maren Lindholm",
    initials: "ML",
    role: "Architectural illustrator · Copenhagen",
    date: "2 weeks ago",
    rating: 5,
    finish: "sand",
    editionLabel: "3000K Studio",
    verified: true,
    title: "Zero monitor glare and genuinely weighted build",
    body: "The micro-prismatic lens sits recessed enough that you never catch the emitter directly from a seated position. The Sand anodization reads like warm limestone in daylight, and the rotary dimmer has the damped resistance of an analog hi-fi dial.",
    helpfulCount: 24,
  },
  {
    id: "rev-2",
    author: "Kenji Takahashi",
    initials: "KT",
    role: "Industrial designer · Seattle",
    date: "1 month ago",
    rating: 5,
    finish: "slate",
    editionLabel: "Tunable Pro",
    verified: true,
    title: "Machining tolerances rival camera lenses",
    body: "Picked up the Slate Tunable Pro for late-night CAD reviews. Shifting from crisp 4000K during material sampling down to 2200K at midnight happens smoothly without flicker on phone video. The linen cord lays completely flat out of the box.",
    helpfulCount: 19,
  },
  {
    id: "rev-3",
    author: "Claire Beaumont",
    initials: "CB",
    role: "Bookbinder & printmaker · Montreal",
    date: "6 weeks ago",
    rating: 5,
    finish: "forest",
    editionLabel: "2700K Warm",
    verified: true,
    title: "Forest finish is understated and deep",
    body: "In person the Forest tone is a quiet mineral pine rather than a loud green. Friction hinge holds any tilt angle without needing tools, and the 1.85 kg plinth stays anchored even when extended forward over a cutting mat.",
    helpfulCount: 14,
  },
  {
    id: "rev-4",
    author: "Devon Patel",
    initials: "DP",
    role: "Staff product engineer · Chicago",
    date: "2 months ago",
    rating: 4,
    finish: "sand",
    editionLabel: "3000K Studio",
    verified: true,
    title: "Superb optical beam; wish the adapter matched the finish",
    body: "Color rendering on physical swatches and print proofs is noticeably richer than my previous desk bar. Deducting a single star only because the inline 24W USB-C adapter is matte charcoal regardless of lamp color—otherwise flawless.",
    helpfulCount: 9,
  },
];

// ── Studio Photography ────────────────────────────────────────────────────────

const PRODUCT_IMAGE_BASE = "/images/blocks/product-detail/";

function lampPhotoSrc(finish: ProductFinishId, angle: ProductGalleryAngleId): string {
  return `${PRODUCT_IMAGE_BASE}${finish}-${angle}.webp`;
}

// ── Inline Crisp SVG Icons ────────────────────────────────────────────────────

function ChevronDownSvg() {
  return (
    <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 7.5 5 5 5-5" />
    </Icon>
  );
}

function ChevronLeftSvg() {
  return (
    <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>
  );
}

function ChevronRightSvg() {
  return (
    <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 5 12.5 10l-5 5" />
    </Icon>
  );
}

function BagSvg() {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.75"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M4.5 7h11l-.9 9.5a1.5 1.5 0 0 1-1.5 1.35H6.9a1.5 1.5 0 0 1-1.5-1.35L4.5 7Z" />
      <path d="M7.25 7V5.5a2.75 2.75 0 0 1 5.5 0V7" />
    </Icon>
  );
}

function HeartSvg({ filled }: { filled: boolean }) {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill={filled ? "currentColor" : "none"}
      stroke="currentColor"
      strokeWidth="1.75"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M10 16.5s-6.25-3.75-6.25-8.4A3.55 3.55 0 0 1 10 5.75a3.55 3.55 0 0 1 6.25 2.35c0 4.65-6.25 8.4-6.25 8.4Z" />
    </Icon>
  );
}

function TruckSvg() {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.65"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M2.5 5.5h9.5v8H2.5z" />
      <path d="M12 8h3.4l2.1 2.4V13.5H12" />
      <circle cx="5.75" cy="14.5" r="1.5" />
      <circle cx="14.5" cy="14.5" r="1.5" />
    </Icon>
  );
}

function ShieldSvg() {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.65"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M10 2.75 16 5v4.6c0 3.7-2.55 6.85-6 7.65-3.45-.8-6-3.95-6-7.65V5l6-2.25Z" />
      <path d="m7.5 10.1 1.75 1.75 3.4-3.6" />
    </Icon>
  );
}

function RotateCcwSvg() {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.65"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M4.2 7.5A6.25 6.25 0 1 1 5.2 14" />
      <path d="M4 3.75v3.9h3.9" />
    </Icon>
  );
}

function ThumbUpSvg() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.75"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M6.5 9.2 9.4 3.8a1.45 1.45 0 0 1 2.7.72L11.6 8h4a1.6 1.6 0 0 1 1.56 1.95l-1 4.65A2 2 0 0 1 14.2 16.2H6.5V9.2Z" />
      <path d="M6.5 9.2H3.8a.8.8 0 0 0-.8.8v5.4a.8.8 0 0 0 .8.8h2.7" />
    </Icon>
  );
}

// ── Styles ────────────────────────────────────────────────────────────────────

const finishSwatchStyles = stylex.create({
  sand: { "--color": "#d5c6b0" },
  slate: { "--color": "#4d5664" },
  forest: { "--color": "#3f5b4e" },
});

const styles = stylex.create({
  root: {
    backgroundColor: semanticColors.bg,
    color: semanticColors.fg,
    fontFamily: fonts.body,
    minHeight: "100%",
    paddingBlock: {
      default: spacing._8,
      "@media (max-width: 640px)": spacing._5,
    },
    paddingInline: {
      default: spacing._6,
      "@media (max-width: 640px)": spacing._4,
    },
    width: "100%",
  },
  container: {
    marginInline: "auto",
    maxWidth: "75rem",
    width: "100%",
  },
  skuText: {
    letterSpacing: "0.04em",
  },
  productGrid: {
    gap: {
      default: spacing._10,
      "@media (max-width: 960px)": spacing._8,
    },
    gridTemplateColumns: {
      default: "minmax(0, 1.12fr) minmax(0, 0.88fr)",
      "@media (max-width: 860px)": "minmax(0, 1fr)",
    },
    width: "100%",
  },
  heroStage: {
    backgroundColor: semanticColors.bgMuted,
    borderColor: semanticColors.border,
    borderRadius: semanticRadii.panelLg,
    borderStyle: "solid",
    borderWidth: "1px",
    boxShadow: semanticShadows.sm,
  },
  mediaImage: {
    display: "block",
    height: "100%",
    objectFit: "cover",
    width: "100%",
  },
  heroOverlayBottom: {
    bottom: spacing._3,
    insetInlineEnd: spacing._3,
    insetInlineStart: spacing._3,
    pointerEvents: "none",
    position: "absolute",
  },
  heroCaptionPill: {
    backdropFilter: "blur(10px)",
    backgroundColor: semanticColors.bgOverlay,
    borderColor: semanticColors.border,
    borderRadius: radii.full,
    borderStyle: "solid",
    borderWidth: "1px",
    maxWidth: "calc(100% - 5.5rem)",
    paddingBlock: spacing._1_5,
    paddingInline: spacing._3,
    pointerEvents: "auto",
  },
  pointerAuto: {
    pointerEvents: "auto",
  },
  heroNavBtn: {
    backdropFilter: "blur(10px)",
    backgroundColor: {
      default: semanticColors.bgOverlay,
      ":hover": semanticColors.bgElevated,
    },
    borderColor: semanticColors.borderEmphasized,
  },
  thumbGrid: {
    gap: spacing._2_5,
    gridTemplateColumns: {
      default: "repeat(3, minmax(0, 1fr))",
      "@media (max-width: 480px)": "repeat(2, minmax(0, 1fr))",
    },
  },
  thumbBtn: {
    appearance: "none",
    backgroundColor: semanticColors.bgMuted,
    borderColor: {
      default: semanticColors.border,
      ":hover": semanticColors.borderEmphasized,
    },
    borderRadius: semanticRadii.panel,
    borderStyle: "solid",
    borderWidth: "1px",
    cursor: "pointer",
    display: "block",
    marginBlock: 0,
    marginInline: 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",
    },
    paddingBlock: 0,
    paddingInline: 0,
    transitionDuration: durations.fast,
    transitionProperty: "border-color, box-shadow, transform",
  },
  thumbBtnSelected: {
    borderColor: semanticColors.accentSolid,
    boxShadow: `0 0 0 2px ${semanticColors.accentSubtle}`,
  },
  thumbLabel: {
    backdropFilter: "blur(6px)",
    backgroundColor: semanticColors.bgOverlay,
    bottom: spacing._1_5,
    borderRadius: semanticRadii.controlSm,
    insetInlineStart: spacing._1_5,
    maxWidth: "calc(100% - 0.75rem)",
    paddingBlock: "2px",
    paddingInline: spacing._1_5,
    position: "absolute",
  },
  infoCol: {
    alignSelf: "start",
    position: {
      default: "sticky",
      "@media (max-width: 860px)": "static",
    },
    top: {
      default: spacing._6,
      "@media (max-width: 860px)": null,
    },
  },
  headingReset: {
    marginBlock: 0,
  },
  pt1: {
    paddingTop: spacing._1,
  },
  pt3: {
    paddingTop: spacing._3,
  },
  leadingSm: {
    lineHeight: lineHeights.sm,
  },
  leadingMd: {
    lineHeight: lineHeights.md,
  },
  leadingLg: {
    lineHeight: lineHeights.lg,
  },
  lineThrough: {
    textDecorationLine: "line-through",
  },
  noWrap: {
    whiteSpace: "nowrap",
  },
  fullWidth: {
    width: "100%",
  },
  ratingLink: {
    appearance: "none",
    backgroundColor: "transparent",
    borderWidth: 0,
    color: {
      default: semanticColors.fgMuted,
      ":hover": semanticColors.fg,
    },
    cursor: "pointer",
    fontFamily: "inherit",
    fontSize: fontSizes.sm,
    lineHeight: lineHeights.sm,
    paddingBlock: 0,
    paddingInline: 0,
    textDecorationLine: "underline",
    textUnderlineOffset: "3px",
  },
  finishCard: {
    alignItems: "center",
    appearance: "none",
    backgroundColor: {
      default: semanticColors.bgPanel,
      ":hover": semanticColors.bgSubtle,
    },
    borderColor: {
      default: semanticColors.border,
      ":hover": semanticColors.borderEmphasized,
    },
    borderRadius: semanticRadii.control,
    borderStyle: "solid",
    borderWidth: "1px",
    color: semanticColors.fg,
    cursor: "pointer",
    display: "flex",
    fontFamily: "inherit",
    fontSize: fontSizes.sm,
    fontWeight: fontWeights.medium,
    gap: spacing._2,
    justifyContent: "flex-start",
    lineHeight: lineHeights.sm,
    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",
    },
    paddingBlock: spacing._2,
    paddingInline: spacing._2_5,
    transitionDuration: durations.fast,
    transitionProperty: "background-color, border-color, box-shadow",
  },
  finishCardSelected: {
    backgroundColor: semanticColors.accentMuted,
    borderColor: semanticColors.accentSolid,
    boxShadow: `0 0 0 1px ${semanticColors.accentSolid}`,
  },
  editionScroller: {
    maxWidth: "100%",
    overflowX: "auto",
  },
  quantityInputBox: {
    width: "7.5rem",
  },
  ctaSecondaryRow: {
    gap: spacing._2_5,
    gridTemplateColumns: {
      default: "repeat(2, minmax(0, 1fr))",
      "@media (max-width: 440px)": "minmax(0, 1fr)",
    },
  },
  assuranceGrid: {
    backgroundColor: semanticColors.bgMuted,
    borderColor: semanticColors.border,
    borderRadius: semanticRadii.panel,
    borderStyle: "solid",
    borderWidth: "1px",
    gridTemplateColumns: {
      default: "repeat(3, minmax(0, 1fr))",
      "@media (max-width: 520px)": "minmax(0, 1fr)",
    },
    paddingBlock: spacing._3,
    paddingInline: spacing._3_5,
  },
  assuranceItem: {
    color: semanticColors.fgMuted,
  },
  reviewsLayout: {
    gridTemplateColumns: {
      default: "minmax(0, 18rem) minmax(0, 1fr)",
      "@media (max-width: 860px)": "minmax(0, 1fr)",
    },
  },
  summaryScoreBig: {
    fontSize: fontSizes._4xl,
    lineHeight: 1,
  },
  summaryBarRow: {
    gap: spacing._2_5,
    gridTemplateColumns: "2.25rem minmax(0, 1fr) 2rem",
  },
  reviewsList: {
    gridTemplateColumns: {
      default: "repeat(2, minmax(0, 1fr))",
      "@media (max-width: 680px)": "minmax(0, 1fr)",
    },
  },
});

const formatUsd = (amount: number) => `$${amount.toFixed(2)}`;

// ── Component ─────────────────────────────────────────────────────────────────

/**
 * ProductDetail — responsive two-column storefront product detail block pairing
 * an interactive multi-angle studio gallery with a sticky buy box, live anodized
 * finish swatches, color-temperature edition selector, quantity stepper,
 * collapsible specification accordion, and filterable customer reviews.
 */
export function ProductDetail({
  brand = "Kōji Atelier",
  name = "Sora Desk Lamp · Edition 02",
  subtitle = "Machined 6061 anodized aluminum architectural task lamp",
  basePrice = 285,
  originalPrice = 340,
  description = "Milled from solid 6061-T6 aluminum and bead-blasted for a glare-free matte grain, Sora Edition 02 pairs a counter-weighted plinth with a precision friction hinge. Its recessed micro-prismatic optical head casts an even, high-CRI work pool across drafting tables without spill onto adjacent displays.",
  initialFinish = "sand",
  initialEdition = "studio-3000k",
  onAddToBag,
  onToggleWishlist,
  palette,
  style,
}: ProductDetailProps) {
  const [selectedFinishId, setSelectedFinishId] =
    useState<ProductFinishId>(initialFinish);
  const [selectedEditionId, setSelectedEditionId] =
    useState<ProductEditionId>(initialEdition);
  const [selectedAngleIndex, setSelectedAngleIndex] = useState(0);
  const [quantity, setQuantity] = useState<number>(1);
  const [bagCount, setBagCount] = useState<number>(0);
  const [wishlisted, setWishlisted] = useState<boolean>(false);
  const [reviewFilter, setReviewFilter] = useState<string>("all");
  const [helpfulVotes, setHelpfulVotes] = useState<Record<string, boolean>>({});

  const reviewsRef = useRef<HTMLElement | null>(null);
  const finishLabelId = useId();
  const editionLabelId = useId();
  const quantityLabelId = useId();

  const queue = useMemo(() => Toast.createToaster(), []);

  const activeFinish = useMemo(
    () => FINISHES.find((item) => item.id === selectedFinishId) ?? FINISHES[0]!,
    [selectedFinishId],
  );

  const activeEdition = useMemo(
    () => EDITIONS.find((item) => item.id === selectedEditionId) ?? EDITIONS[1]!,
    [selectedEditionId],
  );

  const galleryPlates = useMemo(
    () =>
      GALLERY_ANGLES.map((angle) => ({
        ...angle,
        src: lampPhotoSrc(activeFinish.id, angle.id),
        alt: `${name} in ${activeFinish.label} finish (${activeEdition.label}) — ${angle.caption}`,
      })),
    [activeEdition.label, activeFinish.id, activeFinish.label, name],
  );

  const activePlate = galleryPlates[selectedAngleIndex] ?? galleryPlates[0]!;
  const unitPrice = basePrice + activeEdition.priceDelta;
  const compareAtPrice = originalPrice + activeEdition.priceDelta;
  const savings = Math.max(0, compareAtPrice - unitPrice);
  const totalPrice = unitPrice * quantity;
  const sku = `SR02-${activeFinish.skuCode}-${activeEdition.skuCode}`;

  const filteredReviews = useMemo(() => {
    if (reviewFilter === "all") return REVIEWS;
    return REVIEWS.filter((review) => review.finish === reviewFilter);
  }, [reviewFilter]);

  const handleQuantityChange = useCallback((next: number | null) => {
    if (next == null || Number.isNaN(next)) {
      setQuantity(1);
      return;
    }
    setQuantity(Math.min(10, Math.max(1, Math.round(next))));
  }, []);

  const handlePrevAngle = useCallback(() => {
    setSelectedAngleIndex((idx) =>
      idx === 0 ? galleryPlates.length - 1 : idx - 1,
    );
  }, [galleryPlates.length]);

  const handleNextAngle = useCallback(() => {
    setSelectedAngleIndex((idx) =>
      idx === galleryPlates.length - 1 ? 0 : idx + 1,
    );
  }, [galleryPlates.length]);

  const handleAddToBag = useCallback(() => {
    setBagCount((count) => count + quantity);
    onAddToBag?.({
      sku,
      name,
      finish: activeFinish.id,
      edition: activeEdition.id,
      quantity,
      unitPrice,
      totalPrice,
    });
    queue.success(`Added ${quantity} × ${name} to bag`, {
      description: `${activeFinish.label} · ${activeEdition.label} · ${formatUsd(totalPrice)}`,
    });
  }, [
    activeEdition.id,
    activeEdition.label,
    activeFinish.id,
    activeFinish.label,
    name,
    onAddToBag,
    quantity,
    queue,
    sku,
    totalPrice,
    unitPrice,
  ]);

  const handleToggleWishlist = useCallback(() => {
    setWishlisted((prev) => {
      const next = !prev;
      onToggleWishlist?.(next);
      queue.info(
        next ? `Saved ${name} to wishlist` : `Removed ${name} from wishlist`,
        {
          description: `${activeFinish.label} · ${activeEdition.label}`,
        },
      );
      return next;
    });
  }, [activeEdition.label, activeFinish.label, name, onToggleWishlist, queue]);

  const handleBuyNow = useCallback(() => {
    queue.info(`Express checkout ready for ${quantity} × ${name}`, {
      description: `${activeFinish.label} · ${activeEdition.label} · Total ${formatUsd(totalPrice)}`,
    });
  }, [activeEdition.label, activeFinish.label, name, quantity, queue, totalPrice]);

  const handleBreadcrumbClick = useCallback(
    (label: string) => (event: React.MouseEvent<HTMLAnchorElement>) => {
      event.preventDefault();
      queue.info(`Browsing ${label}`, {
        description: `Viewing the ${brand} lighting catalog.`,
      });
    },
    [brand, queue],
  );

  const handleJumpToReviews = useCallback(() => {
    reviewsRef.current?.scrollIntoView({ behavior: "smooth", block: "start" });
  }, []);

  const handleToggleHelpful = useCallback((reviewId: string) => {
    setHelpfulVotes((prev) => ({
      ...prev,
      [reviewId]: !prev[reviewId],
    }));
  }, []);

  return (
    <div {...stylex.props(palette, styles.root, style)}>
      <VStack gap="10" style={styles.container}>
        {/* Top breadcrumb & SKU bar */}
        <HStack wrap="wrap" justify="between" gap="3">
          <Breadcrumb.Root aria-label="Breadcrumb" variant="plain" size="sm">
            <Breadcrumb.List>
              <Breadcrumb.Item>
                <Breadcrumb.Link
                  href="#storefront"
                  onClick={handleBreadcrumbClick(brand)}
                >
                  {brand}
                </Breadcrumb.Link>
              </Breadcrumb.Item>
              <Breadcrumb.Separator aria-hidden="true">/</Breadcrumb.Separator>
              <Breadcrumb.Item>
                <Breadcrumb.Link
                  href="#lighting"
                  onClick={handleBreadcrumbClick("Lighting")}
                >
                  Lighting
                </Breadcrumb.Link>
              </Breadcrumb.Item>
              <Breadcrumb.Separator aria-hidden="true">/</Breadcrumb.Separator>
              <Breadcrumb.Item>
                <Breadcrumb.Link
                  href="#task-lamps"
                  onClick={handleBreadcrumbClick("Task Lamps")}
                >
                  Task Lamps
                </Breadcrumb.Link>
              </Breadcrumb.Item>
              <Breadcrumb.Separator aria-hidden="true">/</Breadcrumb.Separator>
              <Breadcrumb.Item>
                <Breadcrumb.CurrentLink aria-current="page">
                  {name}
                </Breadcrumb.CurrentLink>
              </Breadcrumb.Item>
            </Breadcrumb.List>
          </Breadcrumb.Root>

          <HStack wrap="wrap" gap="2">
            <Text
              render={<span />}
              variant="mono"
              size="xs"
              tone="subtle"
              style={styles.skuText}
            >
              SKU {sku}
            </Text>
            {bagCount > 0 ? (
              <Badge variant="subtle" size="sm" palette={accentPalette}>
                <BagSvg />
                Bag ({bagCount})
              </Badge>
            ) : null}
          </HStack>
        </HStack>

        {/* Main 2-column product detail stage */}
        <Grid render={<main />} align="start" style={styles.productGrid}>
          {/* Left column: Multi-angle SVG product gallery */}
          <VStack render={<section aria-label="Product gallery" />} gap="3">
            <AspectRatio ratio="4/5" rounded="lg" style={styles.heroStage}>
              <img
                src={activePlate.src}
                alt={activePlate.alt}
                {...stylex.props(styles.mediaImage)}
              />

              <HStack justify="between" gap="2" style={styles.heroOverlayBottom}>
                <Text
                  render={<span />}
                  size="xs"
                  weight="medium"
                  truncate="true"
                  style={styles.heroCaptionPill}
                >
                  {activePlate.label} · {activeFinish.label} ·{" "}
                  {activeEdition.shortLabel}
                </Text>

                <HStack gap="1.5" style={styles.pointerAuto}>
                  <IconButton
                    variant="surface"
                    size="sm"
                    shape="rounded"
                    aria-label="Previous product angle"
                    onClick={handlePrevAngle}
                    style={styles.heroNavBtn}
                  >
                    <ChevronLeftSvg />
                  </IconButton>
                  <IconButton
                    variant="surface"
                    size="sm"
                    shape="rounded"
                    aria-label="Next product angle"
                    onClick={handleNextAngle}
                    style={styles.heroNavBtn}
                  >
                    <ChevronRightSvg />
                  </IconButton>
                </HStack>
              </HStack>
            </AspectRatio>

            <Grid
              role="group"
              aria-label="Select gallery angle"
              columns="3"
              style={styles.thumbGrid}
            >
              {galleryPlates.map((plate, index) => {
                const isSelected = index === selectedAngleIndex;
                return (
                  <AspectRatio
                    key={plate.id}
                    ratio="square"
                    rounded="md"
                    render={
                      <button
                        type="button"
                        aria-label={`View ${plate.label}`}
                        aria-pressed={isSelected}
                        onClick={() => setSelectedAngleIndex(index)}
                      />
                    }
                    style={[
                      styles.thumbBtn,
                      isSelected && styles.thumbBtnSelected,
                    ]}
                  >
                    <img
                      src={plate.src}
                      alt={plate.label}
                      {...stylex.props(styles.mediaImage)}
                    />
                    <Text
                      render={<span />}
                      size="2xs"
                      weight="medium"
                      truncate="true"
                      style={styles.thumbLabel}
                    >
                      {plate.label}
                    </Text>
                  </AspectRatio>
                );
              })}
            </Grid>
          </VStack>

          {/* Right column: Sticky buy box & specifications */}
          <VStack
            render={<aside aria-label="Product details" />}
            gap="5"
            style={styles.infoCol}
          >
            <VStack gap="2.5">
              <HStack wrap="wrap" gap="2.5">
                <Badge variant="subtle" size="sm" palette={accentPalette}>
                  Edition 02 · Numbered Run
                </Badge>
                <Status.Root size="sm" palette={greenPalette}>
                  <Status.Indicator />
                  In stock · Ships in 2 days
                </Status.Root>
              </HStack>

              <Heading render={<h1 />} size="3xl" style={styles.headingReset}>
                {name}
              </Heading>

              <Text variant="muted" size="sm">
                {subtitle}
              </Text>

              <HStack wrap="wrap" gap="2">
                <RatingGroup
                  count={5}
                  value={5}
                  readOnly
                  size="sm"
                  palette={amberPalette}
                  aria-label="Rated 4.8 out of 5 stars"
                />
                <Text render={<span />} size="sm" weight="semibold" tabular="true">
                  4.8
                </Text>
                <button
                  type="button"
                  onClick={handleJumpToReviews}
                  {...stylex.props(styles.ratingLink)}
                >
                  (142 verified reviews)
                </button>
              </HStack>

              <HStack align="baseline" wrap="wrap" gap="2.5" style={styles.pt1}>
                <Text render={<span />} size="2xl" weight="semibold" tabular="true">
                  {formatUsd(unitPrice)}
                </Text>
                {compareAtPrice > unitPrice ? (
                  <Text
                    render={<span />}
                    variant="subtle"
                    size="md"
                    tabular="true"
                    style={styles.lineThrough}
                  >
                    {formatUsd(compareAtPrice)}
                  </Text>
                ) : null}
                {savings > 0 ? (
                  <Badge variant="subtle" size="sm" palette={redPalette}>
                    Save ${savings}
                  </Badge>
                ) : null}
              </HStack>
            </VStack>

            <Text variant="muted" size="md" style={styles.leadingLg}>
              {description}
            </Text>

            <Separator orientation="horizontal" size="sm" />

            {/* Anodized finish swatches */}
            <VStack gap="2">
              <HStack align="baseline" wrap="wrap" justify="between" gap="2">
                <Text render={<span />} id={finishLabelId} size="sm" weight="medium">
                  Finish · {activeFinish.label}
                </Text>
                <Text render={<span />} variant="caption">
                  Anodized 6061-T6
                </Text>
              </HStack>

              <Grid
                role="radiogroup"
                aria-labelledby={finishLabelId}
                columns="3"
                gap="2"
              >
                {FINISHES.map((finish) => {
                  const isSelected = finish.id === activeFinish.id;
                  return (
                    <button
                      key={finish.id}
                      type="button"
                      role="radio"
                      aria-checked={isSelected}
                      onClick={() => setSelectedFinishId(finish.id)}
                      {...stylex.props(
                        styles.finishCard,
                        isSelected && styles.finishCardSelected,
                      )}
                    >
                      <ColorSwatch
                        size="md"
                        shape="circle"
                        style={finishSwatchStyles[finish.id]}
                      />
                      <span>{finish.label}</span>
                    </button>
                  );
                })}
              </Grid>

              <Text variant="caption" style={styles.leadingSm}>
                {activeFinish.materialNote}
              </Text>
            </VStack>

            {/* Color-temperature edition segmented control */}
            <VStack gap="2">
              <HStack align="baseline" wrap="wrap" justify="between" gap="2">
                <Text render={<span />} id={editionLabelId} size="sm" weight="medium">
                  Color temperature
                </Text>
                <Text render={<span />} variant="caption">
                  {activeEdition.opticsSummary}
                </Text>
              </HStack>

              <div {...stylex.props(styles.editionScroller)}>
                <SegmentGroup.Root
                  size="sm"
                  value={selectedEditionId}
                  onValueChange={(next) =>
                    setSelectedEditionId(next as ProductEditionId)
                  }
                  aria-labelledby={editionLabelId}
                >
                  {EDITIONS.map((edition) => (
                    <SegmentGroup.Item key={edition.id} value={edition.id}>
                      {edition.label}
                    </SegmentGroup.Item>
                  ))}
                </SegmentGroup.Root>
              </div>

              <Text variant="caption" style={styles.leadingSm}>
                {activeEdition.kelvinNote}
              </Text>
            </VStack>

            {/* Quantity stepper */}
            <VStack gap="2">
              <Text render={<span />} id={quantityLabelId} size="sm" weight="medium">
                Quantity
              </Text>
              <HStack wrap="wrap" justify="between" gap="4">
                <NumberInput.Root
                  value={quantity}
                  onValueChange={handleQuantityChange}
                  min={1}
                  max={10}
                  step={1}
                  size="md"
                  variant="outline"
                  palette={accentPalette}
                  style={styles.quantityInputBox}
                >
                  <NumberInput.Group>
                    <NumberInput.Input
                      aria-labelledby={quantityLabelId}
                      aria-label="Quantity"
                    />
                    <NumberInput.Control />
                  </NumberInput.Group>
                </NumberInput.Root>

                <Text render={<span />} variant="muted" size="sm" tabular="true">
                  Subtotal:{" "}
                  <Text render={<strong />} size="sm" weight="semibold" tabular="true">
                    {formatUsd(totalPrice)}
                  </Text>
                </Text>
              </HStack>
            </VStack>

            {/* Primary & secondary CTAs */}
            <VStack gap="2.5">
              <Button
                variant="solid"
                size="lg"
                palette={accentPalette}
                onClick={handleAddToBag}
                style={styles.fullWidth}
              >
                <BagSvg />
                Add to bag · {formatUsd(totalPrice)}
              </Button>

              <Grid columns="2" style={styles.ctaSecondaryRow}>
                <Button
                  variant="surface"
                  size="lg"
                  palette={wishlisted ? redPalette : undefined}
                  aria-pressed={wishlisted}
                  onClick={handleToggleWishlist}
                  style={styles.fullWidth}
                >
                  <HeartSvg filled={wishlisted} />
                  {wishlisted ? "Saved" : "Save to wishlist"}
                </Button>
                <Button
                  variant="outline"
                  size="lg"
                  onClick={handleBuyNow}
                  style={styles.fullWidth}
                >
                  Buy it now
                </Button>
              </Grid>
            </VStack>

            {/* Fulfillment assurance strip */}
            <Grid columns="3" gap="3" style={styles.assuranceGrid}>
              <HStack align="start" gap="2" style={styles.assuranceItem}>
                <TruckSvg />
                <VStack gap="0">
                  <Text render={<span />} size="xs" weight="medium">
                    Free shipping
                  </Text>
                  <Text render={<span />} variant="caption">
                    Insured 2–4 day courier
                  </Text>
                </VStack>
              </HStack>
              <HStack align="start" gap="2" style={styles.assuranceItem}>
                <ShieldSvg />
                <VStack gap="0">
                  <Text render={<span />} size="xs" weight="medium">
                    5-year warranty
                  </Text>
                  <Text render={<span />} variant="caption">
                    Modular LED coverage
                  </Text>
                </VStack>
              </HStack>
              <HStack align="start" gap="2" style={styles.assuranceItem}>
                <RotateCcwSvg />
                <VStack gap="0">
                  <Text render={<span />} size="xs" weight="medium">
                    30-day trial
                  </Text>
                  <Text render={<span />} variant="caption">
                    Prepaid studio returns
                  </Text>
                </VStack>
              </HStack>
            </Grid>

            {/* Collapsible specifications, shipping, and warranty accordion */}
            <Accordion.Root
              defaultValue={["specs"]}
              multiple
              variant="outline"
              size="md"
            >
              <Accordion.Item value="specs">
                <Accordion.Header>
                  <Accordion.Trigger>
                    Specifications &amp; Materials
                    <Accordion.ItemIndicator>
                      <ChevronDownSvg />
                    </Accordion.ItemIndicator>
                  </Accordion.Trigger>
                </Accordion.Header>
                <Accordion.Panel>
                  <Accordion.ItemBody>
                    <DataList.Root
                      size="sm"
                      orientation="horizontal"
                      variant="subtle"
                    >
                      <DataList.Item>
                        <DataList.ItemLabel>Chassis</DataList.ItemLabel>
                        <DataList.ItemValue>
                          CNC-machined 6061-T6 aluminum · {activeFinish.label}
                        </DataList.ItemValue>
                      </DataList.Item>
                      <DataList.Item>
                        <DataList.ItemLabel>Dimensions</DataList.ItemLabel>
                        <DataList.ItemValue>
                          415 mm H × 310 mm reach · Ø 128 mm base
                        </DataList.ItemValue>
                      </DataList.Item>
                      <DataList.Item>
                        <DataList.ItemLabel>Weight</DataList.ItemLabel>
                        <DataList.ItemValue>
                          1.85 kg with counter-weighted steel core
                        </DataList.ItemValue>
                      </DataList.Item>
                      <DataList.Item>
                        <DataList.ItemLabel>Optics</DataList.ItemLabel>
                        <DataList.ItemValue>
                          {activeEdition.label} · {activeEdition.opticsSummary}
                        </DataList.ItemValue>
                      </DataList.Item>
                      <DataList.Item>
                        <DataList.ItemLabel>Dimming</DataList.ItemLabel>
                        <DataList.ItemValue>
                          Knurled rotary dial · 1%–100% flicker-free
                        </DataList.ItemValue>
                      </DataList.Item>
                      <DataList.Item>
                        <DataList.ItemLabel>Power</DataList.ItemLabel>
                        <DataList.ItemValue>
                          2.4 m braided linen cord · 24W USB-C PD adapter
                        </DataList.ItemValue>
                      </DataList.Item>
                    </DataList.Root>
                  </Accordion.ItemBody>
                </Accordion.Panel>
              </Accordion.Item>

              <Accordion.Item value="shipping">
                <Accordion.Header>
                  <Accordion.Trigger>
                    Shipping &amp; Returns
                    <Accordion.ItemIndicator>
                      <ChevronDownSvg />
                    </Accordion.ItemIndicator>
                  </Accordion.Trigger>
                </Accordion.Header>
                <Accordion.Panel>
                  <Accordion.ItemBody>
                    <Text variant="muted" size="sm" style={styles.leadingMd}>
                      Complimentary carbon-neutral courier delivery across North
                      America and the EU within 2–4 business days. Every lamp
                      ships in a plastic-free molded pulp cradle with a numbered
                      photometric calibration card. Try Sora in your workspace
                      for 30 days—prepaid return labels are included with zero
                      restocking fees.
                    </Text>
                  </Accordion.ItemBody>
                </Accordion.Panel>
              </Accordion.Item>

              <Accordion.Item value="warranty">
                <Accordion.Header>
                  <Accordion.Trigger>
                    Warranty &amp; Care
                    <Accordion.ItemIndicator>
                      <ChevronDownSvg />
                    </Accordion.ItemIndicator>
                  </Accordion.Trigger>
                </Accordion.Header>
                <Accordion.Panel>
                  <Accordion.ItemBody>
                    <Text variant="muted" size="sm" style={styles.leadingMd}>
                      Backed by a 5-year mechanical and optical warranty. The
                      COB LED cartridge, rotary encoder, and braided power cable
                      are modular and user-serviceable with the included 2.5 mm
                      hex key. Wipe the anodized aluminum finish with a dry or
                      slightly damp microfiber cloth; avoid abrasive polishes.
                    </Text>
                  </Accordion.ItemBody>
                </Accordion.Panel>
              </Accordion.Item>
            </Accordion.Root>
          </VStack>
        </Grid>

        <Separator orientation="horizontal" size="sm" />

        {/* Customer reviews section */}
        <VStack
          render={<section ref={reviewsRef} aria-label="Customer reviews" />}
          gap="6"
        >
          <HStack align="end" wrap="wrap" justify="between" gap="4">
            <VStack gap="1">
              <Heading render={<h2 />} size="2xl" style={styles.headingReset}>
                Customer Reviews
              </Heading>
              <Text variant="muted" size="sm">
                Verified studio impressions filtered by anodized finish
              </Text>
            </VStack>

            <div {...stylex.props(styles.editionScroller)}>
              <SegmentGroup.Root
                size="sm"
                value={reviewFilter}
                onValueChange={setReviewFilter}
                aria-label="Filter reviews by finish"
              >
                <SegmentGroup.Item value="all">
                  All ({REVIEWS.length})
                </SegmentGroup.Item>
                <SegmentGroup.Item value="sand">Sand</SegmentGroup.Item>
                <SegmentGroup.Item value="slate">Slate</SegmentGroup.Item>
                <SegmentGroup.Item value="forest">Forest</SegmentGroup.Item>
              </SegmentGroup.Root>
            </div>
          </HStack>

          <Grid align="start" gap="6" style={styles.reviewsLayout}>
            {/* Rating distribution summary card */}
            <Card.Root variant="outline" size="md">
              <Card.Body>
                <HStack align="baseline" gap="2.5">
                  <Text
                    render={<span />}
                    weight="semibold"
                    tabular="true"
                    style={styles.summaryScoreBig}
                  >
                    4.8
                  </Text>
                  <Text render={<span />} variant="muted" size="sm">
                    out of 5
                  </Text>
                </HStack>

                <HStack wrap="wrap" gap="2">
                  <RatingGroup
                    count={5}
                    value={5}
                    readOnly
                    size="sm"
                    palette={amberPalette}
                    aria-label="Average rating 4.8 out of 5"
                  />
                  <Text render={<span />} variant="caption">
                    142 ratings
                  </Text>
                </HStack>

                <VStack gap="2" style={styles.pt3}>
                  {RATING_BREAKDOWN.map((row) => (
                    <Grid key={row.stars} align="center" style={styles.summaryBarRow}>
                      <Text render={<span />} variant="caption" tabular="true">
                        {row.stars}★
                      </Text>
                      <Progress.Root
                        value={row.percent}
                        min={0}
                        max={100}
                        size="sm"
                        variant="subtle"
                        shape="full"
                        palette={amberPalette}
                        aria-label={`${row.stars} star reviews: ${row.percent}%`}
                      >
                        <Progress.Track>
                          <Progress.Range />
                        </Progress.Track>
                      </Progress.Root>
                      <Text
                        render={<span />}
                        variant="caption"
                        tone="subtle"
                        align="end"
                        tabular="true"
                      >
                        {row.count}
                      </Text>
                    </Grid>
                  ))}
                </VStack>
              </Card.Body>
            </Card.Root>

            {/* Review cards grid */}
            <Grid columns="2" gap="4" style={styles.reviewsList}>
              {filteredReviews.map((review) => {
                const isHelpful = Boolean(helpfulVotes[review.id]);
                const displayHelpful = review.helpfulCount + (isHelpful ? 1 : 0);
                const finishOption = FINISHES.find((f) => f.id === review.finish);
                return (
                  <Card.Root key={review.id} variant="outline" size="md">
                    <Card.Header>
                      <HStack align="start" justify="between" gap="3">
                        <HStack gap="2.5">
                          <Avatar.Root size="sm" variant="subtle" shape="full">
                            <Avatar.Fallback>{review.initials}</Avatar.Fallback>
                          </Avatar.Root>
                          <VStack gap="0">
                            <Text render={<span />} size="sm" weight="medium">
                              {review.author}
                            </Text>
                            <Text render={<span />} variant="caption" tone="subtle">
                              {review.role}
                            </Text>
                          </VStack>
                        </HStack>
                        <Text
                          render={<span />}
                          variant="caption"
                          tone="subtle"
                          style={styles.noWrap}
                        >
                          {review.date}
                        </Text>
                      </HStack>
                    </Card.Header>

                    <Card.Body>
                      <VStack gap="2">
                        <HStack wrap="wrap" gap="1.5">
                          <RatingGroup
                            count={5}
                            value={review.rating}
                            readOnly
                            size="xs"
                            palette={amberPalette}
                            aria-label={`Rated ${review.rating} out of 5`}
                          />
                          {review.verified ? (
                            <Badge
                              variant="subtle"
                              size="xs"
                              palette={greenPalette}
                            >
                              Verified
                            </Badge>
                          ) : null}
                          {finishOption ? (
                            <Badge variant="surface" size="xs">
                              {finishOption.label} · {review.editionLabel}
                            </Badge>
                          ) : null}
                        </HStack>

                        <Text render={<h3 />} size="sm" weight="semibold">
                          {review.title}
                        </Text>
                        <Text variant="muted" size="sm" style={styles.leadingMd}>
                          {review.body}
                        </Text>
                      </VStack>
                    </Card.Body>

                    <Card.Footer>
                      <HStack justify="between" style={styles.fullWidth}>
                        <Button
                          variant={isHelpful ? "subtle" : "ghost"}
                          size="xs"
                          palette={isHelpful ? accentPalette : undefined}
                          aria-pressed={isHelpful}
                          onClick={() => handleToggleHelpful(review.id)}
                        >
                          <ThumbUpSvg />
                          Helpful ({displayHelpful})
                        </Button>
                      </HStack>
                    </Card.Footer>
                  </Card.Root>
                );
              })}
            </Grid>
          </Grid>
        </VStack>
      </VStack>

      <Toaster toaster={queue} />
    </div>
  );
}
```

Credit: Inspired by [Product Detail](https://astryx.atmeta.com/playground?template=product-detail) from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.)
