diff --git a/web/docs/design-system.md b/web/docs/design-system.md index 30a7b5777e..fe5089468a 100644 --- a/web/docs/design-system.md +++ b/web/docs/design-system.md @@ -290,6 +290,7 @@ Full-bleed backdrop image that commands the viewport. Gradient overlays dissolve Implementation cues: - Use `.hero-gradient` for the bottom-to-top fade, `.hero-gradient-radial` for vignette, `.hero-gradient-left` for sidebar-edge fade. +- Text over hero artwork must keep 4.5:1 over the brightest artwork, at every width. Percentage fades can't promise that where the text block spans the hero, so the item detail hero draws a shade behind its text block instead (`.detail-hero-copy::before` in `app.css`). Its 85% strength is derived from the dimmest hero text colour; dimmer hero text needs a stronger shade. - Use display typography (`--font-display`) at `text-5xl` to `text-7xl` for the title. - Keep metadata compact and secondary (badges, small text). - Apply Ken Burns motion to the backdrop image for ambient life. diff --git a/web/src/app.css b/web/src/app.css index b65682f897..cc75aa8441 100644 --- a/web/src/app.css +++ b/web/src/app.css @@ -1116,10 +1116,60 @@ html[data-navigation-direction]::view-transition-new(main-content) { hero copy itself does not move at desktop widths, so repainting it for every intermediate viewport size only stalls the browser UI animation. */ .detail-hero-copy { + position: relative; + isolation: isolate; transform: translateZ(0); backface-visibility: hidden; } + /* A shade behind the hero's text, so it keeps 4.5:1 over any artwork. The + hero's own fades sit at fixed percentages of its size and can't follow + copy that ends mid-hero on a desktop and fills it on a phone. 85% of + --background is the least that keeps every hero text colour, down to + --muted-foreground and `text-foreground/60`, at 4.5:1 over pure white. + It eases out over 10rem above the copy and 8rem past its end edge, so the + rest of the artwork keeps its brightness, and runs on to the bottom and + 100rem before the copy. That reaches the hero's start edge in windows up + to 3840px wide; on wider ones the start fade (.detail-hero-scrim-under) + is dark where it ends. Fixed lengths keep the copy's compositor layer + small and the same size while the viewport resizes. The copy's position + and isolation keep the shade between the hero's artwork and the copy's + text. A hero without artwork needs no shade. */ + .item-detail-hero:has(> .hero-backdrop-artwork) .detail-hero-copy::before { + content: ""; + position: absolute; + z-index: -1; + inset-block: -10rem -4rem; + inset-inline: -100rem -8rem; + background: linear-gradient( + to bottom, + transparent, + color-mix(in srgb, var(--background) 5%, transparent) 2rem, + color-mix(in srgb, var(--background) 20%, transparent) 4rem, + color-mix(in srgb, var(--background) 44%, transparent) 6rem, + color-mix(in srgb, var(--background) 68%, transparent) 8rem, + color-mix(in srgb, var(--background) 85%, transparent) 10rem + ); + --detail-hero-copy-side-fades: linear-gradient( + calc(90deg * var(--dir-sign)), + transparent, + rgb(0 0 0 / 6%) 1.6rem, + rgb(0 0 0 / 24%) 3.2rem, + rgb(0 0 0 / 52%) 4.8rem, + rgb(0 0 0 / 80%) 6.4rem, + #000 8rem, + #000 calc(100% - 8rem), + rgb(0 0 0 / 80%) calc(100% - 6.4rem), + rgb(0 0 0 / 52%) calc(100% - 4.8rem), + rgb(0 0 0 / 24%) calc(100% - 3.2rem), + rgb(0 0 0 / 6%) calc(100% - 1.6rem), + transparent + ); + -webkit-mask-image: var(--detail-hero-copy-side-fades); + mask-image: var(--detail-hero-copy-side-fades); + pointer-events: none; + } + /* Item artwork stays on the browser's inexpensive image/composite path. */ .hero-backdrop-artwork { contain: strict; diff --git a/web/src/pages/ItemDetail/DetailHero.tsx b/web/src/pages/ItemDetail/DetailHero.tsx index ba0722e537..9695ad33b7 100644 --- a/web/src/pages/ItemDetail/DetailHero.tsx +++ b/web/src/pages/ItemDetail/DetailHero.tsx @@ -137,9 +137,11 @@ export default function DetailHero({ } })(); + // overflow-clip, not -hidden: the copy's scrim (app.css) reaches past the + // hero, and a hidden-overflow box would let focus or find scroll the hero. return (
@@ -183,8 +185,9 @@ export default function DetailHero({ > {/* Poster */} {showPoster && ( + // z-[1] keeps the poster above the copy's scrim (app.css).
{posterUrl ? ( <> diff --git a/web/src/pages/ItemDetail/components/DetailBreadcrumb.tsx b/web/src/pages/ItemDetail/components/DetailBreadcrumb.tsx index 5b5895326d..f7e0dfcc16 100644 --- a/web/src/pages/ItemDetail/components/DetailBreadcrumb.tsx +++ b/web/src/pages/ItemDetail/components/DetailBreadcrumb.tsx @@ -36,7 +36,7 @@ export default function DetailBreadcrumb({ segments }: DetailBreadcrumbProps) { ) : ( {segment.label} diff --git a/web/src/pages/ItemDetail/components/HeroCrewLine.tsx b/web/src/pages/ItemDetail/components/HeroCrewLine.tsx index 29901d3d7b..4f1cda6fa3 100644 --- a/web/src/pages/ItemDetail/components/HeroCrewLine.tsx +++ b/web/src/pages/ItemDetail/components/HeroCrewLine.tsx @@ -32,12 +32,12 @@ function CrewNames({ people }: { people: CrewPerson[] }) { {p.personId ? ( {p.name} ) : ( - {p.name} + {p.name} )} ))} @@ -82,8 +82,7 @@ export default function HeroCrewLine({
{hasAuthors && ( <> - {t("web.detail.overview.byAuthors")} - + {t("web.detail.overview.byAuthors")} )} {hasAuthors && (hasDirectors || hasWriters || hasGenres) && ( @@ -91,8 +90,7 @@ export default function HeroCrewLine({ )} {hasDirectors && ( <> - {leadLabel} - + {leadLabel} )} {hasDirectors && hasWriters && ( @@ -100,8 +98,7 @@ export default function HeroCrewLine({ )} {hasWriters && ( <> - {t("web.detail.overview.writtenBy")} - + {t("web.detail.overview.writtenBy")} )} {(hasDirectors || hasWriters) && hasGenres && ( diff --git a/web/src/pages/ItemDetail/detailLayout.css b/web/src/pages/ItemDetail/detailLayout.css index 5c66775d03..7a9bbf5518 100644 --- a/web/src/pages/ItemDetail/detailLayout.css +++ b/web/src/pages/ItemDetail/detailLayout.css @@ -41,10 +41,13 @@ min-height: 0; } + /* The copy hugs its text from the bottom of the hero instead of filling its + height, so the scrim it draws behind itself (app.css) starts at the text. */ .item-detail-hero[data-viewport-bounded="true"] .detail-hero-copy { display: flex; flex-direction: column; - height: 100%; + max-height: 100%; + margin-top: auto; min-height: 0; width: 100%; }