{
  "version": 1,
  "group": "parsing",
  "description": "Canonical CSS color parsing fixtures. Unless a case explicitly expects rejection, channels are converted to clipped sRGB and HEX is normalized to uppercase.",
  "errorContract": "Rejected values must throw a user-safe validation error and must never produce a fallback color.",
  "cases": [
    {
      "id": "hex-short-black",
      "family": "hex",
      "input": "#000",
      "expected": { "valid": true, "hex": "#000000", "alpha": 1, "format": "Short HEX" }
    },
    {
      "id": "hex-short-white-lowercase",
      "family": "hex",
      "input": "#fff",
      "expected": { "valid": true, "hex": "#FFFFFF", "alpha": 1, "format": "Short HEX" }
    },
    {
      "id": "hex-six-digit",
      "family": "hex",
      "input": "#336699",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "HEX" }
    },
    {
      "id": "hex-uppercase-preserved",
      "family": "hex",
      "input": "#A1B2C3",
      "expected": { "valid": true, "hex": "#A1B2C3", "alpha": 1, "format": "HEX" }
    },
    {
      "id": "hex-lowercase-normalized",
      "family": "hex",
      "input": "#a1b2c3",
      "expected": { "valid": true, "hex": "#A1B2C3", "alpha": 1, "format": "HEX" }
    },
    {
      "id": "hex-eight-digit-alpha",
      "family": "hex",
      "input": "#33669980",
      "expected": { "valid": true, "hex": "#336699", "alpha": 0.5019607843137255, "format": "HEX alpha" }
    },
    {
      "id": "hex-four-digit-alpha",
      "family": "hex",
      "input": "#0f08",
      "expected": { "valid": true, "hex": "#00FF00", "alpha": 0.5333333333333333, "format": "HEX alpha" }
    },
    {
      "id": "hex-invalid-length",
      "family": "hex",
      "input": "#12345",
      "expected": { "valid": false }
    },
    {
      "id": "hex-invalid-characters",
      "family": "hex",
      "input": "#GGGGGG",
      "expected": { "valid": false }
    },
    {
      "id": "rgb-legacy-comma-syntax",
      "family": "rgb",
      "input": "rgb(51,102,153)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "RGB" }
    },
    {
      "id": "rgb-modern-space-syntax",
      "family": "rgb",
      "input": "rgb(51 102 153)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "RGB" }
    },
    {
      "id": "rgb-percentage-syntax",
      "family": "rgb",
      "input": "rgb(20% 40% 60%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "RGB" }
    },
    {
      "id": "rgb-modern-alpha-percentage",
      "family": "rgb",
      "input": "rgb(51 102 153 / 50%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 0.5, "format": "RGB alpha" }
    },
    {
      "id": "rgba-legacy-alpha-number",
      "family": "rgb",
      "input": "rgba(51,102,153,0.5)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 0.5, "format": "RGB alpha" }
    },
    {
      "id": "hsl-degree-hue",
      "family": "hsl",
      "input": "hsl(210deg 50% 40%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "HSL" }
    },
    {
      "id": "hsl-turn-hue",
      "family": "hsl",
      "input": "hsl(0.583333333333turn 50% 40%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "HSL" }
    },
    {
      "id": "hsl-radian-hue",
      "family": "hsl",
      "input": "hsl(3.665191429188rad 50% 40%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "HSL" }
    },
    {
      "id": "hsl-percentage-channels-with-alpha",
      "family": "hsl",
      "input": "hsl(210 50% 40% / 25%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 0.25, "format": "HSL alpha" }
    },
    {
      "id": "hwb-basic",
      "family": "hwb",
      "input": "hwb(210 20% 40%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "HWB" }
    },
    {
      "id": "hwb-alpha",
      "family": "hwb",
      "input": "hwb(210 20% 40% / 50%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 0.5, "format": "HWB" }
    },
    {
      "id": "lab-d50",
      "family": "lab",
      "input": "lab(41.5208% -4.5733 -33.4939)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "Lab" }
    },
    {
      "id": "lch-d50",
      "family": "lch",
      "input": "lch(41.5208% 33.8047 262.227)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "LCH" }
    },
    {
      "id": "oklab",
      "family": "oklab",
      "input": "oklab(49.9314% -0.03304 -0.092967)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "OKLab" }
    },
    {
      "id": "oklch",
      "family": "oklch",
      "input": "oklch(49.9314% 0.098715 250.433)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "OKLCH" }
    },
    {
      "id": "xyz-d65-color-function",
      "family": "xyz",
      "input": "color(xyz-d65 0.1186638 0.1250646 0.3192555)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "color(xyz-d65)" }
    },
    {
      "id": "xyz-d50-color-function",
      "family": "xyz",
      "input": "color(xyz-d50 0.111187459 0.121927404 0.24083403)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "color(xyz-d50)" }
    },
    {
      "id": "srgb-color-function",
      "family": "srgb",
      "input": "color(srgb 0.2 0.4 0.6)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "color(srgb)" }
    },
    {
      "id": "out-of-gamut-oklch-clips-to-srgb",
      "family": "out-of-gamut",
      "input": "oklch(70% 0.4 40)",
      "expected": { "valid": true, "hex": "#FF0000", "alpha": 1, "format": "OKLCH", "gamutBehavior": "clip-to-srgb" }
    },
    {
      "id": "rgb-out-of-range-clamps",
      "family": "out-of-range",
      "input": "rgb(300 -20 500)",
      "expected": { "valid": true, "hex": "#FF00FF", "alpha": 1, "format": "RGB", "rangeBehavior": "clamp" }
    },
    {
      "id": "hsl-out-of-range-clamps",
      "family": "out-of-range",
      "input": "hsl(210 200% -20%)",
      "expected": { "valid": true, "hex": "#000000", "alpha": 1, "format": "HSL", "rangeBehavior": "clamp" }
    },
    {
      "id": "alpha-above-range-clamps",
      "family": "alpha",
      "input": "rgb(51 102 153 / 150%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 1, "format": "RGB", "rangeBehavior": "clamp" }
    },
    {
      "id": "alpha-below-range-clamps",
      "family": "alpha",
      "input": "rgb(51 102 153 / -10%)",
      "expected": { "valid": true, "hex": "#336699", "alpha": 0, "format": "RGB alpha", "rangeBehavior": "clamp" }
    },
    {
      "id": "rgb-missing-channel-rejected",
      "family": "invalid",
      "input": "rgb(51 102)",
      "expected": { "valid": false }
    },
    {
      "id": "rgb-double-alpha-separator-rejected",
      "family": "invalid",
      "input": "rgb(51 102 153 / 50% / 25%)",
      "expected": { "valid": false }
    },
    {
      "id": "hwb-comma-syntax-rejected",
      "family": "invalid",
      "input": "hwb(210, 20%, 40%)",
      "expected": { "valid": false }
    },
    {
      "id": "nonnumeric-channel-rejected",
      "family": "invalid",
      "input": "oklch(70% nope 40)",
      "expected": { "valid": false }
    },
    {
      "id": "empty-input-rejected",
      "family": "invalid",
      "input": "",
      "expected": { "valid": false }
    }
  ]
}
