Store locator
A global coffee brand with seven branches across Frankfurt, Dublin and Singapore: live search and a city filter, picking an item glides its marker to the centre of the map and opens its popover, the result count always leads, and a dead search falls into the empty state — all SVG, no tiles.
Real scenarios
The component as it is used in a product — not a specimen grid.
Seven branches, three cities, one map
Northbean Roasters on a stylised SVG map: search branches by name or street, hop between cities with the chips, and pick a result — its marker glides to the centre of the frame and the popover opens. The count leads the list live; search for something absent (try “Osaka”) to meet the empty state.
No branch matched this search — the brand is not in that city yet.
The map’s world runs 55% larger than its frame — every pick translates it until the marker sits dead centre.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| search | live | '' | The search matches name and street; while empty the list simply shows the active city’s branches. |
| city-filter | chips | '3 cities' | A city chip filters the list and moves the map to that city; picking a result from another city moves the map too. |
| pan | translate | '650ms' | The map’s world runs 55% larger than its frame; picking a store translates it smoothly until the marker sits dead centre. |
| count | status | 'live' | The count leads the list with aria-live; zero brings the empty card with its clear-search button. |
Snippet
<div class="msl-root" x-data="{
city: 'frankfurt', query: '', active: null,
stores: [
{ id: 'fw1', city: 'frankfurt', name: 'Hauptwache Corner', street: 'Kaiserstraße 12', x: 36, y: 36 },
{ id: 'fw3', city: 'frankfurt', name: 'River Side', street: 'Schaumainkai 41', x: 34, y: 66 },
{ id: 'db1', city: 'dublin', name: 'Grafton Arch', street: 'Grafton Street 22', x: 42, y: 34 },
],
get cityStores() { return this.stores.filter((s) => s.city === this.city); },
get results() {
const q = this.query.trim().toLowerCase();
return q ? this.stores.filter((s) => (s.name + ' ' + s.street).toLowerCase().includes(q))
: this.cityStores;
},
get activeStore() { return this.stores.find((s) => s.id === this.active) || null; },
get pan() {
const s = this.activeStore;
return s ? 'translate: ' + (32.26 - s.x).toFixed(2) + '% ' + (32.26 - s.y).toFixed(2) + '%'
: 'translate: 0% 0%';
},
pick(s) { this.city = s.city; this.active = s.id; },
}" x-on:keydown.escape.window="active = null">
<div class="msl-side">
<input class="msl-search" type="search" x-model="query" placeholder="Branch or street…">
<p class="msl-count" role="status"><span x-text="results.length"></span> stores found</p>
<ul class="msl-list">
<template x-for="s in results" :key="s.id">
<li>
<button type="button" class="msl-row" :class="active === s.id && 'is-active'" x-on:click="pick(s)">
<b x-text="s.name"></b>
<small x-text="s.street"></small>
</button>
</li>
</template>
</ul>
<div class="msl-empty" x-cloak x-show="results.length === 0">
<p>No stores matched — try another search.</p>
</div>
</div>
<div class="msl-stage" dir="ltr">
<div class="msl-world" :style="pan">
<svg class="msl-city" viewBox="0 0 640 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect class="msl-base" width="640" height="400"/>
<path class="msl-river" d="M-10 300 C140 280 260 330 400 306 S560 258 650 280"/>
<rect class="msl-block" x="150" y="80" width="130" height="80" rx="10"/>
<rect class="msl-block" x="330" y="140" width="150" height="70" rx="10"/>
<rect class="msl-block" x="180" y="210" width="120" height="76" rx="10"/>
</svg>
<template x-for="s in cityStores" :key="s.id">
<button type="button" class="msl-pin" :class="active === s.id && 'is-active'"
:style="`inset-inline-start: ${s.x}%; inset-block-start: ${s.y}%`" x-on:click="pick(s)">
<span class="msl-bead"></span>
<span class="msl-pinlabel" x-text="s.name"></span>
</button>
</template>
</div>
</div>
</div>
<style>
.msl-root { --msl-bg: #f6f7f9; --msl-block: #e8eaef; --msl-water: #cfe3f7; --msl-line: #d4d8e0;
--msl-accent: #0f766e; --msl-text: #1c1917; --msl-card: #fff;
display: grid; gap: 1rem; grid-template-columns: minmax(14rem, 1fr) minmax(0, 1.45fr);
font-family: 'Inter', 'Vazirmatn', ui-sans-serif, sans-serif; }
.msl-search { inline-size: 100%; padding: .6rem .9rem; border: 1px solid var(--msl-line);
border-radius: .8rem; font: 400 .85rem/1.4 inherit; }
.msl-count { margin: 0; font-size: .74rem; color: var(--msl-accent); font-weight: 700; }
.msl-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.msl-row { display: grid; gap: .15rem; inline-size: 100%; padding: .65rem .8rem; text-align: start;
border: 1px solid var(--msl-line); border-radius: .8rem; background: var(--msl-card);
color: var(--msl-text); cursor: pointer; }
.msl-row.is-active { border-color: var(--msl-accent); box-shadow: inset 2px 0 0 var(--msl-accent); }
.msl-empty { padding: 1rem; border: 1px dashed var(--msl-line); border-radius: .8rem;
color: var(--msl-text); text-align: center; }
.msl-stage { position: relative; aspect-ratio: 16 / 10; overflow: clip;
border: 1px solid var(--msl-line); border-radius: 1rem; background: var(--msl-bg); }
.msl-world { position: absolute; inset: 0; inline-size: 155%; block-size: 155%;
transition: translate .65s cubic-bezier(.3, .7, .2, 1); }
.msl-city { inline-size: 100%; block-size: 100%; }
.msl-base { fill: var(--msl-bg); }
.msl-river { fill: none; stroke: var(--msl-water); stroke-width: 24; stroke-linecap: round; }
.msl-block { fill: var(--msl-block); }
.msl-pin { position: absolute; translate: -50% -50%; inline-size: 1.55rem; aspect-ratio: 1;
border: none; padding: 0; background: transparent; cursor: pointer; z-index: 2; }
.msl-bead { display: block; inline-size: 100%; aspect-ratio: 1; border-radius: 50%;
border: 3px solid #fff; background: var(--msl-accent);
box-shadow: 0 2px 8px rgba(15, 23, 42, .28); transition: scale .2s; }
.msl-pin:hover .msl-bead, .msl-pin.is-active .msl-bead { scale: 1.25; }
.msl-pinlabel { position: absolute; inset-block-end: calc(100% + .4rem); inset-inline-start: 50%;
translate: -50%; white-space: nowrap; padding: .18rem .55rem; border-radius: .55rem;
background: #fff; color: var(--msl-text); font-size: .68rem; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .msl-world { transition: none; } }
</style>
// app/Pages/Stores.jsx — Inertia (React) page; renders the React
// snippet below unchanged, with Inertia's Link wired into the provider.
import { Link } from '@inertiajs/react';
import { NabuXUIProvider } from '@nabuxai/ui-react';
import StoreLocator from '@/components/StoreLocator';
export default function Stores() {
return (
<NabuXUIProvider locale="en" linkComponent={Link}>
<main className="nx-page">
<StoreLocator />
</main>
</NabuXUIProvider>
);
}
// StoreLocator.jsx — search, city chips, a map that pans to the pick
import { useMemo, useState } from 'react';
import '@nabuxai/ui-core/css';
const CITIES = [
{ id: 'frankfurt', label: 'Frankfurt', tint: '#f59e0b' },
{ id: 'dublin', label: 'Dublin', tint: '#34d399' },
];
const STORES = [
{ id: 'fw1', city: 'frankfurt', name: 'Hauptwache Corner', street: 'Kaiserstraße 12', hours: '07:30 – 20:00', x: 36, y: 36 },
{ id: 'fw2', city: 'frankfurt', name: 'Zeil Windows', street: 'Zeil 106', hours: '09:00 – 21:00', x: 58, y: 55 },
{ id: 'db1', city: 'dublin', name: 'Grafton Arch', street: 'Grafton Street 22', hours: '08:00 – 20:00', x: 42, y: 34 },
{ id: 'db2', city: 'dublin', name: 'Docklands Ferry', street: 'North Wall Quay 8', hours: '07:00 – 18:30', x: 66, y: 60 },
];
const WORLD = 1.55; // the world runs 55% larger than its frame
export default function StoreLocator() {
const [city, setCity] = useState('frankfurt');
const [query, setQuery] = useState('');
const [active, setActive] = useState(null);
const cityStores = useMemo(() => STORES.filter((s) => s.city === city), [city]);
const results = useMemo(() => {
const q = query.trim().toLowerCase();
return q ? STORES.filter((s) => (s.name + ' ' + s.street).toLowerCase().includes(q)) : cityStores;
}, [query, cityStores]);
const activeStore = STORES.find((s) => s.id === active) || null;
const tint = (id) => CITIES.find((c) => c.id === id)?.tint;
// translate % resolve against the world's own box — 50 / WORLD lands the marker dead centre.
const pan = activeStore
? { x: (50 / WORLD - activeStore.x).toFixed(2), y: (50 / WORLD - activeStore.y).toFixed(2) }
: { x: 0, y: 0 };
const pick = (s) => { setCity(s.city); setActive(s.id); };
return (
<>
<style>{`
.msl-root { --msl-bg: #f6f7f9; --msl-block: #e8eaef; --msl-water: #cfe3f7; --msl-line: #d4d8e0;
--msl-accent: #0f766e; --msl-text: #1c1917; --msl-card: #fff; font-family: 'Inter', ui-sans-serif, sans-serif;
display: grid; gap: 1rem; grid-template-columns: minmax(14rem, 1fr) minmax(0, 1.45fr); }
.msl-search { inline-size: 100%; padding: .6rem .9rem; border: 1px solid var(--msl-line);
border-radius: .8rem; font: 400 .85rem/1.4 inherit; }
.msl-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.msl-chip { padding: .3rem .75rem; border: 1px solid var(--msl-line); border-radius: 999px;
background: var(--msl-card); font: 600 .74rem/1 inherit; cursor: pointer; }
.msl-chip[aria-pressed='true'] { border-color: var(--msl-accent); color: var(--msl-accent); }
.msl-count { margin: 0; font-size: .74rem; color: var(--msl-accent); font-weight: 700; }
.msl-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.msl-row { display: grid; gap: .15rem; inline-size: 100%; padding: .65rem .8rem; text-align: start;
border: 1px solid var(--msl-line); border-radius: .8rem; background: var(--msl-card);
color: var(--msl-text); cursor: pointer; }
.msl-row[aria-current='true'] { border-color: var(--msl-accent); box-shadow: inset 2px 0 0 var(--msl-accent); }
.msl-empty { padding: 1rem; border: 1px dashed var(--msl-line); border-radius: .8rem;
color: var(--msl-text); text-align: center; }
.msl-stage { position: relative; aspect-ratio: 16 / 10; overflow: clip;
border: 1px solid var(--msl-line); border-radius: 1rem; background: var(--msl-bg); }
.msl-world { position: absolute; inset: 0; inline-size: 155%; block-size: 155%;
transition: translate .65s cubic-bezier(.3, .7, .2, 1); }
.msl-city { inline-size: 100%; block-size: 100%; }
.msl-base { fill: var(--msl-bg); }
.msl-river { fill: none; stroke: var(--msl-water); stroke-width: 24; stroke-linecap: round; }
.msl-block { fill: color-mix(in oklab, var(--msl-tint) 5%, var(--msl-block)); }
.msl-pin { position: absolute; translate: -50% -50%; inline-size: 1.55rem; aspect-ratio: 1; border: none;
padding: 0; background: transparent; cursor: pointer; z-index: 2; }
.msl-bead { display: block; inline-size: 100%; aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff;
box-shadow: 0 2px 8px rgba(15, 23, 42, .28); transition: scale .2s; }
.msl-pin:hover .msl-bead, .msl-pin[aria-pressed='true'] .msl-bead { scale: 1.25; }
.msl-pop { position: absolute; translate: 1.2rem -50%; z-index: 3; inline-size: 9.5rem; display: grid; gap: .25rem;
padding: .6rem .7rem; border: 1px solid var(--msl-line); border-radius: .8rem; background: var(--msl-card);
color: var(--msl-text); box-shadow: 0 12px 30px rgba(15, 23, 42, .18); }
@media (prefers-reduced-motion: reduce) { .msl-world { transition: none; } }
`}</style>
<div className="msl-root">
<div className="msl-side">
<input className="msl-search" type="search" value={query}
onChange={(e) => setQuery(e.target.value)} placeholder="Branch or street…" aria-label="Search stores" />
<div className="msl-chips" role="group" aria-label="City filter">
{CITIES.map((c) => (
<button key={c.id} type="button" className="msl-chip" aria-pressed={city === c.id}
onClick={() => { setCity(c.id); setActive(null); }}>{c.label}</button>
))}
</div>
<p className="msl-count" role="status">{results.length} stores found</p>
<ul className="msl-list">
{results.map((s) => (
<li key={s.id}>
<button type="button" className="msl-row" aria-current={active === s.id} onClick={() => pick(s)}>
<b>{s.name}</b>
<small>{s.street} · {s.hours}</small>
</button>
</li>
))}
</ul>
{results.length === 0 && (
<div className="msl-empty">
<p>No stores matched — try another search.</p>
<button type="button" onClick={() => setQuery('')}>Clear search</button>
</div>
)}
</div>
<div className="msl-stage" dir="ltr" style={{ '--msl-tint': tint(city) }}>
<div className="msl-world" style={{ translate: `${pan.x}% ${pan.y}%` }}>
<svg className="msl-city" viewBox="0 0 640 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect className="msl-base" width="640" height="400" />
<path className="msl-river" d="M-10 300 C140 280 260 330 400 306 S560 258 650 280" />
<rect className="msl-block" x="150" y="80" width="130" height="80" rx="10" />
<rect className="msl-block" x="330" y="140" width="150" height="70" rx="10" />
<rect className="msl-block" x="180" y="210" width="120" height="76" rx="10" />
</svg>
{cityStores.map((s) => (
<div key={s.id} style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>
<button type="button" className="msl-pin" aria-pressed={active === s.id}
style={{ insetInlineStart: s.x + '%', insetBlockStart: s.y + '%', pointerEvents: 'auto' }}
onClick={() => pick(s)}>
<span className="msl-bead" style={{ background: tint(s.city) }} aria-hidden="true" />
</button>
{active === s.id && (
<div className="msl-pop" role="dialog" aria-label={s.name}
style={{ insetInlineStart: s.x + '%', insetBlockStart: s.y + '%', pointerEvents: 'auto' }}>
<b>{s.name}</b>
<small>{s.street}</small>
<small>{s.hours}</small>
</div>
)}
</div>
))}
</div>
</div>
</div>
</>
);
}
<!-- StoreLocator.vue — search, city chips, a map that pans to the pick -->
<script setup lang="ts">
import { computed, ref } from 'vue';
import '@nabuxai/ui-core/css';
const cities = [
{ id: 'frankfurt', label: 'Frankfurt', tint: '#f59e0b' },
{ id: 'dublin', label: 'Dublin', tint: '#34d399' },
];
const stores = [
{ id: 'fw1', city: 'frankfurt', name: 'Hauptwache Corner', street: 'Kaiserstraße 12', hours: '07:30 – 20:00', x: 36, y: 36 },
{ id: 'fw2', city: 'frankfurt', name: 'Zeil Windows', street: 'Zeil 106', hours: '09:00 – 21:00', x: 58, y: 55 },
{ id: 'db1', city: 'dublin', name: 'Grafton Arch', street: 'Grafton Street 22', hours: '08:00 – 20:00', x: 42, y: 34 },
{ id: 'db2', city: 'dublin', name: 'Docklands Ferry', street: 'North Wall Quay 8', hours: '07:00 – 18:30', x: 66, y: 60 },
];
const WORLD = 1.55;
const city = ref('frankfurt');
const query = ref('');
const active = ref<string | null>(null);
const cityStores = computed(() => stores.filter((s) => s.city === city.value));
const results = computed(() => {
const q = query.value.trim().toLowerCase();
return q ? stores.filter((s) => (s.name + ' ' + s.street).toLowerCase().includes(q)) : cityStores.value;
});
const activeStore = computed(() => stores.find((s) => s.id === active.value) || null);
// translate % resolve against the world's own box — 50 / WORLD lands the marker dead centre.
const pan = computed(() => activeStore.value
? `${(50 / WORLD - activeStore.value.x).toFixed(2)}% ${(50 / WORLD - activeStore.value.y).toFixed(2)}%`
: '0% 0%');
const tintOf = (id: string) => cities.find((c) => c.id === id)?.tint ?? '#0f766e';
const pick = (s: typeof stores[number]) => { city.value = s.city; active.value = s.id; };
</script>
<template>
<div class="msl-root">
<div class="msl-side">
<input class="msl-search" type="search" v-model="query" placeholder="Branch or street…" aria-label="Search stores" />
<div class="msl-chips" role="group" aria-label="City filter">
<button v-for="c in cities" :key="c.id" type="button" class="msl-chip" :aria-pressed="city === c.id"
@click="city = c.id; active = null">{{ c.label }}</button>
</div>
<p class="msl-count" role="status">{{ results.length }} stores found</p>
<ul class="msl-list">
<li v-for="s in results" :key="s.id">
<button type="button" class="msl-row" :aria-current="active === s.id" @click="pick(s)">
<b>{{ s.name }}</b>
<small>{{ s.street }} · {{ s.hours }}</small>
</button>
</li>
</ul>
<div v-if="results.length === 0" class="msl-empty">
<p>No stores matched — try another search.</p>
<button type="button" @click="query = ''">Clear search</button>
</div>
</div>
<div class="msl-stage" dir="ltr" :style="{ '--msl-tint': tintOf(city) }">
<div class="msl-world" :style="{ translate: pan }">
<svg class="msl-city" viewBox="0 0 640 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect class="msl-base" width="640" height="400" />
<path class="msl-river" d="M-10 300 C140 280 260 330 400 306 S560 258 650 280" />
<rect class="msl-block" x="150" y="80" width="130" height="80" rx="10" />
<rect class="msl-block" x="330" y="140" width="150" height="70" rx="10" />
<rect class="msl-block" x="180" y="210" width="120" height="76" rx="10" />
</svg>
<template v-for="s in cityStores" :key="s.id">
<button type="button" class="msl-pin" :aria-pressed="active === s.id"
:style="{ insetInlineStart: s.x + '%', insetBlockStart: s.y + '%' }" @click="pick(s)">
<span class="msl-bead" :style="{ background: tintOf(s.city) }" aria-hidden="true"></span>
</button>
<div v-if="active === s.id" class="msl-pop" role="dialog" :aria-label="s.name"
:style="{ insetInlineStart: s.x + '%', insetBlockStart: s.y + '%' }">
<b>{{ s.name }}</b>
<small>{{ s.street }}</small>
<small>{{ s.hours }}</small>
</div>
</template>
</div>
</div>
</div>
</template>
<style scoped>
.msl-root { --msl-bg: #f6f7f9; --msl-block: #e8eaef; --msl-water: #cfe3f7; --msl-line: #d4d8e0;
--msl-accent: #0f766e; --msl-text: #1c1917; --msl-card: #fff; font-family: 'Inter', ui-sans-serif, sans-serif;
display: grid; gap: 1rem; grid-template-columns: minmax(14rem, 1fr) minmax(0, 1.45fr); }
.msl-search { inline-size: 100%; padding: .6rem .9rem; border: 1px solid var(--msl-line);
border-radius: .8rem; font: 400 .85rem/1.4 inherit; }
.msl-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.msl-chip { padding: .3rem .75rem; border: 1px solid var(--msl-line); border-radius: 999px;
background: var(--msl-card); font: 600 .74rem/1 inherit; cursor: pointer; }
.msl-chip[aria-pressed='true'] { border-color: var(--msl-accent); color: var(--msl-accent); }
.msl-count { margin: 0; font-size: .74rem; color: var(--msl-accent); font-weight: 700; }
.msl-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.msl-row { display: grid; gap: .15rem; inline-size: 100%; padding: .65rem .8rem; text-align: start;
border: 1px solid var(--msl-line); border-radius: .8rem; background: var(--msl-card);
color: var(--msl-text); cursor: pointer; }
.msl-row[aria-current='true'] { border-color: var(--msl-accent); box-shadow: inset 2px 0 0 var(--msl-accent); }
.msl-empty { padding: 1rem; border: 1px dashed var(--msl-line); border-radius: .8rem;
color: var(--msl-text); text-align: center; }
.msl-stage { position: relative; aspect-ratio: 16 / 10; overflow: clip;
border: 1px solid var(--msl-line); border-radius: 1rem; background: var(--msl-bg); }
.msl-world { position: absolute; inset: 0; inline-size: 155%; block-size: 155%;
transition: translate .65s cubic-bezier(.3, .7, .2, 1); }
.msl-city { inline-size: 100%; block-size: 100%; }
.msl-base { fill: var(--msl-bg); }
.msl-river { fill: none; stroke: var(--msl-water); stroke-width: 24; stroke-linecap: round; }
.msl-block { fill: color-mix(in oklab, var(--msl-tint) 5%, var(--msl-block)); }
.msl-pin { position: absolute; translate: -50% -50%; inline-size: 1.55rem; aspect-ratio: 1; border: none;
padding: 0; background: transparent; cursor: pointer; z-index: 2; }
.msl-bead { display: block; inline-size: 100%; aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff;
box-shadow: 0 2px 8px rgba(15, 23, 42, .28); transition: scale .2s; }
.msl-pin:hover .msl-bead, .msl-pin[aria-pressed='true'] .msl-bead { scale: 1.25; }
.msl-pop { position: absolute; translate: 1.2rem -50%; z-index: 3; inline-size: 9.5rem; display: grid; gap: .25rem;
padding: .6rem .7rem; border: 1px solid var(--msl-line); border-radius: .8rem; background: var(--msl-card);
color: var(--msl-text); box-shadow: 0 12px 30px rgba(15, 23, 42, .18); }
@media (prefers-reduced-motion: reduce) { .msl-world { transition: none; } }
</style>
<!-- StoreLocator.svelte — search, city chips, a map that pans to the pick -->
<script lang="ts">
import '@nabuxai/ui-core/css';
const cities = [
{ id: 'frankfurt', label: 'Frankfurt', tint: '#f59e0b' },
{ id: 'dublin', label: 'Dublin', tint: '#34d399' },
];
const stores = [
{ id: 'fw1', city: 'frankfurt', name: 'Hauptwache Corner', street: 'Kaiserstraße 12', hours: '07:30 – 20:00', x: 36, y: 36 },
{ id: 'fw2', city: 'frankfurt', name: 'Zeil Windows', street: 'Zeil 106', hours: '09:00 – 21:00', x: 58, y: 55 },
{ id: 'db1', city: 'dublin', name: 'Grafton Arch', street: 'Grafton Street 22', hours: '08:00 – 20:00', x: 42, y: 34 },
{ id: 'db2', city: 'dublin', name: 'Docklands Ferry', street: 'North Wall Quay 8', hours: '07:00 – 18:30', x: 66, y: 60 },
];
const WORLD = 1.55;
let city = $state('frankfurt');
let query = $state('');
let active = $state<string | null>(null);
const cityStores = $derived(stores.filter((s) => s.city === city));
const results = $derived(
query.trim()
? stores.filter((s) => (s.name + ' ' + s.street).toLowerCase().includes(query.trim().toLowerCase()))
: cityStores,
);
const activeStore = $derived(stores.find((s) => s.id === active) ?? null);
// translate % resolve against the world's own box — 50 / WORLD lands the marker dead centre.
const pan = $derived(activeStore
? `${(50 / WORLD - activeStore.x).toFixed(2)}% ${(50 / WORLD - activeStore.y).toFixed(2)}%`
: '0% 0%');
const tintOf = (id: string) => cities.find((c) => c.id === id)?.tint ?? '#0f766e';
const pick = (s: (typeof stores)[number]) => { city = s.city; active = s.id; };
</script>
<div class="msl-root">
<div class="msl-side">
<input class="msl-search" type="search" bind:value={query}
oninput={(e) => (query = e.currentTarget.value)} placeholder="Branch or street…" aria-label="Search stores" />
<div class="msl-chips" role="group" aria-label="City filter">
{#each cities as c (c.id)}
<button type="button" class="msl-chip" aria-pressed={city === c.id}
onclick={() => { city = c.id; active = null; }}>{c.label}</button>
{/each}
</div>
<p class="msl-count" role="status">{results.length} stores found</p>
<ul class="msl-list">
{#each results as s (s.id)}
<li>
<button type="button" class="msl-row" aria-current={active === s.id} onclick={() => pick(s)}>
<b>{s.name}</b>
<small>{s.street} · {s.hours}</small>
</button>
</li>
{/each}
</ul>
{#if results.length === 0}
<div class="msl-empty">
<p>No stores matched — try another search.</p>
<button type="button" onclick={() => (query = '')}>Clear search</button>
</div>
{/if}
</div>
<div class="msl-stage" dir="ltr" style={`--msl-tint: ${tintOf(city)}`}>
<div class="msl-world" style={`translate: ${pan}`}>
<svg class="msl-city" viewBox="0 0 640 400" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
<rect class="msl-base" width="640" height="400" />
<path class="msl-river" d="M-10 300 C140 280 260 330 400 306 S560 258 650 280" />
<rect class="msl-block" x="150" y="80" width="130" height="80" rx="10" />
<rect class="msl-block" x="330" y="140" width="150" height="70" rx="10" />
<rect class="msl-block" x="180" y="210" width="120" height="76" rx="10" />
</svg>
{#each cityStores as s (s.id)}
<button type="button" class="msl-pin" aria-pressed={active === s.id}
style={`inset-inline-start: ${s.x}%; inset-block-start: ${s.y}%`} onclick={() => pick(s)}>
<span class="msl-bead" style={`background: ${tintOf(s.city)}`} aria-hidden="true"></span>
</button>
{#if active === s.id}
<div class="msl-pop" role="dialog" aria-label={s.name}
style={`inset-inline-start: ${s.x}%; inset-block-start: ${s.y}%`}>
<b>{s.name}</b>
<small>{s.street}</small>
<small>{s.hours}</small>
</div>
{/if}
{/each}
</div>
</div>
</div>
<style>
.msl-root { --msl-bg: #f6f7f9; --msl-block: #e8eaef; --msl-water: #cfe3f7; --msl-line: #d4d8e0;
--msl-accent: #0f766e; --msl-text: #1c1917; --msl-card: #fff; font-family: 'Inter', ui-sans-serif, sans-serif;
display: grid; gap: 1rem; grid-template-columns: minmax(14rem, 1fr) minmax(0, 1.45fr); }
.msl-search { inline-size: 100%; padding: .6rem .9rem; border: 1px solid var(--msl-line);
border-radius: .8rem; font: 400 .85rem/1.4 inherit; }
.msl-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.msl-chip { padding: .3rem .75rem; border: 1px solid var(--msl-line); border-radius: 999px;
background: var(--msl-card); font: 600 .74rem/1 inherit; cursor: pointer; }
.msl-chip[aria-pressed='true'] { border-color: var(--msl-accent); color: var(--msl-accent); }
.msl-count { margin: 0; font-size: .74rem; color: var(--msl-accent); font-weight: 700; }
.msl-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.msl-row { display: grid; gap: .15rem; inline-size: 100%; padding: .65rem .8rem; text-align: start;
border: 1px solid var(--msl-line); border-radius: .8rem; background: var(--msl-card);
color: var(--msl-text); cursor: pointer; }
.msl-row[aria-current='true'] { border-color: var(--msl-accent); box-shadow: inset 2px 0 0 var(--msl-accent); }
.msl-empty { padding: 1rem; border: 1px dashed var(--msl-line); border-radius: .8rem;
color: var(--msl-text); text-align: center; }
.msl-stage { position: relative; aspect-ratio: 16 / 10; overflow: clip;
border: 1px solid var(--msl-line); border-radius: 1rem; background: var(--msl-bg); }
.msl-world { position: absolute; inset: 0; inline-size: 155%; block-size: 155%;
transition: translate .65s cubic-bezier(.3, .7, .2, 1); }
.msl-city { inline-size: 100%; block-size: 100%; }
.msl-base { fill: var(--msl-bg); }
.msl-river { fill: none; stroke: var(--msl-water); stroke-width: 24; stroke-linecap: round; }
.msl-block { fill: color-mix(in oklab, var(--msl-tint) 5%, var(--msl-block)); }
.msl-pin { position: absolute; translate: -50% -50%; inline-size: 1.55rem; aspect-ratio: 1; border: none;
padding: 0; background: transparent; cursor: pointer; z-index: 2; }
.msl-bead { display: block; inline-size: 100%; aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff;
box-shadow: 0 2px 8px rgba(15, 23, 42, .28); transition: scale .2s; }
.msl-pin:hover .msl-bead, .msl-pin[aria-pressed='true'] .msl-bead { scale: 1.25; }
.msl-pop { position: absolute; translate: 1.2rem -50%; z-index: 3; inline-size: 9.5rem; display: grid; gap: .25rem;
padding: .6rem .7rem; border: 1px solid var(--msl-line); border-radius: .8rem; background: var(--msl-card);
color: var(--msl-text); box-shadow: 0 12px 30px rgba(15, 23, 42, .18); }
@media (prefers-reduced-motion: reduce) { .msl-world { transition: none; } }
</style>