Moves each ancestor's `end` mark to the child's end and reapplies that ancestor's tag over the full span `[start, end]`.
**Not** called from `add_text` (too hot while streaming). Call sites use `close_state(true)` at **block** boundaries only (`on_p`/`on_h`/`on_code`/`on_li` end); inline closes use `close_state()` / `close_state(false)`.
Walks ancestors iteratively so a deep style stack cannot overflow the C stack.
| child |
The deepest open state whose subtree just finished receiving text |