# PHASE 02: TAXONOMY, ATTRIBUTES AND PRODUCT SPEC FIELDS

Read `docs/02-INFORMATION-ARCHITECTURE.md` sections 2, 3 and 4, plus decision D-10.

## Scope

The product data structure and its admin experience. No front-end templates yet.

## Build

1. `BC_Attributes_Installer`: seeds the seven global attributes (`pa_size`, `pa_color`, `pa_fabric`, `pa_pattern`, `pa_season`, `pa_thickness`, `pa_set-type`) with the terms listed in the IA doc. Idempotent, safe to run on every activation. Sets `pa_color` to the swatch display type and `pa_size` to button/select as appropriate.
2. A WP-CLI command `wp bc seed-categories` that creates the four parent categories and their children exactly as specified, with slugs matching the URL structure. Do not invent categories.
3. `BC_Product_Spec_Fields`: a metabox on the product edit screen titled Product Specifications, holding the meta fields from data model section 3. Text inputs for dimensions, includes, care and thread count, a number input for pieces, a checkbox for COD blocked, a URL input for video (validated as YouTube or Vimeo only). Nonce plus `edit_products` capability check on save, each field sanitised by its type.
4. `BC_Product_Spec_Render`: exposes `BC_Product_Spec_Render::get_spec_rows( $product )` returning an ordered array of label and value pairs, with empty values already stripped. The theme will call this in phase 7. It must never return an empty-valued row.
5. Register the four image sizes from `docs/04-DESIGN-SYSTEM.md` section 5, and remove `medium_large`, `1536x1536`, `2048x2048` and the unused WooCommerce sizes via `intermediate_image_sizes_advanced`.
6. Cap uploaded image dimensions at 1600px on the long edge using the **`big_image_size_threshold`** filter. That is the correct hook and it is exactly this feature. Do not use `wp_handle_upload`, which fires after the file is stored and is not the resize point.
7. Extend `wp bc seed-demo` from phase 1 so the demo products are realistic: a mix of simple and variable, variable ones varying on size and colour, all spec fields populated, images assigned.

## Acceptance criteria

- [ ] All seven global attributes exist with their terms after activation, and re-activating does not duplicate them
- [ ] The category tree matches the IA doc exactly, four parents, correct children, correct slugs
- [ ] The spec metabox saves and reloads every field correctly, including after a product duplicate
- [ ] Saving with an invalid video URL is rejected with a clear message
- [ ] A product with three of the eight spec fields filled returns exactly three rows from `get_spec_rows()`
- [ ] `wp-content/uploads` shows exactly our four sizes plus core's `thumbnail`, `medium` and `large` and the `-scaled` original. Unset WooCommerce's `woocommerce_thumbnail`, `woocommerce_single` and `woocommerce_gallery_thumbnail` too, since our sizes replace them, and confirm they are gone.
- [ ] Uploading a 4000px image produces a 1600px original
- [ ] A variable product with 4 sizes and 3 colours saves all 12 variations without truncation (check `max_input_vars`)
- [ ] `composer run lint` passes

## Stop

No front-end rendering of any of this. That is phases 6 and 7.
