Band and case accordion
A black band of bold words with spinning sage stars running forever, then a two-face heading and a row of 40px case cards that widen on hover or focus, each with a drawn scene, a white caps label and a turning plus.
Part of the style
Glass Garden
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/glass-garden/cases/figma.html?palette=050bd00a57bfe0ab
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/glass-garden/cases/figma.html?palette=050bd00a57bfe0ab and pass that whole HTML document to the html_to_figma tool, so the part "Band and case accordion" 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
<style>
/* Goes after the pack's base.css */
:root {
--stone: #91816b;
--stone-light: #80715b;
--stone-shade: #746550;
--paper: #0e0600;
--mist: #7f705a;
--ink: #1c0d06;
--ink-soft: #2e1d14;
--charcoal: #25140b;
--graphite: #25140b;
--ash: #5c4f3b;
--sage-mid: #776956;
--sage-pale: #6f614c;
--forest: #25140b;
--line: rgba(28, 13, 6, 0.1);
--grid-line: rgba(28, 13, 6, 0.045);
--spot: rgba(133, 118, 96, 0.15);
--shadow: rgba(28, 13, 6, 0.1);
--glass: rgba(128, 113, 90, 0.55);
--linen: #7d6e58;
--sand: #746550;
--pool: #6e604a;
--stone-deep: #6e604b;
--glass-light: #80715b;
--glass-shadow: #544734;
--sage: #8a745c;
--lime: #d18823;
--pearl-1: #b3844e;
--sticker-leaf: #4a2d06;
--mint-card: #997b5b;
--pearl-4: #978068;
--sand-deep: #90857a;
--sticker-lemon: #a77c4a;
--horn: #917c66;
--pearl-2: #978068;
--sticker-rose: #a4815b;
--rose-light: #9b8164;
--pearl-3: #978068;
--sticker-terracotta: #978068;
--sticker-azul: #7e6951;
}
</style>
<section class="cases" aria-labelledby="cases-title-1">
<div class="cases__band" aria-hidden="true">
<div class="cases__track">
<span class="cases__phrase">Let’s grow your project<svg class="cases__star" viewBox="0 0 40 40"><path d="M20 2c2 12 6 16 18 18-12 2-16 6-18 18-2-12-6-16-18-18 12-2 16-6 18-18z" transform="rotate(45 20 20)"/></svg></span>
<span class="cases__phrase">Let’s grow your project<svg class="cases__star" viewBox="0 0 40 40"><path d="M20 2c2 12 6 16 18 18-12 2-16 6-18 18-2-12-6-16-18-18 12-2 16-6 18-18z" transform="rotate(45 20 20)"/></svg></span>
<span class="cases__phrase">Let’s grow your project<svg class="cases__star" viewBox="0 0 40 40"><path d="M20 2c2 12 6 16 18 18-12 2-16 6-18 18-2-12-6-16-18-18 12-2 16-6 18-18z" transform="rotate(45 20 20)"/></svg></span>
</div>
</div>
<h2 class="cases__title" id="cases-title-1"><span class="cases__kicker">Discover our</span><span class="cases__caps">Latest case studies</span></h2>
<ul class="cases__row">
<li class="cases__card cases__card--mint is-open">
<a class="cases__link" href="#">
<svg class="cases__art" viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect width="800" height="600" class="cases__fill-mint"/>
<g transform="translate(400 300)">
<path d="M0-150L260-20 0 110-260-20z" class="cases__fill-paper"/>
<path d="M-260-20L0 110v40l-260-130z" class="cases__fill-stone-shade"/>
<path d="M260-20L0 110v40l260-130z" class="cases__fill-stone"/>
<path d="M-120-60L40-140l120 60-160 80z" class="cases__fill-pale"/>
<path d="M-40-20L60-70l70 35L30 15z" class="cases__fill-pool"/>
<g class="cases__fill-leaf"><ellipse cx="-150" cy="-10" rx="26" ry="14"/><ellipse cx="-90" cy="20" rx="26" ry="14"/><ellipse cx="-30" cy="50" rx="26" ry="14"/><ellipse cx="150" cy="-10" rx="26" ry="14"/><ellipse cx="90" cy="20" rx="26" ry="14"/></g>
<g class="cases__fill-sage"><ellipse cx="-150" cy="-22" rx="18" ry="16"/><ellipse cx="-90" cy="8" rx="18" ry="16"/><ellipse cx="-30" cy="38" rx="18" ry="16"/><ellipse cx="150" cy="-22" rx="18" ry="16"/><ellipse cx="90" cy="8" rx="18" ry="16"/></g>
<path d="M-200-20l40 20M180-50l40 20" class="cases__line-ink"/>
<circle cx="40" cy="-140" r="6" class="cases__fill-lime"/>
</g>
</svg>
<span class="cases__label">Quinta do Rio, courtyard for a winery</span>
<span class="cases__plus" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></span>
</a>
</li>
<li class="cases__card cases__card--night">
<a class="cases__link" href="#">
<svg class="cases__art" viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect width="800" height="600" class="cases__fill-night"/>
<g class="cases__line-lime" fill="none"><circle cx="400" cy="300" r="190"/><circle cx="400" cy="300" r="130"/><circle cx="400" cy="300" r="70"/><path d="M400 60v480M160 300h480"/></g>
<g class="cases__fill-sage"><circle cx="266" cy="166" r="30"/><circle cx="534" cy="166" r="30"/><circle cx="266" cy="434" r="30"/><circle cx="534" cy="434" r="30"/></g>
<circle cx="400" cy="300" r="14" class="cases__fill-lime"/>
</svg>
<span class="cases__label">Praça Nova, a square that cools its street</span>
<span class="cases__plus" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></span>
</a>
</li>
<li class="cases__card cases__card--stone">
<a class="cases__link" href="#">
<svg class="cases__art" viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect width="800" height="600" class="cases__fill-stone-shade"/>
<g class="cases__fill-stone"><path d="M220 600V280a80 80 0 0 1 160 0v320z"/><path d="M420 600V280a80 80 0 0 1 160 0v320z"/></g>
<g class="cases__fill-paper"><path d="M250 600V290a50 50 0 0 1 100 0v310z"/><path d="M450 600V290a50 50 0 0 1 100 0v310z"/></g>
<g class="cases__fill-leaf"><circle cx="300" cy="540" r="40"/><circle cx="500" cy="540" r="40"/><circle cx="270" cy="560" r="26"/><circle cx="530" cy="560" r="26"/></g>
<path d="M180 200h440" class="cases__line-ink"/>
<circle cx="620" cy="140" r="30" class="cases__fill-butter"/>
</svg>
<span class="cases__label">Casa Alta, a terrace over the river</span>
<span class="cases__plus" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></span>
</a>
</li>
<li class="cases__card cases__card--mist">
<a class="cases__link" href="#">
<svg class="cases__art" viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect width="800" height="600" class="cases__fill-mist"/>
<g class="cases__fill-sage"><path d="M400 560C380 420 420 260 560 160c-10 160-60 300-160 400z"/><path d="M400 560C420 420 380 280 240 200c10 150 60 280 160 360z"/></g>
<path d="M400 560c40-140 80-260 160-400M400 560c-40-130-80-240-160-360" class="cases__line-pale" fill="none"/>
<circle cx="560" cy="160" r="10" class="cases__fill-terracotta"/>
</svg>
<span class="cases__label">Jardim do Bonfim, a school garden</span>
<span class="cases__plus" aria-hidden="true"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></span>
</a>
</li>
</ul>
</section>
<style>
.cases { padding: 0 0 var(--space-xl); background: var(--stone); color: var(--ink); overflow: hidden; }
.cases__band { overflow: hidden; background: var(--ink); color: var(--paper); }
.cases__track { display: flex; width: max-content; animation: cases-roll 26s linear infinite; }
.cases:not(.is-live) .cases__track,
.cases:not(.is-live) .cases__star { animation-play-state: paused; }
.cases__phrase {
display: inline-flex;
flex: none;
align-items: center;
gap: 34px;
padding: 24px 34px 24px 0;
font: 700 var(--band-size)/1 var(--font-body);
letter-spacing: 1px;
white-space: nowrap;
}
.cases__star {
width: 1.12em;
height: 1.12em;
fill: var(--sage);
animation: cases-turn var(--spin-slow) linear infinite;
}
.cases.is-reversed .cases__star { animation-name: cases-turn-back; }
@keyframes cases-roll { to { transform: translateX(-50%); } }
@keyframes cases-turn { to { transform: rotate(1turn); } }
@keyframes cases-turn-back { to { transform: rotate(-1turn); } }
.cases__title { display: grid; margin: var(--space-l) var(--edge) var(--space-m); font-weight: 400; }
.cases__kicker { font: 400 var(--head-s)/1.1 var(--font-display); }
.cases__caps { font: 400 var(--head-l)/1 var(--font-condensed); text-transform: uppercase; letter-spacing: -0.005em; }
.cases__row {
display: flex;
gap: 10px;
height: clamp(340px, 34vw, 560px);
margin: 0;
padding: 0 var(--edge);
list-style: none;
overflow-x: auto;
scrollbar-width: none;
}
.cases__row::-webkit-scrollbar { display: none; }
.cases__card {
position: relative;
flex: none;
width: clamp(120px, 21vw, 300px);
overflow: hidden;
border-radius: var(--radius-xl);
transition: width var(--time) var(--ease-case);
}
.cases__card.is-open { width: 65%; }
.cases__link { position: absolute; inset: 0; display: block; color: var(--ink); text-decoration: none; }
.cases__link:focus-visible { outline: 3px solid var(--sage); outline-offset: -6px; border-radius: var(--radius-xl); }
.cases__art { width: 100%; height: 100%; transition: transform var(--time) var(--ease-case); }
.cases__card.is-open .cases__art { transform: scale(1.03); }
.cases__label {
position: absolute;
left: 16px;
bottom: 16px;
max-width: calc(100% - 32px);
padding: 12px 16px;
border-radius: 6px;
background: var(--paper);
font: 400 var(--text-s)/1.2 var(--font-condensed);
font-size: 15px;
letter-spacing: 0.02em;
text-transform: uppercase;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
opacity: 0;
transform: translateY(8px);
transition: opacity var(--time) var(--ease), transform var(--time) var(--ease);
}
.cases__card.is-open .cases__label { opacity: 1; transform: none; transition-delay: 0.2s; }
.cases__plus {
position: absolute;
top: 18px;
right: 18px;
display: grid;
place-items: center;
width: var(--tap);
height: var(--tap);
border-radius: 50%;
background: rgba(255, 255, 255, 0.55);
color: var(--ink);
transition: transform var(--time) var(--ease), background-color var(--time) var(--ease), color var(--time) var(--ease);
}
.cases__plus svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: scale var(--time) var(--ease); }
.cases__link:hover .cases__plus,
.cases__link:focus-visible .cases__plus { transform: rotate(45deg); background: var(--ink); color: var(--paper); }
.cases__link:hover .cases__plus svg { scale: 1.1; }
.cases__fill-mint { fill: var(--mint-card); }
.cases__fill-paper { fill: var(--paper); }
.cases__fill-stone { fill: var(--stone); }
.cases__fill-stone-shade { fill: var(--stone-shade); }
.cases__fill-pale { fill: var(--sage-pale); }
.cases__fill-pool { fill: var(--mist); }
.cases__fill-leaf { fill: var(--sticker-leaf); }
.cases__fill-sage { fill: var(--sage); }
.cases__fill-lime { fill: var(--lime); }
.cases__fill-night { fill: var(--forest); }
.cases__fill-butter { fill: var(--pearl-4); }
.cases__fill-mist { fill: var(--mist); }
.cases__fill-terracotta { fill: var(--sticker-terracotta); }
.cases__line-ink { stroke: var(--ink); stroke-width: 3; }
.cases__line-lime { stroke: var(--lime); stroke-width: 2; }
.cases__line-pale { stroke: var(--sage-pale); stroke-width: 3; }
@media (max-width: 700px) {
.cases__row { height: 440px; }
.cases__card { width: 76px; }
.cases__card.is-open { width: calc(100% - 172px); min-width: 200px; }
.cases__label { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
.cases__track, .cases__star { animation: none; }
}
</style>
<script>
(() => {
function setUp(root) {
const track = root.querySelector('.cases__track');
for (const phrase of [...track.children]) track.append(phrase.cloneNode(true));
const cards = [...root.querySelectorAll('.cases__card')];
const open = (card) => {
for (const other of cards) other.classList.toggle('is-open', other === card);
};
for (const card of cards) {
const link = card.querySelector('.cases__link');
card.addEventListener('pointerenter', () => open(card));
link.addEventListener('focus', () => open(card));
link.addEventListener('click', (event) => {
if (card.classList.contains('is-open')) return;
event.preventDefault();
open(card);
});
}
let lastScroll = scrollY;
addEventListener('scroll', () => {
root.classList.toggle('is-reversed', scrollY < lastScroll);
lastScroll = scrollY;
}, { passive: true });
new IntersectionObserver(([entry]) => root.classList.toggle('is-live', entry.isIntersecting)).observe(root);
}
document.querySelectorAll('.cases').forEach(setUp);
})();
</script>