# Runway lookbook section

> A Shopify-ready runway where seven cut-out looks walk a looping line and every look opens its own rail of pieces to add to the cart.

- Category: E-commerce
- Version: 1.0
- Source: https://ownlyplans.com/bhaskar/runway-lookbook-section/

## Overview

A single-file runway lookbook for a fashion store, built as a  web component with no libraries. Seven background-free model photos stand in a line that recedes into soft blur; the front look is sharp, and the line loops forever, so the look that walks off on the right quietly rejoins at the back. Shoppers move with the arrows, a drag or swipe, horizontal trackpad scroll, the keyboard or by tapping any model. Each look has its own product rail with a wishlist heart and an add-to-cart button that posts to Shopify's /cart/add.js (a demo mode fakes it), and selecting a block in the Shopify theme editor jumps to that look. The demo is a festive Indian edit with INR prices and free Pexels photos; swap in your own looks and products.

## Tech stack

- CSS
- HTML
- JavaScript
- Shopify
- Web Components

## Build steps

### 1. Stand the looks in a line

Build the section shell and place seven cut-out models on a stage so the front look is sharp and the rest recede, shrink and blur to the left.

Prompt:

```text
Create a single-file HTML runway lookbook section for a fashion store. No libraries. Use a custom element <runway-lookbook class="rwl"> with a two-column grid: a stage on the left and a 300px product rail on the right, 640px tall, on a soft #edf1f6 background, set in Jost. Put seven .rwl__model elements in the stage, each holding a transparent full-length model photo standing on the bottom edge with a soft floor shadow. Write pose(d), where d is the distance from the front: the front model stands at 70% of the stage width; models behind move left with x = frontX - spread * (1 - 0.65^d), scale to 1 - 0.35d for the first and 0.65 * 0.78^(d-1) after, lift slightly, blur by (d - 0.8) * 1.9px and fade out after the fifth. Apply it with translate3d, scale, filter and opacity on a 0.95s cubic-bezier(.65,0,.2,1) transition. Add a FESTIVE EDIT 2026 title and a short intro top left.
```

**Done when:** Seven looks stand in a receding line with the front one sharp and the rest smaller and blurred.

### 2. Walk the line, endlessly

Move through the looks with arrows, drag, swipe, trackpad and keys, and make the line loop so it never runs out.

Prompt:

```text
Keep an unbounded position pos and an index. For model k use dist(k, pos) = mod(k - pos + 1) - 1, so distances wrap into [-1, count - 1): the look that walks off (d between -1 and 0 moves right, grows a little, blurs and fades) rejoins at the back. When a model wraps, place it at its new spot with no transition and re-enable transitions on the next frame, so it never slides across the stage. Add round previous/next arrows with a 01 / 07 counter, ArrowLeft/ArrowRight on the focused stage, horizontal wheel or shift+wheel (one step per 60px with a 450ms lock), and pointer drag: decide horizontal or vertical after 6px, capture the pointer, move the line live by dx / max(160, 38% of the width), then snap by distance or flick speed. Tapping a model further back brings it to the front by the shortest way round. Bottom left, show LOOK 15 with a slide-up label change and a Shop the look link.
```

**Done when:** Arrows, drag, keys and taps all move the line, and after the last look the first one walks in again.

### 3. Give every look its own product rail

Show the pieces of the front look in the rail, with wishlist hearts and an add to cart that works on Shopify.

Prompt:

```text
For each look add a .rwl__group in the rail with three product cards: a cut-out product photo on a light card, the name in small uppercase, the price in INR, a heart button top left (aria-pressed, fills red) and a round + add button bottom right. Only the active group is visible; its cards rise in one by one with an 80ms stagger. Shop the look focuses the rail and pulses its border (on phones it scrolls the rail into view). The add button posts { items: [{ id: variantId, quantity: 1 }], sections: 'cart-icon-bubble' } to Shopify.routes.root + 'cart/add.js', swaps in the returned cart bubble, refreshes [data-cart-count] from cart.js and fires a cart:refresh event. With data-demo on the element, skip the request and show a +1 cart pop instead. Fire runway:change and runway:added events, and in the Shopify theme editor jump to a look when its block is selected.
```

**Done when:** Each look shows its own three pieces, hearts toggle, and add to cart updates the count (or the demo counter).

### 4. Phone layout, dots and polish

Stack the rail under the stage on phones, add dots and a first-visit hint, preload upcoming looks and respect reduced motion.

Prompt:

```text
Under 750px: stack the stage and rail, make the stage min(68svh, 560px) tall, put the front model at 64% with a wider spread, let a model take up to 52cqw, hide the counter and show pill dots at the top (the active dot stretches to 20px). Turn the rail into a 268px horizontal scroll-snap strip with cards at 44% width (52% under 380px). Show a Swipe to walk the line hint in the middle of the stage for a few seconds on load. Re-measure on resize with a ResizeObserver, eagerly load the next three looks' images when the index changes, pause autoplay on hover when data-autoplay is set, read data-start for the first look number, and cut transitions to near zero under prefers-reduced-motion. Make it accessible: a region with carousel roledescription, aria-live on the look label and aria-hidden on the models behind.
```

**Done when:** On a phone you can swipe the line, see the dots and scroll the product strip; on desktop nothing changes.

## Assets

### runway-lookbook.html — The finished section. Put your transparent cut-outs in a photos/ folder (look-15.webp to look-21.webp, look-15-1.webp and so on), or it shows silhouettes.

