···11+<div align="center">
22+<h1>
33+ FixCSS
44+</h1>
55+CSS as it *should* have been designed.
66+</div>
77+<br/>
88+99+In the design of CSS, mistakes were made. In fact, quite a number. The CSS Working Group says as much, having published an [Incomplete List of Mistakes in the Design of CSS](https://wiki.csswg.org/ideas/mistakes/).
1010+1111+This library rectifies these failings, and allows writing CSS the way it _should_ have been designed. FixCSS automatically converts corrected property names, values, selectors, and syntax, as an illustration of what should have been. It also fixes newer syntax compromised by trying to maintain consistency with previous mistakes.
1212+1313+## Usage
1414+1515+### Client-side
1616+1717+To use this script, simply include it in your HTML:
1818+1919+```html
2020+<script src="fixcss.js"></script>
2121+```
2222+2323+That's it. All `<style>` blocks, inline styles, and future DOM mutations are auto-converted. No build step needed.
2424+2525+### Build-time
2626+2727+```bash
2828+# CLI
2929+node fixcss-cli.js styles.css -o styles.fixed.css
3030+3131+# Or programmatically
3232+npm install fixcss
3333+```
3434+3535+```js
3636+const { fixCSS } = require("fixcss");
3737+const fs = require("fs");
3838+3939+const input = fs.readFileSync("styles.css", "utf8");
4040+fs.writeFileSync("styles.out.css", fixCSS(input));
4141+```
4242+4343+## API Reference
4444+4545+### Core Functions
4646+4747+#### `fixCSS.fixCSS(css, options?)`
4848+4949+Convert a CSS string from fixed syntax to browser-compatible CSS.
5050+5151+```js
5252+const out = fixCSS.fixCSS(".box { corner-radius: 10px; }");
5353+// → '.box { border-radius: 10px; }'
5454+```
5555+5656+**Options:**
5757+5858+- `fixShorthandDefaults` (default: `true`) — Single-value `background-size` duplicates to both axes, single-value `translate()` duplicates
5959+- `fixAxisOrder` (default: `true`) — Swap vertical-first axis order to horizontal-first for `background-position` and `border-spacing`
6060+- `fixSelectorCombinators` (default: `true`) — Convert `>>` → ` ` and `++` → `~`
6161+6262+#### `fixCSS.convertCCW(css)`
6363+6464+Convert CCW-ordered 4-value shorthands to CW (see mistake #11). This fix is opt-in, due to just being numbers and there unable to be auto-detected.
6565+6666+```js
6767+// CCW: top, left, bottom, right → CW: top, right, bottom, left
6868+fixCSS.convertCCW(".x { margin: 10px 20px 30px 40px; }");
6969+// → '.x { margin: 10px 40px 30px 20px; }'
7070+```
7171+7272+#### `fixCSS.convertProperties(css)`
7373+7474+Convert only property names (not values or selectors).
7575+7676+### Browser Runtime
7777+7878+#### `fixCSS.start()`
7979+8080+Start observing the DOM for styles and auto-convert. Called automatically on load.
8181+8282+#### `fixCSS.shutdown()`
8383+8484+Stop observing the DOM.
8585+8686+#### `fixCSS.convertPage()`
8787+8888+Manually convert all `<style>` blocks and inline styles on the page.
8989+9090+#### `fixCSS.debug(flag)`
9191+9292+Enable/disable debug logging to the console.
9393+9494+## CLI Usage
9595+9696+```bash
9797+# Convert a file
9898+node fixcss-cli.js input.css -o output.css
9999+100100+# Read from stdin
101101+cat input.css | node fixcss-cli.js --stdin > output.css
102102+103103+# Watch mode
104104+node fixcss-cli.js input.css -o output.css --watch
105105+106106+# With options
107107+node fixcss-cli.js input.css -o output.css --ccw --no-axis
108108+```
109109+110110+| Flag | Description |
111111+| --------------------- | ---------------------------------- |
112112+| `-o, --output <file>` | Write output to file |
113113+| `-w, --watch` | Watch input file for changes |
114114+| `--stdin` | Read from stdin |
115115+| `--no-shorthand` | Don't fix shorthand defaults |
116116+| `--no-axis` | Don't fix axis order |
117117+| `--no-combinators` | Don't fix selector combinators |
118118+| `--ccw` | Enable CCW→CW shorthand conversion |
119119+| `-h, --help` | Show help |
120120+121121+## See Also
122122+123123+- [BritCSS](https://github.com/DeclanChidlow/BritCSS) (the catalyst for this project)