import sys,os,shutil;sys.path.insert(0,'/workspace/auth-kit-20nov/tools')
from kitlib import K,write
# copy tools
T=f'{K}/tools'; os.makedirs(T,exist_ok=True)
for f in ['cssx.py','kitlib.py','build_shared.py','build_design.py','build_design2.py','build_design3.py','build_launch.py','build_launch2.py','build_launch3.py','build_index.py','build_docs.py','build_readme.py','tokens.py','versions.py','shots.py','shoot.py']:
    shutil.copy(f'/workspace/auth-kit-20nov/tools/{f}',f'{T}/{f}')
os.makedirs(f'{T}/rs',exist_ok=True)
shutil.copy('/workspace/auth-kit-20nov/rs/export.mjs',f'{T}/rs/export.mjs')
shutil.copy('/workspace/auth-kit-20nov/tok.py',f'{T}/tok.py')
write(f'{T}/README.md','''# Tools

Scripts that built this kit. You do not need them to use it; they are here so every file can be traced.

- `cssx.py` pulls CSS rules out of a big stylesheet by selector (keeps @media and keyframes the picked rules use).
- `kitlib.py` shared paths and the page template; `build_design*.py` and `build_launch*.py` write the component pages; `build_index.py`, `build_docs.py`, `build_readme.py` write the index and the docs.
- `tokens.py` and `tok.py` read the theme values (the launch ones are computed from the live v12 page in Playwright).
- `shoot.py` and `shots.py` take the screenshots; `versions.py` snapshots each version.
- `rs/export.mjs` renders the badge SVGs to 4K and 8K PNG with `@resvg/resvg-js`.

The paths inside point at the working folders on the box where the kit was built (`/workspace/...`, `/tmp/shot/...`), so they will not run elsewhere without edits. Playwright used `/usr/bin/google-chrome --no-sandbox`.
''')
write(f'{K}/components/README.md','''# Components

Every page is standalone: `index.html` + `<name>.css` (+ `<name>.js` for demo wiring only). Open any `index.html` directly. Use the bar at the top to switch the theme; add `?t=pearl|champagne|midnight|amethyst` to the address, and `&capture=1` to hide the bar.

Each page loads exactly one token file, so the two families never mix.

## Design repo family (`data-t`, ink buttons, Combined B)

| Page | What it shows |
|---|---|
| `buttons` | Ink, Line and Quiet buttons, the Sign in / Create account pair, the Google / Passkey / Email split row that opens in place (64/36 spring), small links, icons |
| `inputs` | Label and field, email, password, username with @, date, select, text area, search, promo, hint, fine print, error line |
| `selects` | Gender (Male, Female, Rather not say), nationality, date of birth, role, category, licences and ratings |
| `steps-progress` | The step bar (3 steps) with the flare in each theme's light, every state |
| `top-bar` | The one top bar with the clock, variants |
| `runway` | One-point-perspective runway, edge lights that switch on once |
| `plan-cards` | Choose your plan (Founding, Pro, Trial, Free, school seats), checkout summary |
| `member-passes` | Founding, Pro, Trial, Free passes and the school pass, with expand-benefits |
| `welcome` | The Welcome screen: one screen, four passes |
| `terms` | The terms line and tick for step 3 |
| `badges` | Badges in the page: tags, medal, name lines, and the full badge sheet with 4K and 8K links |
| `states` | Notices, error line, loading and disabled buttons |
| `ato-claim` | Flight school claim flow: find, claim, waiting, plan, add staff |
| `theme-sheet` | The Settings sheet with the four themes |

## Launch family (`data-theme` + `data-pal`, accent pills, v12 Version 2)

| Page | What it shows |
|---|---|
| `signin-buttons-v12` | Email, Google and passkey pills that open in place, Back, waiting cards, variants and states |
| `inputs-v12` | Fields with icons, password eye and meter, username tick, date of birth, gender, nationality, messages, alerts |
| `email-code-v12` | The six-digit code cells, wrong-code state, resend line |
| `steps-v12` | "Step X of 7" header with the segmented bar and the flare |
| `top-bar-v12` | Top bar with the UTC and SAST clock |
| `runway-v3` | The original `runway.js` (verbatim) drawing the v3 runway |
| `runway-v12` | The v12 hero runway with horizon and lights |
| `plan-passes-v12` | Passes that open to show what is included, school seats, sold out, placeholder |
| `member-pass-v12` | The profile pass in every finish, plus DFE and school pending lines |
| `states-v12` | Loading, paused, lockout, offline line, placeholder |

## Notes

- Design-family CSS is extracted rule by rule from the source files (`tools/cssx.py`), not retyped. In the launch family the source stacked several forced overrides on the pills and a few other rules; the kit folds each override into the rule it overrode, so the look matches and no forced overrides remain. The pill buttons and the footer lines under the sign-in stack are written once by hand from that final look.
- The JS in each page is demo wiring (open, close, type, tick the clock). It is a trimmed copy of the real logic where one exists (`signup.js` sign-in modes and pass toggle, `runway.js`), and it never calls a server.
- Prices on the plan pages are examples (R299, R399, R3,999, R4,999). The live pages read every price from the server.
- Gender is exactly Male, Female, Rather not say. The design-repo sources for v10 and Combined A/B still say Woman / Man / Another gender / Prefer not to say; the kit does not copy that.
''')
write(f'{K}/README.md','''# Go Around · sign-in and sign-up design kit

Everything made for the sign-in and sign-up, collected in one place so it can be rebuilt from scratch. Open **`index.html`** for the preview of all of it (every component live, in all four themes, with the versions and badges).

```
auth-kit/
  index.html            preview of everything (index.css, index.js)
  tokens/               themes (Pearl, Midnight, Amethyst, Champagne), type, spacing, radii, glass, shadows, motion
  fonts/                the real woff2 files + fonts.css
  components/           24 standalone pages (HTML + CSS + JS), design-repo family and launch family
  versions/             11 version snapshots: source, links, one screenshot each
  badges/               SVG sources, 4K and 8K PNG (52 files)
  tools/                the scripts that built the kit
```

## Start here

1. `tokens/README.md`: the four themes and what every value means. **Two token families exist and disagree** (design repo and launch site: Pearl `#F2F2F5` vs `#FAF9F5`, ink buttons vs accent pills). Choose one for the rebuild.
2. `components/README.md`: what is on every component page.
3. `versions/README.md`: every version made, with commit SHAs and live previews.
4. `badges/README.md`: where each badge came from.

## What is in the kit

- **Tokens** for the four themes, in both families, plus `tokens.json`.
- **Fonts**: Clash Display, General Sans, Satoshi, JetBrains Mono, Nippo (and the legacy v3 set).
- **Components**: buttons (Google, Passkey, email, expand in place), inputs and labels, email code, password, steps and progress with the flare per theme, top bar with clock, runway (v3 `runway.js` and the v11 and v12 lights), plan cards and member passes (every tier, expand benefits), badges, welcome screen, gender select (Male, Female, Rather not say), nationality select, terms, error, empty and loading states, flight school claim flow, theme sheet.
- **Versions**: v3 (12 Nov) to v12 Version 2 (20 Nov), including the member pass cards version (v10 rebuild).
- **Badges**: nine plan badges, the locked 9 Nov set and the DFE badge, as SVG, 4K PNG and 8K PNG.

## What is not here, or not what you might expect

- **No 8K or 4K badge originals exist.** Only vector files were ever made. The 4K and 8K PNGs are exported from the SVGs with resvg, and are true 4096 and 8192 px. See `badges/README.md`.
- **Gender options in the older sources are wrong.** v10 and Combined A/B list Woman / Man / Another gender / Prefer not to say. The kit uses Male, Female, Rather not say (which is what the launch v12 page already uses).
- **The two families differ** (see above); nothing was merged or "fixed", so you can compare them.
- **Email code**: only the launch family has the six-digit cell screen; the design repo only has the "Email me a code" request step (on the `buttons` page).
- **Prices are examples.** The live pages read them from the server.
- **No empty-search state** exists in the sources (the school search shows results or the claim form), so none was invented.
- **Nippo** is shipped but not used by any sign-up CSS. Clash Display 400 and 500 are shipped but the sources only use 600.
- **v3 is a stacked build** (several CSS layers on top of each other), so its source is for reading, not copying.
- **Font licences were not checked** (see `fonts/README.md`).
- The logo in the launch top bar is a placeholder tile; use the real mark from the site.
- The real Chromium path in the brief does not exist on the box; the checks ran with `/usr/bin/google-chrome --no-sandbox`.
- Nothing here is deployed or merged.
''')
print('readme ok')