```
<!DOCTYPE html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Runway Lookbook — Section Demo</title>
<link rel="preconnect" href="https://fonts.googleapis.com"><link href="https://fonts.googleapis.com/css2?family=Jost:wght@400;500&display=swap" rel="stylesheet">
<style>
body{margin:0;font-family:Jost,"Helvetica Neue",Arial,sans-serif;background:#fff;color:#111;-webkit-tap-highlight-color:transparent}
.demo-head{display:flex;align-items:center;justify-content:space-between;padding:16px 28px;font-size:11px;letter-spacing:.18em;border-bottom:1px solid #eee;position:sticky;top:0;background:rgba(255,255,255,.92);backdrop-filter:blur(8px);z-index:500}
.demo-head nav{display:flex;gap:26px;color:#9aa} .demo-head nav .on{color:#111}
.demo-note{max-width:720px;margin:18px auto 40px;padding:0 20px;font-size:12px;color:#777;text-align:center;line-height:1.6}
.demo-note a{color:inherit}
@media(max-width:749px){.demo-head{padding:14px 18px}.demo-head nav{display:none}}
.rwl{
  --rwl-bg:#edf1f6;--rwl-card:#e6ecf4;--rwl-ink:#111;--rwl-muted:#6b7280;
  --rwl-rail-w:300px;--rwl-h:640px;--rwl-ease:cubic-bezier(.65,0,.2,1);
  position:relative;background:var(--rwl-bg);color:var(--rwl-ink);
}
.rwl *{box-sizing:border-box}
.rwl__inner{display:grid;grid-template-columns:minmax(0,1fr) var(--rwl-rail-w);height:var(--rwl-h)}

/* ---------- stage ---------- */
.rwl__stage{position:relative;overflow:hidden;container-type:inline-size;touch-action:pan-y;cursor:grab;user-select:none;-webkit-user-select:none;outline:none}
.rwl__stage.is-dragging{cursor:grabbing}
.rwl__stage:focus-visible{box-shadow:inset 0 0 0 2px var(--rwl-ink)}
.rwl__intro{position:absolute;top:36px;left:40px;z-index:200;max-width:330px;pointer-events:none}
.rwl__title{margin:0 0 12px;font-size:clamp(18px,1.7vw,26px);font-weight:500;letter-spacing:.14em;text-transform:uppercase;line-height:1.15}
.rwl__desc{margin:0;font-size:12px;line-height:1.6;color:var(--rwl-muted)}
.rwl__desc p{margin:0}

.rwl__models{position:absolute;inset:0}
.rwl__model{position:absolute;left:0;bottom:0;width:0;height:84%;transform-origin:0 100%;
  will-change:transform,filter,opacity;
  transition:transform .95s var(--rwl-ease),filter .95s var(--rwl-ease),opacity .95s var(--rwl-ease)}
.rwl.is-instant .rwl__model,.rwl__stage.is-dragging .rwl__model{transition:none}
.rwl__figure{position:absolute;bottom:0;left:0;height:100%;transform:translateX(-50%);pointer-events:auto;cursor:pointer}
.rwl__model.is-front .rwl__figure{cursor:inherit}
.rwl__figure img,.rwl__figure svg{display:block;height:100%;width:auto;max-width:var(--rwl-fig-max,34cqw);object-fit:contain;object-position:50% 100%;pointer-events:none;-webkit-user-drag:none}
.rwl__figure::after{content:"";position:absolute;left:50%;bottom:-1.5%;width:70%;height:3.5%;transform:translateX(-50%);
  background:radial-gradient(closest-side,rgba(0,0,0,.18),transparent);z-index:-1}
.rwl__placeholder{height:100%;width:auto;aspect-ratio:1/2.4;fill:rgba(0,0,0,.18);background:rgba(0,0,0,.04)}

/* ---------- caption + controls ---------- */
.rwl__caption{position:absolute;left:40px;bottom:34px;z-index:200;text-shadow:0 0 14px var(--rwl-bg),0 0 4px var(--rwl-bg)}
.rwl__look{display:block;height:1.2em;overflow:hidden;margin:0 0 8px;font-size:clamp(20px,2vw,30px);font-weight:500;letter-spacing:.16em;text-transform:uppercase;line-height:1.2}
.rwl__look span{display:block}
.rwl__look span.is-in{animation:rwlUp .6s var(--rwl-ease)}
@keyframes rwlUp{from{transform:translateY(100%);opacity:0}to{transform:none;opacity:1}}
.rwl__shop{appearance:none;background:none;border:0;padding:0 0 3px;font:inherit;font-size:10px;letter-spacing:.18em;text-transform:uppercase;color:inherit;cursor:pointer;border-bottom:1px solid currentColor}
.rwl__controls{position:absolute;right:24px;bottom:28px;z-index:200;display:flex;align-items:center;gap:10px}
.rwl__count{font-size:11px;letter-spacing:.14em;color:var(--rwl-muted);min-width:56px;text-align:center;font-variant-numeric:tabular-nums}
.rwl__arrow{appearance:none;width:40px;height:40px;border-radius:50%;border:1px solid rgba(0,0,0,.18);background:rgba(255,255,255,.6);color:inherit;display:grid;place-items:center;cursor:pointer;transition:background .2s,opacity .2s}
.rwl__arrow:hover{background:#fff}
.rwl__arrow[disabled]{opacity:.3;cursor:default}
.rwl__arrow svg{width:16px;height:16px}
.rwl__dots{position:absolute;left:50%;top:18px;transform:translateX(-50%);z-index:200;display:none;gap:6px}
.rwl__dot{appearance:none;border:0;padding:0;width:6px;height:6px;border-radius:3px;background:rgba(0,0,0,.2);cursor:pointer;transition:width .35s var(--rwl-ease),background .35s}
.rwl__dot.is-on{width:20px;background:var(--rwl-ink)}
.rwl__hint{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:210;pointer-events:none;font-size:11px;letter-spacing:.2em;text-transform:uppercase;background:rgba(17,17,17,.75);color:#fff;padding:10px 16px;border-radius:999px;opacity:0;transition:opacity .5s}
.rwl__hint.is-on{opacity:1}

/* ---------- product rail ---------- */
.rwl__rail{position:relative;background:#fff;overflow:hidden}
.rwl__rail.is-pulse{animation:rwlPulse .8s ease}
@keyframes rwlPulse{50%{box-shadow:inset 0 0 0 2px var(--rwl-ink)}}
.rwl__group{position:absolute;inset:0;display:flex;flex-direction:column;gap:3px;overflow-y:auto;scrollbar-width:thin;visibility:hidden;pointer-events:none}
.rwl__group.is-active{visibility:visible;pointer-events:auto}
.rwl__card{position:relative;flex:0 0 auto;background:var(--rwl-card);padding:14px 14px 12px;opacity:0;transform:translateY(18px);transition:opacity .45s ease,transform .55s var(--rwl-ease)}
.rwl__group.is-active .rwl__card{opacity:1;transform:none;transition-delay:calc(var(--i,0) * 80ms + 150ms)}
.rwl__media{display:block;aspect-ratio:4/3;margin:0 auto 10px}
.rwl__media img,.rwl__media svg{width:100%;height:100%;object-fit:contain;display:block;mix-blend-mode:multiply}
.rwl__info{display:flex;flex-direction:column;gap:3px;padding-right:30px}
.rwl__name{font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:inherit;text-decoration:none;line-height:1.35}
.rwl__price{font-size:10px;color:var(--rwl-muted);letter-spacing:.04em}
.rwl__heart,.rwl__add{appearance:none;border:0;background:none;color:inherit;cursor:pointer;padding:0;display:grid;place-items:center}
.rwl__heart{position:absolute;top:10px;left:10px;width:28px;height:28px}
.rwl__heart svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.6;transition:fill .2s,transform .2s}
.rwl__heart[aria-pressed="true"] svg{fill:#e11d2e;stroke:#e11d2e;transform:scale(1.12)}
.rwl__add{position:absolute;right:10px;bottom:10px;width:30px;height:30px;border-radius:50%;transition:background .2s,color .2s}
.rwl__add:hover{background:var(--rwl-ink);color:#fff}
.rwl__add svg{width:14px;height:14px;stroke:currentColor;stroke-width:1.6;fill:none}
.rwl__add.is-loading{opacity:.4;pointer-events:none}
.rwl__add.is-done{background:var(--rwl-ink);color:#fff}
.rwl__pop{position:absolute;right:12px;bottom:40px;font-size:12px;font-weight:600;background:var(--rwl-ink);color:#fff;padding:3px 8px;pointer-events:none;animation:rwlPop 1s ease forwards}
@keyframes rwlPop{0%{opacity:0;transform:translateY(6px)}20%{opacity:1;transform:none}80%{opacity:1}100%{opacity:0;transform:translateY(-14px)}}

/* ---------- mobile ---------- */
@media (max-width:749px){
  .rwl__inner{grid-template-columns:1fr;grid-template-rows:auto auto;height:auto}
  .rwl__stage{height:min(68vh,560px);height:min(68svh,560px);min-height:420px}
  .rwl__intro{top:44px;left:20px;right:20px;max-width:none}
  .rwl__title{font-size:19px;margin-bottom:8px}
  .rwl__desc{font-size:11.5px;max-width:30ch}
  .rwl__dots{display:flex}
  .rwl__model{height:70%}
  .rwl__stage{--rwl-fig-max:52cqw}
  .rwl__caption{left:20px;bottom:20px}
  .rwl__look{font-size:22px}
  .rwl__controls{right:14px;bottom:16px;gap:8px}
  .rwl__count{display:none}
  .rwl__arrow{width:38px;height:38px;background:rgba(255,255,255,.85)}
  .rwl__rail{height:268px;border-top:1px solid rgba(0,0,0,.06)}
  .rwl__group{position:absolute;flex-direction:row;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;gap:3px;padding-right:20px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .rwl__group::-webkit-scrollbar{display:none}
  .rwl__card{flex:0 0 44%;scroll-snap-align:start;padding:12px 12px 14px;display:flex;flex-direction:column}
  .rwl__media{aspect-ratio:auto;height:150px;width:100%;margin-bottom:10px}
  .rwl__name{font-size:9.5px}
  .rwl__add{width:34px;height:34px;right:6px;bottom:8px}
  .rwl__heart{width:34px;height:34px;top:4px;left:4px}
}
@media (max-width:380px){ .rwl__card{flex-basis:52%} }
@media (prefers-reduced-motion:reduce){
  .rwl__model,.rwl__card{transition-duration:.01s!important}
}

</style></head><body>
<header class="demo-head"><strong>YOUR STORE</strong><nav><span class="on">Runway</span><span>Collections</span><span>Lookbook</span><span>Shop</span></nav><span>CART (<b id="demoCart">0</b>)</span></header>
<runway-lookbook class="rwl" data-demo data-start="15" data-loop="true" data-autoplay="0">
<div class="rwl__inner"><div class="rwl__stage" data-stage tabindex="0" role="region" aria-roledescription="carousel" aria-label="Runway lookbook">
<div class="rwl__dots" data-dots></div>
<div class="rwl__intro"><h2 class="rwl__title">Festive Edit 2026</h2><div class="rwl__desc"><p>Lehengas, block-print suits and anarkalis for every celebration. Swipe to walk the line.</p></div></div>
<div class="rwl__models"><div class="rwl__model" data-model data-label=""><div class="rwl__figure"><img src="photos/look-15.webp" alt="Look 15: Rani Bridal Lehenga" draggable="false" ></div></div><div class="rwl__model" data-model data-label=""><div class="rwl__figure"><img src="photos/look-16.webp" alt="Look 16: Ivory Block-Print Lehenga" draggable="false" ></div></div><div class="rwl__model" data-model data-label=""><div class="rwl__figure"><img src="photos/look-17.webp" alt="Look 17: Teal Floral Kurta Set" draggable="false" ></div></div><div class="rwl__model" data-model data-label=""><div class="rwl__figure"><img src="photos/look-18.webp" alt="Look 18: Neel Ikat Co-ord" draggable="false" ></div></div><div class="rwl__model" data-model data-label=""><div class="rwl__figure"><img src="photos/look-19.webp" alt="Look 19: Haldi Stripe Suit" draggable="false" loading="lazy"></div></div><div class="rwl__model" data-model data-label=""><div class="rwl__figure"><img src="photos/look-20.webp" alt="Look 20: Silver Mist Anarkali" draggable="false" loading="lazy"></div></div><div class="rwl__model" data-model data-label=""><div class="rwl__figure"><img src="photos/look-21.webp" alt="Look 21: Chandni Ivory Lehenga" draggable="false" loading="lazy"></div></div></div>
<div class="rwl__caption"><p class="rwl__look" data-look aria-live="polite"><span>Look 15</span></p><button type="button" class="rwl__shop" data-shop>Shop the look</button></div>
<div class="rwl__controls"><button type="button" class="rwl__arrow" data-prev aria-label="Previous look"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M10 3 5 8l5 5"/></svg></button><span class="rwl__count" data-count></span><button type="button" class="rwl__arrow" data-next aria-label="Next look"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="m6 3 5 5-5 5"/></svg></button></div>
<div class="rwl__hint" id="hint">Swipe to walk the line →</div>
</div><div class="rwl__rail" data-rail><div class="rwl__group is-active" data-group aria-hidden="false"><div class="rwl__card" style="--i:0"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-15-1.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Rani Zardozi Lehenga Set"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Rani Zardozi Lehenga Set</a><span class="rwl__price">₹48,999</span></div><button type="button" class="rwl__add" data-add data-variant-id="00" aria-label="Add Rani Zardozi Lehenga Set to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:1"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-15-2.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Maroon Velvet Dupatta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Maroon Velvet Dupatta</a><span class="rwl__price">₹6,499</span></div><button type="button" class="rwl__add" data-add data-variant-id="01" aria-label="Add Maroon Velvet Dupatta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:2"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-15-3.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Kundan Bridal Choker"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Kundan Bridal Choker</a><span class="rwl__price">₹3,299</span></div><button type="button" class="rwl__add" data-add data-variant-id="02" aria-label="Add Kundan Bridal Choker to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div></div><div class="rwl__group" data-group aria-hidden="true"><div class="rwl__card" style="--i:0"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-16-1.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Ivory Block-Print Lehenga"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Ivory Block-Print Lehenga</a><span class="rwl__price">₹8,499</span></div><button type="button" class="rwl__add" data-add data-variant-id="10" aria-label="Add Ivory Block-Print Lehenga to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:1"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-16-2.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Mul Cotton Dupatta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Mul Cotton Dupatta</a><span class="rwl__price">₹1,299</span></div><button type="button" class="rwl__add" data-add data-variant-id="11" aria-label="Add Mul Cotton Dupatta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:2"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-16-3.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Embroidered Crop Blouse"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Embroidered Crop Blouse</a><span class="rwl__price">₹2,199</span></div><button type="button" class="rwl__add" data-add data-variant-id="12" aria-label="Add Embroidered Crop Blouse to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div></div><div class="rwl__group" data-group aria-hidden="true"><div class="rwl__card" style="--i:0"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-17-1.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Teal Floral Kurta Set"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Teal Floral Kurta Set</a><span class="rwl__price">₹3,999</span></div><button type="button" class="rwl__add" data-add data-variant-id="20" aria-label="Add Teal Floral Kurta Set to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:1"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-17-2.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Sage Chiffon Dupatta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Sage Chiffon Dupatta</a><span class="rwl__price">₹1,199</span></div><button type="button" class="rwl__add" data-add data-variant-id="21" aria-label="Add Sage Chiffon Dupatta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:2"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-17-3.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Teal Straight Pants"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Teal Straight Pants</a><span class="rwl__price">₹1,499</span></div><button type="button" class="rwl__add" data-add data-variant-id="22" aria-label="Add Teal Straight Pants to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div></div><div class="rwl__group" data-group aria-hidden="true"><div class="rwl__card" style="--i:0"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-18-1.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Neel Ikat Kurta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Neel Ikat Kurta</a><span class="rwl__price">₹2,499</span></div><button type="button" class="rwl__add" data-add data-variant-id="30" aria-label="Add Neel Ikat Kurta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:1"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-18-2.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Ikat Cigarette Pants"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Ikat Cigarette Pants</a><span class="rwl__price">₹1,699</span></div><button type="button" class="rwl__add" data-add data-variant-id="31" aria-label="Add Ikat Cigarette Pants to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:2"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-18-3.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Motif Print Dupatta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Motif Print Dupatta</a><span class="rwl__price">₹1,099</span></div><button type="button" class="rwl__add" data-add data-variant-id="32" aria-label="Add Motif Print Dupatta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div></div><div class="rwl__group" data-group aria-hidden="true"><div class="rwl__card" style="--i:0"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-19-1.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Haldi Block-Print Kurta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Haldi Block-Print Kurta</a><span class="rwl__price">₹2,799</span></div><button type="button" class="rwl__add" data-add data-variant-id="40" aria-label="Add Haldi Block-Print Kurta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:1"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-19-2.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Stripe Mul Dupatta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Stripe Mul Dupatta</a><span class="rwl__price">₹1,399</span></div><button type="button" class="rwl__add" data-add data-variant-id="41" aria-label="Add Stripe Mul Dupatta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:2"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-19-3.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Stripe Straight Pants"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Stripe Straight Pants</a><span class="rwl__price">₹1,399</span></div><button type="button" class="rwl__add" data-add data-variant-id="42" aria-label="Add Stripe Straight Pants to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div></div><div class="rwl__group" data-group aria-hidden="true"><div class="rwl__card" style="--i:0"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-20-1.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Silver Mist Net Anarkali"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Silver Mist Net Anarkali</a><span class="rwl__price">₹12,999</span></div><button type="button" class="rwl__add" data-add data-variant-id="50" aria-label="Add Silver Mist Net Anarkali to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:1"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-20-2.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Sheer Net Dupatta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Sheer Net Dupatta</a><span class="rwl__price">₹2,499</span></div><button type="button" class="rwl__add" data-add data-variant-id="51" aria-label="Add Sheer Net Dupatta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:2"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-20-3.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Oxidised Jhumkas"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Oxidised Jhumkas</a><span class="rwl__price">₹899</span></div><button type="button" class="rwl__add" data-add data-variant-id="52" aria-label="Add Oxidised Jhumkas to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div></div><div class="rwl__group" data-group aria-hidden="true"><div class="rwl__card" style="--i:0"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-21-1.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Chandni Ivory Lehenga"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Chandni Ivory Lehenga</a><span class="rwl__price">₹15,499</span></div><button type="button" class="rwl__add" data-add data-variant-id="60" aria-label="Add Chandni Ivory Lehenga to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:1"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-21-2.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Gota Patti Dupatta"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Gota Patti Dupatta</a><span class="rwl__price">₹2,999</span></div><button type="button" class="rwl__add" data-add data-variant-id="61" aria-label="Add Gota Patti Dupatta to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div><div class="rwl__card" style="--i:2"><a class="rwl__media" href="#" onclick="return false" tabindex="-1" aria-hidden="true"><img src="photos/look-21-3.webp" alt="" loading="lazy"></a><button type="button" class="rwl__heart" aria-pressed="false" aria-label="Save Pearl Maang Tikka"><svg viewBox="0 0 24 24"><path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z"/></svg></button><div class="rwl__info"><a class="rwl__name" href="#" onclick="return false">Pearl Maang Tikka</a><span class="rwl__price">₹1,199</span></div><button type="button" class="rwl__add" data-add data-variant-id="62" aria-label="Add Pearl Maang Tikka to cart"><svg viewBox="0 0 16 16"><path d="M8 2v12M2 8h12"/></svg></button></div></div></div></div>
</runway-lookbook>
<p class="demo-note">The line loops forever — swipe or drag, use the arrows, or tap any model in the line. Photos: put your transparent cut-outs in a photos/ folder next to this file (look-15.webp to look-21.webp for the models, look-15-1.webp and so on for the products). The demo used free Pexels photos with backgrounds removed.</p>
<script>(function(){
  if (customElements.get('runway-lookbook')) return;

  class RunwayLookbook extends HTMLElement {
    connectedCallback(){
      if (this._ready) return; this._ready = true;
      this.stage  = this.querySelector('[data-stage]');
      this.models = Array.from(this.querySelectorAll('[data-model]'));
      this.groups = Array.from(this.querySelectorAll('[data-group]'));
      this.lookEl = this.querySelector('[data-look]');
      this.countEl= this.querySelector('[data-count]');
      this.prevBtn= this.querySelector('[data-prev]');
      this.nextBtn= this.querySelector('[data-next]');
      this.rail   = this.querySelector('[data-rail]');
      this.count  = this.models.length;
      this.start  = parseInt(this.dataset.start || '1', 10) || 1;
      this.loop   = this.dataset.loop === 'true';
      this.autoplay = (parseFloat(this.dataset.autoplay) || 0) * 1000;
      this.index  = 0;   // which look is in front (0..count-1)
      this.pos    = 0;   // unbounded position — keeps growing so the line never ends
      if (!this.count) return;
      if (this.count < 3) this.loop = false;

      this.classList.add('is-instant');
      this.measure(); this.buildDots(); this.place(0, true); this.update(true);
      requestAnimationFrame(()=>requestAnimationFrame(()=>this.classList.remove('is-instant')));

      this.ro = new ResizeObserver(()=>{ this.measure(); this.place(this.pos, true); });
      this.ro.observe(this.stage);

      this.prevBtn && this.prevBtn.addEventListener('click', ()=>this.step(-1));
      this.nextBtn && this.nextBtn.addEventListener('click', ()=>this.step(1));
      this.stage.addEventListener('keydown', e=>{
        if (e.key==='ArrowRight'){ e.preventDefault(); this.step(1); }
        if (e.key==='ArrowLeft'){ e.preventDefault(); this.step(-1); }
      });
      // horizontal trackpad / shift+wheel scroll walks the line (vertical page scroll is left alone)
      let wheelAcc = 0, wheelLock = 0;
      this.stage.addEventListener('wheel', e=>{
        const dx = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : (e.shiftKey ? e.deltaY : 0);
        if (!dx) return;
        e.preventDefault();
        const now = performance.now();
        if (now < wheelLock) return;
        wheelAcc += dx;
        if (Math.abs(wheelAcc) > 60){ this.step(wheelAcc > 0 ? 1 : -1); wheelAcc = 0; wheelLock = now + 450; }
      }, { passive:false });
      this.querySelector('[data-shop]')?.addEventListener('click', ()=>this.focusRail());
      this.bindDrag();
      this.bindCards();
      this.bindEditor();
      this.startAuto();
      this.addEventListener('mouseenter', ()=>this.stopAuto());
      this.addEventListener('mouseleave', ()=>this.startAuto());
    }
    buildDots(){
      const wrap = this.querySelector('[data-dots]');
      if (!wrap || this.count < 2) return;
      wrap.innerHTML = '';
      this.dots = this.models.map((m, k)=>{
        const b = document.createElement('button');
        b.type = 'button'; b.className = 'rwl__dot'; b.setAttribute('aria-label', `Go to look ${this.start + k}`);
        b.addEventListener('click', ()=>this.go(k));
        wrap.appendChild(b); return b;
      });
    }

    disconnectedCallback(){ this.ro && this.ro.disconnect(); this.stopAuto(); }

    measure(){
      this.w = this.stage.clientWidth; this.h = this.stage.clientHeight;
      const mobile = this.w < 600;
      this.frontX = mobile ? .64 : .70;     // where the front model stands (fraction of stage width)
      this.spread = mobile ? .78 : .70;     // how far the line recedes to the left
    }

    /* d = distance from the front (0 = front, 1 = next in line, -1 = just walked off) */
    pose(d){
      let x, s, lift, blur, op;
      if (d >= 0){
        x    = this.frontX - this.spread * (1 - Math.pow(.65, d));
        s    = d <= 1 ? 1 - .35 * d : .65 * Math.pow(.78, d - 1);
        lift = .02 + .30 * (1 - Math.pow(.55, d));
        blur = Math.max(0, (d - .8) * 1.9);
        op   = d > 2 ? Math.max(0, 1 - (d - 2) * .14) : 1;
        const back = Math.min(5, this.count - 2);
        if (d > back) op *= Math.max(0, 1 - (d - back));
      } else {
        const t = -d;
        x = this.frontX + t * .32; s = 1 + t * .16; lift = .02 - t * .05;
        blur = t * 5; op = Math.max(0, 1 - t * 1.5);
      }
      return { x, s, lift, blur, op };
    }

    mod(n){ return ((n % this.count) + this.count) % this.count; }

    /* distance of model k from the front for position f. With loop on, it wraps into [-1, count-1),
       so the look that leaves on the right quietly rejoins at the back of the line. */
    dist(k, f){
      if (!this.loop) return k - f;
      return this.mod(k - f + 1) - 1;
    }

    place(f, instant){
      const front = this.mod(Math.round(f));
      const wraps = [];
      this.models.forEach((m, k)=>{
        const d = this.dist(k, f);
        const prev = m._d;
        m._d = d;
        // a model that just wrapped round must not slide across the stage
        if (!instant && prev !== undefined && Math.abs(d - prev) > this.count / 2){
          m.style.transition = 'none';
          this.apply(m, this.pose(d > prev ? d + 1 : d));
          wraps.push([m, d]);
          return;
        }
        this.apply(m, this.pose(d), d);
        m.classList.toggle('is-front', k === front);
        m.setAttribute('aria-hidden', k === front ? 'false' : 'true');
      });
      if (wraps.length){
        void this.offsetWidth;
        requestAnimationFrame(()=>wraps.forEach(([m, d])=>{
          m.style.transition = '';
          this.apply(m, this.pose(d), d);
          m.classList.remove('is-front'); m.setAttribute('aria-hidden','true');
        }));
      }
    }

    apply(m, p, d){
      m.style.transform = `translate3d(${(p.x*this.w).toFixed(1)}px,${(-p.lift*this.h).toFixed(1)}px,0) scale(${p.s.toFixed(4)})`;
      m.style.filter    = p.blur > .05 ? `blur(${p.blur.toFixed(2)}px)` : 'none';
      m.style.opacity   = p.op.toFixed(3);
      if (d !== undefined) m.style.zIndex = String(100 - Math.round(d * 10));
      m.style.visibility= p.op <= 0.001 ? 'hidden' : 'visible';
    }

    step(n){ this.goPos(Math.round(this.pos) + n); }

    /* jump to look i by the shortest way round */
    go(i, fromAuto){
      i = this.mod(i);
      let delta = i - this.index;
      if (this.loop){ if (delta > this.count/2) delta -= this.count; if (delta < -this.count/2) delta += this.count; }
      this.goPos(Math.round(this.pos) + delta, fromAuto);
    }

    goPos(p, fromAuto){
      if (!this.loop) p = Math.max(0, Math.min(this.count - 1, p));
      if (!fromAuto) this.restartAuto();
      this.pos = p;
      this.place(p);
      const i = this.mod(p);
      if (i !== this.index){ this.index = i; this.update(); }
    }

    update(first){
      const i = this.index, m = this.models[i];
      const label = (m.dataset.label || '').trim() || `Look ${this.start + i}`;
      if (this.lookEl){
        this.lookEl.innerHTML = '';
        const s = document.createElement('span'); s.textContent = label;
        if (!first) s.className = 'is-in';
        this.lookEl.appendChild(s);
      }
      if (this.dots) this.dots.forEach((d, k)=>d.classList.toggle('is-on', k === i));
      if (this.countEl) this.countEl.textContent = `${String(i+1).padStart(2,'0')} / ${String(this.count).padStart(2,'0')}`;
      if (this.prevBtn) this.prevBtn.disabled = !this.loop && i === 0;
      if (this.nextBtn) this.nextBtn.disabled = !this.loop && i === this.count - 1;
      this.groups.forEach((g, k)=>{
        const on = k === i;
        g.classList.toggle('is-active', on);
        g.setAttribute('aria-hidden', on ? 'false' : 'true');
        if (on) g.scrollTo({ top: 0, left: 0 });
      });
      // preload the next few models
      [0,1,2,3].map(o=>this.models[this.mod(i+o)]).forEach(md=>md.querySelectorAll('img[loading="lazy"]').forEach(img=>img.loading='eager'));
      this.dispatchEvent(new CustomEvent('runway:change', { bubbles:true, detail:{ index:i, label } }));
    }

    bindDrag(){
      let x0 = 0, y0 = 0, dx = 0, active = false, horizontal = null, target = null, t0 = 0;
      const unit = ()=>Math.max(160, this.w * .38);
      this.stage.addEventListener('pointerdown', e=>{
        if (e.button !== 0 || e.target.closest('button,a')) return;
        active = true; horizontal = null; dx = 0; x0 = e.clientX; y0 = e.clientY; t0 = performance.now();
        target = e.target.closest('[data-model]');
        this.stopAuto();
      });
      this.stage.addEventListener('pointermove', e=>{
        if (!active) return;
        const mx = e.clientX - x0, my = e.clientY - y0;
        if (horizontal === null && (Math.abs(mx) > 6 || Math.abs(my) > 6)){
          horizontal = Math.abs(mx) > Math.abs(my);
          if (horizontal){ this.stage.setPointerCapture(e.pointerId); this.stage.classList.add('is-dragging'); }
          else { active = false; return; }
        }
        if (!horizontal) return;
        dx = mx;
        let f = this.pos + dx / unit();               // drag right → the line steps forward
        if (!this.loop){ const max = this.count - 1;
          if (f < 0) f = f * .3; if (f > max) f = max + (f - max) * .3; }
        this.place(f, true);
      });
      const end = e=>{
        if (!active) return; active = false;
        this.stage.classList.remove('is-dragging');
        if (horizontal){
          const v = dx / Math.max(1, performance.now() - t0);
          let steps = Math.round(dx / unit());
          if (steps === 0 && (Math.abs(dx) > 40 || Math.abs(v) > .5)) steps = dx > 0 ? 1 : -1;
          this.goPos(Math.round(this.pos) + steps);
        } else if (target && e.type === 'pointerup'){
          const k = this.models.indexOf(target);
          if (k > -1 && k !== this.index) this.go(k);
        }
        this.startAuto();
      };
      this.stage.addEventListener('pointerup', end);
      this.stage.addEventListener('pointercancel', end);
    }

    focusRail(){
      if (!this.rail) return;
      if (window.innerWidth < 750) this.rail.scrollIntoView({ behavior:'smooth', block:'nearest' });
      this.rail.classList.remove('is-pulse'); void this.rail.offsetWidth; this.rail.classList.add('is-pulse');
      this.groups[this.index]?.querySelector('a,button')?.focus({ preventScroll:true });
    }

    bindCards(){
      this.addEventListener('click', async e=>{
        const heart = e.target.closest('.rwl__heart');
        if (heart){ heart.setAttribute('aria-pressed', heart.getAttribute('aria-pressed') === 'true' ? 'false' : 'true'); return; }
        const add = e.target.closest('[data-add]');
        if (!add) return;
        e.preventDefault();
        const card = add.closest('.rwl__card');
        if (this.hasAttribute('data-demo')){ this.added(add, card); return; }
        add.classList.add('is-loading');
        try {
          const root = (window.Shopify && Shopify.routes && Shopify.routes.root) || '/';
          const res = await fetch(root + 'cart/add.js', {
            method:'POST', headers:{ 'Content-Type':'application/json', 'Accept':'application/json' },
            body: JSON.stringify({ items:[{ id: Number(add.dataset.variantId), quantity: 1 }], sections:'cart-icon-bubble' })
          });
          const data = await res.json();
          if (!res.ok) throw new Error(data.description || 'Could not add to cart');
          const bubble = document.getElementById('cart-icon-bubble');
          if (bubble && data.sections && data.sections['cart-icon-bubble']){
            const doc = new DOMParser().parseFromString(data.sections['cart-icon-bubble'], 'text/html');
            const inner = doc.querySelector('.shopify-section');
            bubble.innerHTML = inner ? inner.innerHTML : doc.body.innerHTML;
          }
          fetch(root + 'cart.js').then(r=>r.json()).then(cart=>{
            document.querySelectorAll('[data-cart-count]').forEach(el=>el.textContent = cart.item_count);
            document.dispatchEvent(new CustomEvent('cart:refresh', { detail: cart }));
          }).catch(()=>{});
          this.added(add, card);
        } catch(err){
          add.classList.remove('is-loading');
          add.title = err.message;
        }
      });
    }

    added(add, card){
      add.classList.remove('is-loading'); add.classList.add('is-done');
      this._adds = (this._adds || 0) + 1;
      const pop = document.createElement('span'); pop.className = 'rwl__pop'; pop.textContent = `+${this._adds} cart`;
      card.appendChild(pop); setTimeout(()=>pop.remove(), 1000);
      setTimeout(()=>add.classList.remove('is-done'), 1400);
      this.dispatchEvent(new CustomEvent('runway:added', { bubbles:true, detail:{ variantId: add.dataset.variantId, total: this._adds } }));
    }

    bindEditor(){
      if (!(window.Shopify && Shopify.designMode)) return;
      document.addEventListener('shopify:block:select', e=>{
        const k = this.models.findIndex(m=>m.contains(e.target) || m === e.target);
        const g = this.groups.findIndex(gr=>gr.dataset.blockId === e.detail.blockId);
        const i = k > -1 ? k : g;
        if (i > -1){ this.stopAuto(); this.go(i); }
      });
    }

    startAuto(){
      this.stopAuto();
      if (!this.autoplay || this.count < 2) return;
      this._timer = setInterval(()=>{
        if (!this.loop && this.index === this.count - 1) this.go(0, true); else this.goPos(Math.round(this.pos) + 1, true);
      }, this.autoplay);
    }
    stopAuto(){ clearInterval(this._timer); this._timer = null; }
    restartAuto(){ if (this._timer) this.startAuto(); }
  }
  customElements.define('runway-lookbook', RunwayLookbook);
})();
</script>
<script>
document.querySelector('runway-lookbook').addEventListener('runway:added',e=>{document.getElementById('demoCart').textContent=e.detail.total;});
const h=document.getElementById('hint');setTimeout(()=>h.classList.add('is-on'),700);setTimeout(()=>h.classList.remove('is-on'),3300);
</script>
<script>
/* Missing photo? Show a neat silhouette instead of a broken image. Put your cut-outs in photos/ (see the names in the HTML). */
function rwlSwap(img){
  const fig=img.closest('.rwl__figure'), media=img.closest('.rwl__media'); if(!fig&&!media) return;
  const ns='http://www.w3.org/2000/svg', svg=document.createElementNS(ns,'svg');
  svg.setAttribute('class','rwl__placeholder'); svg.setAttribute('aria-hidden','true');
  if(fig){ svg.setAttribute('viewBox','0 0 100 240'); svg.innerHTML='<circle cx="50" cy="24" r="15"/><path d="M30 46h40l12 82-12 4-5 104H35l-5-104-12-4z"/>'; }
  else { svg.setAttribute('viewBox','0 0 100 75'); svg.style.aspectRatio='4/3'; svg.style.width='100%'; svg.innerHTML='<path d="M50 14a7 7 0 1 1 7 7l-7 6-34 22v8h68v-8L50 27"/>'; }
  img.replaceWith(svg);
}
document.addEventListener('error',e=>{ if(e.target instanceof HTMLImageElement) rwlSwap(e.target); },true);
document.querySelectorAll('.rwl__figure img,.rwl__media img').forEach(img=>{ if(img.complete && !img.naturalWidth) rwlSwap(img); });
</script>
</body></html>
```


