From 041c5f539dec735e6c5c5f8b657ae7f50ae99cf1 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Thu, 13 Aug 2026 08:21:55 -0500 Subject: [PATCH] style: compose CHRNX grunge stages --- assets/css/components.css | 96 ++++-- blocks/latest-podcast/style.css | 47 ++- tests/e2e/music-podcast-stages.spec.mjs | 410 ++++++++++++++++++++++++ tests/e2e/visual-states.spec.mjs | 11 +- tests/smoke/visual-integration.test.mjs | 47 +++ 5 files changed, 585 insertions(+), 26 deletions(-) create mode 100644 tests/e2e/music-podcast-stages.spec.mjs diff --git a/assets/css/components.css b/assets/css/components.css index 078d4c4..a741d98 100644 --- a/assets/css/components.css +++ b/assets/css/components.css @@ -645,29 +645,6 @@ html[data-theme="light"] .chrnx-home-music p { letter-spacing: 0.12em; } -.chrnx-podcast-card__link { - display: block; - padding: clamp(1.5rem, 4vw, 3rem); -} - -@media (min-width: 781px) { - - .chrnx-podcast-card__link { - display: grid; - grid-template-columns: minmax(15rem, 0.72fr) minmax(0, 1.28fr); - align-items: stretch; - padding: clamp(1.25rem, 2.5vw, 2rem); - } - - .chrnx-podcast-card__image, - .chrnx-podcast-card__fallback { - height: 100%; - min-height: 15rem; - max-height: 19rem; - aspect-ratio: auto; - } -} - .chrnx-home-about-preview, .chrnx-subscribe-cta { display: grid; @@ -1330,6 +1307,79 @@ html[data-theme="light"] .chrnx-music-landing .chrnx-character-stage { --chrnx-character-accent: #58a7d8; } +/* Music and Podcast landing stage composition. */ + +.chrnx-music-landing .chrnx-character-stage, +.chrnx-podcast-landing .chrnx-character-stage { + min-height: min(38rem, 100vh); +} + +.chrnx-podcast-landing { + width: min(calc(100vw - 2rem), var(--wp--style--global--wide-size)); + max-width: none; + margin-inline: calc((100% - min(calc(100vw - 2rem), var(--wp--style--global--wide-size))) / 2); +} + +.chrnx-music-landing .chrnx-character-stage__atmosphere > .chrnx-responsive-portrait, +.chrnx-podcast-landing .chrnx-character-stage__atmosphere > .chrnx-responsive-portrait { + position: absolute; + inset: 0; + display: block; + width: 100%; + height: 100%; +} + +.chrnx-music-landing .chrnx-character-stage__atmosphere img, +.chrnx-podcast-landing .chrnx-character-stage__atmosphere img { + display: block; + width: 100%; + height: 100%; + object-fit: cover; +} + +.chrnx-music-landing .chrnx-character-stage__atmosphere img { + opacity: 0.58; +} + +.chrnx-podcast-landing .chrnx-character-stage__atmosphere img { + opacity: 0.5; +} + +.chrnx-music-landing .chrnx-character-stage__atmosphere::after, +.chrnx-podcast-landing .chrnx-character-stage__atmosphere::after { + background-image: + linear-gradient(90deg, rgb(13 17 23 / 82%) 0 36%, rgb(13 17 23 / 22%) 72%, rgb(13 17 23 / 48%)), + linear-gradient(180deg, transparent 62%, rgb(0 0 0 / 34%)); +} + +.chrnx-music-landing .chrnx-character-stage__content, +.chrnx-podcast-landing .chrnx-character-stage__content { + min-width: 0; +} + +.chrnx-music-landing .chrnx-character-stage__art, +.chrnx-podcast-landing .chrnx-character-stage__art { + align-self: end; + overflow: hidden; +} + +.chrnx-music-landing .chrnx-character-stage__art img, +.chrnx-podcast-landing .chrnx-character-stage__art img { + max-height: min(46rem, 100vh); + object-fit: contain; + object-position: center bottom; +} + +.chrnx-podcast-landing > .wp-block-chrnx-latest-podcast { + position: relative; + width: 100%; + max-width: none; + margin-block-start: clamp(1.5rem, 4vw, 3rem); + margin-inline: 0; +} + +/* End Music and Podcast landing stage composition. */ + .chrnx-about .chrnx-character-stage, .is-topic-life .chrnx-character-stage { --chrnx-character-accent: #e0b75b; diff --git a/blocks/latest-podcast/style.css b/blocks/latest-podcast/style.css index ae4dac3..eeeb02e 100644 --- a/blocks/latest-podcast/style.css +++ b/blocks/latest-podcast/style.css @@ -3,14 +3,57 @@ padding: var(--wp--preset--spacing--40, 1.5rem); } +.chrnx-podcast-card__link { + display: grid; + grid-template-columns: minmax(12rem, 34%) minmax(0, 1fr); + align-items: stretch; +} + +.chrnx-podcast-card__content { + min-width: 0; + overflow-wrap: normal; +} + .chrnx-podcast-card__image, .chrnx-podcast-card__fallback { - aspect-ratio: 3 / 2; display: block; - object-fit: cover; width: 100%; + max-width: 100%; + height: 100%; + min-height: 12rem; + max-height: 20rem; + overflow: hidden; + object-fit: cover; +} + +.chrnx-podcast-card__title, +.chrnx-podcast-card__excerpt, +.chrnx-podcast-card__badge { + overflow-wrap: normal; + word-break: normal; } .chrnx-podcast-card__fallback { background: linear-gradient(135deg, var(--wp--preset--color--green), var(--wp--preset--color--violet)); } + +@media (max-width: 720px) { + + .chrnx-podcast-card__link { + grid-template-columns: minmax(0, 1fr); + } + + .chrnx-podcast-card__image, + .chrnx-podcast-card__fallback { + height: auto; + min-height: 0; + aspect-ratio: 3 / 2; + } +} + +@media (min-width: 721px) { + + .chrnx-podcast-card__link { + grid-template-columns: minmax(12rem, 34%) minmax(0, 1fr); + } +} diff --git a/tests/e2e/music-podcast-stages.spec.mjs b/tests/e2e/music-podcast-stages.spec.mjs new file mode 100644 index 0000000..e62dff1 --- /dev/null +++ b/tests/e2e/music-podcast-stages.spec.mjs @@ -0,0 +1,410 @@ +import { expect, test } from '@playwright/test'; + +const REM_46 = 46 * 16; +const landings = [ + { + name: 'Music', + path: '/music/', + root: '.chrnx-music-landing', + atmosphere: '.chrnx-character-stage__collage', + art: 'img[src*="the-no-names-musician-cutout.png"]', + next: ':scope > p', + }, + { + name: 'Podcast', + path: '/podcasts/', + root: '.chrnx-podcast-landing', + atmosphere: '.chrnx-character-stage__frequency', + art: 'img[src*="alter-ego-podcasts.png"]', + next: ':scope > .wp-block-chrnx-latest-podcast', + }, +]; + +async function setTheme( page, theme ) { + await page.addInitScript( ( value ) => localStorage.setItem( 'chrnx-theme', value ), theme ); +} + +async function expectNoHorizontalOverflow( page ) { + const overflow = await page.evaluate( () => + Math.max( + document.documentElement.scrollWidth - window.innerWidth, + document.body.scrollWidth - window.innerWidth, + ), + ); + expect( overflow ).toBeLessThanOrEqual( 1 ); +} + +async function readStage( page, landing ) { + return page.locator( landing.root ).evaluate( ( root, value ) => { + const readRect = ( element ) => { + const bounds = element.getBoundingClientRect(); + return { + bottom: bounds.bottom, + height: bounds.height, + left: bounds.left, + right: bounds.right, + top: bounds.top, + width: bounds.width, + }; + }; + const stage = root.querySelector( '.chrnx-character-stage' ); + const atmosphereLayer = stage.querySelector( '.chrnx-character-stage__atmosphere' ); + const atmosphere = stage.querySelector( value.atmosphere ); + const content = stage.querySelector( '.chrnx-character-stage__content' ); + const artLayer = stage.querySelector( '.chrnx-character-stage__art' ); + const art = stage.querySelector( value.art ); + const next = root.querySelector( value.next ); + const stageRect = readRect( stage ); + const atmosphereLayerRect = readRect( atmosphereLayer ); + const atmosphereRect = readRect( atmosphere ); + const contentRect = readRect( content ); + const artLayerRect = readRect( artLayer ); + const artRect = readRect( art ); + const nextRect = readRect( next ); + const contained = ( child, parent ) => + child.left >= parent.left - 1 && + child.right <= parent.right + 1 && + child.top >= parent.top - 1 && + child.bottom <= parent.bottom + 1; + const overlaps = ( first, second ) => + first.left < second.right - 1 && + first.right > second.left + 1 && + first.top < second.bottom - 1 && + first.bottom > second.top + 1; + + return { + stage: stageRect, + atmosphere: atmosphereRect, + atmosphereLayer: atmosphereLayerRect, + atmosphereFit: window.getComputedStyle( atmosphere ).objectFit, + atmosphereHidden: atmosphereLayer.getAttribute( 'aria-hidden' ), + atmosphereContained: contained( atmosphereRect, stageRect ), + content: contentRect, + contentMinWidth: window.getComputedStyle( content ).minWidth, + art: artRect, + artLayer: artLayerRect, + artContained: contained( artRect, artLayerRect ) && contained( artLayerRect, stageRect ), + artBottomGap: Math.abs( stageRect.bottom - artLayerRect.bottom ), + contentArtOverlap: overlaps( contentRect, artLayerRect ), + next: nextRect, + nextOverlap: overlaps( stageRect, nextRect ), + stageOverflow: stage.scrollWidth - stage.clientWidth, + rootOverflow: root.scrollWidth - root.clientWidth, + }; + }, landing ); +} + +test( 'desktop grunge stages compose atmosphere, copy, art, and latest in both themes', async ( { + page, +} ) => { + test.setTimeout( 90_000 ); + await page.setViewportSize( { width: 1440, height: 900 } ); + + for ( const theme of [ 'dark', 'light' ] ) { + await setTheme( page, theme ); + for ( const landing of landings ) { + await page.goto( landing.path ); + const state = await readStage( page, landing ); + expect( state.stage.height, `${ landing.name } ${ theme } stage height` ).toBeLessThanOrEqual( + Math.min( 900, REM_46 ) + 1, + ); + expect( state.atmosphereContained ).toBeTruthy(); + expect( state.atmosphereFit ).toBe( 'cover' ); + expect( state.artContained ).toBeTruthy(); + expect( state.artBottomGap ).toBeLessThanOrEqual( 1 ); + expect( state.contentArtOverlap ).toBeFalsy(); + expect( state.next.top ).toBeGreaterThanOrEqual( state.stage.bottom - 1 ); + expect( state.nextOverlap ).toBeFalsy(); + expect( state.stageOverflow ).toBeLessThanOrEqual( 1 ); + expect( state.rootOverflow ).toBeLessThanOrEqual( 1 ); + if ( landing.name === 'Podcast' ) { + expect( state.atmosphereHidden ).toBe( 'true' ); + } + await expectNoHorizontalOverflow( page ); + } + } +} ); + +test( 'latest podcast preserves a real 28ch content column and bounded media', async ( { + page, +} ) => { + await page.setViewportSize( { width: 1440, height: 900 } ); + await page.goto( '/podcasts/' ); + const state = await page.locator( '.chrnx-latest-podcast' ).evaluate( ( panel ) => { + const readRect = ( element ) => { + const bounds = element.getBoundingClientRect(); + return { + bottom: bounds.bottom, + height: bounds.height, + left: bounds.left, + right: bounds.right, + top: bounds.top, + width: bounds.width, + }; + }; + const link = panel.querySelector( '.chrnx-podcast-card__link' ); + const media = panel.querySelector( + '.chrnx-podcast-card__image, .chrnx-podcast-card__fallback', + ); + const content = panel.querySelector( '.chrnx-podcast-card__content' ); + const title = content.querySelector( '.chrnx-podcast-card__title' ); + const probe = document.createElement( 'span' ); + const titleStyle = window.getComputedStyle( title ); + Object.assign( probe.style, { + fontFamily: titleStyle.fontFamily, + fontSize: titleStyle.fontSize, + fontWeight: titleStyle.fontWeight, + position: 'fixed', + visibility: 'hidden', + width: '28ch', + } ); + document.body.append( probe ); + const probeWidth = probe.getBoundingClientRect().width; + probe.remove(); + const panelRect = readRect( panel ); + const linkRect = readRect( link ); + const mediaRect = readRect( media ); + const contentRect = readRect( content ); + return { + display: window.getComputedStyle( link ).display, + columns: window.getComputedStyle( link ).gridTemplateColumns, + contentMinWidth: window.getComputedStyle( content ).minWidth, + contentWidth: contentRect.width, + probeWidth, + mediaRatio: mediaRect.width / linkRect.width, + mediaContained: mediaRect.left >= linkRect.left - 1 && mediaRect.right <= linkRect.right + 1, + panelOverflow: panel.scrollWidth - panel.clientWidth, + linkOverflow: link.scrollWidth - link.clientWidth, + contentOverflow: content.scrollWidth - content.clientWidth, + panelHeight: panelRect.height, + }; + } ); + expect( state.display ).toBe( 'grid' ); + expect( state.columns.split( ' ' ) ).toHaveLength( 2 ); + expect( state.contentMinWidth ).toBe( '0px' ); + expect( state.contentWidth ).toBeGreaterThanOrEqual( state.probeWidth - 1 ); + expect( state.mediaRatio ).toBeGreaterThanOrEqual( 0.28 ); + expect( state.mediaRatio ).toBeLessThanOrEqual( 0.42 ); + expect( state.mediaContained ).toBeTruthy(); + expect( state.panelOverflow ).toBeLessThanOrEqual( 1 ); + expect( state.linkOverflow ).toBeLessThanOrEqual( 1 ); + expect( state.contentOverflow ).toBeLessThanOrEqual( 1 ); +} ); + +test( 'mobile and tablet preserve text then art then following content', async ( { page } ) => { + for ( const width of [ 375, 768 ] ) { + await page.setViewportSize( { width, height: width === 375 ? 812 : 1024 } ); + for ( const landing of landings ) { + await page.goto( landing.path ); + const state = await readStage( page, landing ); + expect( state.content.height ).toBeGreaterThan( 0 ); + expect( state.art.height ).toBeGreaterThan( 0 ); + expect( state.content.bottom ).toBeLessThanOrEqual( state.artLayer.top + 1 ); + expect( state.artLayer.bottom ).toBeLessThanOrEqual( state.next.top + 1 ); + expect( state.contentArtOverlap ).toBeFalsy(); + expect( state.nextOverlap ).toBeFalsy(); + expect( state.stageOverflow ).toBeLessThanOrEqual( 1 ); + await expectNoHorizontalOverflow( page ); + } + } +} ); + +test( 'latest podcast stacks at 720px and becomes two columns at 721px', async ( { page } ) => { + for ( const [ width, expectedColumns ] of [ + [ 720, 1 ], + [ 721, 2 ], + ] ) { + await page.setViewportSize( { width, height: 1024 } ); + await page.goto( '/podcasts/' ); + const columns = await page + .locator( '.chrnx-podcast-card__link' ) + .evaluate( + ( link ) => window.getComputedStyle( link ).gridTemplateColumns.split( ' ' ).length, + ); + expect( columns, `${ width }px columns` ).toBe( expectedColumns ); + await expectNoHorizontalOverflow( page ); + } +} ); + +test( '200 percent zoom contains Music copy and Podcast card at narrow and wide viewports', async ( { + page, +} ) => { + test.setTimeout( 90_000 ); + for ( const width of [ 375, 1440 ] ) { + await page.setViewportSize( { width, height: width === 375 ? 812 : 900 } ); + for ( const landing of landings ) { + await page.goto( landing.path ); + await page.evaluate( () => { + document.documentElement.style.zoom = '2'; + } ); + expect( + await page.evaluate( () => window.getComputedStyle( document.documentElement ).zoom ), + ).toBe( '2' ); + const result = await page.locator( landing.root ).evaluate( ( root ) => { + const readRect = ( element ) => { + const bounds = element.getBoundingClientRect(); + return { + bottom: bounds.bottom, + height: bounds.height, + left: bounds.left, + right: bounds.right, + top: bounds.top, + width: bounds.width, + }; + }; + const stage = root.querySelector( '.chrnx-character-stage' ); + const content = stage.querySelector( '.chrnx-character-stage__content' ); + const title = root.querySelector( 'h2, h3, .chrnx-podcast-card__title' ); + const card = root.querySelector( '.chrnx-latest-podcast' ); + const isContained = ( child, parent ) => { + const childRect = readRect( child ); + const parentRect = readRect( parent ); + return childRect.left >= parentRect.left - 1 && childRect.right <= parentRect.right + 1; + }; + return { + copyContained: isContained( content, stage ), + titleClip: title.scrollWidth - title.clientWidth, + cardClip: card ? card.scrollWidth - card.clientWidth : 0, + stageClip: stage.scrollWidth - stage.clientWidth, + }; + } ); + expect( result.copyContained ).toBeTruthy(); + expect( result.titleClip ).toBeLessThanOrEqual( 1 ); + expect( result.cardClip ).toBeLessThanOrEqual( 1 ); + expect( result.stageClip ).toBeLessThanOrEqual( 1 ); + await expectNoHorizontalOverflow( page ); + } + } +} ); + +test( 'DOM-only long Podcast copy wraps normally without clipping', async ( { page } ) => { + for ( const width of [ 375, 1440 ] ) { + await page.setViewportSize( { width, height: width === 375 ? 812 : 900 } ); + await page.goto( '/podcasts/' ); + const state = await page.locator( '.chrnx-latest-podcast' ).evaluate( ( panel ) => { + const title = panel.querySelector( '.chrnx-podcast-card__title' ); + const excerpt = panel.querySelector( '.chrnx-podcast-card__excerpt' ); + const content = panel.querySelector( '.chrnx-podcast-card__content' ); + title.textContent = + 'Conversaciones profundamente humanas sobre software música investigación juegos y comunidad '.repeat( + 3, + ); + excerpt.textContent = + 'Una conversación extensa que conserva palabras reales y espacios normales para comprobar el ajuste editorial. '.repeat( + 10, + ); + const link = panel.querySelector( '.chrnx-podcast-card__link' ); + const titleStyle = window.getComputedStyle( title ); + return { + titleLength: title.textContent.length, + minWidth: window.getComputedStyle( content ).minWidth, + overflowWrap: titleStyle.overflowWrap, + wordBreak: titleStyle.wordBreak, + titleClip: title.scrollWidth - title.clientWidth, + excerptClip: excerpt.scrollWidth - excerpt.clientWidth, + contentClip: content.scrollWidth - content.clientWidth, + linkClip: link.scrollWidth - link.clientWidth, + panelClip: panel.scrollWidth - panel.clientWidth, + }; + } ); + expect( state.titleLength ).toBeGreaterThan( 120 ); + expect( state.minWidth ).toBe( '0px' ); + expect( state.overflowWrap ).toBe( 'normal' ); + expect( state.wordBreak ).toBe( 'normal' ); + expect( state.titleClip ).toBeLessThanOrEqual( 1 ); + expect( state.excerptClip ).toBeLessThanOrEqual( 1 ); + expect( state.contentClip ).toBeLessThanOrEqual( 1 ); + expect( state.linkClip ).toBeLessThanOrEqual( 1 ); + expect( state.panelClip ).toBeLessThanOrEqual( 1 ); + await expectNoHorizontalOverflow( page ); + } +} ); + +const immutableSurfaces = [ + { + name: 'Projects', + path: '/projects/', + root: '.chrnx-home-projects', + art: 'img[src*="alter-ego-code.png"]', + atmosphereCount: 1, + imageSources: [ 'alter-ego-research.png', 'alter-ego-code.png' ], + headings: [ 'Selected work', 'Expressive Tea', 'Ailed', 'Published research' ], + }, + { + name: 'About', + path: '/about/', + root: '.chrnx-about', + art: 'img[src*="alter-ego-life.png"]', + atmosphereCount: 0, + imageSources: [ + 'alter-ego-life.png', + 'alter-ego-literature.png', + 'alter-ego-gaming-half-body.png', + ], + headings: [ 'About', 'Beyond the work' ], + }, +]; + +test( 'Projects and About assets, copy, layering, and geometry remain immutable', async ( { + page, +} ) => { + test.setTimeout( 90_000 ); + for ( const theme of [ 'dark', 'light' ] ) { + await setTheme( page, theme ); + for ( const width of [ 375, 1440 ] ) { + await page.setViewportSize( { width, height: width === 375 ? 812 : 900 } ); + for ( const surface of immutableSurfaces ) { + await page.goto( surface.path ); + const root = page.locator( surface.root ); + for ( const heading of surface.headings ) { + await expect( root.getByRole( 'heading', { name: heading, exact: true } ) ).toHaveCount( + 1, + ); + } + await expect( root.locator( surface.art ) ).toHaveCount( 1 ); + await expect( root.locator( 'picture img' ) ).toHaveCount( surface.imageSources.length ); + for ( const source of surface.imageSources ) { + await expect( root.locator( `picture img[src*="${ source }"]` ) ).toHaveCount( 1 ); + } + const state = await root.evaluate( ( element ) => { + const readRect = ( target ) => { + const bounds = target.getBoundingClientRect(); + return { + bottom: bounds.bottom, + height: bounds.height, + left: bounds.left, + right: bounds.right, + top: bounds.top, + width: bounds.width, + }; + }; + const stage = element.querySelector( '.chrnx-character-stage' ); + const children = [ ...stage.children ].map( ( child ) => child.className ); + const art = stage.querySelector( '.chrnx-character-stage__art' ); + const stageRect = readRect( stage ); + const artRect = readRect( art ); + return { + layerOrder: children.map( ( classes ) => + [ 'atmosphere', 'content', 'art' ].find( ( layer ) => + classes.includes( `chrnx-character-stage__${ layer }` ), + ), + ), + atmospherePictures: stage.querySelectorAll( + '.chrnx-character-stage__atmosphere picture', + ).length, + artRatio: artRect.width / stageRect.width, + overflow: stage.scrollWidth - stage.clientWidth, + }; + } ); + expect( state.layerOrder ).toEqual( [ 'atmosphere', 'content', 'art' ] ); + expect( state.atmospherePictures ).toBe( surface.atmosphereCount ); + if ( width === 1440 ) { + expect( state.artRatio ).toBeGreaterThanOrEqual( 0.35 ); + expect( state.artRatio ).toBeLessThanOrEqual( 0.48 ); + } + expect( state.overflow ).toBeLessThanOrEqual( 1 ); + await expectNoHorizontalOverflow( page ); + } + } + } +} ); diff --git a/tests/e2e/visual-states.spec.mjs b/tests/e2e/visual-states.spec.mjs index 49a26f6..22b25b6 100644 --- a/tests/e2e/visual-states.spec.mjs +++ b/tests/e2e/visual-states.spec.mjs @@ -360,7 +360,9 @@ test( 'lower home sections form compact, contained editorial panels in both them } } ); -test( 'latest podcast is a compact horizontal panel on desktop', async ( { page } ) => { +test( 'latest podcast is a bounded content-aware horizontal panel on desktop', async ( { + page, +} ) => { await page.setViewportSize( { width: 1440, height: 900 } ); await page.goto( '/' ); @@ -379,15 +381,22 @@ test( 'latest podcast is a compact horizontal panel on desktop', async ( { page panelHeight: panelRect.height, viewportHeight: window.innerHeight, mediaHeight: mediaRect.height, + mediaRatio: mediaRect.width / panelRect.width, mediaRight: mediaRect.right, contentLeft: contentRect.left, + contentMinWidth: window.getComputedStyle( content ).minWidth, + contentOverflow: content.scrollWidth - content.clientWidth, }; } ); expect( geometry.display ).toBe( 'grid' ); expect( geometry.panelHeight ).toBeLessThanOrEqual( geometry.viewportHeight * 0.72 ); expect( geometry.mediaHeight ).toBeLessThanOrEqual( geometry.panelHeight * 0.72 ); + expect( geometry.mediaRatio ).toBeGreaterThanOrEqual( 0.28 ); + expect( geometry.mediaRatio ).toBeLessThanOrEqual( 0.42 ); expect( geometry.mediaRight ).toBeLessThanOrEqual( geometry.contentLeft + 1 ); + expect( geometry.contentMinWidth ).toBe( '0px' ); + expect( geometry.contentOverflow ).toBeLessThanOrEqual( 1 ); } ); test( 'lower home panels survive missing media and reduced motion', async ( { page } ) => { diff --git a/tests/smoke/visual-integration.test.mjs b/tests/smoke/visual-integration.test.mjs index 8bbb9c9..ac4cd45 100644 --- a/tests/smoke/visual-integration.test.mjs +++ b/tests/smoke/visual-integration.test.mjs @@ -573,3 +573,50 @@ test( 'character stages define the shared mockup effect and responsive geometry' } assert.match( visualStates, /character stage below-fold derivatives wait for approach/ ); } ); + +test( 'latest podcast owns a content-aware 720px card contract', () => { + const podcast = read( 'blocks/latest-podcast/style.css' ); + + assert.match( + podcast, + /\.chrnx-podcast-card__link\s*\{[\s\S]*?display:\s*grid;[\s\S]*?grid-template-columns:\s*minmax\(12rem,\s*34%\)\s+minmax\(0,\s*1fr\)/, + ); + assert.match( + podcast, + /\.chrnx-podcast-card__content\s*\{[\s\S]*?min-width:\s*0;[\s\S]*?overflow-wrap:\s*normal;/, + ); + assert.match( + podcast, + /\.chrnx-podcast-card__image,[\s\S]*?\.chrnx-podcast-card__fallback\s*\{[\s\S]*?max-width:\s*100%;[\s\S]*?overflow:\s*hidden;/, + ); + assert.match( + podcast, + /\.chrnx-podcast-card__title,[\s\S]*?\.chrnx-podcast-card__excerpt,[\s\S]*?\.chrnx-podcast-card__badge\s*\{[\s\S]*?overflow-wrap:\s*normal;[\s\S]*?word-break:\s*normal;/, + ); + assert.match( + podcast, + /@media \(max-width:\s*720px\)[\s\S]*?\.chrnx-podcast-card__link\s*\{[\s\S]*?grid-template-columns:\s*minmax\(0,\s*1fr\)/, + ); + assert.match( + podcast, + /@media \(min-width:\s*721px\)[\s\S]*?\.chrnx-podcast-card__link\s*\{[\s\S]*?grid-template-columns:\s*minmax\(12rem,\s*34%\)\s+minmax\(0,\s*1fr\)/, + ); +} ); + +test( 'Music and Podcast stage specialization cannot leak into immutable surfaces', () => { + const components = read( 'assets/css/components.css' ); + const block = components.match( + /\/\* Music and Podcast landing stage composition\. \*\/[\s\S]*?\/\* End Music and Podcast landing stage composition\. \*\//, + )?.[ 0 ]; + + assert.ok( block, 'missing bounded Music and Podcast composition block' ); + assert.match( block, /\.chrnx-music-landing \.chrnx-character-stage/ ); + assert.match( block, /\.chrnx-podcast-landing \.chrnx-character-stage/ ); + assert.match( block, /\.chrnx-character-stage__atmosphere/ ); + assert.match( block, /object-fit:\s*cover/ ); + assert.match( block, /\.chrnx-character-stage__content/ ); + assert.match( block, /\.chrnx-character-stage__art/ ); + for ( const forbidden of [ '.chrnx-home-projects', '.chrnx-about', '.chrnx-related-' ] ) { + assert.doesNotMatch( block, new RegExp( forbidden.replaceAll( '.', '\\.' ) ) ); + } +} );