Hero Centered
A centred hero with an announcement pill, a headline whose lines rise out of their masks, one sentence and two pill buttons. CSS only, the entrance plays on load.
View codeA title over a wall of project thumbnails laid back like prints on a table. On scroll the rows slide in opposite directions and click into line as the wall stands up, every thumbnail a link.
With your AI
Say it to your AI. It gets the exact code below, not its best guess, and knows where it goes.
Add the Kodza Hero Showcase to my page.
claude mcp add -t http kodza https://kodza.dev/api/mcp
<section class="kodza-hero-showcase">
<div class="kodza-hero-showcase__scene">
<div class="kodza-hero-showcase__copy">
<p class="kodza-hero-showcase__eyebrow"><span class="kodza-hero-showcase__rise">Selected work · 2019 — 2026</span></p>
<div class="kodza-hero-showcase__head">
<h1 class="kodza-hero-showcase__title"><span class="kodza-hero-showcase__line"><span class="kodza-hero-showcase__rise">All the work.</span></span> <span class="kodza-hero-showcase__line"><span class="kodza-hero-showcase__rise">One scroll.</span></span></h1>
<div class="kodza-hero-showcase__foot">
<p class="kodza-hero-showcase__lead">Twelve projects on one wall. No carousel to swipe, no case study behind a contact form.</p>
<div class="kodza-hero-showcase__actions">
<a class="kodza-hero-showcase__button kodza-hero-showcase__button--ink" href="#">Start a project<svg class="kodza-hero-showcase__arrow" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 8h10.5M9 3.5 13.5 8 9 12.5" /></svg></a>
<a class="kodza-hero-showcase__button kodza-hero-showcase__button--soft" href="#">Our process, briefly</a>
</div>
</div>
</div>
</div>
<div class="kodza-hero-showcase__stage">
<div class="kodza-hero-showcase__wall">
<ul class="kodza-hero-showcase__row">
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-steps-1400.webp" alt="" width="1400" height="933" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Stair Library</span><span class="kodza-hero-showcase__year">2026</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-arch-dark-1400.webp" alt="" width="1400" height="1400" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Arch House</span><span class="kodza-hero-showcase__year">2026</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-columns-1400.webp" alt="" width="1120" height="1400" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Column Hall</span><span class="kodza-hero-showcase__year">2025</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-float-dark-1400.webp" alt="" width="1400" height="933" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Float Pavilion</span><span class="kodza-hero-showcase__year">2025</span></span></a></li>
</ul>
<ul class="kodza-hero-showcase__row">
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-overflow-dark-1400.webp" alt="" width="1400" height="1400" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Overflow Baths</span><span class="kodza-hero-showcase__year">2024</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-grid-1400.webp" alt="" width="1400" height="875" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">The Catalogue</span><span class="kodza-hero-showcase__year">2024</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-stack-dark-1400.webp" alt="" width="1400" height="1050" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Stack Gallery</span><span class="kodza-hero-showcase__year">2024</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-block-1400.webp" alt="" width="1120" height="1400" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Block Archive</span><span class="kodza-hero-showcase__year">2023</span></span></a></li>
</ul>
<ul class="kodza-hero-showcase__row">
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-arch-1400.webp" alt="" width="1400" height="1400" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Arch Studio</span><span class="kodza-hero-showcase__year">2023</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-steps-dark-1400.webp" alt="" width="1400" height="933" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Night Stairs</span><span class="kodza-hero-showcase__year">2022</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-float-1400.webp" alt="" width="1400" height="933" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Float Café</span><span class="kodza-hero-showcase__year">2022</span></span></a></li>
<li class="kodza-hero-showcase__item"><a class="kodza-hero-showcase__card" href="#"><span class="kodza-hero-showcase__frame"><span class="kodza-hero-showcase__curtain"><span class="kodza-hero-showcase__hold"><img src="https://kodza.dev/media/kz-columns-dark-1400.webp" alt="" width="1120" height="1400" /></span></span></span><span class="kodza-hero-showcase__caption"><span class="kodza-hero-showcase__name">Column Court</span><span class="kodza-hero-showcase__year">2021</span></span></a></li>
</ul>
</div>
</div>
</div>
</section>
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Hero Showcase
A title and its buttons over a wall of project thumbnails, laid back like prints on a table, in
three rows set off from one another. On scroll the scene holds while the rows slide in opposite
directions, the wall stands up and the rows click into line, a flat wall of links, as the title
rises out of its masks. Then the page goes on, and scrolling back up plays it all in reverse.
Without the script, or with reduced motion, nothing pins: the title, then the projects in a grid.
Everything is tuned with the --kz-hero-showcase-* variables. */
.kodza-hero-showcase {
--kz-hero-showcase-ink: #0a0a0a;
--kz-hero-showcase-paper: #f2f2f0;
--kz-hero-showcase-dim: rgba(10, 10, 10, 0.62);
--kz-hero-showcase-faint: rgba(10, 10, 10, 0.6);
--kz-hero-showcase-soft: rgba(10, 10, 10, 0.07);
--kz-hero-showcase-well: rgba(10, 10, 10, 0.06); /* behind a thumbnail while it loads */
--kz-hero-showcase-edge: rgba(10, 10, 10, 0.08); /* hairline round a thumbnail, so a dark picture keeps its edge */
--kz-hero-showcase-bg: transparent;
--kz-hero-showcase-width: 1240px;
--kz-hero-showcase-gutter: clamp(16px, 4vw, 40px);
--kz-hero-showcase-size: clamp(38px, min(7cqi, 10svh), 104px); /* the title lines */
--kz-hero-showcase-card: clamp(150px, min(21cqi, 32svh), 320px); /* a thumbnail's width on the wall */
--kz-hero-showcase-gap: clamp(10px, 1.2cqi, 18px);
--kz-hero-showcase-radius: 12px;
--kz-hero-showcase-tilt: 38deg; /* how far the wall lies back at rest */
--kz-hero-showcase-depth: 1600px; /* the perspective: shorter is stronger */
--kz-hero-showcase-top: 0px; /* height of a fixed site header: the scene pins under it */
--kz-hero-showcase-distance: 150svh; /* how long the scene holds */
--kz-hero-showcase-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
--kz-hero-showcase-ease: cubic-bezier(0.22, 1, 0.36, 1);
container: kodza-hero-showcase / inline-size;
position: relative;
box-sizing: border-box;
width: 100%;
color: var(--kz-hero-showcase-ink);
}
.kodza-hero-showcase__scene {
position: relative;
background: var(--kz-hero-showcase-bg);
}
.kodza-hero-showcase__copy {
position: relative;
box-sizing: border-box;
max-width: calc(var(--kz-hero-showcase-width) + 2 * var(--kz-hero-showcase-gutter));
margin: 0 auto;
padding: clamp(72px, 9vw, 140px) max(var(--kz-hero-showcase-gutter), env(safe-area-inset-right, 0px)) clamp(40px, 4.5vw, 64px) max(var(--kz-hero-showcase-gutter), env(safe-area-inset-left, 0px));
transform-origin: 0 0;
}
.kodza-hero-showcase__eyebrow {
overflow: hidden;
margin: 0 0 clamp(16px, 2cqi, 26px);
font-family: var(--kz-hero-showcase-mono);
font-size: 12.5px;
font-weight: 500;
line-height: 1.4;
letter-spacing: 0.02em;
color: var(--kz-hero-showcase-faint);
}
.kodza-hero-showcase__rise {
display: block;
}
/* The title on the left, the words and buttons on the right, on its last line */
.kodza-hero-showcase__head {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
gap: 28px 64px;
align-items: end;
}
.kodza-hero-showcase__title {
margin: 0;
font-size: var(--kz-hero-showcase-size);
font-weight: 700;
line-height: 1;
letter-spacing: -0.05em;
}
/* Each line is a mask: the words rise out of it on arrival, and out of the top as the wall stands */
.kodza-hero-showcase__line {
display: block;
overflow: hidden;
padding-bottom: 0.08em;
margin-bottom: -0.08em;
white-space: nowrap;
}
.kodza-hero-showcase__foot {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 24px;
}
.kodza-hero-showcase__lead {
margin: 0;
font-size: clamp(16px, 1.3cqi, 18px);
line-height: 1.55;
color: var(--kz-hero-showcase-dim);
text-wrap: pretty;
}
.kodza-hero-showcase__actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.kodza-hero-showcase__button {
position: relative;
isolation: isolate;
overflow: hidden;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
height: 52px;
padding: 0 26px;
border: 0;
border-radius: 999px;
font-family: inherit;
font-size: 15px;
font-weight: 500;
line-height: 1;
white-space: nowrap;
text-decoration: none;
cursor: pointer;
}
.kodza-hero-showcase__button:focus-visible {
outline: 2px solid var(--kz-hero-showcase-ink);
outline-offset: 3px;
}
/* Solid: the arrow steps forward on hover */
.kodza-hero-showcase__button--ink {
background: var(--kz-hero-showcase-ink);
color: var(--kz-hero-showcase-paper);
}
.kodza-hero-showcase__arrow {
flex: none;
width: 16px;
height: 16px;
fill: none;
stroke: currentColor;
stroke-width: 1.5;
stroke-linecap: round;
stroke-linejoin: round;
transition: transform 0.3s var(--kz-hero-showcase-ease);
}
/* Soft: ink rises from the bottom edge on hover */
.kodza-hero-showcase__button--soft {
background: var(--kz-hero-showcase-soft);
color: var(--kz-hero-showcase-ink);
transition: color 0.4s var(--kz-hero-showcase-ease);
}
.kodza-hero-showcase__button--soft::before {
content: "";
position: absolute;
inset: 0;
z-index: -1;
border-radius: inherit;
background: var(--kz-hero-showcase-ink);
transform: translateY(101%);
transition: transform 0.4s var(--kz-hero-showcase-ease);
}
/* The wall, without the script: the projects in a grid under the words */
.kodza-hero-showcase__stage {
box-sizing: border-box;
padding: 0 max(var(--kz-hero-showcase-gutter), env(safe-area-inset-right, 0px)) clamp(56px, 7vw, 104px) max(var(--kz-hero-showcase-gutter), env(safe-area-inset-left, 0px));
}
.kodza-hero-showcase__wall {
display: grid;
gap: var(--kz-hero-showcase-gap);
max-width: var(--kz-hero-showcase-width);
margin: 0 auto;
transform-origin: 50% 0;
}
.kodza-hero-showcase__row {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: var(--kz-hero-showcase-gap);
margin: 0;
padding: 0;
list-style: none;
}
.kodza-hero-showcase__item {
margin: 0;
padding: 0;
}
.kodza-hero-showcase__card {
display: block;
border-radius: var(--kz-hero-showcase-radius);
color: inherit;
text-decoration: none;
}
.kodza-hero-showcase__card:focus-visible {
outline: 2px solid var(--kz-hero-showcase-ink);
outline-offset: 4px;
}
/* On arrival a thumbnail opens from its top edge down: the curtain slides down while its content
slides up by as much, so the picture itself stays put */
.kodza-hero-showcase__frame {
position: relative;
display: block;
overflow: hidden;
aspect-ratio: 4 / 3;
border-radius: var(--kz-hero-showcase-radius);
}
.kodza-hero-showcase__curtain,
.kodza-hero-showcase__hold {
position: absolute;
inset: 0;
display: block;
overflow: hidden;
}
.kodza-hero-showcase__hold {
background: var(--kz-hero-showcase-well);
}
.kodza-hero-showcase__hold::after {
content: "";
position: absolute;
inset: 0;
border-radius: var(--kz-hero-showcase-radius);
box-shadow: inset 0 0 0 1px var(--kz-hero-showcase-edge);
pointer-events: none;
}
.kodza-hero-showcase__hold img {
display: block;
width: 100%;
height: 100%;
max-width: none;
object-fit: cover;
transition: scale 0.7s var(--kz-hero-showcase-ease);
}
.kodza-hero-showcase__caption {
display: flex;
justify-content: space-between;
gap: 12px;
overflow: hidden;
padding-top: 10px;
font-family: var(--kz-hero-showcase-mono);
font-size: 12px;
font-weight: 500;
line-height: 1.4;
letter-spacing: 0.02em;
}
.kodza-hero-showcase__name {
overflow: hidden;
min-width: 0;
white-space: nowrap;
text-overflow: ellipsis;
}
.kodza-hero-showcase__year {
flex: none;
color: var(--kz-hero-showcase-faint);
}
@media (hover: hover) {
.kodza-hero-showcase__button--ink:hover .kodza-hero-showcase__arrow {
transform: translateX(4px);
}
.kodza-hero-showcase__button--soft:hover {
color: var(--kz-hero-showcase-paper);
}
.kodza-hero-showcase__button--soft:hover::before {
transform: none;
}
.kodza-hero-showcase__card:hover img {
scale: 1.05;
}
}
/* With the script and motion: a tall section, the scene pinned inside it, the copy at the top and
the wall at the centre, each row a single line that runs past both edges (the script repeats
its projects on either side, then lays the wall back from there) */
@media (prefers-reduced-motion: no-preference) {
.kodza-hero-showcase.is-ready {
height: calc(100svh - var(--kz-hero-showcase-top) + var(--kz-hero-showcase-distance));
}
.kodza-hero-showcase.is-ready .kodza-hero-showcase__scene {
position: sticky;
top: var(--kz-hero-showcase-top);
overflow: hidden;
overflow: clip;
height: calc(100svh - var(--kz-hero-showcase-top));
}
.kodza-hero-showcase.is-ready .kodza-hero-showcase__copy {
padding-top: clamp(28px, 11svh, 120px);
padding-bottom: clamp(24px, 5svh, 48px);
}
.kodza-hero-showcase.is-ready.is-past .kodza-hero-showcase__copy {
pointer-events: none;
}
.kodza-hero-showcase.is-ready .kodza-hero-showcase__stage {
position: absolute;
inset: 0;
z-index: 1;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0;
pointer-events: none;
}
/* One column as wide as the scene: each row overflows it on both sides, centred */
.kodza-hero-showcase.is-ready .kodza-hero-showcase__wall {
grid-template-columns: minmax(0, 1fr);
width: 100%;
max-width: none;
}
.kodza-hero-showcase.is-ready .kodza-hero-showcase__row {
display: flex;
justify-content: center;
}
.kodza-hero-showcase.is-ready .kodza-hero-showcase__item {
flex: none;
width: var(--kz-hero-showcase-card);
}
.kodza-hero-showcase.is-ready .kodza-hero-showcase__card {
pointer-events: auto;
}
/* Its own layer, so Chrome clips the picture's rounded corners inside it: without one, under the
wall's perspective, it can drop a clipped picture and leave the thumbnail blank */
.kodza-hero-showcase.is-ready .kodza-hero-showcase__frame {
will-change: transform;
}
/* Waiting for its entrance: the script sets is-shown and plays the motion in the same frame */
.kodza-hero-showcase.is-ready:not(.is-shown) .kodza-hero-showcase__rise,
.kodza-hero-showcase.is-ready:not(.is-shown) .kodza-hero-showcase__name,
.kodza-hero-showcase.is-ready:not(.is-shown) .kodza-hero-showcase__year {
transform: translateY(105%);
}
/* 2px past the edge: a curtain closed exactly on the frame's edge leaks a hairline on a tilted wall */
.kodza-hero-showcase.is-ready:not(.is-shown) .kodza-hero-showcase__curtain {
transform: translateY(calc(-100% - 2px));
}
.kodza-hero-showcase.is-ready:not(.is-shown) .kodza-hero-showcase__hold {
transform: translateY(calc(100% + 2px));
}
.kodza-hero-showcase.is-ready:not(.is-shown) .kodza-hero-showcase__lead,
.kodza-hero-showcase.is-ready:not(.is-shown) .kodza-hero-showcase__actions {
opacity: 0;
}
/* A phone: bigger thumbnails, two and a bit across */
@container kodza-hero-showcase (max-width: 640px) {
.kodza-hero-showcase.is-ready .kodza-hero-showcase__item {
width: 44cqi;
}
}
}
/* A narrower screen: the words and buttons go under the title */
@container kodza-hero-showcase (max-width: 760px) {
.kodza-hero-showcase__head {
grid-template-columns: minmax(0, 1fr);
}
.kodza-hero-showcase__lead {
max-width: 44ch;
}
}
/* A phone: the buttons share the row, the grid goes to two columns */
@container kodza-hero-showcase (max-width: 520px) {
.kodza-hero-showcase__foot {
align-items: stretch;
}
.kodza-hero-showcase__button {
flex: 1 1 auto;
}
.kodza-hero-showcase__row {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (prefers-reduced-motion: reduce) {
.kodza-hero-showcase *,
.kodza-hero-showcase *::before,
.kodza-hero-showcase *::after {
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}
/* kodza-guard 7db76242057b — generated by Kodza, do not edit.
Theme guard: keeps a site's own CSS (WordPress themes, Bootstrap, CSS resets…) off this
component. :not(#_) is always true and weighs as much as an id, so these lines win over
theme rules made of classes and tags. Customise the component through its --kz-* variables. */
/* What the browser gives, where the component sets it only in some states: at the lowest weight, so its own rules below put it back */
:where(.kodza-hero-showcase__eyebrow):not(#_),
:where(.kodza-hero-showcase__title):not(#_),
:where(.kodza-hero-showcase__row):not(#_),
:where(.kodza-hero-showcase__item):not(#_) {
transition-duration: revert;
}
:where(.kodza-hero-showcase__lead):not(#_) {
max-width: revert;
transition-duration: revert;
}
:where(.kodza-hero-showcase__button):not(#_) {
outline: revert;
transition: revert;
outline-offset: revert;
}
:where(.kodza-hero-showcase__card):not(#_) {
outline: revert;
outline-offset: revert;
transition-duration: revert;
}
/* What the browser gives, on everything the component leaves to it */
.kodza-hero-showcase__scene:not(#_),
.kodza-hero-showcase__rise:not(#_),
.kodza-hero-showcase__head:not(#_),
.kodza-hero-showcase__line:not(#_),
.kodza-hero-showcase__foot:not(#_),
.kodza-hero-showcase__actions:not(#_),
.kodza-hero-showcase__wall:not(#_),
.kodza-hero-showcase__frame:not(#_),
.kodza-hero-showcase__curtain:not(#_),
.kodza-hero-showcase__hold:not(#_),
.kodza-hero-showcase__caption:not(#_),
.kodza-hero-showcase__name:not(#_),
.kodza-hero-showcase__year:not(#_) {
box-sizing: revert;
}
.kodza-hero-showcase__eyebrow:not(#_) {
border: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
font-style: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
transition-property: revert;
transition-timing-function: revert;
transition-delay: revert;
}
.kodza-hero-showcase__title:not(#_) {
border: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-style: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
transition-property: revert;
transition-timing-function: revert;
transition-delay: revert;
}
.kodza-hero-showcase__lead:not(#_) {
border: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-height: revert;
font-family: revert;
font-weight: revert;
font-style: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
transition-property: revert;
transition-timing-function: revert;
transition-delay: revert;
}
.kodza-hero-showcase__button:not(#_) {
margin: revert;
list-style: revert;
float: revert;
box-shadow: revert;
appearance: revert;
max-width: revert;
max-height: revert;
font-style: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-hero-showcase__arrow:not(#_) {
border: revert;
margin: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-hero-showcase__row:not(#_) {
border: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
transition-property: revert;
transition-timing-function: revert;
transition-delay: revert;
}
.kodza-hero-showcase__item:not(#_) {
border: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
transition-property: revert;
transition-timing-function: revert;
transition-delay: revert;
}
.kodza-hero-showcase__card:not(#_) {
border: revert;
margin: revert;
padding: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
appearance: revert;
max-width: revert;
max-height: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
transition-property: revert;
transition-timing-function: revert;
transition-delay: revert;
}
.kodza-hero-showcase__hold img:where(:not([class*="kodza-"])):not(#_) {
border: revert;
margin: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
list-style: revert;
box-sizing: revert;
float: revert;
position: revert;
background-color: revert;
background-image: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-height: revert;
color: revert;
font-family: revert;
font-size: revert;
font-weight: revert;
font-style: revert;
line-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-hero-showcase__eyebrow:not(#_):where(:not([hidden])),
.kodza-hero-showcase__title:not(#_):where(:not([hidden])),
.kodza-hero-showcase__lead:not(#_):where(:not([hidden])),
.kodza-hero-showcase__arrow:not(#_):where(:not([hidden])),
.kodza-hero-showcase__item:not(#_):where(:not([hidden])) {
display: revert;
}
.kodza-hero-showcase__eyebrow:not(#_):where([hidden]),
.kodza-hero-showcase__title:not(#_):where([hidden]),
.kodza-hero-showcase__lead:not(#_):where([hidden]),
.kodza-hero-showcase__arrow:not(#_):where([hidden]),
.kodza-hero-showcase__item:not(#_):where([hidden]) {
display: none;
}
.kodza-hero-showcase__hold:not(#_)::after {
box-sizing: revert;
}
/* The component's own rules, one step stronger: real buttons and fields, what it sets on tags themes style (links, lists, headings, images…), and the root width (a theme may narrow it, never widen it) */
.kodza-hero-showcase__eyebrow:not(#_) {
margin: 0 0 clamp(16px, 2cqi, 26px);
font-family: var(--kz-hero-showcase-mono);
font-size: 12.5px;
font-weight: 500;
line-height: 1.4;
letter-spacing: 0.02em;
color: var(--kz-hero-showcase-faint);
}
.kodza-hero-showcase__title:not(#_) {
margin: 0;
font-size: var(--kz-hero-showcase-size);
font-weight: 700;
line-height: 1;
letter-spacing: -0.05em;
}
.kodza-hero-showcase__lead:not(#_) {
margin: 0;
font-size: clamp(16px, 1.3cqi, 18px);
line-height: 1.55;
color: var(--kz-hero-showcase-dim);
}
.kodza-hero-showcase__button:not(#_) {
position: relative;
box-sizing: border-box;
display: inline-flex;
padding: 0 26px;
border: 0;
border-radius: 999px;
font-family: inherit;
font-size: 15px;
font-weight: 500;
line-height: 1;
text-decoration: none;
}
.kodza-hero-showcase__button:focus-visible:not(#_) {
outline: 2px solid var(--kz-hero-showcase-ink);
outline-offset: 3px;
}
.kodza-hero-showcase__button--ink:not(#_) {
background: var(--kz-hero-showcase-ink);
color: var(--kz-hero-showcase-paper);
}
.kodza-hero-showcase__arrow:not(#_) {
transition: transform 0.3s var(--kz-hero-showcase-ease);
}
.kodza-hero-showcase__button--soft:not(#_) {
background: var(--kz-hero-showcase-soft);
color: var(--kz-hero-showcase-ink);
transition: color 0.4s var(--kz-hero-showcase-ease);
}
.kodza-hero-showcase__row:not(#_) {
display: grid;
margin: 0;
padding: 0;
list-style: none;
}
.kodza-hero-showcase__item:not(#_) {
margin: 0;
padding: 0;
}
.kodza-hero-showcase__card:not(#_) {
display: block;
border-radius: var(--kz-hero-showcase-radius);
color: inherit;
text-decoration: none;
}
.kodza-hero-showcase__card:focus-visible:not(#_) {
outline: 2px solid var(--kz-hero-showcase-ink);
outline-offset: 4px;
}
.kodza-hero-showcase__hold img:not(#_) {
display: block;
max-width: none;
transition: scale 0.7s var(--kz-hero-showcase-ease);
}
@media (hover: hover) {
.kodza-hero-showcase__button--soft:hover:not(#_) {
color: var(--kz-hero-showcase-paper);
}
}
@media (prefers-reduced-motion: no-preference) {
.kodza-hero-showcase.is-ready .kodza-hero-showcase__row:not(#_) {
display: flex;
}
}
@container kodza-hero-showcase (max-width: 760px) {
.kodza-hero-showcase__lead:not(#_) {
max-width: 44ch;
}
}
@media (prefers-reduced-motion: reduce) {
.kodza-hero-showcase *:where(p, h1, a, svg, ul, li, img):not(#_) {
transition-duration: 0.01ms !important;
}
}
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Hero Showcase
// Plays the entrance of Hero Split once the section is in view (the label and title lines rise
// out of their masks, the thumbnails in view open from their top edge down, row after row, the
// rest follows), then hands over to the scroll: the scene pins while the wall of projects, laid
// back like prints on a table with its rows set off from one another, stands up as the rows slide
// in opposite directions and click into line, a flat wall of links, while the title rises out of
// its masks. Each row repeats its projects on both sides so it runs past both edges (the copies
// are hidden from assistive tech and left out of the tab order). Every move is a paused animation
// set from the scroll: scrolling back up plays it in reverse. "kodza:replay" plays the entrance
// again.
(() => {
const SELECTOR = '.kodza-hero-showcase';
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const GLIDE = 'cubic-bezier(0.6, 0, 0.1, 1)'; // slow start, long settle
const SOFT = 'cubic-bezier(0.25, 1, 0.5, 1)';
const OPEN = 'cubic-bezier(0.3, 0.5, 0.1, 1)'; // the thumbnails' curtain: a slow start leaves each one a hairline for 200 ms
const TRAVEL = 'cubic-bezier(0.45, 0, 0.55, 1)'; // the moves on the scroll: gentle, a mouse wheel goes by notches
const SETTLE = 'cubic-bezier(0.3, 0, 0.2, 1)'; // the rows: under way at once, then a long slow stop into line
const OFFSETS = [-1.25, 1.25, -0.75]; // how far each row sits off the line at rest, in thumbnails
const decoded = (root) => Promise.all([...root.querySelectorAll('img')].map((img) => img.decode().catch(() => {})));
// ---------- Scroll engine (begin) ----------
// The same block in every hero that plays on scroll: copy it as is, write only the timeline.
// `root` is a tall track and `scene` sticks inside it (position: sticky, in the CSS); the
// progress runs from 0, the scene just pinned, to 1, about to unpin. `timeline()` returns
// tracks, [element, keyframes, from, to] with from and to in progress; each becomes a paused
// Web Animation whose time follows the scroll, smoothed by a requestAnimationFrame loop that
// sleeps once it has caught up. The tracks are built again when `scene` or an element of
// `watch` changes size, so `timeline()` measures there.
function scrub(root, scene, signal, timeline, watch = []) {
const SPAN = 1000;
let tracks = [];
let live = false;
let now = 0;
let target = 0;
let frame = 0;
let last = 0;
const geometry = () => {
const box = root.getBoundingClientRect();
return {
top: box.top,
scale: box.height / root.offsetHeight || 1, // a parent scaled by transform
run: root.offsetHeight - scene.offsetHeight,
stick: parseFloat(getComputedStyle(scene).top) || 0,
};
};
const progress = () => {
const { top, scale, run, stick } = geometry();
return run > 0 ? Math.min(1, Math.max(0, (stick - top / scale) / run)) : 0;
};
const seek = () => tracks.forEach((a) => { a.currentTime = now * SPAN; });
const tick = (time) => {
const dt = last ? Math.min(time - last, 64) : 16;
last = time;
now += (target - now) * (1 - Math.exp(-dt / 70));
if (Math.abs(target - now) < 0.0004) now = target;
seek();
frame = now === target ? 0 : requestAnimationFrame(tick);
if (!frame) last = 0;
};
const update = () => {
if (!live) return;
target = progress();
if (!frame) frame = requestAnimationFrame(tick);
};
const clear = () => {
tracks.forEach((a) => a.cancel());
tracks = [];
};
const build = () => {
clear();
if (!live) return;
tracks = timeline().filter(([el]) => el).map(([el, keyframes, from, to]) => {
const a = el.animate(keyframes, { duration: (to - from) * SPAN, delay: from * SPAN, endDelay: (1 - to) * SPAN, fill: 'both' });
a.pause();
return a;
});
seek();
update();
};
const stop = () => {
live = false;
cancelAnimationFrame(frame);
frame = last = now = 0;
clear();
};
// Scrolls the page so the progress is at least `p` (a focused control must show)
const reveal = (p) => {
const { top, scale, run, stick } = geometry();
if (run > 0 && progress() < p) window.scrollBy(0, top - (stick - p * run) * scale);
};
document.addEventListener('scroll', update, { passive: true, capture: true, signal });
window.addEventListener('resize', update, { passive: true, signal });
let resized = 0;
const ro = new ResizeObserver(() => {
cancelAnimationFrame(resized);
resized = requestAnimationFrame(build);
});
[scene, ...watch].forEach((el) => el && ro.observe(el));
signal.addEventListener('abort', () => {
ro.disconnect();
cancelAnimationFrame(resized);
stop();
});
return {
start() {
live = true;
build();
},
stop,
progress,
reveal,
};
}
// ---------- Scroll engine (end) ----------
// One instance, with its own state: two copies on a page never interfere. Everything it
// starts is tied to `signal` (listeners get { signal }, observers and timers stop on its
// 'abort' event), so kodza:destroy stops it all.
function mount(root, signal) {
if (reduceMotion) return root.classList.add('is-shown');
const q = (s) => root.querySelector(s);
const scene = q('.kodza-hero-showcase__scene');
const copy = q('.kodza-hero-showcase__copy');
const wall = q('.kodza-hero-showcase__wall');
const rows = [...root.querySelectorAll('.kodza-hero-showcase__row')];
const lines = [...root.querySelectorAll('.kodza-hero-showcase__line')];
const own = rows.map((row) => [...row.children]); // the projects as written
const most = Math.max(1, ...own.map((items) => items.length));
const setting = (name, fallback) => {
const value = parseFloat(getComputedStyle(root).getPropertyValue(`--kz-hero-showcase-${name}`));
return Number.isFinite(value) ? value : fallback;
};
// Each row repeats its projects on both sides, enough copies to run past both edges once it is
// slid off the line. A copy is a twin for the eye only: hidden from assistive tech, its links
// out of the tab order (the mouse can still follow them, they go to the same place).
let copies = 0;
let twins = [];
const fill = (pitch) => {
const k = Math.max(1, Math.ceil((scene.clientWidth / 2 / pitch + 2.25 - most / 2) / most));
if (k === copies) return;
copies = k;
twins.forEach((el) => el.remove());
twins = [];
const twin = (li) => {
const el = li.cloneNode(true);
el.setAttribute('aria-hidden', 'true');
el.querySelectorAll('a, button, [tabindex]').forEach((a) => a.setAttribute('tabindex', '-1'));
twins.push(el);
return el;
};
rows.forEach((row, r) => {
for (let i = 0; i < k; i += 1) {
row.prepend(...own[r].map(twin));
row.append(...own[r].map(twin));
}
});
};
// The wall sits in its place at the centre of the scene (the CSS puts it there). At rest it
// lies back from its top edge, that edge just under the copy, and its rows sit off the line,
// each picture leaning the other way inside its frame: these are the transforms that take it
// there, set inline so the entrance plays on the wall at rest. Layout boxes only (offsetTop…):
// they ignore transforms, so a scaled page changes nothing.
const measure = () => {
const first = own[0][0];
const pitch = (first?.offsetWidth || 200) + (parseFloat(getComputedStyle(rows[0]).columnGap) || 0);
fill(pitch);
const rest = {
wall: `translateY(${copy.offsetTop + copy.offsetHeight - wall.offsetTop}px) perspective(${setting('depth', 1600)}px) rotateX(${setting('tilt', 38)}deg)`,
rows: rows.map((row, r) => `translateX(${OFFSETS[r % OFFSETS.length] * pitch}px)`),
imgs: new Map(),
};
wall.style.transform = rest.wall;
rows.forEach((row, r) => {
row.style.transform = rest.rows[r];
const lean = OFFSETS[r % OFFSETS.length] < 0 ? 4 : -4;
row.querySelectorAll('img').forEach((img) => {
rest.imgs.set(img, `scale(1.1) translateX(${lean}%)`);
img.style.transform = rest.imgs.get(img);
});
});
return rest;
};
// The scroll part, in progress: the wall stands up while the rows slide into line, then holds
// there, flat, for the last stretch before the page goes on
const timeline = () => {
const rest = measure();
const flat = rest.wall.replace(/translateY\([^)]*\)/, 'translateY(0px)').replace(/rotateX\([^)]*\)/, 'rotateX(0deg)');
const leave = (el, start, end) => [el, [{ opacity: 1, transform: 'translateY(0px)', easing: TRAVEL }, { opacity: 0, transform: 'translateY(-12px)' }], start, end];
// The copy rises out of its masks as the wall comes up, the label first
const masked = [q('.kodza-hero-showcase__eyebrow .kodza-hero-showcase__rise'), ...lines.map((l) => l.querySelector(':scope > .kodza-hero-showcase__rise'))];
return [
[wall, [{ transform: rest.wall, easing: TRAVEL }, { transform: flat }], 0, 0.7],
...rows.map((row, r) => [row, [{ transform: rest.rows[r], easing: SETTLE }, { transform: 'translateX(0px)' }], 0, 0.8]),
...[...rest.imgs].map(([img, t]) => [img, [{ transform: t, easing: SETTLE }, { transform: 'scale(1) translateX(0%)' }], 0, 0.8]),
[copy, [{ transform: 'translateY(0px)', easing: TRAVEL }, { transform: `translateY(${-0.05 * scene.clientHeight}px)` }], 0, 0.4],
...masked.map((el, i) => [el, [{ transform: 'translateY(0%)', easing: TRAVEL }, { transform: 'translateY(-105%)' }], i * 0.03, 0.22 + i * 0.03]),
leave(q('.kodza-hero-showcase__lead'), 0.02, 0.24),
leave(q('.kodza-hero-showcase__actions'), 0.04, 0.26),
];
};
const pin = scrub(root, scene, signal, timeline, [copy]);
let running = [];
const stop = () => {
running.forEach((a) => a.cancel());
running = [];
};
const animate = (el, keyframes, options) => {
if (el) running.push(el.animate(keyframes, { easing: GLIDE, fill: 'backwards', ...options }));
};
const rise = (el, delay, duration) => animate(el, [{ transform: 'translateY(105%)' }, { transform: 'none' }], { duration, delay });
// Scrolling during the entrance hurries it, so the scroll takes over without a wait
const hurry = () => {
if (running.length && !root.classList.contains('is-live') && pin.progress() > 0) running.forEach((a) => a.updatePlaybackRate(4));
};
const play = async () => {
await decoded(root);
if (signal.aborted) return;
stop();
pin.stop();
root.classList.remove('is-live');
const rest = measure();
root.classList.add('is-shown');
rise(q('.kodza-hero-showcase__eyebrow .kodza-hero-showcase__rise'), 0, 1000);
lines.forEach((l, i) => rise(l.querySelector(':scope > .kodza-hero-showcase__rise'), 110 + i * 125, 1170));
// The thumbnails in view open row after row, left to right, each from its top edge down,
// settling from a slight zoom; the ones out of view are simply there
const view = scene.getBoundingClientRect();
rows.forEach((row, r) => {
const seen = [...row.children].filter((li) => {
const box = li.getBoundingClientRect();
return box.right > view.left && box.left < view.right && box.top < view.bottom;
});
seen.forEach((li, c) => {
const delay = 260 + r * 140 + c * 70;
const img = li.querySelector('img');
animate(li.querySelector('.kodza-hero-showcase__curtain'), [{ transform: 'translateY(calc(-100% - 2px))' }, { transform: 'none' }], { duration: 1100, delay, easing: OPEN });
animate(li.querySelector('.kodza-hero-showcase__hold'), [{ transform: 'translateY(calc(100% + 2px))' }, { transform: 'none' }], { duration: 1100, delay, easing: OPEN });
if (rest.imgs.has(img)) animate(img, [{ transform: rest.imgs.get(img).replace('scale(1.1)', 'scale(1.3)') }, { transform: rest.imgs.get(img) }], { duration: 1700, delay, easing: SOFT });
rise(li.querySelector('.kodza-hero-showcase__name'), delay + 480, 900);
rise(li.querySelector('.kodza-hero-showcase__year'), delay + 560, 900);
});
});
[q('.kodza-hero-showcase__lead'), q('.kodza-hero-showcase__actions')].forEach((el, i) => {
animate(el, [{ opacity: 0, transform: 'translateY(20px)' }, { opacity: 1, transform: 'none' }], { duration: 900, delay: 700 + i * 110, easing: SOFT });
});
hurry();
const entrance = running;
Promise.all(entrance.map((a) => a.finished)).then(() => {
if (entrance !== running || signal.aborted) return;
root.classList.add('is-live');
pin.start();
}, () => {});
};
root.addEventListener('kodza:replay', play, { signal });
// Once the wall is coming up over the copy, the copy lets clicks through to it
const scrolled = () => {
hurry();
root.classList.toggle('is-past', pin.progress() > 0.25);
};
document.addEventListener('scroll', scrolled, { passive: true, capture: true, signal });
// Tabbing back to a button scrolls back to where it shows: the hero, whole
q('.kodza-hero-showcase__foot').addEventListener('focusin', () => {
if (pin.progress() <= 0) return;
const box = root.getBoundingClientRect();
const k = box.height / root.offsetHeight || 1;
window.scrollBy(0, box.top - (parseFloat(getComputedStyle(scene).top) || 0) * k);
}, { signal });
// Tabbing on to a project lays the wall flat, where every link can be read
wall.addEventListener('focusin', (event) => {
if (event.target.matches(':focus-visible')) pin.reveal(0.8);
}, { signal });
signal.addEventListener('abort', stop);
const io = new IntersectionObserver((entries) => {
if (!entries.some((entry) => entry.isIntersecting)) return;
io.disconnect();
play();
}, { rootMargin: '0px 0px -15% 0px' });
signal.addEventListener('abort', () => io.disconnect());
Promise.all([document.fonts?.ready, decoded(root)]).then(() => {
if (!signal.aborted) io.observe(root);
});
}
// Kodza lifecycle, the same in every component: `kodza:init` starts the instances inside
// event.detail.root (the whole page by default), `kodza:destroy` stops them and puts their
// markup back. For themes and apps that swap content without a page load. Each running root
// keeps its markup as written under KODZA, shared by every Kodza script on the page: a Kodza
// component inside another one is saved as written, not half-started, and stopped with it.
const KODZA = Symbol.for('kodza');
const instances = new WeakMap();
const find = (scope = document) => [scope, ...scope.querySelectorAll(SELECTOR)].filter((el) => el.matches?.(SELECTOR));
const attrsOf = (el) => [...el.attributes].map((a) => [a.name, a.value]);
const put = (el, saved) => {
[...el.attributes].forEach((a) => el.removeAttribute(a.name));
saved.attrs.forEach(([name, value]) => el.setAttribute(name, value));
el.innerHTML = saved.html;
};
// The markup inside a root as written: Kodza components already running in it give back their own
const written = (root) => {
const all = [...root.querySelectorAll('*')];
if (!all.some((el) => el[KODZA])) return root.innerHTML;
const copy = root.cloneNode(true);
const twins = copy.querySelectorAll('*');
let last = null;
all.forEach((el, i) => {
if (!el[KODZA] || last?.contains(el)) return;
last = el;
put(twins[i], el[KODZA]);
});
return copy.innerHTML;
};
const init = (scope) => find(scope).forEach((root) => {
if (root.classList.contains('is-ready')) return; // already running, maybe from another copy of this script
const controller = new AbortController();
const saved = { html: written(root), attrs: attrsOf(root), stop: () => destroy(root) };
instances.set(root, { controller, saved });
root[KODZA] = saved;
mount(root, controller.signal);
root.classList.add('is-ready');
});
const destroy = (scope) => find(scope).forEach((root) => {
const instance = instances.get(root);
if (!instance) return;
instances.delete(root);
// The Kodza components running inside it stop first: once its markup is put back, their own
// script could not find them any more
root.querySelectorAll('*').forEach((el) => el[KODZA]?.stop());
instance.controller.abort();
delete root[KODZA];
put(root, instance.saved);
});
document.addEventListener('kodza:init', (event) => init(event.detail?.root));
document.addEventListener('kodza:destroy', (event) => destroy(event.detail?.root));
init();
// Loaded in <head>, the script runs before the markup exists: once more when it is parsed
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => init(), { once: true });
})();
'use client';
// Kodza — Hero Showcase, for React. From https://kodza.dev/components/hero-showcase/
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Next to this file: hero-showcase.css and hero-showcase.js, the component's CSS and JS from Kodza, as they are.
// Yours to edit: the markup is plain JSX below.
// The script changes this markup once React has rendered it (it adds layers, splits text, moves
// nodes), so React must not patch it afterwards. When a prop changes, the key gives React a fresh
// element: kodza:destroy stops the script on the old one, kodza:init starts it on the new one.
import { useRef, useEffect, type ComponentPropsWithoutRef, type ComponentRef, type CSSProperties } from 'react';
import './hero-showcase.css';
export type HeroShowcaseProps = Omit<ComponentPropsWithoutRef<'section'>, "children" | "vars"> & {
/** Settings, as CSS variables on the root */
vars?: {
/** default: #0a0a0a */
"--kz-hero-showcase-ink"?: string | number;
/** default: #f2f2f0 */
"--kz-hero-showcase-paper"?: string | number;
/** default: rgba(10, 10, 10, 0.62) */
"--kz-hero-showcase-dim"?: string | number;
/** default: rgba(10, 10, 10, 0.6) */
"--kz-hero-showcase-faint"?: string | number;
/** default: rgba(10, 10, 10, 0.07) */
"--kz-hero-showcase-soft"?: string | number;
/** behind a thumbnail while it loads — default: rgba(10, 10, 10, 0.06) */
"--kz-hero-showcase-well"?: string | number;
/** hairline round a thumbnail, so a dark picture keeps its edge — default: rgba(10, 10, 10, 0.08) */
"--kz-hero-showcase-edge"?: string | number;
/** default: transparent */
"--kz-hero-showcase-bg"?: string | number;
/** default: 1240px */
"--kz-hero-showcase-width"?: string | number;
/** default: clamp(16px, 4vw, 40px) */
"--kz-hero-showcase-gutter"?: string | number;
/** the title lines — default: clamp(38px, min(7cqi, 10svh), 104px) */
"--kz-hero-showcase-size"?: string | number;
/** a thumbnail's width on the wall — default: clamp(150px, min(21cqi, 32svh), 320px) */
"--kz-hero-showcase-card"?: string | number;
/** default: clamp(10px, 1.2cqi, 18px) */
"--kz-hero-showcase-gap"?: string | number;
/** default: 12px */
"--kz-hero-showcase-radius"?: string | number;
/** how far the wall lies back at rest — default: 38deg */
"--kz-hero-showcase-tilt"?: string | number;
/** the perspective: shorter is stronger — default: 1600px */
"--kz-hero-showcase-depth"?: string | number;
/** height of a fixed site header: the scene pins under it — default: 0px */
"--kz-hero-showcase-top"?: string | number;
/** how long the scene holds — default: 150svh */
"--kz-hero-showcase-distance"?: string | number;
/** default: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace */
"--kz-hero-showcase-mono"?: string | number;
/** default: cubic-bezier(0.22, 1, 0.36, 1) */
"--kz-hero-showcase-ease"?: string | number;
};
className?: string;
};
export function HeroShowcase({ vars, className, style, ...rest }: HeroShowcaseProps) {
const ref = useRef<ComponentRef<'section'>>(null);
const classes = ["kodza-hero-showcase", className].filter(Boolean).join(' ');
// Everything the markup is made of: when it changes, React gets a fresh element (see the top)
const key = JSON.stringify([classes, vars, style, rest]);
// Starts the script on this element once React has rendered it, stops it when it goes
useEffect(() => {
const root = ref.current;
let live = true;
// @ts-ignore: a plain script, no types to find
import('./hero-showcase.js').then(() => {
if (live) document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root } }));
});
return () => {
live = false;
document.dispatchEvent(new CustomEvent('kodza:destroy', { detail: { root } }));
};
}, [key]);
return (
<section key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
<div className="kodza-hero-showcase__scene">
<div className="kodza-hero-showcase__copy">
<p className="kodza-hero-showcase__eyebrow">
<span className="kodza-hero-showcase__rise">Selected work · 2019 — 2026</span>
</p>
<div className="kodza-hero-showcase__head">
<h1 className="kodza-hero-showcase__title">
<span className="kodza-hero-showcase__line">
<span className="kodza-hero-showcase__rise">All the work.</span>
</span>
{' '}
<span className="kodza-hero-showcase__line">
<span className="kodza-hero-showcase__rise">One scroll.</span>
</span>
</h1>
<div className="kodza-hero-showcase__foot">
<p className="kodza-hero-showcase__lead">Twelve projects on one wall. No carousel to swipe, no case study behind a contact form.</p>
<div className="kodza-hero-showcase__actions">
<a className="kodza-hero-showcase__button kodza-hero-showcase__button--ink" href="#">Start a project<svg className="kodza-hero-showcase__arrow" viewBox="0 0 16 16" aria-hidden="true"> <path d="M2.5 8h10.5M9 3.5 13.5 8 9 12.5" /> </svg></a>
{' '}
<a className="kodza-hero-showcase__button kodza-hero-showcase__button--soft" href="#">Our process, briefly</a>
</div>
</div>
</div>
</div>
<div className="kodza-hero-showcase__stage">
<div className="kodza-hero-showcase__wall">
<ul className="kodza-hero-showcase__row">
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-steps-1400.webp" alt="" width="1400" height="933" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Stair Library</span>
<span className="kodza-hero-showcase__year">2026</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-arch-dark-1400.webp" alt="" width="1400" height="1400" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Arch House</span>
<span className="kodza-hero-showcase__year">2026</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-columns-1400.webp" alt="" width="1120" height="1400" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Column Hall</span>
<span className="kodza-hero-showcase__year">2025</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-float-dark-1400.webp" alt="" width="1400" height="933" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Float Pavilion</span>
<span className="kodza-hero-showcase__year">2025</span>
</span>
</a>
</li>
</ul>
<ul className="kodza-hero-showcase__row">
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-overflow-dark-1400.webp" alt="" width="1400" height="1400" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Overflow Baths</span>
<span className="kodza-hero-showcase__year">2024</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-grid-1400.webp" alt="" width="1400" height="875" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">The Catalogue</span>
<span className="kodza-hero-showcase__year">2024</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-stack-dark-1400.webp" alt="" width="1400" height="1050" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Stack Gallery</span>
<span className="kodza-hero-showcase__year">2024</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-block-1400.webp" alt="" width="1120" height="1400" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Block Archive</span>
<span className="kodza-hero-showcase__year">2023</span>
</span>
</a>
</li>
</ul>
<ul className="kodza-hero-showcase__row">
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-arch-1400.webp" alt="" width="1400" height="1400" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Arch Studio</span>
<span className="kodza-hero-showcase__year">2023</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-steps-dark-1400.webp" alt="" width="1400" height="933" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Night Stairs</span>
<span className="kodza-hero-showcase__year">2022</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-float-1400.webp" alt="" width="1400" height="933" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Float Café</span>
<span className="kodza-hero-showcase__year">2022</span>
</span>
</a>
</li>
<li className="kodza-hero-showcase__item">
<a className="kodza-hero-showcase__card" href="#">
<span className="kodza-hero-showcase__frame">
<span className="kodza-hero-showcase__curtain">
<span className="kodza-hero-showcase__hold">
<img src="https://kodza.dev/media/kz-columns-dark-1400.webp" alt="" width="1120" height="1400" />
</span>
</span>
</span>
<span className="kodza-hero-showcase__caption">
<span className="kodza-hero-showcase__name">Column Court</span>
<span className="kodza-hero-showcase__year">2021</span>
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</section>
);
}
Checked
Robots poked at it before you did. Every component goes through the same checks, and again each time it changes.