···196196`feed_architecture` (`grid` | `linear`) in the Drift `settings` table. Expose
197197via `SettingsCubit` alongside existing theme preferences.
198198199199+## Post Thread — Collapsible Threaded Replies
200200+201201+Current: `PostThreadScreen` renders the parent chain with vertical connectors,
202202+then a flat list of direct replies. No nesting, no collapse controls.
203203+204204+Target: recursive threaded reply tree with indented threadlines and
205205+tap-to-collapse interaction.
206206+207207+### Reply Tree Rendering
208208+209209+Replace the flat reply list with a recursive widget tree that mirrors the
210210+`ThreadViewPost.replies` structure from the Bluesky API. Each reply that itself
211211+has replies renders its children indented one level deeper.
212212+213213+- Use a recursive `ThreadReplyNode` widget that takes a `ThreadViewPost` and a
214214+ `depth` parameter
215215+- Each node renders its post via `PostCardWithActions`, followed by its children
216216+ at `depth + 1`
217217+218218+### Threadlines & Indentation
219219+220220+- Each nesting level draws a vertical threadline on its left edge — a `2px`-wide
221221+ line in `outlineVariant`, offset `37px` from the current indent origin
222222+ (matching the existing parent-chain connector)
223223+- Indentation per level: `24px` left padding, applied cumulatively
224224+- **Color-coded threadlines**: cycle through a palette of 6 muted colors per
225225+ depth level to help users visually track nesting (colors derived from the
226226+ theme's `outline` / `outlineVariant` / `primary` tones)
227227+- Cap visual indentation at **depth 6**. Beyond that, show a
228228+ "Continue this thread →" link that navigates to a new `PostThreadScreen`
229229+ rooted at that reply
230230+231231+### Collapse / Expand Interaction
232232+233233+Two interaction methods (both always active):
234234+235235+| Method | Detail |
236236+| --------------------- | ---------------------------------------------------------------------- |
237237+| **Tap threadline** | Tap the vertical threadline to collapse/expand the subtree beneath it |
238238+| **Long-press comment**| Long-press the post body as a secondary affordance |
239239+240240+Threadline tap target: `24dp` wide (centered on the `2px` line) for comfortable
241241+touch targets, with a subtle highlight on press.
242242+243243+### Collapsed State
244244+245245+When a subtree is collapsed:
246246+247247+- The parent comment's header row (avatar, handle, timestamp) remains visible
248248+- Body text and children are hidden
249249+- A collapsed indicator appears below the header: `"N replies hidden"` in
250250+ `labelSmall`, `onSurfaceVariant`, uppercase, `letterSpacing: 0.1em`
251251+- Smooth `AnimatedCrossFade` or `AnimatedSize` transition (duration `200ms`)
252252+253253+### Auto-Collapse (Optional Setting)
254254+255255+Add a `thread_auto_collapse_depth` setting (`int`, default `null` = disabled).
256256+When set to a value (e.g., `3`), replies deeper than that level are
257257+auto-collapsed on initial load. The user can still expand them manually.
258258+259259+- Persist in the Drift `settings` table alongside existing layout settings
260260+- Never auto-collapse replies by the thread's original poster (OP)
261261+- Expose in the Layout Settings screen as a stepper/dropdown below the existing
262262+ density and architecture options
263263+264264+### State Management
265265+266266+- Collapse state is local to the `PostThreadScreen` — a `Set<String>` of
267267+ collapsed post URIs held in the screen's `State`
268268+- No cubit needed; collapse is ephemeral UI state, not persisted across
269269+ navigations
270270+- When navigating into a "Continue this thread" link, the new screen manages its
271271+ own collapse state independently
272272+199273## Shared Geometry Tokens
200274201275All `0px` border-radius throughout (square corners). Ensure no Flutter widgets
+16
docs/tasks/ui-refactor.md
···5353- [ ] Settings screen entry point (new section or drawer link)
5454- [ ] Persist selections to Drift on change
5555- [ ] Tests for settings screen interactions and persistence round-trip
5656+5757+## M6 — Collapsible Threaded Replies
5858+5959+- [ ] Recursive `ThreadReplyNode` widget that renders nested replies from `ThreadViewPost.replies`
6060+- [ ] Indentation with cumulative `24px` left padding per depth level
6161+- [ ] Color-coded vertical threadlines (cycle palette of 6 muted theme-derived colors)
6262+- [ ] Tap-threadline-to-collapse interaction with `24dp` touch target
6363+- [ ] Long-press-to-collapse as secondary affordance
6464+- [ ] Collapsed state: header visible, body/children hidden, "N replies hidden" indicator
6565+- [ ] `AnimatedSize` / `AnimatedCrossFade` collapse transition (`200ms`)
6666+- [ ] Depth cap at 6 with "Continue this thread →" navigation link
6767+- [ ] Local collapse state via `Set<String>` of post URIs in screen `State`
6868+- [ ] `thread_auto_collapse_depth` setting in Drift + Drift migration
6969+- [ ] Expose auto-collapse depth in Layout Settings screen
7070+- [ ] Never auto-collapse OP replies
7171+- [ ] Tests for thread tree rendering, collapse/expand, depth cap, and auto-collapse behavior