diff --git a/README.md b/README.md index 51b6eb5..e467260 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,37 @@ Run the configuration smoke test with: npm run test:smoke ``` +## Local visual review + +Seed the local `wp-env` site with deterministic review content: + +```sh +./scripts/seed-test-content.sh +``` + +The script accepts only `localhost` or `127.0.0.1`. It updates records marked +with `_chrnx_fixture_key` and leaves unrelated local content alone. Repeated +runs reuse the same pages and posts. + +Rebuild the responsive portrait derivatives on macOS with `sips`, `cwebp`, and +`avifenc`: + +```sh +./scripts/build-responsive-images.sh +``` + +The PNG masters remain unchanged. WordPress serves 384 px and 768 px AVIF or +WebP sources, with the PNG as a fallback. + +Capture the approved local review routes with Chromium: + +```sh +node scripts/capture-visual-review.mjs +``` + +The capture script rejects public hosts and writes its screenshots to +`tmp/imagegen/`, which Git ignores. + Use `npm run env:stop` to stop the local WordPress environment. If Homebrew's Docker CLI cannot find an existing standalone Compose v2 binary, diff --git a/assets/css/components.css b/assets/css/components.css new file mode 100644 index 0000000..4750f28 --- /dev/null +++ b/assets/css/components.css @@ -0,0 +1,849 @@ +/* + * Theme-state and responsive component variants intentionally follow + * their base rules. + */ + +/* stylelint-disable no-descending-specificity */ + +:root { + --chrnx-bg: #0d1117; + --chrnx-surface: #151b23; + --chrnx-surface-raised: #1b222c; + --chrnx-text: #e6edf3; + --chrnx-muted: #a1acb8; + --chrnx-line: rgb(139 148 158 / 28%); + --chrnx-accent: #7c6cf0; + --chrnx-accent-soft: rgb(124 108 240 / 16%); + --chrnx-green: #69c795; + --chrnx-link: #a99df8; + --chrnx-shadow: 0 1.5rem 4rem rgb(0 0 0 / 24%); + --chrnx-radius: 1.25rem; +} + +html[data-theme="light"] { + --chrnx-bg: #f6f2e9; + --chrnx-surface: #fffdf7; + --chrnx-surface-raised: #fff; + --chrnx-text: #25221f; + --chrnx-muted: #625c54; + --chrnx-line: rgb(70 61 51 / 18%); + --chrnx-accent: #674ca4; + --chrnx-accent-soft: rgb(103 76 164 / 12%); + --chrnx-green: #327854; + --chrnx-link: #60408e; + --chrnx-shadow: 0 1.5rem 4rem rgb(70 61 51 / 12%); +} + +@media (prefers-color-scheme: light) { + + :root:not([data-theme]) { + --chrnx-bg: #f6f2e9; + --chrnx-surface: #fffdf7; + --chrnx-surface-raised: #fff; + --chrnx-text: #25221f; + --chrnx-muted: #625c54; + --chrnx-line: rgb(70 61 51 / 18%); + --chrnx-accent: #674ca4; + --chrnx-accent-soft: rgb(103 76 164 / 12%); + --chrnx-green: #327854; + --chrnx-link: #60408e; + --chrnx-shadow: 0 1.5rem 4rem rgb(70 61 51 / 12%); + } +} + +body { + background-color: var(--chrnx-bg); + background-image: + radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--chrnx-accent) 14%, transparent), transparent 34rem), + linear-gradient(var(--chrnx-line) 1px, transparent 1px), + linear-gradient(90deg, var(--chrnx-line) 1px, transparent 1px); + background-position: 0 0, center, center; + background-size: auto, 3rem 3rem, 3rem 3rem; + color: var(--chrnx-text); +} + +.wp-site-blocks { + overflow: clip; +} + +.wp-site-blocks > main { + margin-block-start: 0; +} + +main a, +footer a { + color: var(--chrnx-link); + text-underline-offset: 0.2em; + text-decoration-thickness: 0.08em; +} + +.chrnx-primary-navigation a, +.chrnx-footer-navigation a { + color: var(--chrnx-link); +} + +.wp-site-blocks h1, +.wp-site-blocks h2, +.wp-site-blocks h3, +.wp-site-blocks h4 { + color: var(--chrnx-text); + text-wrap: balance; +} + +.wp-site-blocks p, +.wp-site-blocks li { + text-wrap: pretty; +} + +.chrnx-home > section, +.chrnx-home > .wp-block-group, +.chrnx-home > .wp-block-chrnx-featured-stories, +.chrnx-home > .wp-block-chrnx-journal-stream, +.chrnx-home > .wp-block-chrnx-latest-podcast { + max-width: var(--wp--style--global--wide-size); + margin-inline: auto; + padding-block: clamp(3.5rem, 7vw, 7rem); +} + +.chrnx-home > * + * { + border-top: 1px solid var(--chrnx-line); +} + +.chrnx-home-intro { + position: relative; + display: grid; + min-height: min(74vh, 48rem); + align-content: center; + padding-right: clamp(0rem, 15vw, 12rem); +} + +.chrnx-home-intro::before { + display: block; + margin-bottom: 1.25rem; + color: var(--chrnx-green); + content: "CHR/NX · NIGHT WORKSHOP"; + font-family: var(--wp--preset--font-family--metadata); + font-size: 0.75rem; + font-weight: 700; + letter-spacing: 0.16em; +} + +.chrnx-home-intro::after { + position: absolute; + right: 2%; + bottom: 14%; + width: clamp(5rem, 11vw, 8.5rem); + aspect-ratio: 1; + border: 1px solid var(--chrnx-line); + border-radius: 50%; + box-shadow: inset 0 0 0 1.25rem var(--chrnx-accent-soft); + content: ""; +} + +.chrnx-home-intro h1 { + max-width: 13ch; + margin: 0; + font-size: var(--wp--preset--font-size--display); + letter-spacing: -0.035em; +} + +.chrnx-home-intro p { + max-width: 58ch; + margin-top: 1.5rem; + color: var(--chrnx-muted); + font-size: var(--wp--preset--font-size--large); +} + +.chrnx-featured-stories > h2, +.chrnx-journal-stream > h2, +.chrnx-home-projects > h2, +.chrnx-home-music h2, +.chrnx-home-about-preview h2 { + font-size: var(--wp--preset--font-size--x-large); +} + +.chrnx-featured-stories__grid { + align-items: stretch; + margin-top: 2rem; +} + +.chrnx-featured-story, +.chrnx-journal-card, +.chrnx-podcast-card, +.chrnx-related-card, +.chrnx-release-card { + position: relative; + overflow: hidden; + border: 1px solid var(--chrnx-line); + border-radius: var(--chrnx-radius); + background: color-mix(in srgb, var(--chrnx-surface) 92%, transparent); + box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 8%); +} + +.chrnx-featured-story__link, +.chrnx-journal-card__link, +.chrnx-podcast-card__link, +.chrnx-related-card__link { + color: inherit; + text-decoration: none; +} + +.chrnx-featured-story__link:hover, +.chrnx-journal-card__link:hover, +.chrnx-podcast-card__link:hover, +.chrnx-related-card__link:hover { + color: inherit; +} + +.chrnx-featured-story__content, +.chrnx-journal-card__content, +.chrnx-podcast-card__content, +.chrnx-related-card__content { + display: grid; + gap: 0.75rem; + padding: clamp(1.25rem, 2.5vw, 2rem); +} + +.chrnx-featured-story__badge, +.chrnx-journal-card__badge, +.chrnx-podcast-card__badge, +.chrnx-related-card__badge, +.chrnx-page-kicker { + color: var(--chrnx-green); + font-family: var(--wp--preset--font-family--metadata); + font-size: 0.75rem; + font-weight: 700; + letter-spacing: 0.12em; + text-transform: uppercase; +} + +.chrnx-featured-story__title, +.chrnx-journal-card__title, +.chrnx-podcast-card__title, +.chrnx-related-card__title { + margin: 0; + font-size: var(--wp--preset--font-size--large); +} + +.chrnx-featured-story__excerpt, +.chrnx-journal-card__excerpt, +.chrnx-podcast-card__excerpt, +.chrnx-related-card__excerpt { + color: var(--chrnx-muted); +} + +.chrnx-featured-story__fallback, +.chrnx-journal-card__fallback, +.chrnx-related-card__fallback { + background-color: var(--chrnx-surface-raised); + background-image: + linear-gradient(145deg, transparent 0 48%, color-mix(in srgb, var(--chrnx-green) 35%, transparent) 49% 51%, transparent 52%), + radial-gradient(circle at 76% 24%, var(--chrnx-accent-soft) 0 14%, transparent 15%); +} + +.chrnx-featured-story__fallback, +.chrnx-journal-card__fallback, +.chrnx-podcast-card__fallback, +.chrnx-related-card__fallback { + background-position: right bottom; + background-repeat: no-repeat; + background-size: auto 125%; +} + +.chrnx-featured-story__fallback.is-topic-code, +.chrnx-journal-card__fallback.is-topic-code, +.chrnx-related-card__fallback.is-topic-code { + background-image: url(../images/generated/alter-ego-code-384.webp); +} + +.chrnx-featured-story__fallback.is-topic-research, +.chrnx-journal-card__fallback.is-topic-research, +.chrnx-related-card__fallback.is-topic-research { + background-image: url(../images/generated/alter-ego-research-384.webp); +} + +.chrnx-featured-story__fallback.is-topic-gaming, +.chrnx-journal-card__fallback.is-topic-gaming, +.chrnx-related-card__fallback.is-topic-gaming { + background-image: url(../images/generated/alter-ego-gaming-384.webp); +} + +.chrnx-featured-story__fallback.is-topic-literature, +.chrnx-journal-card__fallback.is-topic-literature, +.chrnx-related-card__fallback.is-topic-literature { + background-image: url(../images/generated/alter-ego-literature-384.webp); +} + +.chrnx-featured-story__fallback.is-topic-life, +.chrnx-journal-card__fallback.is-topic-life, +.chrnx-related-card__fallback.is-topic-life { + background-image: url(../images/generated/alter-ego-life-384.webp); +} + +.chrnx-featured-story__fallback.is-topic-podcasts, +.chrnx-journal-card__fallback.is-topic-podcasts, +.chrnx-podcast-card__fallback.is-topic-podcasts, +.chrnx-related-card__fallback.is-topic-podcasts { + background-color: #10151d; + background-image: url(../images/generated/alter-ego-podcasts-384.webp); +} + +.chrnx-featured-story__fallback.is-topic-music, +.chrnx-journal-card__fallback.is-topic-music, +.chrnx-related-card__fallback.is-topic-music { + background-color: #160f0b; + background-image: url(../images/generated/the-no-names-musician-cutout-384.webp); +} + +.chrnx-journal-stream__filters { + align-items: end; + margin-block: 2rem; + padding: 1rem; + border: 1px solid var(--chrnx-line); + border-radius: 0.75rem; + background: var(--chrnx-surface); +} + +.chrnx-journal-stream__filters label { + min-width: min(100%, 11rem); + color: var(--chrnx-muted); + font-family: var(--wp--preset--font-family--metadata); + font-size: var(--wp--preset--font-size--small); +} + +.chrnx-journal-stream__filters input, +.chrnx-journal-stream__filters select { + min-height: 45px; + padding: 0.6rem 0.75rem; + border: 1px solid var(--chrnx-line); + border-radius: 0.4rem; + background: var(--chrnx-bg); + color: var(--chrnx-text); +} + +.chrnx-journal-stream__filters button, +.chrnx-subscribe-cta a { + min-height: 45px; + padding: 0.7rem 1.1rem; + border: 0; + border-radius: 999px; + background: var(--chrnx-green); + color: var(--chrnx-bg); + font-weight: 700; + text-decoration: none; +} + +.chrnx-journal-stream__list { + grid-template-columns: repeat(2, minmax(0, 1fr)); + margin: 0; +} + +.chrnx-journal-stream__list > li { + min-width: 0; +} + +.chrnx-journal-card__link { + display: grid; + grid-template-columns: minmax(7rem, 0.45fr) minmax(0, 1fr); + height: 100%; +} + +.chrnx-journal-card__fallback, +.chrnx-journal-card__image { + height: 100%; + min-height: 13rem; + object-fit: cover; +} + +.chrnx-home-projects { + position: relative; + isolation: isolate; + min-height: 38rem; + overflow: hidden; + border-radius: calc(var(--chrnx-radius) * 1.5); + background: + linear-gradient(125deg, var(--chrnx-surface) 0 58%, transparent 58%), + radial-gradient(circle at 80% 35%, var(--chrnx-accent-soft), transparent 48%); +} + +.chrnx-home-projects > h2, +.chrnx-home-projects > .wp-block-columns { + position: relative; + z-index: 2; + max-width: 62%; +} + +.chrnx-home-projects .wp-block-columns { + display: grid; + gap: 0; + grid-template-columns: 1fr; + border-top: 1px solid var(--chrnx-line); +} + +.chrnx-home-projects .wp-block-column { + padding-block: 1.25rem; + border-bottom: 1px solid var(--chrnx-line); +} + +.chrnx-home-projects .wp-block-column h3 { + margin: 0; +} + +.chrnx-responsive-portrait { + display: block; +} + +.chrnx-section-portrait { + display: block; + width: 100%; + height: auto; + filter: drop-shadow(0 2rem 2rem rgb(0 0 0 / 28%)); +} + +.chrnx-home-projects > .chrnx-responsive-portrait { + position: absolute; + z-index: 1; + right: -2rem; + bottom: 0; + width: min(43%, 25rem); +} + +.chrnx-home-projects > .chrnx-responsive-portrait:last-child { + z-index: 0; + right: 22%; + width: min(30%, 17rem); + opacity: 0.3; + filter: saturate(0.6); +} + +.chrnx-home-music .wp-block-columns { + position: relative; + overflow: hidden; + min-height: 34rem; + padding: clamp(2rem, 6vw, 5rem); + border: 1px solid rgb(197 88 35 / 35%); + border-radius: calc(var(--chrnx-radius) * 1.5); + background: + linear-gradient(110deg, rgb(13 17 23 / 98%) 0 45%, rgb(13 17 23 / 30%) 70%), + linear-gradient(145deg, #54260f, #0d1117 75%); + color: #e6edf3; +} + +.chrnx-home-music h2 { + color: #e6edf3; +} + +.chrnx-home-music p { + color: #c6ced7; +} + +html[data-theme="light"] .chrnx-home-music h2, +html[data-theme="light"] .chrnx-home-music p { + color: #e6edf3; +} + +@media (prefers-color-scheme: light) { + + :root:not([data-theme]) .chrnx-home-music h2, + :root:not([data-theme]) .chrnx-home-music p { + color: #e6edf3; + } +} + +.chrnx-home-music .wp-block-column:first-child { + position: relative; + z-index: 2; +} + +.chrnx-home-music .wp-block-column:last-child { + align-self: end; +} + +.chrnx-home-music .chrnx-responsive-portrait { + width: min(100%, 29rem); + margin: auto auto -5rem; +} + +.chrnx-latest-podcast { + position: relative; +} + +.chrnx-latest-podcast::before { + display: block; + margin-bottom: 1.5rem; + color: var(--chrnx-green); + content: "LATEST CONVERSATION"; + font-family: var(--wp--preset--font-family--metadata); + font-size: 0.75rem; + font-weight: 700; + letter-spacing: 0.12em; +} + +.chrnx-podcast-card__link { + display: block; + padding: clamp(1.5rem, 4vw, 3rem); +} + +.chrnx-home-about-preview, +.chrnx-subscribe-cta { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: end; + gap: 2rem; +} + +.chrnx-home-about-preview p, +.chrnx-subscribe-cta p { + max-width: 58ch; + color: var(--chrnx-muted); +} + +.chrnx-entry, +.chrnx-archive, +.chrnx-search, +.chrnx-not-found { + padding-block: clamp(3.5rem, 7vw, 7rem); +} + +.chrnx-entry > h1, +.chrnx-archive > h1, +.chrnx-search > h1, +.chrnx-not-found > h1 { + font-size: var(--wp--preset--font-size--display); + letter-spacing: -0.035em; +} + +.chrnx-entry--page > .wp-block-post-title, +.chrnx-archive > .wp-block-query-title { + width: min(100%, var(--wp--style--global--content-size)); + margin-inline: auto; + color: var(--chrnx-green); + font-family: var(--wp--preset--font-family--metadata); + font-size: var(--wp--preset--font-size--small); + letter-spacing: 0.14em; + text-transform: uppercase; +} + +.chrnx-entry__meta { + padding-block: 1rem; + border-block: 1px solid var(--chrnx-line); + color: var(--chrnx-muted); +} + +.chrnx-entry pre { + overflow-x: auto; + padding: 1.25rem; + border: 1px solid var(--chrnx-line); + border-radius: 0.75rem; + background: #090c10; + color: #d9e7df; + font-size: 0.9rem; +} + +.chrnx-topic-hero { + display: grid; + min-height: 30rem; + grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.65fr); + align-items: end; + overflow: hidden; + margin-bottom: 3rem; + border: 1px solid var(--chrnx-line); + border-radius: calc(var(--chrnx-radius) * 1.5); + background: linear-gradient(135deg, var(--chrnx-surface), var(--chrnx-accent-soft)); +} + +.chrnx-topic-hero__content { + padding: clamp(2rem, 6vw, 5rem); +} + +.chrnx-topic-hero__title { + margin: 0; + font-size: var(--wp--preset--font-size--display); +} + +.chrnx-topic-hero__art { + align-self: end; +} + +.chrnx-topic-hero__art .chrnx-section-portrait { + max-height: 34rem; + object-fit: contain; + object-position: bottom; +} + +.chrnx-music-landing, +.chrnx-podcast-landing, +.chrnx-about { + position: relative; +} + +.chrnx-music-landing > h2, +.chrnx-podcast-landing > h2, +.chrnx-about > h2 { + font-size: var(--wp--preset--font-size--display); +} + +.chrnx-music-landing__art { + display: grid; + grid-template-columns: minmax(0, 1.25fr) minmax(15rem, 0.75fr); + overflow: hidden; + margin-block: 3rem; + border-radius: calc(var(--chrnx-radius) * 1.5); + background: #15100d; +} + +.chrnx-music-landing__art > img { + width: 100%; + height: 100%; + max-height: 40rem; + object-fit: cover; +} + +.chrnx-music-landing__art .chrnx-responsive-portrait { + align-self: end; +} + +.chrnx-music-landing__portrait { + max-height: 38rem; + object-fit: contain; + object-position: bottom; +} + +.chrnx-release-list { + display: grid; + gap: 1rem; + grid-template-columns: repeat(3, minmax(0, 1fr)); +} + +.chrnx-release-card { + padding: 1.5rem; +} + +.chrnx-podcast-landing > .chrnx-responsive-portrait { + float: right; + width: min(45%, 24rem); + margin: -7rem 0 2rem 2rem; +} + +.chrnx-podcast-landing [data-type="core/group"]:empty, +.chrnx-podcast-landing > .wp-block-group:empty, +.chrnx-podcast-show > .wp-block-group:empty { + display: none; +} + +.chrnx-about__portraits { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + align-items: end; + overflow: hidden; + margin-block: 2rem 3rem; + border: 1px solid var(--chrnx-line); + border-radius: calc(var(--chrnx-radius) * 1.5); + background: linear-gradient(145deg, var(--chrnx-surface), var(--chrnx-accent-soft)); +} + +.chrnx-about__portraits .chrnx-responsive-portrait { + min-width: 0; + margin: 0 -14%; +} + +.chrnx-about__portraits .chrnx-responsive-portrait:first-child { + margin-left: 0; +} + +.chrnx-about__portraits .chrnx-responsive-portrait:last-child { + margin-right: 0; +} + +.chrnx-about__portraits .chrnx-section-portrait { + max-height: 24rem; + object-fit: contain; + object-position: bottom; +} + +.chrnx-journal-stream__empty, +.chrnx-not-found .wp-block-search, +.chrnx-search .wp-block-query-no-results { + padding: 2rem; + border: 1px dashed var(--chrnx-line); + border-radius: var(--chrnx-radius); + background: var(--chrnx-surface); +} + +.chrnx-journal-stream__pagination a, +.chrnx-journal-stream__pagination span { + display: inline-flex; + min-width: 45px; + min-height: 45px; + align-items: center; + justify-content: center; + border: 1px solid var(--chrnx-line); + border-radius: 50%; +} + +.chrnx-journal-stream__pagination .current { + background: var(--chrnx-green); + color: var(--chrnx-bg); +} + +@media (hover: hover) { + + .chrnx-featured-story, + .chrnx-journal-card, + .chrnx-podcast-card, + .chrnx-related-card { + transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease; + } + + .chrnx-featured-story:hover, + .chrnx-journal-card:hover, + .chrnx-podcast-card:hover, + .chrnx-related-card:hover { + border-color: color-mix(in srgb, var(--chrnx-green) 62%, var(--chrnx-line)); + box-shadow: var(--chrnx-shadow); + transform: translateY(-0.25rem); + } +} + +@media (max-width: 900px) { + + .chrnx-journal-stream__list, + .chrnx-release-list { + grid-template-columns: 1fr; + } + + .chrnx-home-projects > h2, + .chrnx-home-projects > .wp-block-columns { + max-width: 70%; + } + + .chrnx-topic-hero { + grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.6fr); + } +} + +@media (max-width: 599px) { + + body { + background-size: auto, 2rem 2rem, 2rem 2rem; + } + + .chrnx-home > section, + .chrnx-home > .wp-block-group, + .chrnx-home > .wp-block-chrnx-featured-stories, + .chrnx-home > .wp-block-chrnx-journal-stream, + .chrnx-home > .wp-block-chrnx-latest-podcast { + padding-block: 3.5rem; + } + + .chrnx-home-intro { + min-height: 38rem; + padding-right: 0; + } + + .chrnx-home-intro::after { + display: none; + } + + .chrnx-journal-stream__filters, + .chrnx-home-about-preview, + .chrnx-subscribe-cta { + display: grid; + grid-template-columns: 1fr; + } + + .chrnx-journal-stream__filters label, + .chrnx-journal-stream__filters input, + .chrnx-journal-stream__filters select, + .chrnx-journal-stream__filters button { + width: 100%; + } + + .chrnx-journal-card__link { + grid-template-columns: 1fr; + } + + .chrnx-journal-card__fallback, + .chrnx-journal-card__image { + min-height: 10rem; + } + + .chrnx-home-projects { + min-height: 42rem; + padding-inline: 1.5rem; + } + + .chrnx-home-projects > h2, + .chrnx-home-projects > .wp-block-columns { + max-width: 100%; + } + + .chrnx-home-projects > .chrnx-responsive-portrait { + right: -3rem; + width: min(72%, 21rem); + } + + .chrnx-home-projects > .chrnx-responsive-portrait:last-child { + display: none; + } + + .chrnx-home-music .wp-block-columns { + padding: 2rem 1.5rem 0; + } + + .chrnx-topic-hero { + min-height: 36rem; + grid-template-columns: 1fr; + } + + .chrnx-topic-hero__art { + width: min(88%, 24rem); + margin: -4rem auto 0; + } + + .chrnx-music-landing__art { + grid-template-columns: 1fr; + } + + .chrnx-music-landing__art > img { + max-height: 24rem; + } + + .chrnx-podcast-landing > .chrnx-responsive-portrait { + float: none; + width: min(85%, 22rem); + margin: 0 auto 2rem; + } + + .chrnx-about__portraits { + grid-template-columns: repeat(3, 70%); + overflow-x: auto; + scroll-snap-type: x mandatory; + } + + .chrnx-about__portraits .chrnx-responsive-portrait { + margin: 0; + scroll-snap-align: center; + } +} + +@media (prefers-reduced-motion: reduce) { + + .chrnx-featured-story, + .chrnx-journal-card, + .chrnx-podcast-card, + .chrnx-related-card { + transition: none; + } + + .chrnx-featured-story:hover, + .chrnx-journal-card:hover, + .chrnx-podcast-card:hover, + .chrnx-related-card:hover { + transform: none; + } + + .chrnx-about__portraits { + scroll-behavior: auto; + } +} diff --git a/assets/images/generated/alter-ego-code-384.avif b/assets/images/generated/alter-ego-code-384.avif new file mode 100644 index 0000000..fa4a61f Binary files /dev/null and b/assets/images/generated/alter-ego-code-384.avif differ diff --git a/assets/images/generated/alter-ego-code-384.webp b/assets/images/generated/alter-ego-code-384.webp new file mode 100644 index 0000000..993bf44 Binary files /dev/null and b/assets/images/generated/alter-ego-code-384.webp differ diff --git a/assets/images/generated/alter-ego-code-768.avif b/assets/images/generated/alter-ego-code-768.avif new file mode 100644 index 0000000..a0b78e1 Binary files /dev/null and b/assets/images/generated/alter-ego-code-768.avif differ diff --git a/assets/images/generated/alter-ego-code-768.webp b/assets/images/generated/alter-ego-code-768.webp new file mode 100644 index 0000000..d2af08f Binary files /dev/null and b/assets/images/generated/alter-ego-code-768.webp differ diff --git a/assets/images/generated/alter-ego-code.json b/assets/images/generated/alter-ego-code.json new file mode 100644 index 0000000..b31e40a --- /dev/null +++ b/assets/images/generated/alter-ego-code.json @@ -0,0 +1,5 @@ +{ + "source": "alter-ego-code.png", + "formats": [ "avif", "webp" ], + "widths": [ 384, 768 ] +} diff --git a/assets/images/generated/alter-ego-gaming-384.avif b/assets/images/generated/alter-ego-gaming-384.avif new file mode 100644 index 0000000..1dc5d30 Binary files /dev/null and b/assets/images/generated/alter-ego-gaming-384.avif differ diff --git a/assets/images/generated/alter-ego-gaming-384.webp b/assets/images/generated/alter-ego-gaming-384.webp new file mode 100644 index 0000000..a629d6c Binary files /dev/null and b/assets/images/generated/alter-ego-gaming-384.webp differ diff --git a/assets/images/generated/alter-ego-gaming-768.avif b/assets/images/generated/alter-ego-gaming-768.avif new file mode 100644 index 0000000..c3ded7e Binary files /dev/null and b/assets/images/generated/alter-ego-gaming-768.avif differ diff --git a/assets/images/generated/alter-ego-gaming-768.webp b/assets/images/generated/alter-ego-gaming-768.webp new file mode 100644 index 0000000..3ba8e01 Binary files /dev/null and b/assets/images/generated/alter-ego-gaming-768.webp differ diff --git a/assets/images/generated/alter-ego-gaming.json b/assets/images/generated/alter-ego-gaming.json new file mode 100644 index 0000000..336a127 --- /dev/null +++ b/assets/images/generated/alter-ego-gaming.json @@ -0,0 +1,5 @@ +{ + "source": "alter-ego-gaming.png", + "formats": [ "avif", "webp" ], + "widths": [ 384, 768 ] +} diff --git a/assets/images/generated/alter-ego-life-384.avif b/assets/images/generated/alter-ego-life-384.avif new file mode 100644 index 0000000..f242f78 Binary files /dev/null and b/assets/images/generated/alter-ego-life-384.avif differ diff --git a/assets/images/generated/alter-ego-life-384.webp b/assets/images/generated/alter-ego-life-384.webp new file mode 100644 index 0000000..22c8701 Binary files /dev/null and b/assets/images/generated/alter-ego-life-384.webp differ diff --git a/assets/images/generated/alter-ego-life-768.avif b/assets/images/generated/alter-ego-life-768.avif new file mode 100644 index 0000000..98aedcf Binary files /dev/null and b/assets/images/generated/alter-ego-life-768.avif differ diff --git a/assets/images/generated/alter-ego-life-768.webp b/assets/images/generated/alter-ego-life-768.webp new file mode 100644 index 0000000..3025cb8 Binary files /dev/null and b/assets/images/generated/alter-ego-life-768.webp differ diff --git a/assets/images/generated/alter-ego-life.json b/assets/images/generated/alter-ego-life.json new file mode 100644 index 0000000..8666f11 --- /dev/null +++ b/assets/images/generated/alter-ego-life.json @@ -0,0 +1,5 @@ +{ + "source": "alter-ego-life.png", + "formats": [ "avif", "webp" ], + "widths": [ 384, 768 ] +} diff --git a/assets/images/generated/alter-ego-literature-384.avif b/assets/images/generated/alter-ego-literature-384.avif new file mode 100644 index 0000000..cb91e62 Binary files /dev/null and b/assets/images/generated/alter-ego-literature-384.avif differ diff --git a/assets/images/generated/alter-ego-literature-384.webp b/assets/images/generated/alter-ego-literature-384.webp new file mode 100644 index 0000000..348776f Binary files /dev/null and b/assets/images/generated/alter-ego-literature-384.webp differ diff --git a/assets/images/generated/alter-ego-literature-768.avif b/assets/images/generated/alter-ego-literature-768.avif new file mode 100644 index 0000000..10e1b96 Binary files /dev/null and b/assets/images/generated/alter-ego-literature-768.avif differ diff --git a/assets/images/generated/alter-ego-literature-768.webp b/assets/images/generated/alter-ego-literature-768.webp new file mode 100644 index 0000000..0357b48 Binary files /dev/null and b/assets/images/generated/alter-ego-literature-768.webp differ diff --git a/assets/images/generated/alter-ego-literature.json b/assets/images/generated/alter-ego-literature.json new file mode 100644 index 0000000..6e19d2e --- /dev/null +++ b/assets/images/generated/alter-ego-literature.json @@ -0,0 +1,5 @@ +{ + "source": "alter-ego-literature.png", + "formats": [ "avif", "webp" ], + "widths": [ 384, 768 ] +} diff --git a/assets/images/generated/alter-ego-podcasts-384.avif b/assets/images/generated/alter-ego-podcasts-384.avif new file mode 100644 index 0000000..506590b Binary files /dev/null and b/assets/images/generated/alter-ego-podcasts-384.avif differ diff --git a/assets/images/generated/alter-ego-podcasts-384.webp b/assets/images/generated/alter-ego-podcasts-384.webp new file mode 100644 index 0000000..a56ea24 Binary files /dev/null and b/assets/images/generated/alter-ego-podcasts-384.webp differ diff --git a/assets/images/generated/alter-ego-podcasts-768.avif b/assets/images/generated/alter-ego-podcasts-768.avif new file mode 100644 index 0000000..04a667b Binary files /dev/null and b/assets/images/generated/alter-ego-podcasts-768.avif differ diff --git a/assets/images/generated/alter-ego-podcasts-768.webp b/assets/images/generated/alter-ego-podcasts-768.webp new file mode 100644 index 0000000..3b6a55a Binary files /dev/null and b/assets/images/generated/alter-ego-podcasts-768.webp differ diff --git a/assets/images/generated/alter-ego-podcasts.json b/assets/images/generated/alter-ego-podcasts.json new file mode 100644 index 0000000..31d5850 --- /dev/null +++ b/assets/images/generated/alter-ego-podcasts.json @@ -0,0 +1,5 @@ +{ + "source": "alter-ego-podcasts.png", + "formats": [ "avif", "webp" ], + "widths": [ 384, 768 ] +} diff --git a/assets/images/generated/alter-ego-research-384.avif b/assets/images/generated/alter-ego-research-384.avif new file mode 100644 index 0000000..ddbe787 Binary files /dev/null and b/assets/images/generated/alter-ego-research-384.avif differ diff --git a/assets/images/generated/alter-ego-research-384.webp b/assets/images/generated/alter-ego-research-384.webp new file mode 100644 index 0000000..dc31349 Binary files /dev/null and b/assets/images/generated/alter-ego-research-384.webp differ diff --git a/assets/images/generated/alter-ego-research-768.avif b/assets/images/generated/alter-ego-research-768.avif new file mode 100644 index 0000000..e14daa6 Binary files /dev/null and b/assets/images/generated/alter-ego-research-768.avif differ diff --git a/assets/images/generated/alter-ego-research-768.webp b/assets/images/generated/alter-ego-research-768.webp new file mode 100644 index 0000000..0ac576e Binary files /dev/null and b/assets/images/generated/alter-ego-research-768.webp differ diff --git a/assets/images/generated/alter-ego-research.json b/assets/images/generated/alter-ego-research.json new file mode 100644 index 0000000..20005d0 --- /dev/null +++ b/assets/images/generated/alter-ego-research.json @@ -0,0 +1,5 @@ +{ + "source": "alter-ego-research.png", + "formats": [ "avif", "webp" ], + "widths": [ 384, 768 ] +} diff --git a/assets/images/generated/the-no-names-musician-cutout-384.avif b/assets/images/generated/the-no-names-musician-cutout-384.avif new file mode 100644 index 0000000..c5ef956 Binary files /dev/null and b/assets/images/generated/the-no-names-musician-cutout-384.avif differ diff --git a/assets/images/generated/the-no-names-musician-cutout-384.webp b/assets/images/generated/the-no-names-musician-cutout-384.webp new file mode 100644 index 0000000..2251fe7 Binary files /dev/null and b/assets/images/generated/the-no-names-musician-cutout-384.webp differ diff --git a/assets/images/generated/the-no-names-musician-cutout-768.avif b/assets/images/generated/the-no-names-musician-cutout-768.avif new file mode 100644 index 0000000..d8db4cd Binary files /dev/null and b/assets/images/generated/the-no-names-musician-cutout-768.avif differ diff --git a/assets/images/generated/the-no-names-musician-cutout-768.webp b/assets/images/generated/the-no-names-musician-cutout-768.webp new file mode 100644 index 0000000..dd9a0c5 Binary files /dev/null and b/assets/images/generated/the-no-names-musician-cutout-768.webp differ diff --git a/assets/images/generated/the-no-names-musician-cutout.json b/assets/images/generated/the-no-names-musician-cutout.json new file mode 100644 index 0000000..50e5017 --- /dev/null +++ b/assets/images/generated/the-no-names-musician-cutout.json @@ -0,0 +1,5 @@ +{ + "source": "the-no-names-musician-cutout.png", + "formats": [ "avif", "webp" ], + "widths": [ 384, 768 ] +} diff --git a/blocks/topic-hero/render.php b/blocks/topic-hero/render.php index 1d9fb35..c210069 100644 --- a/blocks/topic-hero/render.php +++ b/blocks/topic-hero/render.php @@ -25,7 +25,7 @@ $chrnx_label = $chrnx_term instanceof WP_Term ? $chrnx_term->name : ucfirst( $
- + diff --git a/functions.php b/functions.php index efddd65..17ee7c5 100644 --- a/functions.php +++ b/functions.php @@ -2,7 +2,7 @@ define( 'CHRNX_VERSION', '0.1.0' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'settings', 'queries', 'blocks', 'theme-preference' ) as $module ) { +foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'settings', 'queries', 'media', 'blocks', 'theme-preference' ) as $module ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $path = get_theme_file_path( "inc/{$module}.php" ); if ( file_exists( $path ) ) { diff --git a/inc/assets.php b/inc/assets.php index 97e66bd..c404725 100644 --- a/inc/assets.php +++ b/inc/assets.php @@ -21,5 +21,11 @@ function chrnx_enqueue_assets() { array( 'chrnx-base' ), CHRNX_VERSION ); + wp_enqueue_style( + 'chrnx-components', + get_theme_file_uri( 'assets/css/components.css' ), + array( 'chrnx-layout' ), + CHRNX_VERSION + ); } add_action( 'wp_enqueue_scripts', 'chrnx_enqueue_assets' ); diff --git a/inc/media.php b/inc/media.php new file mode 100644 index 0000000..cc272af --- /dev/null +++ b/inc/media.php @@ -0,0 +1,38 @@ +'; + $markup .= ''; + $markup .= ''; + $markup .= ''; + $markup .= ''; + + return $markup; +} diff --git a/patterns/about.php b/patterns/about.php index f90d646..70d39b2 100644 --- a/patterns/about.php +++ b/patterns/about.php @@ -12,6 +12,13 @@ $chrnx_research_url = esc_url( 'https://arxiv.org/abs/2603.05352' ); ?>
+ +
+ + + +
+

.

diff --git a/patterns/home-music.php b/patterns/home-music.php index ece2336..698290b 100644 --- a/patterns/home-music.php +++ b/patterns/home-music.php @@ -8,7 +8,6 @@ * * @package CHRNX */ -$chrnx_home_music_art = get_theme_file_uri( 'assets/images/the-no-names-musician-cutout.png' ); ?>
@@ -20,7 +19,7 @@ $chrnx_home_music_art = get_theme_file_uri( 'assets/images/the-no-names-musician

- <?php echo esc_attr__( 'The No Names musician portrait', 'chrnx' ); ?> +
diff --git a/patterns/home-projects.php b/patterns/home-projects.php index 31c7fc9..7c9c276 100644 --- a/patterns/home-projects.php +++ b/patterns/home-projects.php @@ -11,6 +11,7 @@ ?>
+

@@ -19,5 +20,6 @@

+
diff --git a/patterns/music-landing.php b/patterns/music-landing.php index 82cbb46..4201155 100644 --- a/patterns/music-landing.php +++ b/patterns/music-landing.php @@ -9,7 +9,6 @@ * @package CHRNX */ $chrnx_music_collage = get_theme_file_uri( 'assets/images/the-no-names-collage.jpeg' ); -$chrnx_music_cutout = get_theme_file_uri( 'assets/images/the-no-names-musician-cutout.png' ); ?>
@@ -20,7 +19,7 @@ $chrnx_music_cutout = get_theme_file_uri( 'assets/images/the-no-names-musician-
<?php echo esc_attr__( 'The No Names collage', 'chrnx' ); ?> - <?php echo esc_attr__( 'The No Names musician portrait', 'chrnx' ); ?> +

diff --git a/patterns/podcast-landing.php b/patterns/podcast-landing.php index 134d9d4..071a608 100644 --- a/patterns/podcast-landing.php +++ b/patterns/podcast-landing.php @@ -8,12 +8,11 @@ * * @package CHRNX */ -$chrnx_podcast_art = get_theme_file_uri( 'assets/images/alter-ego-podcasts.png' ); ?>

- +
diff --git a/patterns/podcast-show.php b/patterns/podcast-show.php index b36529d..9e79367 100644 --- a/patterns/podcast-show.php +++ b/patterns/podcast-show.php @@ -8,11 +8,10 @@ * * @package CHRNX */ -$chrnx_podcast_show_art = get_theme_file_uri( 'assets/images/alter-ego-podcasts.png' ); ?>
- +
diff --git a/scripts/build-responsive-images.sh b/scripts/build-responsive-images.sh new file mode 100755 index 0000000..b2d8180 --- /dev/null +++ b/scripts/build-responsive-images.sh @@ -0,0 +1,41 @@ +#!/bin/sh +set -eu + +chrnx_image_script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +chrnx_image_root=$(dirname -- "$chrnx_image_script_dir") +chrnx_image_output="$chrnx_image_root/assets/images/generated" +chrnx_image_tmp=$(mktemp -d "${TMPDIR:-/tmp}/chrnx-images.XXXXXX") +trap 'rm -rf -- "$chrnx_image_tmp"' EXIT HUP INT TERM + +for chrnx_image_tool in sips cwebp avifenc; do + if ! command -v "$chrnx_image_tool" >/dev/null 2>&1; then + echo "Required image tool is missing: $chrnx_image_tool" >&2 + exit 1 + fi +done + +mkdir -p -- "$chrnx_image_output" + +chrnx_build_portrait() { + chrnx_image_basename=$1 + chrnx_image_source="$chrnx_image_root/assets/images/$chrnx_image_basename.png" + if [ ! -f "$chrnx_image_source" ]; then + echo "Source portrait is missing: $chrnx_image_source" >&2 + exit 1 + fi + + for chrnx_image_width in 384 768; do + chrnx_image_resized="$chrnx_image_tmp/$chrnx_image_basename-$chrnx_image_width.png" + sips --resampleWidth "$chrnx_image_width" "$chrnx_image_source" --out "$chrnx_image_resized" >/dev/null + cwebp -quiet -preset picture -q 78 -alpha_q 90 -m 6 -metadata none "$chrnx_image_resized" -o "$chrnx_image_output/$chrnx_image_basename-$chrnx_image_width.webp" + avifenc --ignore-exif --ignore-xmp --ignore-icc --qcolor 58 --qalpha 85 --speed 6 "$chrnx_image_resized" "$chrnx_image_output/$chrnx_image_basename-$chrnx_image_width.avif" >/dev/null + done +} + +for chrnx_image_topic in code gaming life literature podcasts research; do + chrnx_build_portrait "alter-ego-$chrnx_image_topic" + printf '{\n\t"source": "alter-ego-%s.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' "$chrnx_image_topic" > "$chrnx_image_output/alter-ego-$chrnx_image_topic.json" +done + +chrnx_build_portrait "the-no-names-musician-cutout" +printf '{\n\t"source": "the-no-names-musician-cutout.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_output/the-no-names-musician-cutout.json" diff --git a/scripts/capture-visual-review.mjs b/scripts/capture-visual-review.mjs new file mode 100644 index 0000000..00f7cd6 --- /dev/null +++ b/scripts/capture-visual-review.mjs @@ -0,0 +1,77 @@ +import { mkdir } from 'node:fs/promises'; +import { chromium } from '@playwright/test'; + +const baseURL = process.env.CHRNX_REVIEW_URL || 'http://localhost:8888'; +const host = new URL(baseURL).hostname; +if (!['localhost', '127.0.0.1'].includes(host)) { + throw new Error('Visual review capture is restricted to local WordPress.'); +} + +const output = new URL('../tmp/imagegen/', import.meta.url); +await mkdir(output, { recursive: true }); + +const browser = await chromium.launch(); + +async function capture({ name, path, theme, viewport, fullPage = true }) { + const context = await browser.newContext({ + viewport, + colorScheme: theme, + reducedMotion: 'reduce', + }); + await context.addInitScript( + (preference) => localStorage.setItem('chrnx-theme', preference), + theme, + ); + const page = await context.newPage(); + await page.goto(new URL(path, baseURL).href, { waitUntil: 'networkidle' }); + await page.addStyleTag({ + content: '*,*::before,*::after{animation:none!important;transition:none!important}', + }); + await page.evaluate(async () => { + await document.fonts.ready; + for (let y = 0; y <= document.documentElement.scrollHeight; y += window.innerHeight) { + window.scrollTo(0, y); + await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))); + } + await Promise.race([ + Promise.all( + [...document.images].map((image) => + image.complete ? Promise.resolve() : image.decode().catch(() => {}), + ), + ), + new Promise((resolve) => setTimeout(resolve, 3000)), + ]); + window.scrollTo(0, 0); + }); + await page.screenshot({ path: new URL(`${name}.png`, output).pathname, fullPage }); + console.log( + `${name}.png ${await page.evaluate( + () => `${document.documentElement.scrollWidth}x${document.documentElement.scrollHeight}`, + )}`, + ); + await context.close(); +} + +const desktop = { width: 1440, height: 900 }; +const mobile = { width: 375, height: 812 }; +for (const spec of [ + { name: 'home-desktop-dark', path: '/', theme: 'dark', viewport: desktop }, + { name: 'home-desktop-light', path: '/', theme: 'light', viewport: desktop }, + { name: 'home-mobile-dark', path: '/', theme: 'dark', viewport: mobile }, + { name: 'home-mobile-light', path: '/', theme: 'light', viewport: mobile }, + { name: 'topic-code-desktop-dark', path: '/topic/code/', theme: 'dark', viewport: desktop }, + { + name: 'topic-research-desktop-dark', + path: '/topic/research/', + theme: 'dark', + viewport: desktop, + }, + { name: 'topic-gaming-desktop-dark', path: '/topic/gaming/', theme: 'dark', viewport: desktop }, + { name: 'music-desktop-dark', path: '/music/', theme: 'dark', viewport: desktop }, + { name: 'podcasts-desktop-dark', path: '/podcasts/', theme: 'dark', viewport: desktop }, + { name: 'about-desktop-dark', path: '/about/', theme: 'dark', viewport: desktop }, +]) { + await capture(spec); +} + +await browser.close(); diff --git a/scripts/seed-test-content.php b/scripts/seed-test-content.php new file mode 100644 index 0000000..d754354 --- /dev/null +++ b/scripts/seed-test-content.php @@ -0,0 +1,152 @@ +> Fixture records. + */ +function chrnx_seed_read_fixture( string $filename ): array { + $path = get_theme_file_path( 'tests/fixtures/' . $filename ); + if ( ! is_readable( $path ) ) { + WP_CLI::error( 'Fixture is not readable: ' . $filename ); + } + + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- This is a local mapped theme fixture, never a URL. + $data = json_decode( (string) file_get_contents( $path ), true ); + if ( ! is_array( $data ) || ! array_is_list( $data ) ) { + WP_CLI::error( 'Fixture JSON is invalid: ' . $filename ); + } + return $data; +} + +/** + * Find the post managed by one stable fixture key. + * + * @param string $fixture_key Fixture key. + * @param string $post_type Post type. + * @return int Post ID or zero. + */ +function chrnx_seed_find_post( string $fixture_key, string $post_type ): int { + $ids = get_posts( + array( + 'post_type' => $post_type, + 'post_status' => 'any', + 'posts_per_page' => 1, + 'fields' => 'ids', + 'no_found_rows' => true, + 'suppress_filters' => true, + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false, + 'meta_key' => '_chrnx_fixture_key', + 'meta_value' => $fixture_key, + ) + ); + return empty( $ids ) ? 0 : absint( $ids[0] ); +} + +/** + * Insert or update one fixture-owned post without touching unrelated content. + * + * @param array $fixture Fixture record. + * @param string $post_type Post type. + * @param int $offset Stable publication-date offset. + * @return int Post ID. + */ +function chrnx_seed_upsert_post( array $fixture, string $post_type, int $offset ): int { + $key = isset( $fixture['fixtureKey'] ) ? sanitize_key( $fixture['fixtureKey'] ) : ''; + if ( '' === $key ) { + WP_CLI::error( 'Every fixture requires a fixtureKey.' ); + } + + $post_id = chrnx_seed_find_post( $key, $post_type ); + $payload = array( + 'ID' => $post_id, + 'post_type' => $post_type, + 'post_status' => sanitize_key( $fixture['status'] ?? 'publish' ), + 'post_title' => sanitize_text_field( $fixture['title'] ?? '' ), + 'post_name' => sanitize_title( $fixture['slug'] ?? $fixture['title'] ?? $key ), + 'post_excerpt' => wp_kses_post( $fixture['excerpt'] ?? '' ), + 'post_content' => wp_kses_post( $fixture['content'] ?? '' ), + 'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '2026-08-01 18:00:00 UTC' ) + ( $offset * HOUR_IN_SECONDS ) ), + ); + + $result = $post_id ? wp_update_post( $payload, true ) : wp_insert_post( $payload, true ); + if ( is_wp_error( $result ) ) { + WP_CLI::error( 'Could not upsert fixture ' . $key . '.' ); + } + + update_post_meta( $result, '_chrnx_fixture_key', $key ); + return absint( $result ); +} + +chrnx_seed_editorial_terms(); +$chrnx_seed_pages = chrnx_seed_read_fixture( 'pages.json' ); +$chrnx_seed_posts = chrnx_seed_read_fixture( 'posts.json' ); +$chrnx_seed_page_ids = array(); +$chrnx_seed_post_ids = array(); + +foreach ( $chrnx_seed_pages as $chrnx_seed_index => $chrnx_seed_page ) { + $chrnx_seed_page_id = chrnx_seed_upsert_post( $chrnx_seed_page, 'page', $chrnx_seed_index ); + $chrnx_seed_page_ids[ $chrnx_seed_page['slug'] ] = $chrnx_seed_page_id; +} + +foreach ( $chrnx_seed_posts as $chrnx_seed_index => $chrnx_seed_post ) { + $chrnx_seed_post_id = chrnx_seed_upsert_post( $chrnx_seed_post, 'post', 24 + $chrnx_seed_index ); + wp_set_object_terms( $chrnx_seed_post_id, sanitize_key( $chrnx_seed_post['topic'] ?? '' ), 'chrnx_topic', false ); + wp_set_object_terms( $chrnx_seed_post_id, sanitize_key( $chrnx_seed_post['language'] ?? '' ), 'chrnx_language', false ); + + if ( isset( $chrnx_seed_post['show'] ) ) { + wp_set_object_terms( $chrnx_seed_post_id, sanitize_key( $chrnx_seed_post['show'] ), 'chrnx_show', false ); + } else { + wp_set_object_terms( $chrnx_seed_post_id, array(), 'chrnx_show', false ); + } + + foreach ( array( 'chrnx_episode_number', 'chrnx_episode_duration' ) as $chrnx_seed_meta_key ) { + delete_post_meta( $chrnx_seed_post_id, $chrnx_seed_meta_key ); + } + if ( isset( $chrnx_seed_post['episodeNumber'] ) ) { + update_post_meta( $chrnx_seed_post_id, 'chrnx_episode_number', absint( $chrnx_seed_post['episodeNumber'] ) ); + } + if ( isset( $chrnx_seed_post['episodeDuration'] ) ) { + update_post_meta( $chrnx_seed_post_id, 'chrnx_episode_duration', chrnx_sanitize_episode_duration( $chrnx_seed_post['episodeDuration'] ) ); + } + $chrnx_seed_post_ids[ $chrnx_seed_post['fixtureKey'] ] = $chrnx_seed_post_id; +} + +$chrnx_seed_sticky_ids = array(); +foreach ( $chrnx_seed_posts as $chrnx_seed_post ) { + if ( ! empty( $chrnx_seed_post['featured'] ) && isset( $chrnx_seed_post_ids[ $chrnx_seed_post['fixtureKey'] ] ) ) { + $chrnx_seed_sticky_ids[] = $chrnx_seed_post_ids[ $chrnx_seed_post['fixtureKey'] ]; + } +} +update_option( 'sticky_posts', $chrnx_seed_sticky_ids ); +update_option( 'blogname', 'CHRNX' ); +update_option( 'blogdescription', 'Ideas made tangible.' ); +update_option( 'show_on_front', 'page' ); +update_option( 'page_on_front', $chrnx_seed_page_ids['home'] ); +update_option( 'page_for_posts', 0 ); +update_option( 'chrnx_subscribe_page_id', $chrnx_seed_page_ids['subscribe'] ); +update_option( 'permalink_structure', '/%postname%/' ); +flush_rewrite_rules( false ); + +WP_CLI::log( + sprintf( + 'CHRNX_FIXTURES pages=%d posts=%d front=%d', + count( $chrnx_seed_page_ids ), + count( $chrnx_seed_post_ids ), + $chrnx_seed_page_ids['home'] + ) +); diff --git a/scripts/seed-test-content.sh b/scripts/seed-test-content.sh new file mode 100755 index 0000000..adb13c4 --- /dev/null +++ b/scripts/seed-test-content.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -eu + +chrnx_script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +chrnx_project_dir=$(dirname -- "$chrnx_script_dir") +chrnx_docker_cli_dir=${CHRNX_DOCKER_CLI_DIR:-/opt/homebrew/opt/docker/bin} + +if [ ! -x "$chrnx_docker_cli_dir/docker" ]; then + echo "Docker CLI not found at the approved Colima path: $chrnx_docker_cli_dir/docker" >&2 + exit 1 +fi + +cd -- "$chrnx_project_dir" +chrnx_seed_probe=$(PATH="$chrnx_docker_cli_dir:$PATH" npm exec -- wp-env run cli wp eval 'echo "CHRNX_HOST=" . wp_parse_url( home_url( "/" ), PHP_URL_HOST );') +case "$chrnx_seed_probe" in + *CHRNX_HOST=localhost*|*CHRNX_HOST=127.0.0.1*) ;; + *) + echo "Refusing to seed anything except localhost or 127.0.0.1." >&2 + exit 1 + ;; +esac +PATH="$chrnx_docker_cli_dir:$PATH" npm exec -- wp-env run cli wp eval-file wp-content/themes/chrnx/scripts/seed-test-content.php diff --git a/templates/front-page.html b/templates/front-page.html new file mode 100644 index 0000000..4b8a382 --- /dev/null +++ b/templates/front-page.html @@ -0,0 +1,21 @@ + + + +
+ + + + + + + +
+

About

+

Independent research, software, music, games, and the human life around the work.

+
+ + +
+ + + diff --git a/tests/e2e/global-setup.mjs b/tests/e2e/global-setup.mjs index d4a3876..4c45c7b 100644 --- a/tests/e2e/global-setup.mjs +++ b/tests/e2e/global-setup.mjs @@ -1,9 +1,9 @@ import { execFileSync } from 'node:child_process'; export default function globalSetup() { - execFileSync( - 'npm', - [ 'exec', '--', 'wp-env', 'run', 'cli', 'wp', 'eval', 'chrnx_seed_editorial_terms();' ], - { cwd: process.cwd(), env: process.env, stdio: 'inherit' }, - ); + execFileSync( './scripts/seed-test-content.sh', [], { + cwd: process.cwd(), + env: process.env, + stdio: 'inherit', + } ); } diff --git a/tests/e2e/visual-states.spec.mjs b/tests/e2e/visual-states.spec.mjs new file mode 100644 index 0000000..2897055 --- /dev/null +++ b/tests/e2e/visual-states.spec.mjs @@ -0,0 +1,140 @@ +import { expect, test } from '@playwright/test'; +import { injectAxe } from 'axe-playwright'; + +const viewports = [ + { width: 375, height: 812 }, + { width: 768, height: 1024 }, + { width: 1440, height: 900 }, + { width: 2560, height: 1440 }, +]; + +async function expectNoHorizontalOverflow( page ) { + const overflow = await page.evaluate( () => ( { + document: document.documentElement.scrollWidth - window.innerWidth, + body: document.body.scrollWidth - window.innerWidth, + } ) ); + expect( overflow.document ).toBeLessThanOrEqual( 1 ); + expect( overflow.body ).toBeLessThanOrEqual( 1 ); +} + +test( 'home remains coherent at all approved review viewports', async ( { page } ) => { + for ( const viewport of viewports ) { + await page.setViewportSize( viewport ); + await page.goto( '/' ); + await expect( page.getByRole( 'banner' ) ).toBeVisible(); + await expect( page.locator( 'main#chrnx-main' ) ).toBeVisible(); + await expect( page.getByRole( 'contentinfo' ) ).toBeVisible(); + await expect( page.getByRole( 'heading', { level: 1 } ) ).toHaveCount( 1 ); + await expect( page.getByText( 'Selected work', { exact: true } ) ).toBeVisible(); + await expect( page.getByText( 'The No Names', { exact: true } ).first() ).toBeVisible(); + await expect( page.locator( 'picture source[type="image/avif"]' ).first() ).toHaveAttribute( + 'srcset', + /384\.avif 384w/, + ); + await expectNoHorizontalOverflow( page ); + } +} ); + +test( 'topic, music, podcast, and about surfaces use real content and approved art', async ( { + page, +} ) => { + for ( const [ path, heading, asset ] of [ + [ '/topic/code/', 'Code', 'alter-ego-code' ], + [ '/topic/research/', 'Research', 'alter-ego-research' ], + [ '/topic/gaming/', 'Gaming', 'alter-ego-gaming' ], + ] ) { + await page.goto( path ); + await expect( page.getByRole( 'heading', { level: 1, name: heading } ) ).toBeVisible(); + await expect( page.locator( `.chrnx-topic-hero img[src*="${ asset }.png"]` ) ).toBeVisible(); + await expectNoHorizontalOverflow( page ); + } + + await page.goto( '/music/' ); + await expect( page.getByRole( 'heading', { level: 1, name: 'Music' } ) ).toBeVisible(); + await expect( page.getByText( 'Grunge mexicano para cerebros que no se callan.' ) ).toBeVisible(); + await expect( + page.locator( 'picture img[src*="the-no-names-musician-cutout.png"]' ), + ).toBeVisible(); + + await page.goto( '/podcasts/' ); + await expect( page.getByRole( 'heading', { level: 1, name: 'Podcasts' } ) ).toBeVisible(); + await expect( page.locator( 'picture img[src*="alter-ego-podcasts.png"]' ) ).toBeVisible(); + await expect( page.locator( 'iframe, audio' ) ).toHaveCount( 0 ); + + await page.goto( '/about/' ); + await expect( page.getByRole( 'heading', { level: 1, name: 'About' } ) ).toBeVisible(); + await expect( page.getByRole( 'link', { name: 'arXiv:2603.05352' } ) ).toHaveAttribute( + 'href', + 'https://arxiv.org/abs/2603.05352', + ); + await expect( page.locator( '.chrnx-about__portraits picture' ) ).toHaveCount( 3 ); +} ); + +test( 'long, incomplete, empty, and missing states stay usable', async ( { page } ) => { + await page.goto( '/?s=fixture-that-cannot-exist' ); + await expect( page.getByText( 'No journal entries match these filters yet.' ) ).toBeVisible(); + await expect( page.getByRole( 'link', { name: 'Browse the full Journal' } ) ).toBeVisible(); + + await page.goto( '/conversacion-pendiente-de-datos-editoriales/' ); + await expect( + page.getByRole( 'heading', { level: 1, name: 'Conversación pendiente de datos editoriales' } ), + ).toBeVisible(); + await expect( page.locator( '.chrnx-podcast-meta' ) ).toHaveCount( 0 ); + + await page.goto( '/emotion-is-not-a-slider-designing-expressive-systems-that-can-hesitate/' ); + await expect( page.locator( 'pre code' ) ).toContainText( 'const state' ); + await expectNoHorizontalOverflow( page ); + + await page.goto( '/this-route-does-not-exist/' ); + await expect( page ).toHaveTitle( /Page not found/i ); + await expect( page.getByRole( 'heading', { level: 1, name: 'Page not found' } ) ).toBeVisible(); +} ); + +test( 'reduced motion removes card transitions while theme preference remains user-controlled', async ( { + page, +} ) => { + await page.emulateMedia( { reducedMotion: 'reduce', colorScheme: 'light' } ); + await page.goto( '/' ); + const card = page.locator( '.chrnx-featured-story' ).first(); + const duration = await card.evaluate( ( element ) => + Number.parseFloat( window.getComputedStyle( element ).transitionDuration ), + ); + expect( duration ).toBeLessThanOrEqual( 0.001 ); + await expect( page.locator( '.chrnx-home-music h2' ) ).toHaveCSS( 'color', 'rgb(230, 237, 243)' ); + await page.getByRole( 'radio', { name: 'Dark', exact: true } ).check(); + await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' ); +} ); + +test( 'key public surfaces pass automated WCAG 2.2 AA checks', async ( { page }, testInfo ) => { + test.skip( + testInfo.project.name !== 'chromium', + 'One engine is sufficient for deterministic axe rules.', + ); + const tags = [ 'wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa' ]; + for ( const viewport of [ viewports[ 0 ], viewports[ 2 ] ] ) { + await page.setViewportSize( viewport ); + for ( const path of [ + '/', + '/music/', + '/podcasts/', + '/about/', + '/topic/code/', + '/?s=fixture-that-cannot-exist', + '/this-route-does-not-exist/', + ] ) { + await page.goto( path ); + await injectAxe( page ); + const violations = await page.evaluate( async ( runOnly ) => { + const result = await globalThis.axe.run( document, { + runOnly: { type: 'tag', values: runOnly }, + } ); + return result.violations.map( ( violation ) => ( { + id: violation.id, + impact: violation.impact, + nodes: violation.nodes.map( ( node ) => node.target ), + } ) ); + }, tags ); + expect( violations, `${ path } at ${ viewport.width }px` ).toEqual( [] ); + } + } +} ); diff --git a/tests/fixtures/pages.json b/tests/fixtures/pages.json new file mode 100644 index 0000000..7138d9a --- /dev/null +++ b/tests/fixtures/pages.json @@ -0,0 +1,51 @@ +[ + { + "fixtureKey": "page-home", + "slug": "home", + "title": "CHRNX", + "status": "publish", + "content": "" + }, + { + "fixtureKey": "page-journal", + "slug": "journal", + "title": "Journal", + "status": "publish", + "content": "

Notas desde el taller

" + }, + { + "fixtureKey": "page-projects", + "slug": "projects", + "title": "Projects", + "status": "publish", + "content": "

Software · investigación · sistemas expresivos

" + }, + { + "fixtureKey": "page-music", + "slug": "music", + "title": "Music", + "status": "publish", + "content": "" + }, + { + "fixtureKey": "page-podcasts", + "slug": "podcasts", + "title": "Podcasts", + "status": "publish", + "content": "" + }, + { + "fixtureKey": "page-about", + "slug": "about", + "title": "About", + "status": "publish", + "content": "" + }, + { + "fixtureKey": "page-subscribe", + "slug": "subscribe", + "title": "Subscribe", + "status": "publish", + "content": "

Stay close to the work

New notes, experiments, music, and conversations. The final subscription provider will be connected before launch.

" + } +] diff --git a/tests/fixtures/posts.json b/tests/fixtures/posts.json new file mode 100644 index 0000000..81626ed --- /dev/null +++ b/tests/fixtures/posts.json @@ -0,0 +1,107 @@ +[ + { + "fixtureKey": "post-code-primary", + "title": "Emotion is not a slider: designing expressive systems that can hesitate", + "excerpt": "A working note on modeling emotional state without flattening behavior into a single number.", + "content": "

Expressive software gets interesting when uncertainty is part of the model instead of an error to erase.

const state = observe(world);\nconst choice = agent.respond(state, { uncertainty: true });
", + "topic": "code", + "language": "en", + "featured": true + }, + { + "fixtureKey": "post-research-primary", + "title": "What game AI can learn from the uncomfortable space between intention and action", + "excerpt": "Research notes from the intersection of emotion modeling, agency, and believable play.", + "content": "

My research asks how internal state becomes behavior players can read without turning a character into a dashboard.

", + "topic": "research", + "language": "en", + "featured": true + }, + { + "fixtureKey": "post-gaming-primary", + "title": "The save file remembers what the hero pretends to forget", + "excerpt": "A design sketch about memory, consequence, and the stories systems tell behind our backs.", + "content": "

Games become personal when the system remembers a decision after the player has renamed it.

", + "topic": "gaming", + "language": "en", + "featured": true + }, + { + "fixtureKey": "post-literature-long", + "title": "Escribir cuando la casa por fin se queda en silencio y cada pequeño ruido parece tener una opinión larguísima sobre el borrador abierto", + "excerpt": "Notas sobre escribir de noche, editar sin piedad y conservar la parte que todavía respira.", + "content": "

La noche no vuelve más inteligente al texto, pero sí deja escuchar dónde está fingiendo.

", + "topic": "literature", + "language": "es", + "fixtureState": "long-title" + }, + { + "fixtureKey": "post-music-studio", + "title": "Una cuerda rota también puede decidir el arreglo", + "excerpt": "Diario de producción de The No Names: estudio crudo, cero live.", + "content": "

La toma no quedó limpia. Quedó viva, que para este disco importa bastante más.

", + "topic": "music", + "language": "es", + "fixtureState": "missing-media" + }, + { + "fixtureKey": "post-podcast-episode", + "title": "Silicon Ranch: conversaciones sin diapositivas", + "excerpt": "Un episodio local de demostración para probar estructura, metadatos y estados sin publicar datos de cohosts.", + "content": "

Este contenido existe únicamente como fixture local del tema.

", + "topic": "podcasts", + "language": "es", + "show": "silicon-ranch", + "episodeNumber": 2, + "episodeDuration": "58:24" + }, + { + "fixtureKey": "post-podcast-missing-meta", + "title": "Conversación pendiente de datos editoriales", + "excerpt": "Estado de prueba para un episodio sin show ni duración asignados.", + "content": "

El tema debe seguir siendo claro aunque la ficha editorial todavía esté incompleta.

", + "topic": "podcasts", + "language": "es", + "fixtureState": "missing-podcast-meta" + }, + { + "fixtureKey": "post-life-fatherhood", + "title": "Tres voces en casa y una idea que tendrá que esperar", + "excerpt": "La vida diaria no interrumpe el trabajo: le da escala, límites y sentido.", + "content": "

Hay ideas que mejoran cuando esperan a que termine la tarea, el juego o la conversación importante.

", + "topic": "life", + "language": "es" + }, + { + "fixtureKey": "post-code-open-source", + "title": "Small interfaces, fewer lies", + "excerpt": "Why narrow APIs often produce software that is easier to trust and maintain.", + "content": "

A public interface is a promise. Smaller promises leave less room for accidental fiction.

", + "topic": "code", + "language": "en" + }, + { + "fixtureKey": "post-research-paper", + "title": "From a paper to a playable question", + "excerpt": "Turning published research into experiments that can be felt, inspected, and challenged.", + "content": "

Publication is not the end of an idea. It is where other people finally get a fair chance to disagree with it.

", + "topic": "research", + "language": "en" + }, + { + "fixtureKey": "post-gaming-accessibility", + "title": "Difficulty is a conversation, not a gate", + "excerpt": "A note about challenge, access, and respecting different ways of reading a game.", + "content": "

Accessibility does not remove authorship. It gives more players a route into it.

", + "topic": "gaming", + "language": "en" + }, + { + "fixtureKey": "post-literature-draft", + "title": "El monstruo en el margen", + "excerpt": "Un fragmento breve sobre notas que empiezan como correcciones y terminan confesando otra historia.", + "content": "

La tinta sabía algo que el narrador todavía no.

", + "topic": "literature", + "language": "es" + } +] diff --git a/tests/php/PatternsTest.php b/tests/php/PatternsTest.php index 85bdb82..47038c5 100644 --- a/tests/php/PatternsTest.php +++ b/tests/php/PatternsTest.php @@ -59,10 +59,11 @@ class PatternsTest extends WP_UnitTestCase { /** Local art is generated through escaped theme URIs with intrinsic dimensions. */ public function test_art_patterns_use_only_escaped_local_theme_images() { foreach ( array( 'home-music', 'music-landing', 'podcast-landing', 'podcast-show' ) as $name ) { - $source = file_get_contents( get_theme_file_path( 'patterns/' . $name . '.php' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture. - $content = $this->render_pattern( get_theme_file_path( 'patterns/' . $name . '.php' ) ); - $this->assertStringContainsString( 'get_theme_file_uri(', $source, $name ); - $this->assertStringContainsString( 'esc_url(', $source, $name ); + $source = file_get_contents( get_theme_file_path( 'patterns/' . $name . '.php' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture. + $content = $this->render_pattern( get_theme_file_path( 'patterns/' . $name . '.php' ) ); + $uses_responsive_helper = str_contains( $source, 'chrnx_get_topic_portrait_markup(' ); + $uses_direct_uri = str_contains( $source, 'get_theme_file_uri(' ) && str_contains( $source, 'esc_url(' ); + $this->assertTrue( $uses_responsive_helper || $uses_direct_uri, $name ); $this->assertMatchesRegularExpression( '/]*\bwidth="1122"[^>]*\bheight="1402"/i', $content, $name ); $this->assertMatchesRegularExpression( '/]*\bloading="lazy"[^>]*\bdecoding="async"/i', $content, $name ); } diff --git a/tests/php/ResponsiveMediaTest.php b/tests/php/ResponsiveMediaTest.php new file mode 100644 index 0000000..fe8db21 --- /dev/null +++ b/tests/php/ResponsiveMediaTest.php @@ -0,0 +1,30 @@ +assertStringContainsString( 'assertStringContainsString( 'type="image/avif"', $markup ); + $this->assertStringContainsString( 'type="image/webp"', $markup ); + $this->assertStringContainsString( 'alter-ego-code.png', $markup ); + $this->assertStringContainsString( 'width="1122"', $markup ); + $this->assertStringContainsString( 'height="1402"', $markup ); + $this->assertStringContainsString( 'loading="lazy"', $markup ); + $this->assertStringContainsString( 'decoding="async"', $markup ); + $this->assertStringContainsString( 'sizes="(max-width: 599px) 70vw, 384px"', $markup ); + $this->assertStringContainsString( 'alt="Code workshop portrait"', $markup ); + } + + /** Unknown topic values cannot synthesize asset paths. */ + public function test_unknown_topic_portrait_returns_empty_markup() { + $this->assertSame( '', chrnx_get_topic_portrait_markup( '../../private', '', '' ) ); + } +} diff --git a/tests/smoke/e2e-harness.test.mjs b/tests/smoke/e2e-harness.test.mjs index 46767a6..f7dd10b 100644 --- a/tests/smoke/e2e-harness.test.mjs +++ b/tests/smoke/e2e-harness.test.mjs @@ -2,13 +2,15 @@ import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; -test( 'Playwright seeds editorial prerequisites once outside browser workers', async () => { +test( 'Playwright seeds deterministic local fixtures once outside browser workers', async () => { const config = await readFile( 'playwright.config.mjs', 'utf8' ); const setup = await readFile( 'tests/e2e/global-setup.mjs', 'utf8' ); + const seed = await readFile( 'scripts/seed-test-content.php', 'utf8' ); const spec = await readFile( 'tests/e2e/editorial-editor.spec.mjs', 'utf8' ); assert.match( config, /globalSetup:\s*['"]\.\/tests\/e2e\/global-setup\.mjs['"]/ ); - assert.match( setup, /wp-env.*chrnx_seed_editorial_terms\(\);/s ); - assert.equal( setup.match( /chrnx_seed_editorial_terms/g )?.length, 1 ); + assert.match( setup, /execFileSync\(\s*['"]\.\/scripts\/seed-test-content\.sh['"]/s ); + assert.equal( setup.match( /seed-test-content\.sh/g )?.length, 1 ); + assert.equal( seed.match( /chrnx_seed_editorial_terms\(\);/g )?.length, 1 ); assert.doesNotMatch( spec, /wp-env|execFileSync|beforeAll/ ); } ); diff --git a/tests/smoke/visual-integration.test.mjs b/tests/smoke/visual-integration.test.mjs new file mode 100644 index 0000000..15d778b --- /dev/null +++ b/tests/smoke/visual-integration.test.mjs @@ -0,0 +1,69 @@ +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { test } from 'node:test'; + +const read = ( path ) => readFileSync( new URL( `../../${ path }`, import.meta.url ), 'utf8' ); + +test( 'local visual fixtures define stable pages and representative editorial states', () => { + const pages = JSON.parse( read( 'tests/fixtures/pages.json' ) ); + const posts = JSON.parse( read( 'tests/fixtures/posts.json' ) ); + + assert.deepEqual( + pages.map( ( page ) => page.slug ), + [ 'home', 'journal', 'projects', 'music', 'podcasts', 'about', 'subscribe' ], + ); + assert.ok( pages.every( ( page ) => page.fixtureKey && page.status === 'publish' ) ); + assert.ok( posts.length >= 10 ); + assert.ok( posts.some( ( post ) => post.title.length > 100 ) ); + assert.ok( posts.some( ( post ) => post.content.includes( 'wp:code' ) ) ); + assert.ok( posts.some( ( post ) => post.fixtureState === 'missing-media' ) ); + assert.ok( posts.some( ( post ) => post.fixtureState === 'missing-podcast-meta' ) ); + for ( const topic of [ 'code', 'research', 'gaming', 'literature', 'music', 'podcasts', 'life' ] ) { + assert.ok( posts.some( ( post ) => post.topic === topic ), `missing ${ topic } fixture` ); + } +} ); + +test( 'the seed entrypoint is explicitly local-only and uses a stable fixture key', () => { + const shell = read( 'scripts/seed-test-content.sh' ); + const php = read( 'scripts/seed-test-content.php' ); + + assert.match( shell, /localhost|127\.0\.0\.1/ ); + assert.match( shell, /wp eval-file/ ); + assert.match( php, /_chrnx_fixture_key/ ); + assert.match( php, /show_on_front/ ); + assert.match( php, /page_on_front/ ); + assert.match( php, /page_for_posts/ ); +} ); + +test( 'the visual layer is separately enqueued and covers responsive accessible states', () => { + const assets = read( 'inc/assets.php' ); + const components = read( 'assets/css/components.css' ); + + assert.match( assets, /chrnx-components/ ); + assert.match( components, /\.chrnx-section-portrait/ ); + assert.match( components, /prefers-reduced-motion/ ); + assert.match( components, /@media \(max-width: 599px\)/ ); + assert.match( components, /html\[data-theme="light"\]/ ); +} ); + +test( 'all approved portraits expose reproducible WebP and AVIF derivatives', () => { + for ( const topic of [ 'code', 'gaming', 'life', 'literature', 'podcasts', 'research' ] ) { + const manifest = JSON.parse( read( `assets/images/generated/alter-ego-${ topic }.json` ) ); + assert.equal( manifest.source, `alter-ego-${ topic }.png` ); + assert.deepEqual( manifest.formats, [ 'avif', 'webp' ] ); + assert.deepEqual( manifest.widths, [ 384, 768 ] ); + } +} ); + +test( 'front page and section pages connect the real editorial patterns', () => { + const front = read( 'templates/front-page.html' ); + assert.match( front, /chrnx\/home-intro/ ); + assert.match( front, /chrnx\/featured-stories/ ); + assert.match( front, /chrnx\/journal-stream/ ); + assert.match( front, /chrnx\/latest-podcast/ ); + + const fixtures = read( 'tests/fixtures/pages.json' ); + for ( const slug of [ 'chrnx/about', 'chrnx/music-landing', 'chrnx/podcast-landing' ] ) { + assert.match( fixtures, new RegExp( slug.replace( '/', '\\/' ) ) ); + } +} );