# HTML Explainer Contract This resource specifies HOW the generated HTML file behaves and is validated. For content requirements, refer to the sibling `document-structure.md` file. > Pages made by `oma explain render` meet sections 1–5 by construction (inline CSS and > script under a `default-src 'none'` policy, `
` code, light/dark themes, shuffled quiz > with per-option feedback). For those pages this contract reduces to section 6 > (`oma explain validate`) and section 7 (secret gates). Sections 1–5 remain the rules for > hand-written HTML. ## 1. Self-contained Rule The generated HTML file MUST make ZERO external resource loads. - No CDN scripts or stylesheets. - No webfonts. - No external images (use inline SVG or data URIs). - Must open correctly offline via `file://`. - **Note:** Hyperlink anchors (``) ARE allowed. The ban covers resource-LOADING only. ## 2. Code Blocks - All code blocks must use `` tags. - Any custom-styled container holding code MUST declare `white-space: pre-wrap` (or `pre`). - Do NOT use external syntax-highlighting libraries. Use plain theme-aware colors only. ## 3. Font Stack The `Self-contained rule` supersedes any webfont suggestion in the project `design.md`. Use the following font stack: 1. Locally installed Pretendard, matched by family name — NOT the CSS `local()` function, which is only valid inside `@font-face src` (see the code comment below) 2. System CJK fonts (`Apple SD Gothic Neo` / `Noto Sans CJK`) 3. `system-ui` stack ```css /* Locally installed Pretendard resolves by family name; local() is only valid inside @font-face src, so never use it in font-family. */ font-family: Pretendard, 'Pretendard Variable', 'Apple SD Gothic Neo', 'Noto Sans CJK KR', 'Noto Sans CJK JP', 'Noto Sans CJK SC', 'Noto Sans CJK TC', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; ``` ## 4. Layout and Accessibility (a11y) - **Responsive:** Mobile-first, responsive from 375px up. - **Readable Measure & Line Height:** Body text containers MUST enforce a max-width (800px–880px / ~75ch) with centered margin (`margin: 0 auto`) and generous line-height (`1.6`–`1.7`) to prevent wide-screen line stretching and ensure optimal reading rhythm. - **Diagram Visuals:** Every diagram/visual MUST be wrapped in a `` with `overflow-x: auto; max-width: 100%;` and use SVG `viewBox` / CSS variables (`var(...)`) to prevent mobile clipping and guarantee seamless Dark/Light theme switching. - **Contrast:** WCAG AA contrast in BOTH light and dark themes. - **Dark Mode:** Must support `prefers-color-scheme: dark` as well as explicit manual theme toggling via data attributes. - **Motion:** Animations are optional and must be subtle. - **Focus States:** Visible focus states are required on all interactive elements. ## 5. Quiz JS Specification - Use **Vanilla JS only** (no frameworks). - Options must be rendered as `