# Cursor Rules for PDF-Translate Skill
# High-fidelity vector PDF translation, layout preservation, and automated audit.

# Rule 1: Layout & Height Preservation (unified convention, same as SKILL.md)
- Probe the source first (PyMuPDF `page.rect`, `get_image_rects`, `get_drawings`); never guess sizes.
- Use `@page { size: <source width> <source height>; margin: 0; }`.
- Wrap each page in a `.page` container with exactly the source width/height, page margins in `padding`, and `overflow: hidden`.
- Never combine `@page` margins with a fixed `.page` height; never let flex/table heights expand across pages.

# Rule 2: Zero Hallucination Pipeline
- Always extract clause hierarchy trees and numerical metrics into a structured schema before filling templates.
- Never summarize, merge, or omit statutory sub-clauses (e.g. 2.1.1~2.1.8).
- Never fabricate non-existent numbers, dates, or workflow steps.

# Rule 3: Automated Verification
- After generating HTML, run `python scripts/render_pdf.py input.html output.pdf --strict-overflow` (exit 2 = overflow).
- Always audit using `python scripts/audit_pdf.py --src original.pdf --tgt output.pdf --compare-png compare_png/`.
- Any Critical Error from `audit_pdf.py` must trigger self-repair before user delivery; review warnings (missing clauses / numbers / refs).
