Folding spines
Four panels side by side where all but one are folded to 24 px spines; clicking a spine opens it with a grid-template-columns transition and turns it orange.
Part of the style
Ink Spine Diptych
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/ink-spine-diptych/spines/figma.html
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/ink-spine-diptych/spines/figma.html and pass that whole HTML document to the html_to_figma tool, so the part "Folding spines" lands as editable layers in my open Figma file. Fonts come from Google Fonts: if a face is missing in Figma, pick the closest one.
Code
<section class="spines" aria-label="Shelves" style="--tracks: minmax(var(--spine-tap), 0fr) minmax(var(--spine-tap), 1fr) minmax(var(--spine-tap), 0fr) minmax(var(--spine-tap), 0fr)">
<article class="spines__panel spines__panel--dark">
<button class="spines__spine" type="button" aria-expanded="false"><span class="spines__label">01 Harbour newsreels</span></button>
<div class="spines__body">
<h2 class="spines__title">Harbour newsreels</h2>
<p class="spines__text">Forty reels made for the cinema before the main feature: launches, storms, a king opening a fish market. Most were shown once and stored in a tin under the stage.</p>
<div class="spines__frame"><img class="spines__picture" src="assets/snow-tree.jpg" alt="A bare tree in a snowy square with a tram in the fog behind" width="668" height="800" loading="lazy"></div>
</div>
</article>
<article class="spines__panel spines__panel--light is-open">
<button class="spines__spine" type="button" aria-expanded="true"><span class="spines__label">02 Deck films</span></button>
<div class="spines__body">
<h2 class="spines__title">Deck films</h2>
<p class="spines__text">Home movies shot from ferries and trawlers between 1952 and 1979, given to us by the families who kept them. We screen them silent, in the order the boats sailed.</p>
<div class="spines__frame"><img class="spines__picture" src="assets/cloud-study.jpg" alt="Banks of cloud over a low dark hill line" width="974" height="1200" loading="lazy"></div>
</div>
</article>
<article class="spines__panel spines__panel--dark">
<button class="spines__spine" type="button" aria-expanded="false"><span class="spines__label">03 Projection booth</span></button>
<div class="spines__body">
<h2 class="spines__title">Projection booth</h2>
<p class="spines__text">Conversations with the people who ran the machines: how a reel was spliced, how a hall was darkened, what a crowd sounded like when the film broke.</p>
<p class="spines__meta">Six recordings · 2 h 40 min</p>
</div>
</article>
<article class="spines__panel spines__panel--light">
<button class="spines__spine" type="button" aria-expanded="false"><span class="spines__label">04 Town hall copies</span></button>
<div class="spines__body">
<h2 class="spines__title">Town hall copies</h2>
<p class="spines__text">Prints that never went back to the distributor. Each one is catalogued by the building it was found in, then by the street, then by the year.</p>
<p class="spines__meta">212 prints · 9 towns</p>
</div>
</article>
</section>
<style>
.spines {
display: grid;
grid-template-columns: var(--tracks);
height: clamp(520px, 52vw, 720px);
overflow: hidden;
container-type: inline-size;
transition: grid-template-columns var(--fold) var(--ease-fold), grid-template-rows var(--fold) var(--ease-fold);
}
.spines__panel {
display: flex;
min-width: 0;
min-height: 0;
overflow: hidden;
transition: background-color var(--fold) var(--ease-fold), color var(--fold) var(--ease-fold);
}
.spines__panel--dark {
background: var(--ink);
color: var(--paper-text);
}
.spines__panel--light {
background: var(--paper);
color: var(--ink);
}
.spines__panel.is-open {
background: var(--signal);
color: var(--signal-ink);
}
.spines__spine {
display: flex;
flex: none;
align-items: flex-end;
justify-content: center;
width: var(--spine-tap);
padding: var(--edge) 0;
border: 0;
background: transparent;
color: inherit;
cursor: pointer;
}
.spines__spine:focus-visible { outline: var(--rule) solid currentColor; outline-offset: -4px; }
.spines__label {
writing-mode: vertical-rl;
rotate: 180deg;
font-family: var(--font-display);
font-weight: var(--display-weight);
font-size: var(--text-s);
line-height: 1;
white-space: nowrap;
transition: opacity var(--quick) var(--ease-fade);
}
.spines__spine:hover .spines__label { opacity: 0.5; }
.spines__body {
display: flex;
flex-direction: column;
gap: var(--space-m);
flex: none;
width: calc(100cqw - var(--spine-tap) * 4);
padding: var(--edge) var(--edge) var(--edge) 0;
opacity: 0;
transition: opacity var(--quick) var(--ease-fade);
}
.spines__panel.is-open .spines__body {
opacity: 1;
transition-delay: calc(var(--fold) / 2);
}
.spines__title {
margin: 0;
font-family: var(--font-display);
font-weight: var(--display-weight);
font-size: var(--display-m);
line-height: var(--leading-tight);
letter-spacing: var(--track-display);
text-transform: uppercase;
}
.spines__text {
max-width: 30em;
margin: 0;
font-size: var(--text-m);
line-height: var(--leading-text);
}
.spines__meta {
margin: auto 0 0;
font-family: var(--font-display);
font-weight: var(--display-weight);
font-size: var(--display-s);
line-height: 1;
}
.spines__frame {
flex: 1 1 0;
min-height: 0;
overflow: hidden;
}
.spines__picture {
width: 100%;
height: 100%;
object-fit: cover;
scale: 1.08;
filter: grayscale(1) contrast(1.25);
}
@media (max-width: 40rem) {
.spines {
grid-template-columns: 1fr;
grid-template-rows: var(--tracks);
height: auto;
}
.spines__panel { flex-direction: column; }
.spines__spine {
justify-content: flex-start;
align-items: center;
width: 100%;
min-height: var(--spine-tap);
padding: 0 var(--edge);
}
.spines__label { writing-mode: horizontal-tb; rotate: none; }
.spines__body {
width: 100%;
padding: 0 var(--edge) var(--edge);
}
.spines__panel:not(.is-open) .spines__body { display: none; }
.spines__frame { flex: none; aspect-ratio: 4 / 3; }
}
</style>
<script>
(() => {
for (const root of document.querySelectorAll('.spines')) {
const panels = [...root.querySelectorAll('.spines__panel')];
const open = (chosen) => {
panels.forEach((panel) => {
const isOpen = panel === chosen;
panel.classList.toggle('is-open', isOpen);
panel.querySelector('.spines__spine').setAttribute('aria-expanded', String(isOpen));
});
root.style.setProperty('--tracks', panels.map((panel) =>
panel === chosen ? 'minmax(var(--spine-tap), 1fr)' : 'minmax(var(--spine-tap), 0fr)').join(' '));
};
panels.forEach((panel) => {
panel.querySelector('.spines__spine').addEventListener('click', () => open(panel));
});
}
})();
</script>