{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "size-guide-modal",
  "title": "Size Guide Modal",
  "description": "A shoe product card with a size grid and a Size guide link that opens a modal with three tabs: a selectable US/UK/EU size chart in cm or inches, a Find my size tool that recommends a size from foot length and width, and an illustrated How to measure guide. Picking a size applies it to the product.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/size-guide-modal/size-guide-modal.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, LayoutGroup, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface ShoeSize {\n  us: string;\n  uk: string;\n  eu: string;\n  /** Foot length in centimetres. */\n  cm: number;\n  soldOut?: boolean;\n}\nexport interface SizeGuideModalProps {\n  product?: { name: string; price: number; was?: number; image: string; fitNote?: string };\n  sizes?: ShoeSize[];\n  currency?: string;\n  defaultSize?: string;\n  onSizeChange?: (size: ShoeSize) => void;\n  onAdd?: (size: ShoeSize) => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: {\n    bg: \"#0A0A0A\",\n    card: \"#141414\",\n    panel: \"#121212\",\n    title: \"#FFFFFF\",\n    muted: \"rgba(255,255,255,0.45)\",\n    body: \"rgba(255,255,255,0.62)\",\n    line: \"rgba(255,255,255,0.12)\",\n    lineHi: \"rgba(255,255,255,0.35)\",\n    tile: \"#F1F1F1\",\n    accent: \"#7CDE6A\",\n    accentText: \"#0B1A08\",\n    accentSoft: \"rgba(124,222,106,0.12)\",\n    buttonBg: \"#FFFFFF\",\n    buttonText: \"#111111\",\n    ghost: \"rgba(255,255,255,0.07)\",\n    scrim: \"rgba(0,0,0,0.72)\",\n    shadow: \"0 30px 80px -20px rgba(0,0,0,0.8)\",\n    scheme: \"dark\" as const,\n  },\n  light: {\n    bg: \"#FFFFFF\",\n    card: \"#F7F7F7\",\n    panel: \"#FFFFFF\",\n    title: \"#111111\",\n    muted: \"rgba(0,0,0,0.45)\",\n    body: \"rgba(0,0,0,0.62)\",\n    line: \"rgba(0,0,0,0.1)\",\n    lineHi: \"rgba(0,0,0,0.3)\",\n    tile: \"#F1F1F1\",\n    accent: \"#2F9E44\",\n    accentText: \"#FFFFFF\",\n    accentSoft: \"rgba(47,158,68,0.1)\",\n    buttonBg: \"#111111\",\n    buttonText: \"#FFFFFF\",\n    ghost: \"rgba(0,0,0,0.05)\",\n    scrim: \"rgba(10,10,10,0.5)\",\n    shadow: \"0 30px 80px -24px rgba(0,0,0,0.35)\",\n    scheme: \"light\" as const,\n  },\n};\ntype Palette = (typeof PALETTES)[keyof typeof PALETTES];\n\nconst PRODUCT = { name: \"Running Shoes\", price: 99, was: 149, image: \"/demo/running-shoes.webp\", fitNote: \"Runs true to size for 78% of buyers\" };\nconst SIZES: ShoeSize[] = [\n  { us: \"7\", uk: \"6\", eu: \"40\", cm: 25 },\n  { us: \"7.5\", uk: \"6.5\", eu: \"40.5\", cm: 25.4 },\n  { us: \"8\", uk: \"7\", eu: \"41\", cm: 25.8 },\n  { us: \"8.5\", uk: \"7.5\", eu: \"42\", cm: 26.2, soldOut: true },\n  { us: \"9\", uk: \"8\", eu: \"42.5\", cm: 26.7 },\n  { us: \"9.5\", uk: \"8.5\", eu: \"43\", cm: 27.1 },\n  { us: \"10\", uk: \"9\", eu: \"44\", cm: 27.5 },\n  { us: \"10.5\", uk: \"9.5\", eu: \"44.5\", cm: 27.9 },\n  { us: \"11\", uk: \"10\", eu: \"45\", cm: 28.3 },\n  { us: \"12\", uk: \"11\", eu: \"46\", cm: 29.2, soldOut: true },\n];\nconst TABS = [\n  { id: \"chart\", label: \"Size chart\" },\n  { id: \"find\", label: \"Find my size\" },\n  { id: \"measure\", label: \"How to measure\" },\n] as const;\ntype Tab = (typeof TABS)[number][\"id\"];\ntype Width = \"narrow\" | \"regular\" | \"wide\";\n\nconst fmtLen = (cm: number, unit: \"cm\" | \"in\") => (unit === \"cm\" ? `${cm.toFixed(1)} cm` : `${(cm / 2.54).toFixed(2)} in`);\n\nfunction recommend(sizes: ShoeSize[], footCm: number, width: Width) {\n  // Wide feet go up half a size; narrow feet can take the closest size even if it's a touch short.\n  const target = footCm + (width === \"wide\" ? 0.4 : width === \"narrow\" ? -0.15 : 0);\n  return sizes.find((s) => s.cm >= target) ?? null;\n}\n\nfunction Seg<T extends string>({ value, options, onChange, p, label, id }: { value: T; options: { v: T; label: string }[]; onChange: (v: T) => void; p: Palette; label: string; id: string }) {\n  return (\n    <LayoutGroup id={id}>\n      <div role=\"radiogroup\" aria-label={label} className=\"inline-flex rounded-full border p-0.5\" style={{ borderColor: p.line }}>\n        {options.map((o) => {\n          const on = value === o.v;\n          return (\n            <button key={o.v} type=\"button\" role=\"radio\" aria-checked={on} onClick={() => onChange(o.v)} className=\"relative rounded-full px-3 py-1 text-[12px] font-medium\" style={{ color: on ? p.buttonText : p.body }}>\n              {on ? <motion.span layoutId=\"seg\" className=\"absolute inset-0 rounded-full\" style={{ background: p.buttonBg }} transition={{ type: \"spring\", stiffness: 500, damping: 38 }} /> : null}\n              <span className=\"relative\">{o.label}</span>\n            </button>\n          );\n        })}\n      </div>\n    </LayoutGroup>\n  );\n}\n\nfunction FootDiagram({ p }: { p: Palette }) {\n  const reduce = useReducedMotion();\n  return (\n    <svg viewBox=\"0 0 220 260\" className=\"h-auto w-full max-w-[220px]\" aria-hidden=\"true\">\n      <rect x=\"40\" y=\"14\" width=\"140\" height=\"232\" rx=\"6\" fill={p.ghost} stroke={p.line} />\n      <line x1=\"40\" y1=\"232\" x2=\"180\" y2=\"232\" stroke={p.lineHi} strokeDasharray=\"4 4\" />\n      <text x=\"110\" y=\"252\" textAnchor=\"middle\" fontSize=\"10\" fill={p.muted}>\n        wall\n      </text>\n      <path d=\"M110 228c-26 0-34-22-34-52 0-26 6-44 6-70 0-30 10-62 34-62 20 0 28 22 28 48 0 30-6 46-6 76 0 34-8 60-28 60z\" fill=\"none\" stroke={p.title} strokeWidth=\"2\" />\n      {[\n        [88, 46, 8],\n        [104, 38, 7],\n        [119, 38, 6],\n        [132, 44, 5],\n        [142, 54, 4.5],\n      ].map(([cx, cy, r], i) => (\n        <circle key={i} cx={cx} cy={cy} r={r} fill=\"none\" stroke={p.title} strokeWidth=\"1.6\" />\n      ))}\n      <motion.g initial={reduce ? false : { opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: 0.3 }}>\n        <line x1=\"196\" y1=\"30\" x2=\"196\" y2=\"232\" stroke={p.accent} strokeWidth=\"2\" />\n        <path d=\"m191 37 5-8 5 8M191 225l5 8 5-8\" fill=\"none\" stroke={p.accent} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n        <text x=\"204\" y=\"134\" fontSize=\"11\" fill={p.accent} transform=\"rotate(90 204 134)\" textAnchor=\"middle\">\n          heel to longest toe\n        </text>\n      </motion.g>\n    </svg>\n  );\n}\n\nexport function SizeGuideModal({ product = PRODUCT, sizes = SIZES, currency = \"$\", defaultSize = \"9\", onSizeChange, onAdd, theme = \"dark\", className }: SizeGuideModalProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [size, setSize] = React.useState<string | null>(defaultSize);\n  const [open, setOpen] = React.useState(false);\n  const [tab, setTab] = React.useState<Tab>(\"chart\");\n  const [unit, setUnit] = React.useState<\"cm\" | \"in\">(\"cm\");\n  const [pending, setPending] = React.useState<string | null>(defaultSize);\n  const [foot, setFoot] = React.useState(26.5);\n  const [width, setWidth] = React.useState<Width>(\"regular\");\n  const [added, setAdded] = React.useState(false);\n  const openerRef = React.useRef<HTMLButtonElement>(null);\n  const dialogRef = React.useRef<HTMLDivElement>(null);\n  const tabRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n  const cur = sizes.find((s) => s.us === size) ?? null;\n  const pend = sizes.find((s) => s.us === pending) ?? null;\n  const rec = recommend(sizes, foot, width);\n  const minCm = sizes[0].cm - 1;\n  const maxCm = sizes[sizes.length - 1].cm + 0.5;\n\n  const choose = (s: ShoeSize) => {\n    if (s.soldOut) return;\n    setSize(s.us);\n    setAdded(false);\n    onSizeChange?.(s);\n  };\n  const show = () => {\n    setPending(size);\n    setOpen(true);\n  };\n  const close = React.useCallback(() => {\n    setOpen(false);\n    // The page behind the dialog is inert until the exit finishes, so focus it on the next tick.\n    setTimeout(() => openerRef.current?.focus(), 0);\n  }, []);\n  const apply = (us: string | null) => {\n    const s = sizes.find((x) => x.us === us);\n    if (s && !s.soldOut) choose(s);\n    close();\n  };\n\n  React.useEffect(() => {\n    if (!open) return;\n    const dlg = dialogRef.current;\n    dlg?.querySelector<HTMLElement>(\"[data-autofocus]\")?.focus();\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key === \"Escape\") return close();\n      if (e.key !== \"Tab\" || !dlg) return;\n      const f = [...dlg.querySelectorAll<HTMLElement>(\"button:not([disabled]), input, [tabindex='0']\")].filter((el) => el.offsetParent !== null);\n      if (!f.length) return;\n      const first = f[0];\n      const last = f[f.length - 1];\n      const to = e.shiftKey ? (document.activeElement === first ? last : null) : document.activeElement === last ? first : null;\n      if (!to) return;\n      e.preventDefault();\n      to.focus();\n    };\n    document.addEventListener(\"keydown\", onKey);\n    return () => document.removeEventListener(\"keydown\", onKey);\n  }, [open, close]);\n\n  const tabKey = (e: React.KeyboardEvent, i: number) => {\n    const d = e.key === \"ArrowRight\" ? 1 : e.key === \"ArrowLeft\" ? -1 : 0;\n    if (!d) return;\n    e.preventDefault();\n    const n = (i + d + TABS.length) % TABS.length;\n    setTab(TABS[n].id);\n    tabRefs.current[n]?.focus();\n  };\n\n  const ease = [0.22, 1, 0.36, 1] as const;\n\n  return (\n    <section className={cn(\"relative flex w-full flex-col justify-center overflow-hidden px-4 py-12 sm:min-h-[780px] sm:px-8 sm:py-16\", className)} style={{ background: p.bg, color: p.body, colorScheme: p.scheme }}>\n      {/* Product */}\n      <div inert={open} className=\"mx-auto grid w-full max-w-[960px] items-center gap-8 md:grid-cols-2 md:gap-12\">\n        <div className=\"relative aspect-[4/3] overflow-hidden rounded-2xl md:aspect-square\" style={{ background: p.tile }}>\n          {/* eslint-disable-next-line @next/next/no-img-element -- plain img keeps the block framework-agnostic */}\n          <img src={product.image} alt={product.name} width={1344} height={752} className=\"h-full w-full object-cover\" style={{ objectPosition: \"50% 55%\", transform: \"scale(1.15)\" }} />\n        </div>\n        <div className=\"min-w-0\">\n          <p className=\"text-[12px] font-medium tracking-[0.14em] uppercase\" style={{ color: p.muted }}>\n            Northline · Men’s\n          </p>\n          <h2 className=\"mt-2 text-[30px] font-semibold tracking-tight sm:text-[34px]\" style={{ color: p.title }}>\n            {product.name}\n          </h2>\n          <div className=\"mt-2 flex items-baseline gap-3\">\n            <span className=\"text-[22px] font-semibold tabular-nums\" style={{ color: p.title }}>\n              {currency}\n              {product.price.toFixed(2)}\n            </span>\n            {product.was ? (\n              <span className=\"text-[15px] tabular-nums line-through\" style={{ color: p.muted }}>\n                {currency}\n                {product.was.toFixed(2)}\n              </span>\n            ) : null}\n          </div>\n\n          <div className=\"mt-7 flex items-center justify-between gap-3\">\n            <p id={`${uid}-sz`} className=\"text-[13px]\" style={{ color: p.muted }}>\n              Size <span style={{ color: p.title }}>{cur ? `US ${cur.us} · EU ${cur.eu}` : \"Pick a size\"}</span>\n            </p>\n            <button ref={openerRef} type=\"button\" onClick={show} aria-haspopup=\"dialog\" className=\"inline-flex items-center gap-1.5 text-[13px] font-medium underline-offset-4 hover:underline\" style={{ color: p.title }}>\n              <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <rect x=\"2.5\" y=\"7\" width=\"19\" height=\"10\" rx=\"2\" />\n                <path d=\"M6.5 7v3M10 7v4M13.5 7v3M17 7v4\" />\n              </svg>\n              Size guide\n            </button>\n          </div>\n          <div role=\"radiogroup\" aria-labelledby={`${uid}-sz`} className=\"mt-3 grid grid-cols-5 gap-2\">\n            {sizes.map((s) => {\n              const on = size === s.us;\n              return (\n                <button\n                  key={s.us}\n                  type=\"button\"\n                  role=\"radio\"\n                  aria-checked={on}\n                  aria-disabled={s.soldOut}\n                  aria-label={`US ${s.us}${s.soldOut ? \", sold out\" : \"\"}`}\n                  onClick={() => choose(s)}\n                  className={cn(\"relative h-11 overflow-hidden rounded-xl border text-[14px] font-medium tabular-nums transition-colors\", s.soldOut && \"cursor-not-allowed\")}\n                  style={{ borderColor: on ? p.title : p.line, background: on ? p.buttonBg : \"transparent\", color: on ? p.buttonText : s.soldOut ? p.muted : p.title }}\n                >\n                  {s.us}\n                  {s.soldOut ? <span className=\"absolute inset-0\" style={{ background: `linear-gradient(to top right, transparent calc(50% - 0.5px), ${p.line} 50%, transparent calc(50% + 0.5px))` }} aria-hidden=\"true\" /> : null}\n                </button>\n              );\n            })}\n          </div>\n          {product.fitNote ? (\n            <div className=\"mt-4\">\n              <div className=\"flex justify-between text-[11px]\" style={{ color: p.muted }}>\n                <span>Runs small</span>\n                <span>True to size</span>\n                <span>Runs large</span>\n              </div>\n              <div className=\"relative mt-1.5 h-1.5 rounded-full\" style={{ background: p.ghost }}>\n                <span className=\"absolute top-1/2 left-[52%] size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-2\" style={{ background: p.accent, borderColor: p.bg }} />\n              </div>\n              <p className=\"mt-2 text-[12px]\">{product.fitNote}</p>\n            </div>\n          ) : null}\n          <motion.button\n            type=\"button\"\n            disabled={!cur}\n            onClick={() => cur && (setAdded(true), onAdd?.(cur))}\n            whileTap={reduce ? undefined : { scale: 0.98 }}\n            animate={{ background: added ? p.accent : p.buttonBg, color: added ? p.accentText : p.buttonText }}\n            className=\"mt-6 h-12 w-full rounded-full text-[15px] font-semibold disabled:opacity-50\"\n          >\n            {added ? `Added · US ${cur?.us}` : cur ? `Add to cart · US ${cur.us}` : \"Pick a size\"}\n          </motion.button>\n        </div>\n      </div>\n\n      {/* Dialog */}\n      <AnimatePresence>\n        {open ? (\n          <motion.div\n            key=\"scrim\"\n            className=\"absolute inset-0 z-30 flex items-end justify-center sm:items-start sm:overflow-y-auto sm:p-6\"\n            style={{ background: p.scrim }}\n            initial={{ opacity: 0 }}\n            animate={{ opacity: 1 }}\n            exit={{ opacity: 0 }}\n            onMouseDown={(e) => e.target === e.currentTarget && close()}\n          >\n            <motion.div\n              ref={dialogRef}\n              role=\"dialog\"\n              aria-modal=\"true\"\n              aria-labelledby={`${uid}-title`}\n              initial={reduce ? { opacity: 0 } : { opacity: 0, y: 40 }}\n              animate={{ opacity: 1, y: 0 }}\n              exit={reduce ? { opacity: 0 } : { opacity: 0, y: 40 }}\n              transition={{ duration: 0.38, ease }}\n              className=\"flex max-h-[92%] w-full flex-col overflow-hidden rounded-t-3xl border sm:my-auto sm:max-h-none sm:max-w-[640px] sm:rounded-3xl\"\n              style={{ background: p.panel, borderColor: p.line, boxShadow: p.shadow }}\n            >\n              <div className=\"flex items-start justify-between gap-4 px-5 pt-5 sm:px-7 sm:pt-6\">\n                <div>\n                  <h3 id={`${uid}-title`} className=\"text-[20px] font-semibold tracking-tight\" style={{ color: p.title }}>\n                    Size guide\n                  </h3>\n                  <p className=\"mt-0.5 text-[13px]\" style={{ color: p.muted }}>\n                    {product.name} · men’s sizing\n                  </p>\n                </div>\n                <button type=\"button\" data-autofocus onClick={close} aria-label=\"Close size guide\" className=\"grid size-9 shrink-0 place-items-center rounded-full\" style={{ background: p.ghost, color: p.title }}>\n                  <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" aria-hidden=\"true\">\n                    <path d=\"M6 6l12 12M18 6 6 18\" />\n                  </svg>\n                </button>\n              </div>\n\n              <LayoutGroup id={`${uid}-tabs`}>\n                <div role=\"tablist\" aria-label=\"Size guide sections\" className=\"mt-4 flex gap-0.5 overflow-x-auto border-b px-3.5 [scrollbar-width:none] sm:px-7\" style={{ borderColor: p.line }}>\n                  {TABS.map((t, i) => {\n                    const on = tab === t.id;\n                    return (\n                      <button\n                        key={t.id}\n                        ref={(el) => {\n                          tabRefs.current[i] = el;\n                        }}\n                        type=\"button\"\n                        role=\"tab\"\n                        id={`${uid}-tab-${t.id}`}\n                        aria-selected={on}\n                        aria-controls={`${uid}-panel`}\n                        tabIndex={on ? 0 : -1}\n                        onClick={() => setTab(t.id)}\n                        onKeyDown={(e) => tabKey(e, i)}\n                        className=\"relative shrink-0 px-2.5 pt-1 pb-3 text-[13px] font-medium whitespace-nowrap sm:px-3 sm:text-[14px]\"\n                        style={{ color: on ? p.title : p.muted }}\n                      >\n                        {t.label}\n                        {on ? <motion.span layoutId=\"tab-line\" className=\"absolute inset-x-2 -bottom-px h-0.5 rounded-full\" style={{ background: p.title }} /> : null}\n                      </button>\n                    );\n                  })}\n                </div>\n              </LayoutGroup>\n\n              <div id={`${uid}-panel`} role=\"tabpanel\" aria-labelledby={`${uid}-tab-${tab}`} className=\"min-h-0 flex-1 overflow-y-auto px-5 py-5 sm:px-7\">\n                <AnimatePresence mode=\"wait\" initial={false}>\n                  <motion.div key={tab} initial={reduce ? false : { opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -8 }} transition={{ duration: 0.2 }}>\n                    {tab === \"chart\" ? (\n                      <>\n                        <div className=\"mb-3 flex items-center justify-between gap-3\">\n                          <p className=\"text-[13px]\">Tap a row to pick that size.</p>\n                          <Seg\n                            id={`${uid}-u1`}\n                            label=\"Units\"\n                            value={unit}\n                            onChange={setUnit}\n                            p={p}\n                            options={[\n                              { v: \"cm\", label: \"cm\" },\n                              { v: \"in\", label: \"in\" },\n                            ]}\n                          />\n                        </div>\n                        <div className=\"overflow-hidden rounded-2xl border\" style={{ borderColor: p.line }}>\n                          <div className=\"grid grid-cols-[1fr_1fr_1fr_1.6fr] px-3 py-2.5 text-[13px] font-medium sm:px-4\" style={{ background: p.ghost, color: p.muted }} aria-hidden=\"true\">\n                            <span>US</span>\n                            <span>UK</span>\n                            <span>EU</span>\n                            <span className=\"text-right\">Foot length</span>\n                          </div>\n                          <div role=\"radiogroup\" aria-label=\"Sizes\">\n                            {sizes.map((s) => {\n                              const on = pending === s.us;\n                              return (\n                                <button\n                                  key={s.us}\n                                  type=\"button\"\n                                  role=\"radio\"\n                                  aria-checked={on}\n                                  aria-label={`US ${s.us}, UK ${s.uk}, EU ${s.eu}, ${fmtLen(s.cm, unit)}${s.soldOut ? \", sold out\" : \"\"}`}\n                                  onClick={() => setPending(s.us)}\n                                  className=\"grid w-full grid-cols-[1fr_1fr_1fr_1.6fr] items-center border-t px-3 py-2.5 text-left text-[13px] tabular-nums transition-colors outline-none hover:bg-[var(--hov)] focus-visible:bg-[var(--hov)] sm:px-4\"\n                                  style={{ borderColor: p.line, background: on ? p.accentSoft : undefined, color: on ? p.title : p.body, [\"--hov\" as string]: p.ghost }}\n                                >\n                                  <span className=\"inline-flex items-center gap-2 font-semibold\" style={{ color: p.title }}>\n                                    <span className=\"size-1.5 rounded-full\" style={{ background: on ? p.accent : \"transparent\" }} />\n                                    {s.us}\n                                  </span>\n                                  <span>{s.uk}</span>\n                                  <span>{s.eu}</span>\n                                  <span className=\"text-right\">\n                                    {s.soldOut ? (\n                                      <span className=\"mr-2 text-[11px]\" style={{ color: p.muted }}>\n                                        Sold out\n                                      </span>\n                                    ) : null}\n                                    {fmtLen(s.cm, unit)}\n                                  </span>\n                                </button>\n                              );\n                            })}\n                          </div>\n                        </div>\n                      </>\n                    ) : tab === \"find\" ? (\n                      <div>\n                        <div className=\"flex items-center justify-between gap-3\">\n                          <label htmlFor={`${uid}-foot`} className=\"text-[13px] font-medium\" style={{ color: p.title }}>\n                            Your foot length\n                          </label>\n                          <Seg\n                            id={`${uid}-u2`}\n                            label=\"Units\"\n                            value={unit}\n                            onChange={setUnit}\n                            p={p}\n                            options={[\n                              { v: \"cm\", label: \"cm\" },\n                              { v: \"in\", label: \"in\" },\n                            ]}\n                          />\n                        </div>\n                        <p className=\"mt-3 text-[32px] font-semibold tracking-tight tabular-nums\" style={{ color: p.title }} aria-hidden=\"true\">\n                          {fmtLen(foot, unit)}\n                        </p>\n                        <input id={`${uid}-foot`} type=\"range\" min={minCm} max={maxCm} step={0.1} value={foot} onChange={(e) => setFoot(Number(e.target.value))} aria-valuetext={fmtLen(foot, unit)} className=\"mt-2 w-full\" style={{ accentColor: p.accent }} />\n                        <div className=\"mt-1 flex justify-between text-[11px] tabular-nums\" style={{ color: p.muted }}>\n                          <span>{fmtLen(minCm, unit)}</span>\n                          <span>{fmtLen(maxCm, unit)}</span>\n                        </div>\n                        <p className=\"mt-5 mb-2 text-[13px] font-medium\" style={{ color: p.title }}>\n                          Foot width\n                        </p>\n                        <Seg\n                          id={`${uid}-w`}\n                          label=\"Foot width\"\n                          value={width}\n                          onChange={setWidth}\n                          p={p}\n                          options={[\n                            { v: \"narrow\", label: \"Narrow\" },\n                            { v: \"regular\", label: \"Regular\" },\n                            { v: \"wide\", label: \"Wide\" },\n                          ]}\n                        />\n                        <div className=\"mt-5 rounded-2xl border p-4\" style={{ borderColor: p.line, background: p.card }} aria-live=\"polite\">\n                          <AnimatePresence mode=\"popLayout\" initial={false}>\n                            <motion.div key={rec ? `${rec.us}-${width}` : \"none\"} initial={reduce ? false : { opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -8 }} transition={{ duration: 0.2 }}>\n                              {rec ? (\n                                <div className=\"flex flex-wrap items-center justify-between gap-3\">\n                                  <div>\n                                    <p className=\"text-[12px]\" style={{ color: p.muted }}>\n                                      We recommend\n                                    </p>\n                                    <p className=\"text-[22px] font-semibold tracking-tight\" style={{ color: p.title }}>\n                                      US {rec.us}{\" \"}\n                                      <span className=\"text-[14px] font-normal\" style={{ color: p.muted }}>\n                                        · UK {rec.uk} · EU {rec.eu}\n                                      </span>\n                                    </p>\n                                    <p className=\"mt-0.5 text-[12px]\">{rec.soldOut ? \"Sold out in this size right now.\" : width === \"wide\" ? \"Half a size up for a wider foot.\" : `Fits feet up to ${fmtLen(rec.cm, unit)}.`}</p>\n                                  </div>\n                                  <button type=\"button\" disabled={rec.soldOut} onClick={() => apply(rec.us)} className=\"rounded-full px-4 py-2 text-[13px] font-semibold disabled:opacity-40\" style={{ background: p.buttonBg, color: p.buttonText }}>\n                                    Use US {rec.us}\n                                  </button>\n                                </div>\n                              ) : (\n                                <p className=\"text-[14px]\">That’s longer than our largest size. Try our Wide fit range or contact us for advice.</p>\n                              )}\n                            </motion.div>\n                          </AnimatePresence>\n                        </div>\n                      </div>\n                    ) : (\n                      <div className=\"grid items-center gap-6 sm:grid-cols-[200px_minmax(0,1fr)]\">\n                        <div className=\"mx-auto w-[170px] sm:w-full\">\n                          <FootDiagram p={p} />\n                        </div>\n                        <ol className=\"space-y-4\">\n                          {[\n                            [\"Stand on paper\", \"Put a sheet of paper on the floor with one short edge against a wall. Stand on it, heel touching the wall.\"],\n                            [\"Mark your longest toe\", \"Have someone mark the tip of your longest toe, or lean forward and mark it yourself.\"],\n                            [\"Measure and pick\", \"Measure from the wall to the mark. Do both feet in the evening and use the longer one.\"],\n                          ].map(([h, b], i) => (\n                            <li key={h} className=\"flex gap-3\">\n                              <span className=\"grid size-6 shrink-0 place-items-center rounded-full text-[12px] font-semibold\" style={{ background: p.accentSoft, color: p.accent }}>\n                                {i + 1}\n                              </span>\n                              <span>\n                                <span className=\"block text-[14px] font-medium\" style={{ color: p.title }}>\n                                  {h}\n                                </span>\n                                <span className=\"mt-0.5 block text-[13px] leading-relaxed\">{b}</span>\n                              </span>\n                            </li>\n                          ))}\n                        </ol>\n                      </div>\n                    )}\n                  </motion.div>\n                </AnimatePresence>\n              </div>\n\n              <div className=\"flex items-center justify-between gap-3 border-t px-5 py-4 sm:px-7\" style={{ borderColor: p.line }}>\n                <p className=\"min-w-0 truncate text-[13px]\" style={{ color: p.muted }}>\n                  {pend ? (\n                    <>\n                      Selected <span style={{ color: p.title }}>US {pend.us}</span>\n                      {pend.soldOut ? \" · sold out\" : \"\"}\n                    </>\n                  ) : (\n                    \"No size selected\"\n                  )}\n                </p>\n                <button type=\"button\" disabled={!pend || pend.soldOut} onClick={() => apply(pending)} className=\"shrink-0 rounded-full px-5 py-2.5 text-[14px] font-semibold disabled:opacity-40\" style={{ background: p.buttonBg, color: p.buttonText }}>\n                  {pend && !pend.soldOut ? `Select US ${pend.us}` : \"Select size\"}\n                </button>\n              </div>\n            </motion.div>\n          </motion.div>\n        ) : null}\n      </AnimatePresence>\n    </section>\n  );\n}\n\nexport default SizeGuideModal;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}