style: refine CHRNX canvas and hero

This commit is contained in:
chrnx committed 2026-08-12 14:40:06 -05:00
1 parent c95d8ffa9a
commit f56ea601d2
3 files changed
+111 -19

No files matched your search

+29 -19
View File
@@ -51,14 +51,18 @@ html[data-theme="light"] {
}
}
body {
body,
html[data-theme="dark"] body,
html[data-theme="light"] body,
:root:not([data-theme]) 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;
radial-gradient(circle at 90% 6%, color-mix(in srgb, var(--chrnx-accent) 16%, transparent), transparent 34rem),
radial-gradient(circle at 8% 42%, color-mix(in srgb, var(--chrnx-green) 8%, transparent), transparent 30rem),
linear-gradient(165deg, color-mix(in srgb, var(--chrnx-surface) 22%, transparent), transparent 42%, color-mix(in srgb, var(--chrnx-accent) 5%, transparent));
background-position: center top, center 36rem, center;
background-repeat: no-repeat, no-repeat, no-repeat;
background-size: 100% 48rem, 100% 54rem, 100% 100%;
color: var(--chrnx-text);
}
@@ -109,12 +113,14 @@ footer a {
border-top: 1px solid var(--chrnx-line);
}
.chrnx-home-intro {
.chrnx-home > .chrnx-home-intro {
position: relative;
display: grid;
min-height: min(74vh, 48rem);
box-sizing: border-box;
min-height: min(64vh, 42rem);
align-content: center;
padding-right: clamp(0rem, 15vw, 12rem);
padding-block: clamp(3rem, 5vh, 4rem);
padding-right: clamp(0rem, 12vw, 9rem);
}
.chrnx-home-intro::before {
@@ -141,17 +147,18 @@ footer a {
}
.chrnx-home-intro h1 {
max-width: 13ch;
max-width: 18ch;
margin: 0;
font-size: var(--wp--preset--font-size--display);
font-size: clamp(2.35rem, 1.75rem + 2.8vw, 4.25rem);
line-height: 1.08;
letter-spacing: -0.035em;
}
.chrnx-home-intro p {
max-width: 58ch;
margin-top: 1.5rem;
margin-top: 1.25rem;
color: var(--chrnx-muted);
font-size: var(--wp--preset--font-size--large);
font-size: clamp(1.125rem, 1.02rem + 0.45vw, 1.5rem);
}
.chrnx-featured-stories > h2,
@@ -723,10 +730,6 @@ html[data-theme="light"] .chrnx-home-music p {
@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,
@@ -735,11 +738,18 @@ html[data-theme="light"] .chrnx-home-music p {
padding-block: 3.5rem;
}
.chrnx-home-intro {
min-height: 38rem;
.chrnx-home > .chrnx-home-intro {
min-height: auto;
max-height: 34rem;
align-content: start;
padding-block: 2.5rem;
padding-right: 0;
}
.chrnx-home-intro h1 {
font-size: clamp(2.2rem, 10vw, 2.75rem);
}
.chrnx-home-intro::after {
display: none;
}
+54
View File
@@ -35,6 +35,60 @@ test( 'home remains coherent at all approved review viewports', async ( { page }
}
} );
test( 'explicit themes use an atmospheric canvas and a compact home introduction', async ( {
page,
} ) => {
const canvases = new Map();
for ( const theme of [ 'Dark', 'Light' ] ) {
await page.setViewportSize( { width: 1440, height: 900 } );
await page.goto( '/' );
await page.getByRole( 'radio', { name: theme, exact: true } ).check();
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', theme.toLowerCase() );
const desktop = await page.evaluate( () => {
const hero = document.querySelector( '.chrnx-home-intro' );
const bodyStyle = window.getComputedStyle( document.body );
const heroRect = hero.getBoundingClientRect();
return {
backgroundColor: bodyStyle.backgroundColor,
backgroundImage: bodyStyle.backgroundImage,
backgroundRepeat: bodyStyle.backgroundRepeat,
backgroundSize: bodyStyle.backgroundSize,
heroHeight: heroRect.height,
};
} );
expect( desktop.backgroundImage ).toMatch( /(?:radial|linear)-gradient/ );
expect( desktop.backgroundImage ).not.toBe( 'none' );
expect(
desktop.backgroundRepeat.split( ', ' ).every( ( value ) => value === 'no-repeat' ),
).toBeTruthy();
expect( desktop.backgroundSize ).not.toMatch( /(?:32|48)px\s+(?:32|48)px/ );
expect( desktop.heroHeight ).toBeGreaterThanOrEqual( 900 * 0.6 - 1 );
expect( desktop.heroHeight ).toBeLessThanOrEqual( 900 * 0.68 + 1 );
expect( desktop.heroHeight ).toBeLessThanOrEqual( 42 * 16 + 1 );
canvases.set( theme, `${ desktop.backgroundColor } ${ desktop.backgroundImage }` );
await page.setViewportSize( { width: 375, height: 812 } );
const mobile = await page.locator( '.chrnx-home-intro' ).evaluate( ( hero ) => {
const heroRect = hero.getBoundingClientRect();
const paragraphRect = hero.querySelector( 'p' ).getBoundingClientRect();
const style = window.getComputedStyle( hero );
return {
height: heroRect.height,
trailingSpace: heroRect.bottom - paragraphRect.bottom,
sectionSpacing: Number.parseFloat( style.paddingBottom ),
};
} );
expect( mobile.height ).toBeLessThanOrEqual( 34 * 16 + 1 );
expect( mobile.trailingSpace ).toBeLessThanOrEqual( mobile.sectionSpacing + 1 );
}
expect( canvases.get( 'Dark' ) ).not.toBe( canvases.get( 'Light' ) );
} );
test( 'seeded post permalink resolves its single template', async ( { page } ) => {
const title = 'The save file remembers what the hero pretends to forget';
const expectedPath = '/the-save-file-remembers-what-the-hero-pretends-to-forget/';
+28
View File
@@ -76,6 +76,34 @@ test( 'the visual layer is separately enqueued and covers responsive accessible
assert.match( components, /html\[data-theme="light"\]/ );
} );
test( 'the page canvas is atmospheric rather than a repeating grid', () => {
const components = read( 'assets/css/components.css' );
const bodyRule = components.match( /body,[\s\S]*?:root:not\(\[data-theme\]\) body\s*\{(?<declarations>[\s\S]*?)\n\}/ )?.groups?.declarations ?? '';
assert.match( bodyRule, /background-repeat:\s*no-repeat(?:,\s*no-repeat)*;/ );
assert.doesNotMatch(
bodyRule,
/linear-gradient\([^)]*1px,\s*transparent\s+1px\)[\s\S]*linear-gradient\(90deg,[^)]*1px,\s*transparent\s+1px\)/,
);
assert.doesNotMatch( bodyRule, /background-size:\s*[^;]*(?:2|3)rem\s+(?:2|3)rem/ );
assert.doesNotMatch(
components,
/@media\s*\(max-width:\s*599px\)[\s\S]*?body\s*\{[\s\S]*?background-size:/,
);
} );
test( 'the home introduction declares compact desktop and mobile bounds', () => {
const components = read( 'assets/css/components.css' );
const desktopRule = components.match( /\.chrnx-home\s*>\s*\.chrnx-home-intro\s*\{(?<declarations>[\s\S]*?)\n\}/ )?.groups?.declarations ?? '';
const mobileRules = components.match( /@media\s*\(max-width:\s*599px\)[\s\S]*$/ )?.[ 0 ] ?? '';
const mobileRule = mobileRules.match( /\.chrnx-home\s*>\s*\.chrnx-home-intro\s*\{(?<declarations>[\s\S]*?)\n\t\}/ )?.groups?.declarations ?? '';
assert.match( desktopRule, /min-height:\s*min\((?:6[0-8])vh,\s*42rem\);/ );
assert.match( mobileRule, /min-height:\s*auto;/ );
assert.match( mobileRule, /max-height:\s*34rem;/ );
assert.match( mobileRule, /align-content:\s*start;/ );
} );
test( 'all approved portraits rebuild byte-identically within payload bounds', () => {
const readme = read( 'README.md' );
const documentedCommand = 'mktemp -d "${TMPDIR:-/tmp}/chrnx-responsive.XXXXXX"';