# Yokan KMP Field Guide

A dependency-free documentation website for developers learning Kotlin Multiplatform through Yokan.

## Preview locally

From the repository root:

```bash
python3 -m http.server 4173 --directory docs
```

Open <http://localhost:4173>. Do not open the HTML files directly: serving them catches relative-link and asset-path mistakes that `file://` can hide.

## Structure

```text
docs/
├── index.html              Landing page and learning path
├── getting-started.html    Tooling, builds, and source sets
├── architecture.html       Startup, shared layers, and data flow
├── patterns.html           Reusable KMP patterns
├── MPV_INTEGRATION.md      Existing native media deep dive
└── assets/
    ├── app.js              Shared header, footer, theme, TOC, copy buttons
    ├── mark.svg            Site mark
    └── styles.css          Design tokens, layouts, components, responsive rules
```

There is no package manager, generated output, or vendored web dependency. Everything under `docs/` is publishable as static files.

## Update an existing chapter

1. Verify the claim against the current project source; link to the exact Codeberg file when useful.
2. Explain the KMP principle first, then show how Yokan implements it.
3. Keep snippets short enough to teach one decision. Do not duplicate whole production classes.
4. Preserve heading IDs because the table of contents and inbound links use them.
5. Preview desktop and mobile widths, test both color themes, and exercise every link.

## Add a chapter

1. Copy the shell from an existing guide page.
2. Give the body a unique `data-page` value.
3. Add the page to `SITE_PAGES` in `assets/app.js`.
4. Add it to the chapter list in each guide page's `.side-nav`.
5. Connect it through the previous/next navigation.
6. Add a short entry on the landing page when it changes the learning path.

## Writing rules

- Target developers who know basic Kotlin but are new to KMP.
- Use “shared” for code available to multiple targets and name the exact source set when precision matters.
- Distinguish Compose Multiplatform from Kotlin Multiplatform: shared UI is a project choice, not a KMP requirement.
- Treat Yokan as a reference, not as the only valid architecture.
- Mark transitional architecture honestly and describe only what the tree contains. For example, dependencies are wired by hand in `ServiceRegistry`/`YokanRuntime`; there is no DI framework.
- Prefer official Kotlin, JetBrains, Ktor, and Android documentation for external references.
- Update version-specific statements when `gradle/libs.versions.toml` changes.

## Verification checklist

- All HTML pages return HTTP 200.
- Header, footer, and navigation render with JavaScript enabled.
- The current page is announced with `aria-current="page"`.
- Table-of-contents links move to the correct section.
- Code copy controls work in a secure context or fall back to text selection.
- Layout remains readable at 375 px, 768 px, and desktop widths.
- Keyboard focus is visible; reduced-motion preferences are respected.
- Internal links and referenced source paths resolve.
