<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Peel Stack</title>
<style>
:root{
--ground:#F3EEE2;--card:#E6E3CE;--card2:#EBE8D7;--ink:#1E1F15;--deep:#0F100A;
--lift:#3D4128;--muted:#5A5E3B;--soft:#C9C8A6;--accent:#86914C;
--font:"Geist",system-ui,-apple-system,sans-serif;
}
@font-face{font-family:"Geist";src:url("/fonts-geist/Geist-Regular-latin.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap;}
@font-face{font-family:"Geist";src:url("/fonts-geist/Geist-Medium-latin.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap;}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--ground);color:var(--ink);font-family:var(--font);-webkit-font-smoothing:antialiased}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
.cover{width:100%;height:100%;object-fit:cover;object-position:center;display:block;pointer-events:none;user-select:none}
.hint{position:fixed;left:50%;bottom:5vh;transform:translateX(-50%);margin:0;font-size:10px;font-weight:500;letter-spacing:.22em;text-transform:uppercase;color:var(--muted);pointer-events:none;z-index:5;white-space:nowrap}
@media (prefers-reduced-motion:reduce){ .hint{display:none} }
html,body{overflow:hidden}
.stage{position:fixed;inset:0;display:grid;place-items:center;touch-action:none}
.deck{position:relative;width:min(70vw,62vh*0.72);height:min(78vh,70vw*1.25);transform-style:preserve-3d}
.card{position:absolute;inset:0;overflow:hidden;border-radius:6px;background:var(--card2);box-shadow:0 18px 40px rgba(15,16,10,.16);transform-origin:50% 100%;cursor:grab}
.card img{width:100%;height:100%;object-fit:cover;display:block}
.card.is-drag{cursor:grabbing}
</style>
</head>
<body>
<div class="stage" id="stage">
<div class="deck" id="deck"></div>
</div>
<p class="hint">Drag or swipe</p>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.13.0/dist/gsap.min.js"></script>
<script>
(function(){
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const srcOf = (f) => "/images/webp/" + f;
const files = ["look-hero.webp","courtyard-coat.webp","platform-suit.webp","wet-street-coat.webp","golden-hour-coat.webp"];
const deck = document.getElementById("deck");
const cards = [];
files.forEach((f, n) => {
const el = document.createElement("div");
el.className = "card";
const img = document.createElement("img");
img.className="cover"; img.alt=""; img.src=srcOf(f); img.draggable=false;
el.appendChild(img);
deck.appendChild(el);
cards.push(el);
});
function layout(){
cards.forEach((c, n) => {
const z = cards.length - n;
const rest = n===0 ? 0 : Math.min(n, 3);
gsap.set(c, {zIndex:z, x: rest*10, y: rest*12, rotation: rest*2.2, scale: 1 - rest*0.03});
});
}
layout();
let startX=0, dragging=false, top=cards[0];
function bind(el){
el.addEventListener("pointerdown", (e) => {
if (el !== cards[0]) return;
dragging=true; el.classList.add("is-drag");
startX=e.clientX; el.setPointerCapture(e.pointerId);
});
el.addEventListener("pointermove", (e) => {
if (!dragging || el !== cards[0]) return;
const dx = e.clientX - startX;
gsap.set(el, {x:dx, rotation: dx/22});
});
function end(e){
if (!dragging || el !== cards[0]) return;
dragging=false; el.classList.remove("is-drag");
const dx = e.clientX - startX;
const w = el.getBoundingClientRect().width;
if (reduce){ /* snap only if clearly thrown */ }
if (Math.abs(dx) > w * 0.28){
const dir = dx < 0 ? -1 : 1;
gsap.to(el, {x: dir * (w*1.15), rotation: dir*18, duration: reduce?0:0.55, ease:"power3.in", onComplete(){
cards.push(cards.shift());
layout();
}});
} else {
gsap.to(el, {x:0, rotation:0, duration: reduce?0:0.55, ease:"expo.out"});
}
}
el.addEventListener("pointerup", end);
el.addEventListener("pointercancel", end);
}
cards.forEach(bind);
})();
</script>
</body>
</html>
Build a single self-contained HTML file (vanilla CSS and JavaScript; GSAP 3.13+ from jsDelivr, plus ScrollTrigger or Flip only if required) for “Peel Stack”.
A small stack of stills. Drag one aside and it eases off the pile.
Use the Olive & Moss palette: ground #F3EEE2, card #E6E3CE, ink #1E1F15, deep #0F100A, lift #3D4128, muted #5A5E3B, soft #C9C8A6, accent #86914C. Amber #FFA51F is not used as type. Images use object-fit: cover (or equivalent cover mapping in a shader) and must be undistorted at rest. Easing: expo.out / power3.inOut, no bounce or elastic. Respect prefers-reduced-motion. One file.