## Build instructions by tool

### Claude Code

Open a terminal in an empty folder, run `claude`, then paste the prompt.

```text
Build the "Runway lookbook section" app from the OwnlyPlans blueprint at https://ownlyplans.com/bhaskar/runway-lookbook-section/.
Stack: CSS, HTML, JavaScript, Shopify, Web Components.
Follow the plan's steps in order: Stand the looks in a line → Walk the line, endlessly → Give every look its own product rail → Phone layout, dots and polish.
Download the full plan (Markdown) from the link above and keep it in the project root as PLAN.md.
Ask me before adding anything not in the plan. (Prepared for Claude Code.)
```

### Cursor

Open an empty folder in Cursor, start an Agent chat, then paste the prompt.

```text
Build the "Runway lookbook section" app from the OwnlyPlans blueprint at https://ownlyplans.com/bhaskar/runway-lookbook-section/.
Stack: CSS, HTML, JavaScript, Shopify, Web Components.
Follow the plan's steps in order: Stand the looks in a line → Walk the line, endlessly → Give every look its own product rail → Phone layout, dots and polish.
Download the full plan (Markdown) from the link above and keep it in the project root as PLAN.md.
Ask me before adding anything not in the plan. (Prepared for Cursor.)
```

### Lovable

Start a new Lovable project and paste the prompt as your first message.

```text
Build the "Runway lookbook section" app from the OwnlyPlans blueprint at https://ownlyplans.com/bhaskar/runway-lookbook-section/.
Stack: CSS, HTML, JavaScript, Shopify, Web Components.
Follow the plan's steps in order: Stand the looks in a line → Walk the line, endlessly → Give every look its own product rail → Phone layout, dots and polish.
Download the full plan (Markdown) from the link above and keep it in the project root as PLAN.md.
Ask me before adding anything not in the plan. (Prepared for Lovable.)
```

## Definition of done

- Every build step is complete and the app runs locally.
- The main user flow works end to end.
- Share your build on OwnlyPlans with a demo link, build time and tool.
