diff --git a/assets/css/components.css b/assets/css/components.css index c5be0be..a01978f 100644 --- a/assets/css/components.css +++ b/assets/css/components.css @@ -450,15 +450,33 @@ footer a { object-fit: cover; } +.chrnx-home > .chrnx-home-projects, +.chrnx-home > .chrnx-home-music, +.chrnx-home > .wp-block-chrnx-latest-podcast, +.chrnx-home > .chrnx-home-about-preview, +.chrnx-home > .wp-block-chrnx-subscribe-cta { + margin-block-start: var(--wp--preset--spacing--70); + padding-block: var(--wp--preset--spacing--60); + border-top: 0; +} + +.chrnx-home > .chrnx-home-music { + padding-block: 0; +} + .chrnx-home-projects { position: relative; isolation: isolate; - min-height: 38rem; + min-height: 34rem; overflow: hidden; + padding-inline: clamp(1.5rem, 5vw, 4rem); + border: 1px solid var(--chrnx-line); border-radius: calc(var(--chrnx-radius) * 1.5); - background: + background-color: var(--chrnx-surface); + background-image: linear-gradient(125deg, var(--chrnx-surface) 0 58%, transparent 58%), radial-gradient(circle at 80% 35%, var(--chrnx-accent-soft), transparent 48%); + box-shadow: var(--chrnx-shadow); } .chrnx-home-projects > h2, @@ -472,6 +490,7 @@ footer a { display: grid; gap: 0; grid-template-columns: 1fr; + margin-bottom: 0; border-top: 1px solid var(--chrnx-line); } @@ -498,32 +517,50 @@ footer a { .chrnx-home-projects > .chrnx-responsive-portrait { position: absolute; z-index: 1; - right: -2rem; + right: clamp(0.5rem, 3vw, 2rem); bottom: 0; - width: min(43%, 25rem); + width: min(41%, 23rem); } .chrnx-home-projects > .chrnx-responsive-portrait:last-child { z-index: 0; - right: 22%; - width: min(30%, 17rem); - opacity: 0.3; - filter: saturate(0.6); + right: 24%; + width: min(28%, 15rem); + opacity: 0.38; + filter: saturate(0.55) contrast(1.08) drop-shadow(0 1rem 2rem rgb(0 0 0 / 24%)); } .chrnx-home-music .wp-block-columns { position: relative; + isolation: isolate; 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%), + background-color: #0d1117; + background-image: + linear-gradient(110deg, rgb(13 17 23 / 98%) 0 44%, rgb(13 17 23 / 66%) 68%, rgb(13 17 23 / 84%)), linear-gradient(145deg, #54260f, #0d1117 75%); + box-shadow: 0 2rem 5rem rgb(0 0 0 / 28%); color: #e6edf3; } +.chrnx-home-music .wp-block-columns::before { + position: absolute; + z-index: 0; + inset: 0; + background-image: + linear-gradient(90deg, rgb(13 17 23 / 62%), rgb(13 17 23 / 8%)), + url(../images/the-no-names-collage.jpeg); + background-position: center, 72% 42%; + background-repeat: no-repeat; + background-size: cover; + content: ""; + filter: saturate(0.72) contrast(1.08); + opacity: 0.72; +} + .chrnx-home-music h2 { color: #e6edf3; } @@ -551,16 +588,32 @@ html[data-theme="light"] .chrnx-home-music p { } .chrnx-home-music .wp-block-column:last-child { + position: relative; + z-index: 2; align-self: end; } .chrnx-home-music .chrnx-responsive-portrait { width: min(100%, 29rem); - margin: auto auto -5rem; + margin: auto auto 0; + filter: drop-shadow(0 1.5rem 2rem rgb(0 0 0 / 42%)); +} + +.chrnx-home-music__art { + max-height: 30rem; + object-fit: contain; + object-position: center bottom; + filter: contrast(1.06) saturate(0.9); } .chrnx-latest-podcast { position: relative; + padding-inline: clamp(1.5rem, 5vw, 4rem); + border: 1px solid color-mix(in srgb, #58a7d8 36%, var(--chrnx-line)); + border-radius: calc(var(--chrnx-radius) * 1.25); + background-color: var(--chrnx-surface-raised); + background-image: linear-gradient(135deg, color-mix(in srgb, #58a7d8 12%, transparent), transparent 58%); + box-shadow: 0 1.25rem 3rem rgb(0 0 0 / 12%); } .chrnx-latest-podcast::before { @@ -582,9 +635,38 @@ html[data-theme="light"] .chrnx-home-music p { .chrnx-home-about-preview, .chrnx-subscribe-cta { display: grid; - grid-template-columns: minmax(0, 1fr) auto; - align-items: end; + align-items: start; gap: 2rem; + padding-inline: clamp(1.5rem, 5vw, 4rem); + border-radius: var(--chrnx-radius); +} + +.chrnx-home-about-preview { + grid-template-columns: minmax(12rem, 0.65fr) minmax(0, 1.35fr); + border: 1px solid var(--chrnx-line); + border-left: 0.35rem solid var(--chrnx-accent); + background-color: var(--chrnx-surface); + background-image: linear-gradient(105deg, var(--chrnx-accent-soft), transparent 48%); +} + +.chrnx-subscribe-cta { + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + border: 1px solid color-mix(in srgb, var(--chrnx-green) 44%, var(--chrnx-line)); + background-color: var(--chrnx-surface-raised); + background-image: linear-gradient(115deg, color-mix(in srgb, var(--chrnx-green) 14%, transparent), transparent 62%); + box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chrnx-green) 8%, transparent); +} + +.chrnx-subscribe-cta__title, +.chrnx-subscribe-cta p { + grid-column: 1; + margin-block: 0; +} + +.chrnx-subscribe-cta__link { + grid-column: 2; + grid-row: 1 / span 2; } .chrnx-home-about-preview p, @@ -866,7 +948,7 @@ html[data-theme="light"] .chrnx-home-music p { } .chrnx-home-projects { - min-height: 42rem; + min-height: 36rem; padding-inline: 1.5rem; } @@ -876,8 +958,8 @@ html[data-theme="light"] .chrnx-home-music p { } .chrnx-home-projects > .chrnx-responsive-portrait { - right: -3rem; - width: min(72%, 21rem); + right: 0; + width: min(68%, 19rem); } .chrnx-home-projects > .chrnx-responsive-portrait:last-child { @@ -888,6 +970,31 @@ html[data-theme="light"] .chrnx-home-music p { padding: 2rem 1.5rem 0; } + .chrnx-home > .chrnx-home-music { + padding-block: 0; + } + + .chrnx-home-music .wp-block-columns::before { + background-position: center, 60% center; + opacity: 0.56; + } + + .chrnx-home-music .chrnx-responsive-portrait { + width: min(82%, 20rem); + } + + .chrnx-home-about-preview, + .chrnx-subscribe-cta { + grid-template-columns: 1fr; + gap: 1rem; + } + + .chrnx-subscribe-cta__link { + grid-column: 1; + grid-row: auto; + justify-self: start; + } + .chrnx-topic-hero { min-height: 36rem; grid-template-columns: 1fr; diff --git a/tests/e2e/visual-states.spec.mjs b/tests/e2e/visual-states.spec.mjs index d4b45ed..c994426 100644 --- a/tests/e2e/visual-states.spec.mjs +++ b/tests/e2e/visual-states.spec.mjs @@ -52,6 +52,158 @@ test( 'home remains coherent at all approved review viewports', async ( { page } } } ); +test( 'lower home sections form compact, contained editorial panels in both themes', async ( { + page, +} ) => { + const expectedOrder = [ + 'chrnx-home-projects', + 'chrnx-home-music', + 'wp-block-chrnx-latest-podcast', + 'chrnx-home-about-preview', + 'wp-block-chrnx-subscribe-cta', + ]; + + for ( const theme of [ 'Dark', 'Light' ] ) { + for ( const viewport of viewports ) { + await page.setViewportSize( viewport ); + await page.goto( '/' ); + await page.evaluate( + ( value ) => window.localStorage.setItem( 'chrnx-theme', value ), + theme.toLowerCase(), + ); + await page.reload(); + await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', theme.toLowerCase() ); + + const result = await page.locator( '.chrnx-home' ).evaluate( ( home, order ) => { + const selectors = [ + '.chrnx-home-projects', + '.chrnx-home-music .wp-block-columns', + '.chrnx-latest-podcast', + '.chrnx-home-about-preview', + '.chrnx-subscribe-cta', + ]; + const panels = selectors.map( ( selector ) => home.querySelector( selector ) ); + const bodyStyle = window.getComputedStyle( document.body ); + const canvas = `${ bodyStyle.backgroundColor }|${ bodyStyle.backgroundImage }`; + const spacingProbe = document.createElement( 'div' ); + spacingProbe.style.cssText = + 'position:absolute;visibility:hidden;width:var(--wp--preset--spacing--70);height:1px'; + document.body.append( spacingProbe ); + const xl = spacingProbe.getBoundingClientRect().width; + spacingProbe.remove(); + const signature = ( element ) => { + const style = window.getComputedStyle( element ); + return `${ style.backgroundColor }|${ style.backgroundImage }|${ style.borderTopColor }|${ style.boxShadow }`; + }; + const hasOpaqueSurface = ( element ) => { + const style = window.getComputedStyle( element ); + return ( + style.backgroundColor !== 'rgba(0, 0, 0, 0)' && style.backgroundColor !== 'transparent' + ); + }; + const isTreated = ( element ) => { + const style = window.getComputedStyle( element ); + return ( + style.filter !== 'none' || + style.boxShadow !== 'none' || + style.maskImage !== 'none' || + style.webkitMaskImage !== 'none' + ); + }; + const isContained = ( child, frame ) => { + const childRect = child.getBoundingClientRect(); + const frameRect = frame.getBoundingClientRect(); + return ( + childRect.left >= frameRect.left - 1 && + childRect.right <= frameRect.right + 1 && + childRect.top >= frameRect.top - 1 && + childRect.bottom <= frameRect.bottom + 1 + ); + }; + const panelRects = panels.map( ( panel ) => panel.getBoundingClientRect() ); + const journalRect = home.querySelector( '.chrnx-journal-stream' ).getBoundingClientRect(); + const musicFrame = panels[ 1 ]; + const collage = window.getComputedStyle( musicFrame, '::before' ); + const musician = musicFrame.querySelector( '.chrnx-home-music__art' ); + const projectPortraits = [ + ...panels[ 0 ].querySelectorAll( '.chrnx-section-portrait' ), + ].filter( ( portrait ) => portrait.getClientRects().length > 0 ); + + return { + directOrder: [ ...home.children ] + .filter( ( child ) => + order.some( ( className ) => child.classList.contains( className ) ), + ) + .map( ( child ) => + order.find( ( className ) => child.classList.contains( className ) ), + ), + signatures: panels.map( signature ), + opaqueSurfaces: panels.map( hasOpaqueSurface ), + canvas, + xl, + gaps: [ + panelRects[ 0 ].top - journalRect.bottom, + ...panelRects + .slice( 1 ) + .map( ( rect, index ) => rect.top - panelRects[ index ].bottom ), + ], + projectsContained: projectPortraits.every( ( portrait ) => + isContained( portrait, panels[ 0 ] ), + ), + projectsTreated: projectPortraits.every( isTreated ), + collageBackground: collage.backgroundImage, + collageContent: collage.content, + collageContained: + collage.position === 'absolute' && + [ collage.inset, collage.top, collage.right, collage.bottom, collage.left ] + .join( ' ' ) + .includes( '0px' ), + musicianContained: isContained( musician, musicFrame ), + musicianTreated: isTreated( musician ), + }; + }, expectedOrder ); + + expect( result.directOrder ).toEqual( expectedOrder ); + expect( result.xl ).toBeGreaterThan( 0 ); + expect( + result.gaps.every( ( gap ) => gap >= -1 && gap <= result.xl + 1 ), + `gaps ${ result.gaps.join( ', ' ) }; XL ${ result.xl } at ${ viewport.width }px ${ theme }`, + ).toBeTruthy(); + expect( new Set( result.signatures ).size ).toBe( result.signatures.length ); + expect( result.opaqueSurfaces.every( Boolean ) ).toBeTruthy(); + expect( + result.signatures.every( ( signature ) => signature !== result.canvas ), + ).toBeTruthy(); + expect( result.projectsContained ).toBeTruthy(); + expect( result.projectsTreated ).toBeTruthy(); + expect( result.collageBackground ).toContain( 'the-no-names-collage.jpeg' ); + expect( result.collageContent ).not.toBe( 'none' ); + expect( result.collageContained ).toBeTruthy(); + expect( result.musicianContained ).toBeTruthy(); + expect( result.musicianTreated ).toBeTruthy(); + await expectNoHorizontalOverflow( page ); + } + } +} ); + +test( 'lower home panels survive missing media and reduced motion', async ( { page } ) => { + await page.emulateMedia( { reducedMotion: 'reduce' } ); + await page.route( /\/assets\/images\//, ( route ) => route.abort() ); + await page.setViewportSize( { width: 375, height: 812 } ); + await page.goto( '/' ); + + for ( const selector of [ + '.chrnx-home-projects', + '.chrnx-home-music .wp-block-columns', + '.chrnx-latest-podcast', + '.chrnx-home-about-preview', + '.chrnx-subscribe-cta', + ] ) { + await expect( page.locator( selector ) ).toBeVisible(); + } + await expectNoHorizontalOverflow( page ); +} ); + test( 'explicit themes use an atmospheric canvas and a compact home introduction', async ( { page, } ) => { diff --git a/tests/smoke/visual-integration.test.mjs b/tests/smoke/visual-integration.test.mjs index 6522688..ad52b01 100644 --- a/tests/smoke/visual-integration.test.mjs +++ b/tests/smoke/visual-integration.test.mjs @@ -89,6 +89,47 @@ test( 'the page canvas is atmospheric rather than a repeating grid', () => { ); } ); +test( 'lower home sections preserve editorial order and define layered panel treatments', () => { + const front = read( 'templates/front-page.html' ); + const components = read( 'assets/css/components.css' ); + const orderedSections = [ + 'chrnx/home-projects', + 'chrnx/home-music', + 'chrnx/latest-podcast', + 'chrnx-home-about-preview', + 'chrnx/subscribe-cta', + ]; + let previousIndex = -1; + + for ( const section of orderedSections ) { + const currentIndex = front.indexOf( section ); + assert.ok( currentIndex > previousIndex, `${ section } must keep its semantic position` ); + previousIndex = currentIndex; + } + + assert.match( + components, + /\.chrnx-home-music \.wp-block-columns::before\s*\{[\s\S]*?the-no-names-collage\.jpeg/, + ); + assert.match( + components, + /\.chrnx-home-music \.chrnx-responsive-portrait\s*\{[\s\S]*?(?:filter|box-shadow|mask(?:-image)?):/, + ); + for ( const selector of [ + '.chrnx-home-projects', + '.chrnx-latest-podcast', + '.chrnx-home-about-preview', + '.chrnx-subscribe-cta', + ] ) { + const escapedSelector = selector.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' ); + assert.match( + components, + new RegExp( `${ escapedSelector }[^,{]*\\{[\\s\\S]*?background(?:-color|-image)?:` ), + `${ selector } needs an authored surface`, + ); + } +} ); + test( 'all approved portraits rebuild byte-identically within payload bounds', () => { const readme = read( 'README.md' ); const documentedCommand = 'mktemp -d "${TMPDIR:-/tmp}/chrnx-responsive.XXXXXX"';