diff --git a/docs/superpowers/plans/2026-08-12-editorial-polish.md b/docs/superpowers/plans/2026-08-12-editorial-polish.md new file mode 100644 index 0000000..faaeeaf --- /dev/null +++ b/docs/superpowers/plans/2026-08-12-editorial-polish.md @@ -0,0 +1,97 @@ +# CHRNX Editorial Polish Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Deliver the approved compact editorial redesign and make seeded post permalinks resolve correctly in the local WordPress environment. + +**Architecture:** Keep content and block structure stable, expressing the redesign through scoped theme tokens and component CSS. Add server-rendered current-navigation semantics, and centralize permalink synchronization in the fixture-environment helper so both apply and restore paths update the live rewrite object before flushing. + +**Tech Stack:** WordPress 6.9 block theme, PHP 8, CSS, PHPUnit, Node smoke tests, Playwright, wp-env on Colima. + +--- + +### Task 1: Synchronize fixture permalinks + +**Files:** +- Modify: `scripts/lib/fixture-environment.php` +- Modify: `scripts/seed-test-content.php` +- Test: `tests/php/FixtureEnvironmentTest.php` +- Test: `tests/e2e/visual-states.spec.mjs` + +- [ ] **Step 1: Write a failing PHPUnit test** proving that applying `/%postname%/` updates both the option and the active `$wp_rewrite->permalink_structure`, while restore reinstates the previous structure. +- [ ] **Step 1a: Cover both raw-option states**: one snapshot where `permalink_structure` exists and one where the row is absent. After restore, assert exact raw database existence/value and the live `$wp_rewrite->permalink_structure` in both cases. +- [ ] **Step 2: Run** `npm run test:php -- --filter FixtureEnvironmentTest` and verify the rewrite-object assertion fails for the current implementation. +- [ ] **Step 3: Write `seeded post permalink resolves its single template`**: select a stable published fixture card by its fixture-backed title, capture the click navigation response, require HTTP 200, require the expected slug URL, and require the single-post heading/template rather than accepting any rendered page. +- [ ] **Step 4: Run** `npx playwright test tests/e2e/visual-states.spec.mjs --project=chromium --grep "seeded post permalink"` and verify the current 404. +- [ ] **Step 5: Add a small synchronization helper** that updates the live rewrite object before `flush_rewrite_rules( false )`. Because `WP_Rewrite::set_permalink_structure()` writes the option, the restore path must reapply the captured raw option existence/value after synchronizing the object and before flushing; an originally absent row must remain absent. Call the helper from fixture apply/restore and remove the redundant unsynchronized flush in the seeder. +- [ ] **Step 6: Re-run both focused tests** and verify GREEN. +- [ ] **Step 7: Commit** as `fix: synchronize CHRNX fixture permalinks`. + +### Task 2: Replace the global grid and compact the home hero + +**Files:** +- Modify: `assets/css/components.css` +- Test: `tests/e2e/visual-states.spec.mjs` +- Test: `tests/smoke/visual-integration.test.mjs` + +- [ ] **Step 1: Add failing visual-contract tests** that require `background-repeat: no-repeat`, reject the current orthogonal 1px `linear-gradient` plus tiled `background-size` grid signature on `body`, bound desktop hero height to 60–68vh with a 42rem maximum, bound mobile hero to no more than 34rem and its trailing empty space to one section-spacing unit, and assert a theme-aware non-flat computed gradient in explicit dark and light modes. +- [ ] **Step 2: Run the focused smoke and Chromium tests** and verify failures describe the current grid and oversized hero. +- [ ] **Step 3: Replace the body background** with layered non-repeating radial/linear gradients and remove the mobile background-size override. +- [ ] **Step 4: Compact `.chrnx-home-intro`** to a 60–68vh range with a lower maximum, wider title measure, tighter type scale, and less mobile whitespace. +- [ ] **Step 5: Verify dark/light at 375, 1440, and reduced-motion**, then re-run focused tests. +- [ ] **Step 6: Commit** as `style: refine CHRNX canvas and hero`. + +### Task 3: Integrate navigation, focus, and footer + +**Files:** +- Modify: `inc/blocks.php` +- Modify: `blocks/header-tools/render.php` +- Modify: `blocks/footer-content/render.php` +- Modify: `assets/css/base.css` +- Modify: `assets/css/layout.css` +- Modify: `assets/css/components.css` +- Test: `tests/php/BlockRenderingTest.php` +- Test: `tests/e2e/navigation.spec.mjs` + +- [ ] **Step 1: Add failing PHP tests** for a shared `chrnx_get_current_navigation_destination()` helper and both render blocks. Exact destination pages select themselves; post singles, Search, topic/language/show archives, and the Journal listing select Journal; front page, unrelated pages, and 404 select none. Cover every mapping, exact-path boundaries such as `/music-notes/`, and require exactly one matching `aria-current="page"` in header and footer. +- [ ] **Step 2: Add failing browser assertions in explicit light and dark modes** for correct header/footer `aria-current`, green hover/current navigation text with at least 4.5:1 contrast against its adjacent surface, a non-color current marker, no default underline, preserved hover/focus affordance, Zen Maru Gothic with compact weight, heading typography for the footer site name, metadata typography for credit/Sinaloa copy, and an opaque footer with visible top border and measurable internal padding. +- [ ] **Step 2a: Replace conflicting focus assertions** that require a visible 3px outline. Require a non-none rounded `box-shadow` halo, at least 3:1 halo contrast against the adjacent surface, and a non-none transparent outline fallback for Search, Theme, and Menu in explicit light/dark modes. Preserve no-JS and keyboard-link focus coverage. +- [ ] **Step 3: Verify RED** with focused PHPUnit and Chromium navigation runs. +- [ ] **Step 4: Implement the route matrix in `inc/blocks.php`** using WordPress conditional/query APIs and canonical local URLs, then consume the result in both render blocks without trusting raw request input. +- [ ] **Step 5: Restyle navigation and footer** with theme fonts, current/hover states, opaque surfaces, and rounded focus rings that retain contrast plus a non-none transparent outline fallback. +- [ ] **Step 6: Re-run navigation behavior, no-JS, keyboard, and axe coverage** across Chromium/Firefox/WebKit. +- [ ] **Step 7: Commit** as `style: integrate CHRNX navigation and footer`. + +### Task 4: Polish the lower home sections and music imagery + +**Files:** +- Modify: `assets/css/components.css` +- Modify: `patterns/home-music.php` only if the existing markup cannot expose both layers without decorative CSS +- Test: `tests/php/PatternsTest.php` +- Test: `tests/e2e/visual-states.spec.mjs` +- Test: `tests/smoke/visual-integration.test.mjs` + +- [ ] **Step 1: Add failing CSS/browser contracts** requiring non-transparent and computed-distinguishable surfaces for Selected Work, Podcast, About, and Subscribe; section gaps no larger than the defined XL token at 375/768/1440/2560; contained collage/portraits; an observable filter, mask, overlay, or shadow treatment; zero horizontal overflow in both themes; and unchanged semantic section/content order. +- [ ] **Step 2: Verify RED** against the untreated `.chrnx-home-music` composition and repetitive lower-page rhythm. +- [ ] **Step 3: Refine Selected Work** with a contained editorial surface, aligned project rows, and layered/tinted portraits. +- [ ] **Step 4: Compose Home Music artwork** so `the-no-names-collage.jpeg` is a decorative background or pseudo-layer inside the existing `.chrnx-home-music` frame while the current musician `` remains an isolated foreground layer. Prove both assets share the frame. If pseudo-content cannot provide an accessible and robust implementation, minimally update `patterns/home-music.php` and its rendering test. +- [ ] **Step 5: Give Podcast, About, and Subscribe distinct panel hierarchy** while preserving their semantic blocks and content. +- [ ] **Step 6: Verify at 375, 768, 1440, and 2560**, both themes, missing-media states, and reduced motion. +- [ ] **Step 7: Commit** as `style: finish CHRNX editorial sections`. + +### Task 5: Final real-site verification + +**Files:** +- Modify only if a verified regression requires it. +- Modify: `scripts/capture-visual-review.mjs` +- Test: `tests/smoke/visual-integration.test.mjs` +- Create ignored screenshots under: `tmp/imagegen/editorial-polish-*.png` + +- [ ] **Step 1: Run** `PATH=/opt/homebrew/opt/docker/bin:$PATH npm test` and require smoke, JS/CSS lint, PHPCS, Jest, isolated PHPUnit, and Playwright to pass. If any regression appears, write and observe a focused failing test before changing production code. +- [ ] **Step 2: Seed and fingerprint run 1** with `./scripts/seed-test-content.sh default`, then execute `PATH=/opt/homebrew/opt/docker/bin:$PATH npx wp-env run cli wp eval '$rows=get_posts(array("post_type"=>array("page","post"),"post_status"=>"any","posts_per_page"=>-1,"meta_key"=>"_chrnx_fixture_key")); $map=array(); foreach($rows as $row){$key=get_post_meta($row->ID,"_chrnx_fixture_key",true); if($key){$map[$key]=(int)$row->ID;}} ksort($map); global $wp_rewrite; echo wp_json_encode(array("fixtures"=>$map,"pages"=>count(array_filter($rows,fn($p)=>"page"===$p->post_type)),"posts"=>count(array_filter($rows,fn($p)=>"post"===$p->post_type)),"scenario"=>get_option("_chrnx_fixture_featured_limit","default"),"subscribe"=>(int)get_option("chrnx_subscribe_page_id"),"subscribe_status"=>get_post_status((int)get_option("chrnx_subscribe_page_id")),"option_permalink"=>get_option("permalink_structure"),"live_permalink"=>$wp_rewrite->permalink_structure));' | sed -n '/^{/p' > "${TMPDIR%/}/chrnx-fixtures-1.json"`. Require valid JSON, 19 sorted fixture keys, 7 pages, 12 posts, default scenario, published Subscribe, and matching `/%postname%/` option/live structures. +- [ ] **Step 2a: Seed and fingerprint run 2** by repeating the prior seed and command into `"${TMPDIR%/}/chrnx-fixtures-2.json"`, then run `cmp "${TMPDIR%/}/chrnx-fixtures-1.json" "${TMPDIR%/}/chrnx-fixtures-2.json"`; require exit 0. Resolve a stable post URL with `POST_URL="$(PATH=/opt/homebrew/opt/docker/bin:$PATH npx wp-env run cli wp post list --post_type=post --post_status=publish --meta_key=_chrnx_fixture_key --field=url --format=csv | sed -n '2p')"` or an equivalent exact `wp eval` emitting `get_permalink()`, and require `curl -fsS -o /dev/null -w '%{http_code}' "$POST_URL"` to print `200`. +- [ ] **Step 3: Add a failing smoke contract** for a bounded `scripts/capture-visual-review.mjs` capture set containing Home, Music, one post, and a footer crop in desktop/mobile light/dark variants under `tmp/imagegen/editorial-polish-*.png`; verify RED, then minimally extend the script and verify GREEN. +- [ ] **Step 4: Inspect screenshots** for overflow, noisy background, oversized hero, raw image stacking, generic navigation, transparent footer, and intrusive focus rings. +- [ ] **Step 5: Run exact HTTP probes**: set `PROBE_DIR="$(mktemp -d "${TMPDIR%/}/chrnx-http.XXXXXX")"`; for `http://localhost:8888/`, `/music/`, `/journal/`, `/?s=expressive`, and the resolved `$POST_URL`, run `curl -sS -o "$PROBE_DIR/.html" -w '%{http_code}' ` and require `200`; run the same for `/definitely-missing-chrnx-route/` and require `404`. Finally run `! rg -n 'PHP (Warning|Notice|Fatal)|Stack trace' "$PROBE_DIR"` and require exit 0, then remove only the resolved `$PROBE_DIR` after verifying its basename starts with `chrnx-http.`. +- [ ] **Step 6: Run `git diff --check` and a scoped secrets/debug-path scan.** +- [ ] **Step 7: Present the local URLs and screenshot paths for user approval before merging locally.** diff --git a/docs/superpowers/specs/2026-08-12-editorial-polish-design.md b/docs/superpowers/specs/2026-08-12-editorial-polish-design.md new file mode 100644 index 0000000..4d1022e --- /dev/null +++ b/docs/superpowers/specs/2026-08-12-editorial-polish-design.md @@ -0,0 +1,47 @@ +# CHRNX Editorial Polish Design + +## Objective + +Turn the current functional theme into a compact editorial site that feels like a nocturnal creative workshop. Preserve the approved CHRNX identity, content model, light/dark/system preference, responsive mobile header, and accessible keyboard behavior. + +## Visual direction + +The site uses a continuous low-contrast atmospheric gradient instead of a page-wide grid. Dark mode blends Night, a restrained violet bloom, and a faint green bloom; light mode uses warm paper with similarly restrained color. Decorative patterns may remain inside individual cards or fallback artwork, but not across the page canvas. + +The home introduction becomes a compact editorial hero. On desktop it should occupy roughly 60–68 viewport-height units with a practical maximum, rather than dominating the first screen. Its title remains the primary statement but uses a wider measure and tighter responsive scale. The metadata kicker, introductory copy, and circular autism-infinity-inspired accent remain supporting elements rather than separate focal points. + +Sections after Journal should no longer read as a repetitive stack. Selected Work uses a contained raised surface and layered portraits; Music becomes a collage composition with the band artwork and isolated musician sharing one visual frame; Podcast, About, and Subscribe use distinct but related panel treatments and tighter vertical rhythm. Portraits receive deliberate contrast, shadow, masking, or gradient overlays rather than appearing as untreated rectangular exports. + +## Navigation and focus + +Primary and footer navigation use Zen Maru Gothic at a compact weight so they belong to the same typographic voice as the content. Navigation links have no default underline. Hover and the current destination use accessible green; the current destination also receives `aria-current="page"` and a restrained visual marker that does not rely on color alone. + +Keyboard focus remains visible. The existing double-box appearance is replaced with a thin rounded halo using `box-shadow` and a transparent outline fallback. Search, Theme, and Menu must retain at least 3:1 focus-indicator contrast in both themes. No focus indicator is removed without replacement. + +## Footer + +The footer becomes an opaque workshop surface with a clear upper border and internal spacing. Its site name, navigation, credit, and Sinaloa line use the theme's heading/metadata type families rather than browser-generic styling. Footer links have no permanent underline, but preserve hover and focus affordances. + +## Permalink repair + +The local fixture seeder must synchronize the live `WP_Rewrite` object whenever it changes or restores `permalink_structure`, before flushing rules. A seeded published post must resolve through its pretty permalink with HTTP 200. This is a local fixture defect, not content replacement, and the snapshot/restore guarantees remain intact. + +## Constraints + +- Preserve all light/dark/system precedence and no-JavaScript behavior. +- Preserve the approved mobile header structure and 44-pixel targets. +- Do not publish, deploy, push, or replace synthetic fixtures with public content. +- Do not add animation or motion-dependent meaning. +- Maintain WCAG 2.2 AA automated checks and meaningful visible focus. +- Keep changes localized to visual CSS, navigation/footer rendering, fixture rewrite synchronization, and their tests. + +## Acceptance criteria + +- Neither theme renders a global repeating grid. +- The desktop hero is visibly shorter and the mobile hero avoids excessive blank space. +- Primary/footer navigation is un-underlined, typographically integrated, and exposes a correct current state. +- Search/Menu/Theme focus is visible but no longer appears as a double rectangular outline. +- Footer has an opaque theme-aware surface. +- Home sections following Journal have distinct surfaces and deliberate image treatment. +- Seeded post permalinks return 200 instead of 404. +- Focused tests and the full PHP/JS/Playwright matrix pass.