Direction-Aware Hover
Tiles whose caption, or a second photo, slides in from the edge the pointer comes from and leaves by the edge it goes out. The keyboard opens it from the bottom; on touch the caption sits under the photo.
View codeA grid of pictures where the one you click takes two by two cells and the others slide out of its way, then its caption card unfolds from the name pill. Two columns in narrow containers.
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 Make Way Grid to my page.
claude mcp add -t http kodza https://kodza.dev/api/mcp
<div class="kodza-make-way">
<ul class="kodza-make-way__grid">
<li class="kodza-make-way__item">
<div class="kodza-make-way__frame">
<img class="kodza-make-way__image" src="https://kodza.dev/media/kz-float-1400.webp" width="1400" height="933" alt="A concrete block hovering above the ground, over its own shadow" loading="lazy">
<button class="kodza-make-way__toggle" type="button" aria-expanded="false">
<span class="kodza-make-way__label"><span class="kodza-make-way__label-inner"><span class="kodza-make-way__index">01</span> <span class="kodza-make-way__name">Float House</span></span></span>
<span class="kodza-make-way__close" aria-hidden="true"></span>
</button>
<div class="kodza-make-way__details">
<h3 class="kodza-make-way__title">Float House</h3>
<p class="kodza-make-way__meta">Le Havre · 2026 · 180 m²</p>
<p class="kodza-make-way__text">One cantilever, no hidden supports. The structure does what the drawings said it would.</p>
</div>
</div>
</li>
<li class="kodza-make-way__item">
<div class="kodza-make-way__frame">
<img class="kodza-make-way__image" src="https://kodza.dev/media/kz-stack-1400.webp" width="1400" height="1050" alt="Three concrete slabs stacked at slightly different angles" loading="lazy">
<button class="kodza-make-way__toggle" type="button" aria-expanded="false">
<span class="kodza-make-way__label"><span class="kodza-make-way__label-inner"><span class="kodza-make-way__index">02</span> <span class="kodza-make-way__name">Stack Tower</span></span></span>
<span class="kodza-make-way__close" aria-hidden="true"></span>
</button>
<div class="kodza-make-way__details">
<h3 class="kodza-make-way__title">Stack Tower</h3>
<p class="kodza-make-way__meta">Rotterdam · 2025 · 12 floors</p>
<p class="kodza-make-way__text">Twelve floors, each one turned a little. Nobody asked for a twist. The wind did.</p>
</div>
</div>
</li>
<li class="kodza-make-way__item">
<div class="kodza-make-way__frame">
<img class="kodza-make-way__image" src="https://kodza.dev/media/kz-steps-1400.webp" width="1400" height="933" alt="Concrete steps climbing towards the light" loading="lazy">
<button class="kodza-make-way__toggle" type="button" aria-expanded="false">
<span class="kodza-make-way__label"><span class="kodza-make-way__label-inner"><span class="kodza-make-way__index">03</span> <span class="kodza-make-way__name">Steps Library</span></span></span>
<span class="kodza-make-way__close" aria-hidden="true"></span>
</button>
<div class="kodza-make-way__details">
<h3 class="kodza-make-way__title">Steps Library</h3>
<p class="kodza-make-way__meta">Porto · 2024 · 2 400 m²</p>
<p class="kodza-make-way__text">The stairs are the reading room. Sit anywhere. The books come down to you.</p>
</div>
</div>
</li>
<li class="kodza-make-way__item">
<div class="kodza-make-way__frame">
<img class="kodza-make-way__image" src="https://kodza.dev/media/kz-columns-1400.webp" width="1120" height="1400" alt="A row of square concrete pillars under a flat roof, casting striped shadows" loading="lazy">
<button class="kodza-make-way__toggle" type="button" aria-expanded="false">
<span class="kodza-make-way__label"><span class="kodza-make-way__label-inner"><span class="kodza-make-way__index">04</span> <span class="kodza-make-way__name">Columns Hall</span></span></span>
<span class="kodza-make-way__close" aria-hidden="true"></span>
</button>
<div class="kodza-make-way__details">
<h3 class="kodza-make-way__title">Columns Hall</h3>
<p class="kodza-make-way__meta">Bilbao · 2023 · 1 100 m²</p>
<p class="kodza-make-way__text">Forty pillars, one roof. The shadows tell the time better than the clock in the lobby.</p>
</div>
</div>
</li>
<li class="kodza-make-way__item">
<div class="kodza-make-way__frame">
<img class="kodza-make-way__image" src="https://kodza.dev/media/kz-arch-1400.webp" width="1400" height="1400" alt="A concrete wall with a round-topped opening, sunlight pouring through it" loading="lazy">
<button class="kodza-make-way__toggle" type="button" aria-expanded="false">
<span class="kodza-make-way__label"><span class="kodza-make-way__label-inner"><span class="kodza-make-way__index">05</span> <span class="kodza-make-way__name">Arch Pavilion</span></span></span>
<span class="kodza-make-way__close" aria-hidden="true"></span>
</button>
<div class="kodza-make-way__details">
<h3 class="kodza-make-way__title">Arch Pavilion</h3>
<p class="kodza-make-way__meta">Marseille · 2026 · 90 m²</p>
<p class="kodza-make-way__text">One wall, one opening. The light does the rest, and it never sends an invoice.</p>
</div>
</div>
</li>
<li class="kodza-make-way__item">
<div class="kodza-make-way__frame">
<img class="kodza-make-way__image" src="https://kodza.dev/media/kz-overflow-1400.webp" width="1400" height="1400" alt="A two-storey concrete house, its upper floor cantilevered over the ground" loading="lazy">
<button class="kodza-make-way__toggle" type="button" aria-expanded="false">
<span class="kodza-make-way__label"><span class="kodza-make-way__label-inner"><span class="kodza-make-way__index">06</span> <span class="kodza-make-way__name">Overflow Studio</span></span></span>
<span class="kodza-make-way__close" aria-hidden="true"></span>
</button>
<div class="kodza-make-way__details">
<h3 class="kodza-make-way__title">Overflow Studio</h3>
<p class="kodza-make-way__meta">Nantes · 2025 · 140 m²</p>
<p class="kodza-make-way__text">The upper floor overflows its box. In CSS that's a bug. Here it's the view.</p>
</div>
</div>
</li>
</ul>
</div>
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Make Way Grid
A grid of pictures, one open at a time: the one you click takes two by two cells and the
others slide out of its way, then its card unfolds from the name pill and its text rises
line by line. Two columns in narrow containers.
Tuned with the --kz-make-way-* variables; the script's timing sits under its SELECTOR. */
.kodza-make-way {
--kz-make-way-columns: 3;
--kz-make-way-columns-small: 2; /* under 560px of container */
--kz-make-way-ratio: 0.75; /* row height for a column width of 1 */
--kz-make-way-ratio-small: 1;
--kz-make-way-span: 2; /* cells the open picture takes, across and down */
--kz-make-way-gap: 12px;
--kz-make-way-inset: 16px; /* pill, card and close button, from the picture's edges */
--kz-make-way-inset-small: 10px;
--kz-make-way-card: 340px; /* the card's widest */
--kz-make-way-radius: calc(16px * var(--kz-radius-scale, 1));
--kz-make-way-card-radius: calc(12px * var(--kz-radius-scale, 1));
--kz-make-way-bg: #e9e9e6; /* behind a picture still loading */
--kz-make-way-pill-bg: #ffffff; /* pill, card and close button */
--kz-make-way-pill-fg: #0a0a0a;
--kz-make-way-muted: rgba(10, 10, 10, 0.64);
--kz-make-way-focus: #0a0a0a;
--kz-make-way-line: transparent; /* a hairline round each picture, for dark pictures on a dark page */
container: kodza-make-way / inline-size;
}
.kodza-make-way__grid {
--kz-make-way-cols: var(--kz-make-way-columns);
--kz-make-way-rows: var(--kz-make-way-ratio);
--kz-make-way-pad: var(--kz-make-way-inset);
--kz-make-way-col: calc((100cqi - (var(--kz-make-way-cols) - 1) * var(--kz-make-way-gap)) / var(--kz-make-way-cols));
--kz-make-way-across: min(var(--kz-make-way-span), var(--kz-make-way-cols));
display: grid;
grid-template-columns: repeat(var(--kz-make-way-cols), minmax(0, 1fr));
grid-auto-rows: calc(var(--kz-make-way-col) * var(--kz-make-way-rows));
gap: var(--kz-make-way-gap);
margin: 0;
padding: 0;
list-style: none;
isolation: isolate;
}
.kodza-make-way__item {
position: relative;
min-width: 0;
margin: 0;
padding: 0;
}
/* The open picture passes over the others, the one closing over the rest */
.kodza-make-way__item.is-open {
z-index: 2;
}
.kodza-make-way__item.is-leaving {
z-index: 1;
}
/* The script slides and resizes the frame from its old cells to its new ones */
.kodza-make-way__frame {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
border-radius: var(--kz-make-way-radius);
background: var(--kz-make-way-bg);
}
.kodza-make-way__frame::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
box-shadow: inset 0 0 0 1px var(--kz-make-way-line);
pointer-events: none;
}
.kodza-make-way__frame:has(.kodza-make-way__toggle:focus-visible) {
outline: 2px solid var(--kz-make-way-focus);
outline-offset: 3px;
}
.kodza-make-way__image {
display: block;
width: 100%;
max-width: none;
height: 100%;
object-fit: cover;
transition: transform calc(0.9s * var(--kz-motion-scale, 1)) cubic-bezier(0.22, 1, 0.36, 1);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
.kodza-make-way__item:not(.is-open):hover .kodza-make-way__image {
transform: scale(1.04);
}
}
/* The button covers the whole picture: click anywhere on it to open, again to close */
.kodza-make-way__toggle {
position: absolute;
inset: 0;
display: block;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
color: inherit;
font: inherit;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.kodza-make-way__toggle:focus-visible {
outline: none;
}
/* The name pill. Hidden once open, still read by screen readers: the card takes its place */
.kodza-make-way__label {
position: absolute;
bottom: var(--kz-make-way-pad);
left: var(--kz-make-way-pad);
display: block;
max-width: calc(100% - 2 * var(--kz-make-way-pad));
height: 34px;
padding: 0 14px;
box-sizing: border-box;
overflow: hidden;
border-radius: var(--kz-radius-pill, 999px);
background: var(--kz-make-way-pill-bg);
color: var(--kz-make-way-pill-fg);
font-family: var(--kz-font-label, inherit);
font-size: var(--kz-font-label-size, 13px);
font-weight: var(--kz-font-label-weight, 500);
letter-spacing: var(--kz-font-label-tracking, inherit);
text-transform: var(--kz-font-label-case, inherit);
line-height: 34px;
text-align: left;
white-space: nowrap;
transition: opacity 0s linear calc(0.4s * var(--kz-motion-scale, 1));
}
.kodza-make-way__label-inner {
display: block;
height: 100%;
transition: transform calc(0.35s * var(--kz-motion-scale, 1)) cubic-bezier(0.22, 1, 0.36, 1) calc(0.4s * var(--kz-motion-scale, 1));
}
.kodza-make-way__index {
margin-right: 4px;
color: var(--kz-make-way-muted);
font-family: var(--kz-font-label, var(--kz-font-mono, ui-monospace, "SF Mono", Menlo, monospace));
font-size: var(--kz-font-label-size, 11px);
}
.kodza-make-way__item.is-open .kodza-make-way__label {
opacity: 0;
transition: opacity 0s linear calc(0.2s * var(--kz-motion-scale, 1));
}
.kodza-make-way__item.is-open .kodza-make-way__label-inner {
transform: translateY(-100%);
transition: transform calc(0.22s * var(--kz-motion-scale, 1)) cubic-bezier(0.65, 0, 0.35, 1);
}
.kodza-make-way__close {
position: absolute;
top: var(--kz-make-way-pad);
right: var(--kz-make-way-pad);
width: 36px;
height: 36px;
border-radius: var(--kz-radius-pill, 999px);
background: var(--kz-make-way-pill-bg);
opacity: 0;
transform: scale(0.6) rotate(-45deg);
transition:
opacity calc(0.18s * var(--kz-motion-scale, 1)) ease,
transform calc(0.18s * var(--kz-motion-scale, 1)) cubic-bezier(0.65, 0, 0.35, 1);
}
.kodza-make-way__close::before,
.kodza-make-way__close::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: 14px;
height: 1.5px;
margin: -0.75px 0 0 -7px;
background: var(--kz-make-way-pill-fg);
transform: rotate(45deg);
}
.kodza-make-way__close::after {
transform: rotate(-45deg);
}
.kodza-make-way__item.is-open .kodza-make-way__close {
opacity: 1;
transform: none;
transition:
opacity calc(0.3s * var(--kz-motion-scale, 1)) ease calc(0.4s * var(--kz-motion-scale, 1)),
transform calc(0.4s * var(--kz-motion-scale, 1)) cubic-bezier(0.22, 1, 0.36, 1) calc(0.4s * var(--kz-motion-scale, 1));
}
/* The card, as wide as it will be once open. Closed, it is folded down to the pill's shape
(--kz-make-way-fold, measured by the script) and unfolds from it */
.kodza-make-way__details {
position: absolute;
bottom: var(--kz-make-way-pad);
left: var(--kz-make-way-pad);
width: min(var(--kz-make-way-card), var(--kz-make-way-across) * var(--kz-make-way-col) + (var(--kz-make-way-across) - 1) * var(--kz-make-way-gap) - 2 * var(--kz-make-way-pad));
padding: 20px 22px 22px;
box-sizing: border-box;
border-radius: var(--kz-make-way-card-radius);
background: var(--kz-make-way-pill-bg);
color: var(--kz-make-way-pill-fg);
clip-path: var(--kz-make-way-fold, inset(100% 100% 0 0));
visibility: hidden;
pointer-events: none;
transition:
clip-path calc(0.3s * var(--kz-motion-scale, 1)) cubic-bezier(0.65, 0, 0.35, 1) calc(0.1s * var(--kz-motion-scale, 1)),
visibility 0s linear calc(0.4s * var(--kz-motion-scale, 1));
}
.kodza-make-way__item.is-open .kodza-make-way__details {
clip-path: inset(0 round var(--kz-make-way-card-radius));
visibility: visible;
pointer-events: auto;
transition:
clip-path calc(0.55s * var(--kz-motion-scale, 1)) cubic-bezier(0.22, 1, 0.36, 1) calc(0.2s * var(--kz-motion-scale, 1)),
visibility 0s linear calc(0.2s * var(--kz-motion-scale, 1));
}
.kodza-make-way__title {
margin: 0 0 6px;
color: inherit;
font-family: var(--kz-font-display, inherit);
font-size: calc(24px * var(--kz-font-display-scale, 1));
font-weight: var(--kz-font-display-weight, 600);
letter-spacing: var(--kz-font-display-tracking, -0.035em);
text-transform: var(--kz-font-display-case, inherit);
line-height: 1.15;
}
.kodza-make-way__meta {
margin: 0 0 12px;
color: var(--kz-make-way-muted);
font-family: var(--kz-font-label, var(--kz-font-mono, ui-monospace, "SF Mono", Menlo, monospace));
font-size: var(--kz-font-label-size, 12px);
font-weight: var(--kz-font-label-weight, inherit);
letter-spacing: var(--kz-font-label-tracking, inherit);
line-height: var(--kz-font-label-leading, 1.4);
}
.kodza-make-way__text {
margin: 0;
color: var(--kz-make-way-muted);
font-size: 15px;
line-height: 1.55;
text-wrap: pretty;
}
/* Each line rises from behind its own mask once the card has unfolded */
.kodza-make-way__line {
display: block;
overflow: hidden;
padding-bottom: 0.1em;
margin-bottom: -0.1em;
}
.kodza-make-way__line > span {
display: block;
transform: translateY(110%);
transition: transform calc(0.18s * var(--kz-motion-scale, 1)) cubic-bezier(0.65, 0, 0.35, 1);
}
.kodza-make-way__item.is-open .kodza-make-way__line > span {
transform: none;
transition: transform calc(0.6s * var(--kz-motion-scale, 1)) cubic-bezier(0.22, 1, 0.36, 1) calc((0.32s + var(--kz-line, 0) * 0.06s) * var(--kz-motion-scale, 1));
}
@container kodza-make-way (max-width: 559px) {
.kodza-make-way__grid {
--kz-make-way-cols: var(--kz-make-way-columns-small);
--kz-make-way-rows: var(--kz-make-way-ratio-small);
--kz-make-way-pad: var(--kz-make-way-inset-small);
}
.kodza-make-way__index {
display: none;
}
}
@media (prefers-reduced-motion: reduce) {
.kodza-make-way__label,
.kodza-make-way__label-inner,
.kodza-make-way__close,
.kodza-make-way__details,
.kodza-make-way__line > span {
transition-duration: 0.01ms !important;
transition-delay: 0s !important;
}
}
/* Theming example — on a dark background:
.dark-section .kodza-make-way {
--kz-make-way-bg: #1c1c1c;
--kz-make-way-pill-bg: #161616;
--kz-make-way-pill-fg: #f2f2f0;
--kz-make-way-muted: rgba(242, 242, 240, 0.62);
--kz-make-way-focus: #f2f2f0;
}
*/
/* kodza-guard 0f24fcc1b551 — 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-make-way__toggle):not(#_) {
outline: revert;
}
/* What the browser gives, on everything the component leaves to it */
.kodza-make-way:not(#_),
.kodza-make-way__frame:not(#_),
.kodza-make-way__label-inner:not(#_),
.kodza-make-way__index:not(#_),
.kodza-make-way__name:not(#_),
.kodza-make-way__close:not(#_),
.kodza-make-way__line:not(#_),
.kodza-make-way__line span:where(:not([class*="kodza-"])):not(#_) {
box-sizing: revert;
}
.kodza-make-way__grid:not(#_) {
border: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: 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-make-way__item:not(#_) {
border: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: 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-make-way__image: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-make-way__toggle:not(#_) {
text-decoration: revert;
transition: revert;
list-style: revert;
box-sizing: revert;
float: revert;
box-shadow: revert;
outline-offset: revert;
appearance: revert;
max-width: revert;
max-height: revert;
letter-spacing: revert;
text-transform: revert;
text-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
white-space: revert;
min-height: revert;
}
.kodza-make-way__title:not(#_) {
border: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: 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-underline-offset: revert;
text-align: revert;
text-indent: revert;
text-shadow: revert;
vertical-align: revert;
}
.kodza-make-way__meta:not(#_) {
border: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: 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;
}
.kodza-make-way__text:not(#_) {
border: revert;
padding: revert;
border-radius: revert;
outline: revert;
text-decoration: revert;
transition: 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-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;
}
.kodza-make-way__item:not(#_):where(:not([hidden])),
.kodza-make-way__title:not(#_):where(:not([hidden])),
.kodza-make-way__meta:not(#_):where(:not([hidden])),
.kodza-make-way__text:not(#_):where(:not([hidden])) {
display: revert;
}
.kodza-make-way__item:not(#_):where([hidden]),
.kodza-make-way__title:not(#_):where([hidden]),
.kodza-make-way__meta:not(#_):where([hidden]),
.kodza-make-way__text:not(#_):where([hidden]) {
display: none;
}
.kodza-make-way__frame:not(#_)::after,
.kodza-make-way__close:not(#_)::before,
.kodza-make-way__close: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-make-way__grid:not(#_) {
display: grid;
margin: 0;
padding: 0;
list-style: none;
}
.kodza-make-way__item:not(#_) {
position: relative;
margin: 0;
padding: 0;
}
.kodza-make-way__image:not(#_) {
display: block;
max-width: none;
transition: transform calc(0.9s * var(--kz-motion-scale, 1)) cubic-bezier(0.22, 1, 0.36, 1);
}
.kodza-make-way__toggle:not(#_) {
position: absolute;
inset: 0;
display: block;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
color: inherit;
font: inherit;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
}
.kodza-make-way__toggle:focus-visible:not(#_) {
outline: none;
}
.kodza-make-way__title:not(#_) {
margin: 0 0 6px;
color: inherit;
font-family: var(--kz-font-display, inherit);
font-size: calc(24px * var(--kz-font-display-scale, 1));
font-weight: var(--kz-font-display-weight, 600);
letter-spacing: var(--kz-font-display-tracking, -0.035em);
text-transform: var(--kz-font-display-case, inherit);
line-height: 1.15;
}
.kodza-make-way__meta:not(#_) {
margin: 0 0 12px;
color: var(--kz-make-way-muted);
font-family: var(--kz-font-label, var(--kz-font-mono, ui-monospace, "SF Mono", Menlo, monospace));
font-size: var(--kz-font-label-size, 12px);
font-weight: var(--kz-font-label-weight, inherit);
letter-spacing: var(--kz-font-label-tracking, inherit);
line-height: var(--kz-font-label-leading, 1.4);
}
.kodza-make-way__text:not(#_) {
margin: 0;
color: var(--kz-make-way-muted);
font-size: 15px;
line-height: 1.55;
}
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Make Way Grid
// Opens one picture at a time: it takes two by two cells, the others slide out of its way
// (measured before and after, then animated from where they were), and its card unfolds from
// the name pill. Each card text is cut into lines at the card's width, so it rises line by line.
// Tune it with the --kz-make-way-* variables in the CSS and the constants below.
(() => {
const SELECTOR = '.kodza-make-way';
const MOVE = 700; // ms, the pictures sliding to their new cells; the card unfolds while they move (CSS)
const MOVE_EASE = 'cubic-bezier(0.76, 0, 0.24, 1)';
const CAUGHT_EASE = 'cubic-bezier(0.33, 0.66, 0.4, 1)'; // a move caught mid-way goes on at speed, no stop
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
// The site's pace, --kz-motion-scale (set on :root, read on the instance): every duration of the
// script times it, and 0 moves nothing, like reduced motion
const paceOf = (el) => {
const pace = parseFloat(getComputedStyle(el).getPropertyValue('--kz-motion-scale'));
return pace >= 0 ? pace : 1;
};
// 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) {
const pace = paceOf(root);
const still = reduceMotion || !pace; // the still path: no motion asked, by the visitor or the site
const grid = root.querySelector('.kodza-make-way__grid');
const items = grid ? [...grid.children].filter((el) => el.matches('.kodza-make-way__item')) : [];
const frames = items.map((item) => item.querySelector('.kodza-make-way__frame'));
const toggles = items.map((item) => item.querySelector('.kodza-make-way__toggle'));
const pills = items.map((item) => item.querySelector('.kodza-make-way__label'));
const cards = items.map((item) => item.querySelector('.kodza-make-way__details'));
if (!items.length || [...frames, ...toggles, ...pills, ...cards].some((el) => !el)) return;
// Plain text only: a title or paragraph with links or markup just shows with its card
const texts = cards.map((card) => [...card.querySelectorAll('.kodza-make-way__title, .kodza-make-way__meta, .kodza-make-way__text')]
.filter((el) => !el.children.length)
.map((el) => ({ el, words: el.textContent.trim().split(/[^\S ]+/) })));
// Cuts a text into masked lines; the line count runs on from `first` across a card's texts
const split = (el, words, first) => {
el.textContent = '';
const spans = words.map((word) => {
const span = document.createElement('span');
span.textContent = `${word} `;
el.append(span);
return span;
});
const lines = [];
spans.forEach((span) => {
const last = lines[lines.length - 1];
if (last && last.top === span.offsetTop) last.words.push(span.textContent);
else lines.push({ top: span.offsetTop, words: [span.textContent] });
});
el.textContent = '';
lines.forEach((line, i) => {
const outer = document.createElement('span');
const inner = document.createElement('span');
outer.className = 'kodza-make-way__line';
inner.textContent = line.words.join('').trim();
inner.style.setProperty('--kz-line', first + i);
outer.append(inner);
el.append(outer, ' ');
});
return first + lines.length;
};
// Lines at the card's width, and each card folded down to its pill (same corner, same size)
let measured = -1;
const layout = () => {
const width = cards[0].offsetWidth;
if (width !== measured) {
measured = width;
texts.forEach((list) => list.reduce((first, { el, words }) => split(el, words, first), 0));
}
cards.forEach((card, i) => {
const pill = pills[i];
const round = Math.min(parseFloat(getComputedStyle(pill).borderTopLeftRadius) || 0, pill.offsetHeight / 2);
card.style.setProperty('--kz-make-way-fold', `inset(${card.offsetHeight - pill.offsetHeight}px ${card.offsetWidth - pill.offsetWidth}px 0px 0px round ${round}px)`);
});
};
// The open picture keeps its row and takes the cells on its free side; the others flow
// around it in order
let current = -1;
const spanOf = () => Math.max(1, parseInt(getComputedStyle(root).getPropertyValue('--kz-make-way-span'), 10) || 2);
const place = () => {
const cols = getComputedStyle(grid).gridTemplateColumns.split(' ').length;
const span = spanOf();
const across = Math.min(span, cols);
items.forEach((item, i) => {
const open = i === current;
item.style.gridColumn = open ? `${Math.min(i % cols, cols - across) + 1} / span ${across}` : '';
item.style.gridRow = open ? `${Math.floor(i / cols) + 1} / span ${span}` : '';
});
};
// The engine moves the pictures: they slide and grow from their old cells to their new ones
const engine = makeWay(grid, frames, { duration: MOVE * pace, easing: MOVE_EASE, caught: CAUGHT_EASE });
let generation = 0;
const go = (next) => {
const leaving = items[current];
const change = () => {
items.forEach((item, i) => {
item.classList.toggle('is-open', i === next);
item.classList.remove('is-leaving');
toggles[i].setAttribute('aria-expanded', String(i === next));
});
current = next;
place();
};
if (still) return change();
const run = ++generation;
engine.move(change).then(() => run === generation && leaving?.classList.remove('is-leaving'));
if (leaving) leaving.classList.add('is-leaving');
};
toggles.forEach((toggle, i) => toggle.addEventListener('click', () => go(i === current ? -1 : i), { signal }));
// Escape closes and gives the focus back; the arrows move along the pictures, and open the
// next one when one is open
root.addEventListener('keydown', (event) => {
if (event.key === 'Escape' && current >= 0) {
const toggle = toggles[current];
go(-1);
toggle.focus();
return;
}
const at = toggles.indexOf(event.target);
const to = at < 0 ? undefined : { ArrowLeft: at - 1, ArrowRight: at + 1, Home: 0, End: toggles.length - 1 }[event.key];
if (to === undefined) return;
event.preventDefault();
const next = (to + toggles.length) % toggles.length;
toggles[next].focus();
if (current >= 0) go(next);
}, { signal });
// Written open in the markup: it starts open
const first = items.findIndex((item) => item.classList.contains('is-open'));
items.forEach((item, i) => {
item.classList.toggle('is-open', i === first);
toggles[i].setAttribute('aria-expanded', String(i === first));
});
current = first;
place();
layout();
// A new width can change the column count and the card's lines
let width = grid.clientWidth;
let raf = 0;
const observer = new ResizeObserver(() => {
if (grid.clientWidth === width) return;
width = grid.clientWidth;
cancelAnimationFrame(raf);
raf = requestAnimationFrame(() => {
engine.cancel();
place();
layout();
});
});
observer.observe(root);
document.fonts?.ready.then(() => {
if (signal.aborted) return;
measured = -1;
layout();
});
signal.addEventListener('abort', () => {
observer.disconnect();
cancelAnimationFrame(raf);
engine.cancel();
});
}
// ---------- Make Way engine (copied as is by Expanding Panels) ----------
// move(change) measures every frame in the container's own pixels (a parent scaled by
// transform does not shift them), runs change() to give them their new places, measures again,
// then slides and resizes each frame from where it was to where it is. Caught mid-move, a frame
// starts again from where it is. The container's height follows, so the page below never
// jumps. A frame clips its picture (object-fit: cover): the picture grows with it, never stretched.
// timing: { duration, easing, caught } — caught, the easing of a move that starts mid-way.
function makeWay(container, frames, { duration, easing, caught = easing }) {
let moving = [];
const rects = () => {
const box = container.getBoundingClientRect();
const scale = box.width / container.offsetWidth || 1;
return frames.map((frame) => {
const rect = frame.getBoundingClientRect();
return { x: (rect.left - box.left) / scale, y: (rect.top - box.top) / scale, w: rect.width / scale, h: rect.height / scale };
});
};
const cancel = () => {
moving.forEach((animation) => animation.cancel());
moving = [];
};
const move = (change) => {
const before = rects();
const tall = container.offsetHeight;
const timing = { duration, easing: moving.some((a) => a.playState === 'running') ? caught : easing };
cancel();
change();
const after = rects();
frames.forEach((frame, i) => {
const [a, b] = [before[i], after[i]];
if (Math.max(Math.abs(a.x - b.x), Math.abs(a.y - b.y), Math.abs(a.w - b.w), Math.abs(a.h - b.h)) < 0.5) return;
moving.push(frame.animate([
{ transform: `translate(${a.x - b.x}px, ${a.y - b.y}px)`, width: `${a.w}px`, height: `${a.h}px` },
{ transform: 'translate(0px, 0px)', width: `${b.w}px`, height: `${b.h}px` },
], timing));
});
const height = container.offsetHeight;
if (height !== tall) moving.push(container.animate([{ height: `${tall}px` }, { height: `${height}px` }], timing));
// Resolves once everything has arrived, false when a newer move or a cancel cut it short
return Promise.all(moving.map((animation) => animation.finished)).then(() => true, () => false);
};
return { move, cancel };
}
// ---------- end of the engine ----------
// 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. Two
// components on one root (a reveal on a stat card) both start, and stop together.
const KODZA = Symbol.for('kodza');
const RUNNING = Symbol.for(`kodza ${SELECTOR}`); // a root this component runs on, for every copy of this script
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) => {
// Already running, maybe from another copy of this script. Marked is-ready with no Kodza component
// running on it, a root is a copy of a started one (a cloned slide): it is left as it is
if (root[RUNNING] || (root.classList.contains('is-ready') && !root[KODZA])) return;
// Rendered by React (data-kodza-manual): React starts it, with an init aimed at that markup once
// it has hydrated it. Any earlier start would change markup React has not taken over yet
const owner = root.closest('[data-kodza-manual]');
if (owner && !(scope && owner.contains(scope))) return;
const controller = new AbortController();
// Another Kodza component already running on this root: its markup as written is kept, and the
// two stop together
const before = root[KODZA];
const saved = { html: before ? before.html : written(root), attrs: before ? before.attrs : attrsOf(root), stop: () => destroy(root) };
if (before) before.above = saved;
instances.set(root, { controller, saved, before });
root[KODZA] = saved;
root[RUNNING] = true;
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);
instance.saved.above?.stop(); // a Kodza component started after it on the same root stops first
// 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[RUNNING];
// Started on top of another one: that one stops next, and puts the markup back
if (instance.before) {
delete instance.before.above;
root[KODZA] = instance.before;
return instance.before.stop();
}
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 — Make Way Grid, for React. From https://kodza.dev/components/make-way-grid/
// 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: make-way-grid.css and make-way-grid.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.
// data-kodza-manual keeps the script from starting it on its own: the effect below does, once
// React has hydrated the markup (on a page that streams in, the script can load first).
// Built from your data (tabs, rows, options)? Put what the markup is made of in the key, as plain
// values (ids, text, numbers): a change starts the script again on fresh markup. What the visitor
// changes (the open tab, the sort, what they type) is the script's: keep it out of the key, follow
// it with onClick or onInput on the root, and change it from your code as a visitor would (click
// the tab; set the field's value, then dispatch a bubbling input event).
import { useRef, useEffect, type ComponentPropsWithoutRef, type ComponentRef, type CSSProperties } from 'react';
import './make-way-grid.css';
export type MakeWayGridProps = Omit<ComponentPropsWithoutRef<'div'>, "children" | "vars"> & {
/** Settings, as CSS variables on the root */
vars?: {
/** default: 3 */
"--kz-make-way-columns"?: string | number;
/** under 560px of container — default: 2 */
"--kz-make-way-columns-small"?: string | number;
/** row height for a column width of 1 — default: 0.75 */
"--kz-make-way-ratio"?: string | number;
/** default: 1 */
"--kz-make-way-ratio-small"?: string | number;
/** cells the open picture takes, across and down — default: 2 */
"--kz-make-way-span"?: string | number;
/** default: 12px */
"--kz-make-way-gap"?: string | number;
/** pill, card and close button, from the picture's edges — default: 16px */
"--kz-make-way-inset"?: string | number;
/** default: 10px */
"--kz-make-way-inset-small"?: string | number;
/** the card's widest — default: 340px */
"--kz-make-way-card"?: string | number;
/** default: calc(16px * var(--kz-radius-scale, 1)) */
"--kz-make-way-radius"?: string | number;
/** default: calc(12px * var(--kz-radius-scale, 1)) */
"--kz-make-way-card-radius"?: string | number;
/** behind a picture still loading — default: #e9e9e6 */
"--kz-make-way-bg"?: string | number;
/** pill, card and close button — default: #ffffff */
"--kz-make-way-pill-bg"?: string | number;
/** default: #0a0a0a */
"--kz-make-way-pill-fg"?: string | number;
/** default: rgba(10, 10, 10, 0.64) */
"--kz-make-way-muted"?: string | number;
/** default: #0a0a0a */
"--kz-make-way-focus"?: string | number;
/** a hairline round each picture, for dark pictures on a dark page — default: transparent */
"--kz-make-way-line"?: string | number;
};
className?: string;
};
export function MakeWayGrid({ vars, className, style, ...rest }: MakeWayGridProps) {
const ref = useRef<ComponentRef<'div'>>(null);
const classes = ["kodza-make-way", 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('./make-way-grid.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 (
<div key={key} {...rest} className={classes} data-kodza-manual style={{ ...vars, ...style } as CSSProperties} ref={ref}>
<ul className="kodza-make-way__grid">
<li className="kodza-make-way__item">
<div className="kodza-make-way__frame">
<img className="kodza-make-way__image" src="https://kodza.dev/media/kz-float-1400.webp" width="1400" height="933" alt="A concrete block hovering above the ground, over its own shadow" loading="lazy" />
{' '}
<button className="kodza-make-way__toggle" type="button" aria-expanded="false">
<span className="kodza-make-way__label">
<span className="kodza-make-way__label-inner">
<span className="kodza-make-way__index">01</span>
{' '}
<span className="kodza-make-way__name">Float House</span>
</span>
</span>
{' '}
<span className="kodza-make-way__close" aria-hidden="true" />
</button>
<div className="kodza-make-way__details">
<h3 className="kodza-make-way__title">Float House</h3>
<p className="kodza-make-way__meta">Le Havre · 2026 · 180 m²</p>
<p className="kodza-make-way__text">One cantilever, no hidden supports. The structure does what the drawings said it would.</p>
</div>
</div>
</li>
<li className="kodza-make-way__item">
<div className="kodza-make-way__frame">
<img className="kodza-make-way__image" src="https://kodza.dev/media/kz-stack-1400.webp" width="1400" height="1050" alt="Three concrete slabs stacked at slightly different angles" loading="lazy" />
{' '}
<button className="kodza-make-way__toggle" type="button" aria-expanded="false">
<span className="kodza-make-way__label">
<span className="kodza-make-way__label-inner">
<span className="kodza-make-way__index">02</span>
{' '}
<span className="kodza-make-way__name">Stack Tower</span>
</span>
</span>
{' '}
<span className="kodza-make-way__close" aria-hidden="true" />
</button>
<div className="kodza-make-way__details">
<h3 className="kodza-make-way__title">Stack Tower</h3>
<p className="kodza-make-way__meta">Rotterdam · 2025 · 12 floors</p>
<p className="kodza-make-way__text">Twelve floors, each one turned a little. Nobody asked for a twist. The wind did.</p>
</div>
</div>
</li>
<li className="kodza-make-way__item">
<div className="kodza-make-way__frame">
<img className="kodza-make-way__image" src="https://kodza.dev/media/kz-steps-1400.webp" width="1400" height="933" alt="Concrete steps climbing towards the light" loading="lazy" />
{' '}
<button className="kodza-make-way__toggle" type="button" aria-expanded="false">
<span className="kodza-make-way__label">
<span className="kodza-make-way__label-inner">
<span className="kodza-make-way__index">03</span>
{' '}
<span className="kodza-make-way__name">Steps Library</span>
</span>
</span>
{' '}
<span className="kodza-make-way__close" aria-hidden="true" />
</button>
<div className="kodza-make-way__details">
<h3 className="kodza-make-way__title">Steps Library</h3>
<p className="kodza-make-way__meta">Porto · 2024 · 2 400 m²</p>
<p className="kodza-make-way__text">The stairs are the reading room. Sit anywhere. The books come down to you.</p>
</div>
</div>
</li>
<li className="kodza-make-way__item">
<div className="kodza-make-way__frame">
<img className="kodza-make-way__image" src="https://kodza.dev/media/kz-columns-1400.webp" width="1120" height="1400" alt="A row of square concrete pillars under a flat roof, casting striped shadows" loading="lazy" />
{' '}
<button className="kodza-make-way__toggle" type="button" aria-expanded="false">
<span className="kodza-make-way__label">
<span className="kodza-make-way__label-inner">
<span className="kodza-make-way__index">04</span>
{' '}
<span className="kodza-make-way__name">Columns Hall</span>
</span>
</span>
{' '}
<span className="kodza-make-way__close" aria-hidden="true" />
</button>
<div className="kodza-make-way__details">
<h3 className="kodza-make-way__title">Columns Hall</h3>
<p className="kodza-make-way__meta">Bilbao · 2023 · 1 100 m²</p>
<p className="kodza-make-way__text">Forty pillars, one roof. The shadows tell the time better than the clock in the lobby.</p>
</div>
</div>
</li>
<li className="kodza-make-way__item">
<div className="kodza-make-way__frame">
<img className="kodza-make-way__image" src="https://kodza.dev/media/kz-arch-1400.webp" width="1400" height="1400" alt="A concrete wall with a round-topped opening, sunlight pouring through it" loading="lazy" />
{' '}
<button className="kodza-make-way__toggle" type="button" aria-expanded="false">
<span className="kodza-make-way__label">
<span className="kodza-make-way__label-inner">
<span className="kodza-make-way__index">05</span>
{' '}
<span className="kodza-make-way__name">Arch Pavilion</span>
</span>
</span>
{' '}
<span className="kodza-make-way__close" aria-hidden="true" />
</button>
<div className="kodza-make-way__details">
<h3 className="kodza-make-way__title">Arch Pavilion</h3>
<p className="kodza-make-way__meta">Marseille · 2026 · 90 m²</p>
<p className="kodza-make-way__text">One wall, one opening. The light does the rest, and it never sends an invoice.</p>
</div>
</div>
</li>
<li className="kodza-make-way__item">
<div className="kodza-make-way__frame">
<img className="kodza-make-way__image" src="https://kodza.dev/media/kz-overflow-1400.webp" width="1400" height="1400" alt="A two-storey concrete house, its upper floor cantilevered over the ground" loading="lazy" />
{' '}
<button className="kodza-make-way__toggle" type="button" aria-expanded="false">
<span className="kodza-make-way__label">
<span className="kodza-make-way__label-inner">
<span className="kodza-make-way__index">06</span>
{' '}
<span className="kodza-make-way__name">Overflow Studio</span>
</span>
</span>
{' '}
<span className="kodza-make-way__close" aria-hidden="true" />
</button>
<div className="kodza-make-way__details">
<h3 className="kodza-make-way__title">Overflow Studio</h3>
<p className="kodza-make-way__meta">Nantes · 2025 · 140 m²</p>
<p className="kodza-make-way__text">The upper floor overflows its box. In CSS that's a bug. Here it's the view.</p>
</div>
</div>
</li>
</ul>
</div>
);
}
Checked
Robots poked at it before you did. Every component goes through the same checks, and again each time it changes.