Skip to content

Commit a1913ee

Browse files
committed
Keep hero artwork layered across breakpoints
1 parent ff9826a commit a1913ee

1 file changed

Lines changed: 47 additions & 58 deletions

File tree

‎src/index.css‎

Lines changed: 47 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -204,31 +204,57 @@
204204
}
205205

206206
.hero-content {
207-
align-items: flex-start;
207+
min-height: clamp(36rem, 135vw, 42rem);
208+
align-items: center;
208209
padding-top: 3.5rem;
209-
padding-bottom: 0;
210+
padding-bottom: 3.5rem;
210211
}
211212

212213
.hero-copy {
213214
position: relative;
214215
z-index: 2;
216+
width: min(100%, 36rem);
217+
min-width: 0;
215218
}
216219

217220
.hero-science-field {
218-
position: relative;
221+
/*
222+
* Keep the visual and copy in one layered composition at every width.
223+
* The generated 1600px asset has 126px of transparent padding on its
224+
* right edge, so clip that measured 7.875% tail and compensate for it.
225+
*/
226+
--hero-source-right-trim: 7.875%;
227+
--hero-copy-gap: max(0px, calc(100vw - 38rem));
228+
--hero-overlap-end: calc(92.125% - var(--hero-copy-gap));
229+
--hero-fade-start: max(0px, calc(var(--hero-overlap-end) - 12rem));
230+
position: absolute;
231+
top: 50%;
232+
right: 1rem;
219233
z-index: 1;
220-
width: min(118vw, 34rem);
221-
margin-top: 1rem;
222-
margin-right: -8vw;
223-
margin-bottom: -2.5rem;
224-
margin-left: auto;
234+
width: clamp(34rem, 150vw, 46rem);
235+
margin: 0;
236+
clip-path: inset(0 var(--hero-source-right-trim) 0 0);
225237
pointer-events: none;
226-
opacity: 0.78;
227-
transform: translateX(-4vw);
238+
opacity: 0.88;
239+
transform: translate(var(--hero-source-right-trim), -50%);
240+
-webkit-mask-image: linear-gradient(
241+
90deg,
242+
rgb(0 0 0 / 0.28) 0,
243+
rgb(0 0 0 / 0.28) var(--hero-fade-start),
244+
#000 var(--hero-overlap-end),
245+
#000 100%
246+
);
247+
mask-image: linear-gradient(
248+
90deg,
249+
rgb(0 0 0 / 0.28) 0,
250+
rgb(0 0 0 / 0.28) var(--hero-fade-start),
251+
#000 var(--hero-overlap-end),
252+
#000 100%
253+
);
228254
}
229255

230256
.dark .hero-science-field {
231-
opacity: 0.72;
257+
opacity: 0.82;
232258
}
233259

234260
.hero-science-art {
@@ -308,21 +334,21 @@
308334

309335
@media (min-width: 480px) {
310336
.hero-science-field {
311-
width: min(108vw, 40rem);
312-
margin-top: 1.5rem;
313-
margin-right: -7vw;
337+
width: clamp(40rem, 150vw, 46rem);
314338
}
315339
}
316340

317341
@media (min-width: 640px) {
318342
.hero-content {
343+
min-height: 42rem;
319344
padding-top: 4rem;
345+
padding-bottom: 4rem;
320346
}
321347

322348
.hero-science-field {
323-
width: min(100vw, 46rem);
324-
margin-top: 2rem;
325-
margin-right: -6vw;
349+
--hero-copy-gap: max(0px, calc(100vw - 39rem));
350+
right: 1.5rem;
351+
width: clamp(46rem, 110vw, 56rem);
326352
}
327353
}
328354

@@ -335,59 +361,22 @@
335361
}
336362

337363
.hero-science-field {
338-
position: absolute;
339-
top: 50%;
340-
/*
341-
* The generated 1600px asset has 126px of transparent padding on its
342-
* right edge. Clip that measured 7.875% tail and compensate by the same
343-
* amount so the visible genome track aligns with the page content edge.
344-
*/
345-
--hero-source-right-trim: 7.875%;
346364
/*
347365
* Anchor the visible artwork to the shared 72rem content stage. It grows
348-
* through normal desktop widths, then tapers toward 54rem so browser
349-
* zoom-out cannot pull a giant illustration toward the far edge. The
350-
* transparent artwork deliberately sits beneath the foreground copy.
366+
* from 56rem to 64rem instead of shrinking with 60vw, preserving the
367+
* protein-and-type overlap through narrow desktop aspect ratios.
351368
*/
369+
--hero-copy-gap: min(32rem, calc(100vw - 40rem));
352370
right: max(2rem, calc(50vw - 34rem));
353-
width: min(60vw, clamp(54rem, calc(72rem - 10vw), 64rem));
354-
margin: 0;
355-
clip-path: inset(0 var(--hero-source-right-trim) 0 0);
371+
width: clamp(56rem, 70vw, 64rem);
356372
opacity: 0.9;
357-
transform: translate(var(--hero-source-right-trim), -50%);
358373
}
359374

360375
.dark .hero-science-field {
361376
opacity: 0.84;
362377
}
363378
}
364379

365-
@media (min-width: 1280px) {
366-
.hero-science-field {
367-
/*
368-
* The fade ends at the copy's right edge. Its position is derived from
369-
* the shared 72rem container, 2rem gutters, and the measured source trim,
370-
* so it follows the overlap instead of relying on viewport-specific stops.
371-
*/
372-
--hero-overlap-end: calc(92.125% - 39.5rem);
373-
--hero-fade-start: max(0px, calc(var(--hero-overlap-end) - 10rem));
374-
-webkit-mask-image: linear-gradient(
375-
90deg,
376-
rgb(0 0 0 / 0.12) 0,
377-
rgb(0 0 0 / 0.12) var(--hero-fade-start),
378-
#000 var(--hero-overlap-end),
379-
#000 100%
380-
);
381-
mask-image: linear-gradient(
382-
90deg,
383-
rgb(0 0 0 / 0.12) 0,
384-
rgb(0 0 0 / 0.12) var(--hero-fade-start),
385-
#000 var(--hero-overlap-end),
386-
#000 100%
387-
);
388-
}
389-
}
390-
391380
@keyframes hero-science-drift {
392381
0%,
393382
100% {

0 commit comments

Comments
 (0)