Files
ai-agent/docs/mockups/home-motion.html
gabrielvidalandClaude Opus 5.5 3872f594dd docs(mockups): home motion round 2 — make room then enter, grey widgets, pills, smooth notification open, Android sync
Applies the first form's answers: no layout skeletons (sections make room,
then enter from their edge), stale widgets just grey, Pop sent card, newest-
first stable rail, pill entry styles, notification cards opening smoothly,
and the sync stage split into what the notif-clear merge already does vs
what's left (app-to-app live state).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 23:02:42 +01:00

1318 lines
93 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<title>Home Motion Mockups</title>
<meta name="claude:viewport-fit-sides" content="cover">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700&family=JetBrains+Mono:wght@400;600&display=swap">
<style>
/* Layout: a review sheet — sticky chapter bar, then one stage per motion (the user's own words as eyebrow), its spec under it.
The phone/desktop frames inside the stages use the ai-agent app's own tokens (frontend/src/index.css). */
:root {
--page: hsl(24 14% 5%);
--page-2: hsl(24 12% 8%);
--ink: hsl(30 22% 94%);
--ink-2: hsl(30 8% 64%);
--rule: hsl(24 10% 17%);
/* the app (dark) */
--bg: hsl(0 0% 4%);
--card: hsl(0 0% 7%);
--border: hsl(0 0% 18%);
--muted: hsl(0 0% 13%);
--mfg: hsl(0 0% 60%);
--fg: hsl(0 0% 95%);
--primary: hsl(24 95% 55%);
--on-primary: hsl(24 60% 6%);
--amber: #f59e0b;
--emerald: #10b981;
--violet: #a78bfa;
--blue: #60a5fa;
--red: #ef4444;
/* Android system UI (heads-up + shade) */
--os: hsl(220 8% 17%);
--os-fg: hsl(0 0% 95%);
--os-2: hsl(220 6% 68%);
--os-bg: hsl(220 10% 10%);
--sheen: color-mix(in srgb, var(--fg) 12%, var(--muted));
--display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
--ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
--appmono: ui-monospace, SFMono-Regular, Menlo, monospace;
--s: .8;
color-scheme: dark;
}
@media (prefers-color-scheme: light) {
:root:not([data-theme="dark"]) {
--page: hsl(30 30% 97%); --page-2: hsl(30 22% 93%); --ink: hsl(24 12% 10%); --ink-2: hsl(24 6% 38%); --rule: hsl(24 12% 85%);
--bg: hsl(0 0% 100%); --card: hsl(0 0% 100%); --border: hsl(0 0% 89%); --muted: hsl(0 0% 94%); --mfg: hsl(0 0% 45%); --fg: hsl(0 0% 9%);
--primary: hsl(24 95% 53%); --on-primary: hsl(0 0% 100%); --violet: #7c3aed; --blue: #2563eb; --amber: #d97706; --emerald: #059669;
--os: hsl(220 20% 96%); --os-fg: hsl(220 15% 12%); --os-2: hsl(220 8% 40%); --os-bg: hsl(220 20% 99%);
color-scheme: light;
}
}
:root[data-theme="light"] {
--page: hsl(30 30% 97%); --page-2: hsl(30 22% 93%); --ink: hsl(24 12% 10%); --ink-2: hsl(24 6% 38%); --rule: hsl(24 12% 85%);
--bg: hsl(0 0% 100%); --card: hsl(0 0% 100%); --border: hsl(0 0% 89%); --muted: hsl(0 0% 94%); --mfg: hsl(0 0% 45%); --fg: hsl(0 0% 9%);
--primary: hsl(24 95% 53%); --on-primary: hsl(0 0% 100%); --violet: #7c3aed; --blue: #2563eb; --amber: #d97706; --emerald: #059669;
--os: hsl(220 20% 96%); --os-fg: hsl(220 15% 12%); --os-2: hsl(220 8% 40%); --os-bg: hsl(220 20% 99%);
color-scheme: light;
}
:root[data-theme="dark"] {
--page: hsl(24 14% 5%); --page-2: hsl(24 12% 8%); --ink: hsl(30 22% 94%); --ink-2: hsl(30 8% 64%); --rule: hsl(24 10% 17%);
--bg: hsl(0 0% 4%); --card: hsl(0 0% 7%); --border: hsl(0 0% 18%); --muted: hsl(0 0% 13%); --mfg: hsl(0 0% 60%); --fg: hsl(0 0% 95%);
--primary: hsl(24 95% 55%); --on-primary: hsl(24 60% 6%); --violet: #a78bfa; --blue: #60a5fa; --amber: #f59e0b; --emerald: #10b981;
--os: hsl(220 8% 17%); --os-fg: hsl(0 0% 95%); --os-2: hsl(220 6% 68%); --os-bg: hsl(220 10% 10%);
color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.55 var(--ui); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--page); }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
code { font: 12px/1 var(--mono); color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 2px 5px; border-radius: 4px; }
/* ── page chrome ─────────────────────────────────────────── */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--page) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; align-items: center; gap: 14px; padding-block: 10px; }
.brand { font: 700 15px/1 var(--display); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand i { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
nav.toc { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
nav.toc a { font: 500 12px/1 var(--mono); color: var(--ink-2); text-decoration: none; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 999px; white-space: nowrap; }
nav.toc a:hover { color: var(--ink); border-color: var(--primary); }
.speed { display: flex; gap: 2px; border: 1px solid var(--rule); border-radius: 9px; padding: 2px; flex: none; }
.speed button { font: 600 11px/1 var(--mono); padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); cursor: pointer; }
.speed button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.intro { padding-block: 48px 12px; }
.eyebrow { font: 600 12px/1.4 var(--mono); color: var(--primary); letter-spacing: .04em; text-transform: uppercase; }
h1 { font: 700 clamp(32px, 5.4vw, 56px)/1.02 var(--display); letter-spacing: -.02em; margin: 10px 0 16px; text-wrap: balance; max-width: 15ch; }
.intro p { max-width: 64ch; color: var(--ink-2); margin: 0 0 12px; }
.finding { margin-top: 26px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.finding > div { border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; background: var(--page-2); min-width: 0; }
.finding h3 { margin: 0 0 6px; font: 700 15px/1.3 var(--display); display: flex; gap: 8px; align-items: center; }
.finding p { margin: 0; font-size: 14px; color: var(--ink-2); }
.pill { font: 600 10px/1 var(--mono); padding: 4px 7px; border-radius: 999px; letter-spacing: .03em; text-transform: uppercase; flex: none; }
.pill.ok { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 14%, transparent); }
.pill.half { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.pill.no { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.round2 { margin-top: 18px; border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--rule)); border-radius: 14px; padding: 14px 18px; background: color-mix(in srgb, var(--primary) 5%, var(--page-2)); }
.round2 h3 { margin: 0 0 8px; font: 700 15px/1.3 var(--display); }
.round2 ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; display: grid; gap: 4px; }
.round2 b { color: var(--ink); font-weight: 600; }
.round2 a { color: var(--primary); }
.ch { padding-block: 52px 8px; border-top: 1px solid var(--rule); margin-top: 40px; scroll-margin-top: 64px; }
.ch-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ch-head > div { flex: 1; min-width: 0; }
h2 { font: 700 clamp(24px, 3.2vw, 32px)/1.1 var(--display); margin: 8px 0 0; letter-spacing: -.01em; text-wrap: balance; }
.replay { display: inline-flex; gap: 6px; align-items: center; font: 600 12px/1 var(--mono); padding: 8px 12px; border-radius: 9px; border: 1px solid var(--rule); background: var(--page-2); color: var(--ink); cursor: pointer; }
.replay:hover { border-color: var(--primary); }
.lede { max-width: 70ch; color: var(--ink-2); margin: 12px 0 22px; }
.stage { position: relative; display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; justify-content: center; padding: 26px 18px; border-radius: 20px; background: var(--page-2); border: 1px solid var(--rule); overflow: hidden; }
.spec { margin: 18px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 28px; }
.spec li { position: relative; padding-left: 16px; font-size: 14px; color: var(--ink-2); min-width: 0; }
.spec li::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; border-radius: 2px; background: var(--primary); }
.spec b { color: var(--ink); font-weight: 600; }
.hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font: 600 11px/1 var(--mono); color: var(--ink-2); background: var(--page); border: 1px solid var(--rule); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
footer { margin-top: 64px; padding-block: 24px 48px; border-top: 1px solid var(--rule); color: var(--ink-2); font: 12px/1.6 var(--mono); }
/* ── device frames ───────────────────────────────────────── */
.dev { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.phone { position: relative; width: calc(360px * var(--s)); height: calc(var(--h) * var(--s)); border-radius: calc(28px * var(--s)); border: 1px solid var(--border); overflow: hidden; background: var(--bg); box-shadow: 0 24px 60px -24px rgb(0 0 0 / .55); }
.screen { position: absolute; top: 0; left: 0; width: var(--w, 360px); height: var(--h); transform: scale(var(--s)); transform-origin: 0 0; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font: 14px/1.4 var(--ui); overflow: hidden; }
.phone.wide { width: calc(var(--w) * var(--s)); border-radius: calc(14px * var(--s)); }
figcaption { font: 600 12px/1.3 var(--mono); color: var(--ink-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
figcaption .ic { width: 14px; height: 14px; }
.count { padding: 3px 8px; border-radius: 999px; border: 1px solid var(--rule); }
.count.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.count.good { color: var(--emerald); border-color: color-mix(in srgb, var(--emerald) 45%, transparent); }
.finger { position: absolute; z-index: 90; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--fg) 30%, transparent); border: 2px solid color-mix(in srgb, var(--fg) 75%, transparent); transform: translate(-50%, -50%); pointer-events: none; opacity: 0; }
/* ── the app, mocked (Tailwind classes of the real components, by hand) ── */
.ic { width: 16px; height: 16px; flex: none; display: block; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sbar { flex: none; height: 24px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font: 600 11px/1 var(--ui); color: var(--fg); }
.sbar i { display: inline-block; width: 22px; height: 9px; border-radius: 2px; border: 1.5px solid var(--fg); opacity: .8; }
.m-hdr { flex: none; display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.m-hdr > .ic { color: var(--primary); }
.m-hdr .t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.m-hdr b { font-size: 15px; }
.m-hdr small { font-size: 11px; color: var(--mfg); min-height: 13px; }
.m-hdr .tools { margin-left: auto; display: flex; gap: 14px; color: var(--mfg); }
.m-scroll { position: relative; flex: 1; min-height: 0; overflow: hidden; padding: 14px; display: flex; flex-direction: column; gap: 22px; }
.m-scroll.flow { gap: 0; }
.m-nav { flex: none; height: 56px; border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: center; color: var(--mfg); background: var(--bg); position: relative; z-index: 31; }
.m-nav .on { background: var(--primary); color: var(--on-primary); border-radius: 12px; padding: 8px; }
.m-composer { position: absolute; left: 12px; right: 12px; bottom: 66px; z-index: 30; border: 1px solid var(--border); background: var(--card); border-radius: 16px; padding: 12px 12px 10px; box-shadow: 0 18px 40px -12px rgb(0 0 0 / .6); }
.m-composer.flat { bottom: 12px; }
.m-ctext { font: 14px/1.4 var(--appmono); min-height: 40px; color: var(--fg); transition: opacity .2s; }
.m-ctext .ph { color: var(--mfg); }
.m-ctext .tx:not(:empty) ~ .ph { display: none; }
.m-crow { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--mfg); }
.chip { font-size: 11px; padding: 3px 8px; border-radius: 999px; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); white-space: nowrap; }
.chip.v { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }
.send { margin-left: auto; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--muted); color: var(--mfg); transition: background-color .2s, color .2s; }
.send.armed { background: var(--primary); color: var(--on-primary); }
.undo { position: absolute; left: 14px; right: 14px; top: 0; height: 2px; border-radius: 2px; background: var(--primary); transform-origin: left; transform: scaleX(0); }
.m-h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.m-h2 > span:first-child { display: flex; gap: 6px; align-items: center; }
.m-h2 .ic { width: 14px; height: 14px; }
.m-h2 .r { font-size: 11px; font-weight: 400; color: var(--mfg); }
.m-banner { display: flex; gap: 8px; align-items: flex-start; border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); background: color-mix(in srgb, var(--amber) 9%, var(--card)); color: var(--amber); border-radius: 12px; padding: 10px 12px; font-size: 12px; }
.m-banner > span { flex: 1; }
.m-loading { height: 200px; display: grid; place-items: center; color: var(--mfg); font-size: 13px; }
.mb22 { margin-bottom: 22px; }
/* usage strip — stale = "just grey, like empty": no value, grey labels, grey bars */
.m-usage { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 8px; }
.m-tile { width: 30%; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-align: center; }
.m-g { position: relative; width: 100%; max-width: 96px; }
.m-g svg { width: 100%; display: block; overflow: visible; }
.m-g path { fill: none; stroke-width: 8; stroke-linecap: round; }
.m-g .trk { stroke: var(--muted); }
.m-g .val { stroke: var(--primary); }
.m-gv { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; font-size: 20px; font-weight: 600; line-height: 1; min-height: 20px; }
.m-tl { margin-top: 7px; font-size: 12px; font-weight: 500; transition: color .4s; }
.m-ts { margin-top: 2px; font: 10px/13px var(--appmono); color: var(--mfg); min-height: 13px; max-width: 100%; white-space: nowrap; overflow: hidden; transition: color .4s; }
.m-spark { display: flex; align-items: flex-end; gap: 3px; height: 40px; width: 100%; max-width: 100px; }
.m-spark i { flex: 1; height: 6%; border-radius: 3px; background: var(--primary); opacity: .4; transition: background-color .4s, opacity .4s; }
.m-spark i:last-child { opacity: 1; }
.m-sv { font: 600 20px/20px var(--appmono); min-height: 20px; }
.stale .m-tl, .stale .m-ts { color: color-mix(in srgb, var(--mfg) 70%, transparent); }
.stale .val { opacity: 0; }
.stale .m-spark i { background: var(--muted); opacity: 1; }
/* running card (ConversationListElement) */
.m-runs { display: flex; flex-direction: column; }
.m-runwrap { margin-bottom: 8px; }
.m-run { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); background: color-mix(in srgb, var(--primary) 5%, var(--card)); transition: border-color .3s, background-color .3s; }
.m-run.done { border-color: color-mix(in srgb, var(--emerald) 55%, transparent); background: color-mix(in srgb, var(--emerald) 7%, var(--card)); }
.m-lead { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.tile { position: relative; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--primary); border: 1px solid color-mix(in srgb, var(--primary) 55%, transparent); background: color-mix(in srgb, var(--primary) 13%, transparent); transition: color .3s, background-color .3s, border-color .3s; }
.tile .ic { width: 18px; height: 18px; }
.stt { color: var(--amber); display: grid; place-items: center; }
.stt .ic { width: 13px; height: 13px; }
.done .stt { color: var(--emerald); }
.m-main { flex: 1; min-width: 0; }
.m-title { font-size: 14px; font-weight: 500; line-height: 1.3; min-height: 18px; overflow-wrap: anywhere; }
.m-title.prov { color: var(--mfg); font-style: italic; }
.m-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; min-height: 18px; }
.m-tag { display: inline-flex; gap: 4px; align-items: center; font-size: 10px; line-height: 1.3; padding: 2px 7px; border-radius: 999px; color: var(--primary); background: color-mix(in srgb, var(--primary) 13%, transparent); white-space: nowrap; }
.m-tag.v { color: var(--violet); background: color-mix(in srgb, var(--violet) 15%, transparent); }
.m-tag.task { color: var(--amber); background: color-mix(in srgb, var(--amber) 13%, transparent); }
.m-tag.more { color: var(--mfg); background: var(--muted); }
.m-tag.ok { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 15%, transparent); }
.m-tag.naming { color: var(--mfg); background: linear-gradient(90deg, var(--muted) 25%, var(--sheen) 50%, var(--muted) 75%); background-size: 300% 100%; animation: sheen 1.5s linear infinite; }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: -200% 0; } }
.m-tag .ic { width: 10px; height: 10px; }
.m-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.m-cost { font: 600 14px/1 var(--appmono); }
.m-pct { font: 10px/1 var(--appmono); color: var(--mfg); background: var(--muted); padding: 3px 5px; border-radius: 5px; }
.m-el { font: 11px/1 var(--appmono); color: var(--mfg); }
.roll { display: inline-block; }
/* waiting for feedback */
.m-wait { border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); background: color-mix(in srgb, var(--red) 6%, var(--card)); border-radius: 12px; padding: 12px; }
.m-wait-t { display: flex; gap: 8px; font-size: 14px; font-weight: 500; }
.m-wait-t .ago { margin-left: auto; font: 11px var(--appmono); color: var(--mfg); }
.m-wait-b { margin-top: 4px; font-size: 12px; color: var(--mfg); }
.m-wait-tags { padding-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; font-size: 11px; color: var(--mfg); font-style: italic; }
.m-wait-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--mfg); }
.m-btn { display: inline-flex; gap: 6px; align-items: center; background: var(--primary); color: var(--on-primary); font-weight: 600; border-radius: 9px; padding: 6px 11px; }
.m-btn .ic { width: 13px; height: 13px; }
/* notification card (NotificationCard) */
.m-notif { position: relative; display: flex; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); transition: opacity .3s, border-color .3s; }
.m-notif.unread { border-color: color-mix(in srgb, var(--primary) 42%, transparent); }
.dot { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card); transition: opacity .3s, transform .3s; }
.m-notif:not(.unread) .dot { opacity: 0; transform: scale(.4); }
.m-notif:not(.unread) .tile { color: var(--mfg); background: var(--muted); border-color: var(--border); }
.m-nmain { flex: 1; min-width: 0; }
.m-ntop { display: flex; align-items: center; gap: 6px; }
.m-type { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; color: var(--t); background: color-mix(in srgb, var(--t) 15%, transparent); transition: color .3s, background-color .3s; }
.m-notif:not(.unread) .m-type { color: var(--mfg); background: var(--muted); }
.m-ago { margin-left: auto; font-size: 11px; color: var(--mfg); }
.m-ntitle { margin-top: 4px; font-size: 14px; font-weight: 600; line-height: 1.3; }
.m-nbody { margin-top: 2px; font-size: 13px; color: var(--mfg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-nconv { margin-top: 6px; display: flex; gap: 5px; align-items: center; font-size: 11px; color: var(--mfg); white-space: nowrap; overflow: hidden; }
.m-nconv .ic { width: 11px; height: 11px; }
.m-ndetail { height: 0; overflow: hidden; }
.m-ndetail .in { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); margin-top: 10px; padding-top: 9px; display: grid; gap: 7px; font-size: 13px; color: var(--mfg); }
.m-ndetail .lnk { display: flex; gap: 5px; align-items: center; color: var(--primary); font-size: 12px; }
.m-ndetail .lnk .ic { width: 12px; height: 12px; }
.m-ndetail .foot { display: flex; justify-content: space-between; font-size: 11px; }
.seen-tag { position: absolute; right: 10px; bottom: 8px; font: 600 10px/1 var(--mono); color: var(--emerald); background: color-mix(in srgb, var(--emerald) 14%, var(--card)); padding: 4px 6px; border-radius: 5px; }
.sec { position: relative; }
.shifted { outline: 2px dashed var(--red); outline-offset: 3px; border-radius: 10px; }
.shift-tag { position: absolute; right: 2px; top: -12px; z-index: 40; font: 700 11px/1 var(--mono); color: #fff; background: var(--red); padding: 4px 6px; border-radius: 5px; }
/* stacks */
.st-list { display: flex; flex-direction: column; }
.st { position: relative; margin-bottom: 12px; touch-action: pan-y; cursor: pointer; user-select: none; -webkit-user-select: none; }
.st-cards { position: relative; }
.st-card { position: absolute; left: 0; right: 0; top: 0; overflow: hidden; border-radius: 12px; transform-origin: 50% 100%; }
.st-card > .m-notif > * { transition: opacity .22s; }
.st-card.sheet > .m-notif > * { opacity: 0; }
.st-card.sheet > .m-notif { background: color-mix(in srgb, var(--fg) 3%, var(--card)); border-color: var(--border); }
.st-head { position: absolute; left: 2px; right: 2px; top: 0; height: 24px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s; }
.st-head .conv { display: flex; gap: 6px; align-items: center; min-width: 0; flex: 1; }
.st-head .conv span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-head .ic { width: 13px; height: 13px; color: var(--primary); }
.st-col { display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--border); background: var(--card); color: var(--mfg); font-size: 11px; border-radius: 999px; padding: 3px 8px; cursor: pointer; }
.st-col .ic { width: 12px; height: 12px; color: var(--mfg); }
.st.open .st-head { opacity: 1; pointer-events: auto; }
.st-badge { position: absolute; z-index: 50; top: -7px; right: 10px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: none; place-items: center; font: 700 11px/1 var(--appmono); background: var(--primary); color: var(--on-primary); border: 2px solid var(--bg); transition: opacity .2s, transform .2s; }
.st.multi .st-badge { display: grid; }
.st.open .st-badge { opacity: 0; transform: scale(.5); }
/* Android heads-up + shade */
.osn { border-radius: 18px; padding: 10px 12px; background: var(--os); color: var(--os-fg); box-shadow: 0 10px 28px -10px rgb(0 0 0 / .55); }
.osn .app { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--os-2); }
.osn .app i { width: 16px; height: 16px; border-radius: 50%; background: var(--primary); }
.osn b { display: block; font-size: 13px; margin-top: 4px; }
.osn span.bd { display: block; font-size: 12px; color: var(--os-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hu { position: absolute; left: 8px; right: 8px; top: 28px; z-index: 70; transform: translateY(-160%); }
.shade { position: absolute; left: 0; right: 0; top: 0; z-index: 65; padding: 30px 10px 14px; background: var(--os-bg); border-radius: 0 0 22px 22px; box-shadow: 0 20px 40px -10px rgb(0 0 0 / .6); transform: translateY(-102%); }
.shade h4 { margin: 0 6px 8px; font: 600 11px/1 var(--ui); color: var(--os-2); text-transform: uppercase; letter-spacing: .05em; }
.shade .osn { box-shadow: none; margin-bottom: 6px; }
.shade .gone-tag { font: 600 10px/1 var(--mono); color: var(--emerald); margin-left: auto; }
/* sync */
.sync { width: 100%; display: grid; grid-template-columns: auto minmax(90px, 1fr) auto; align-items: center; }
.hub { display: flex; align-items: center; min-width: 0; }
.wire { position: relative; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 11px); }
.pulse { position: absolute; left: 0; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent); opacity: 0; }
.node { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--rule); background: var(--page); font: 600 11px/1.2 var(--mono); color: var(--ink); text-align: center; }
.node small { font-weight: 400; color: var(--ink-2); }
.node .ic { width: 20px; height: 20px; color: var(--primary); }
.log { width: 100%; margin: 4px 0 0; padding: 12px 14px; list-style: none; border-radius: 12px; background: var(--page); border: 1px solid var(--rule); font: 12px/1.7 var(--mono); color: var(--ink-2); min-height: 120px; }
.log li { display: flex; gap: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-items: baseline; }
.log time { color: var(--primary); flex: none; }
.log b { color: var(--ink); font-weight: 600; }
.log em { font-style: normal; font-size: 10px; padding: 1px 5px; border-radius: 4px; flex: none; }
.log em.today { color: var(--emerald); background: color-mix(in srgb, var(--emerald) 14%, transparent); }
.log em.new { color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }
.sync-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tablewrap { margin-top: 18px; overflow-x: auto; border: 1px solid var(--rule); border-radius: 14px; }
.sync-table th, .sync-table td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.sync-table tr:last-child td { border-bottom: 0; }
.sync-table th { font: 600 11px/1.3 var(--mono); color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.sync-table td:first-child { font-weight: 600; white-space: nowrap; color: var(--ink); }
.sync-table td { color: var(--ink-2); min-width: 200px; }
/* sent card (SentPreview) */
.variants { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 22px; width: 100%; justify-items: center; }
.vlabel { font: 700 13px/1.3 var(--display); color: var(--ink); }
.vlabel span { font: 500 12px/1.3 var(--mono); color: var(--ink-2); margin-left: 4px; }
.sent-slot { position: absolute; right: 12px; left: 12px; z-index: 25; display: flex; justify-content: flex-end; }
.sent { width: fit-content; max-width: 85%; min-width: 160px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); background: color-mix(in srgb, var(--primary) 5%, var(--card)); padding: 10px; box-shadow: 0 10px 24px -8px rgb(0 0 0 / .45); text-align: left; }
.sent-h { display: flex; gap: 4px; align-items: center; font-size: 10px; font-weight: 500; color: var(--primary); min-height: 13px; margin-bottom: 4px; }
.sent-h .ic { width: 12px; height: 12px; }
.sent-b { font-size: 13px; line-height: 1.4; }
.sent-tags { display: flex; gap: 4px; margin-top: 6px; }
.sent-tags span { font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--mfg); }
.faint { opacity: .35; }
.surface { width: min(360px, 100%); padding: 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--border); color: var(--fg); font: 14px/1.4 var(--ui); }
@media (max-width: 760px) {
.desk { --s: .56; }
.sync { grid-template-columns: 1fr; justify-items: center; }
.hub { flex-direction: column; height: 150px; }
.wire { width: 2px; height: auto; flex: 1; background: repeating-linear-gradient(180deg, var(--border) 0 6px, transparent 6px 11px); }
.pulse { left: 50%; top: 0; }
}
@media (max-width: 480px) {
:root { --s: .84; }
.stage { padding: 18px 10px; }
.top .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
.spin, .m-tag.naming { animation: none !important; }
}
.caret::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 1px; vertical-align: -.12em; background: var(--primary); animation: blink .9s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
</style>
<header class="top">
<div class="wrap">
<div class="brand"><i></i><span>ai-agent · home</span></div>
<nav class="toc" aria-label="Mockups">
<a href="#no-jump">No jumps</a><a href="#stale">Widgets</a><a href="#stacks">Stacks</a><a href="#sync">Sync</a><a href="#running">Running</a><a href="#pills">Pills</a><a href="#titles">Titles</a><a href="#sent">Sent card</a>
</nav>
<div class="speed" role="group" aria-label="Playback speed">
<button type="button" data-speed="1" aria-pressed="true">1×</button>
<button type="button" data-speed="0.5" aria-pressed="false">½×</button>
<button type="button" data-speed="0.25" aria-pressed="false">¼×</button>
</div>
</div>
</header>
<main class="wrap">
<section class="intro">
<div class="eyebrow">ai-agent · home page · mockups, round 2 · 1 Nov 2026</div>
<h1>The home page, without the jumps</h1>
<p>Each stage below replays one of your asks, on the home page as it looked in today's screenshots (Pixel 9 and desktop, Personal profile). They loop while on screen; <b>Replay</b> restarts one, and the speed switch at the top slows every stage down to inspect the timing. The stack and sync stages are also clickable.</p>
<div class="round2">
<h3>What changed since your first answers</h3>
<ul>
<li><b>No layout skeletons.</b> Sections appear when their data lands. The page first makes room (everything below glides down), then the new element enters from its own edge: the worker banner from the top of the screen, running cards from the left, notifications dropping in.</li>
<li><b>Widgets</b> are just grey while loading, like empty, then their values type in.</li>
<li><b>Pills</b> on running cards animate in (three styles to pick from, under <a href="#pills">Pills</a>).</li>
<li><b>Notifications open smoothly:</b> the card's height glides open and the cards below follow.</li>
<li><b>Sent card:</b> Pop, your pick. <b>Sync:</b> both ways with the Android push, which another session shipped this evening (the <code>notif-clear</code> merge), so the stage marks what exists and what is new.</li>
</ul>
</div>
<div class="finding">
<div>
<h3><span class="pill ok">yes</span> Notifications are in the backend</h3>
<p>Every push is recorded server-side (conversation metadata plus the hub log), and an SSE <code>notification</code> event refreshes every open device when one lands.</p>
</div>
<div>
<h3><span class="pill ok">today</span> Android push ↔ app</h3>
<p>Since this evening: swipe the Android push away and it leaves New in the open apps; read a card in the app and the push leaves the phone.</p>
</div>
<div>
<h3><span class="pill half">gap</span> App ↔ app isn't live</h3>
<p>A swipe on the desktop reaches the phone's open PWA only on reload. New / unread live in one whole ui-state blob each tab rewrites, so a stale tab can bring a swiped card back.</p>
</div>
<div>
<h3><span class="pill no">jumps</span> 3 snaps on load</h3>
<p>On the Pixel 9: <i>Loading notifications…</i> swaps for content, <i>Waiting for feedback</i> lands above Running (+148 px), then its tag row replaces <i>conversation not loaded</i>.</p>
</div>
</div>
</section>
<!-- ─────────────────────────────────────────────── -->
<section class="ch" id="no-jump">
<div class="ch-head">
<div><div class="eyebrow">You asked: “Nothing should jump”</div><h2>Make room, then enter</h2></div>
<button class="replay" type="button">↻ Replay</button>
</div>
<p class="lede">Left, today's load as captured: sections snap in as their queries land and shove what's below. Right, the same arrivals in the same order, with nothing pre-drawn: each time something new shows up, the content below glides down first, then the newcomer comes in from its edge.</p>
<div class="stage"></div>
<ul class="spec">
<li><b>Two beats.</b> Room: the slot opens from 0 to its height (240 ms ease-out) and everything below glides with it. Enter: the element slides in from its edge (380–520 ms) once the room is there.</li>
<li><b>Edges:</b> banners slide down from the top of the screen like a drawer (room and entry together); running cards come from the left; Waiting for feedback and notifications drop in from just above.</li>
<li><b>Leaving</b> reverses it: the element exits by its edge (cards right, banners up), then the gap closes.</li>
<li><b>No loading swap.</b> <code>ConversationHome</code> renders its sections as their data arrives; a late tag row opens its height, then its pills pop in.</li>
<li><b>Only live arrivals animate.</b> A page painted from the cache shows what it has at once; what lands after the first paint enters.</li>
<li><b>Touches</b> <code>ConversationHome</code>, <code>WaitingForFeedback</code>, <code>RunningConversations</code>, the banners, and one shared <code>&lt;Enter from="left|top"&gt;</code> wrapper doing the two beats.</li>
</ul>
</section>
<!-- ─────────────────────────────────────────────── -->
<section class="ch" id="stale">
<div class="ch-head">
<div><div class="eyebrow">You asked: “a stale state when loading … loaded values appear with progress text” · picked: just grey, like empty</div><h2>Usage widgets: grey, then typed in</h2></div>
<button class="replay" type="button">↻ Replay</button>
</div>
<p class="lede">While a reading is on its way, the strip is the widget with nothing in it: grey labels, an empty gauge track, flat grey bars and no figures. When it lands, the colour comes back, each value types in while its gauge sweeps in step, and the sparkline grows left to right.</p>
<div class="stage"></div>
<ul class="spec">
<li><b>Stale = empty, in grey.</b> No placeholder blocks, no shimmer. Each tile keeps its own line heights, so filling it moves nothing.</li>
<li><b>Cached numbers stay hidden</b> until the fresh reading lands (your pick).</li>
<li><b>Loaded:</b> colour fades back (400 ms); each figure types in ~0.6 s while its gauge sweeps 0 → value over 0.65 s; tiles start 120 ms apart; bars grow 45 ms apart.</li>
<li><b>Later live updates</b> keep today's digit roll (<code>Roll</code>).</li>
<li><b>Touches</b> <code>ProfileUsageCard</code> (Meter, Stat, Spark), <code>ArcGauge</code> (a <code>stale</code> prop), <code>lib/profileUsage</code> (per-source loading flags).</li>
</ul>
</section>
<!-- ─────────────────────────────────────────────── -->
<section class="ch" id="stacks">
<div class="ch-head">
<div><div class="eyebrow">You asked: “stacked by conversation (latest on top), clicking unstacks the pile” · “notifications should open smoothly too”</div><h2>One stack per conversation</h2></div>
<button class="replay" type="button">↻ Replay</button>
</div>
<p class="lede">The New feed grouped by conversation. The demo:
<br>• a push lands for <i>French localization</i>: its stack glides to the top, then the card lands on it;
<br>• a tap fans the stack out, and a tap on one card opens it smoothly while the cards below follow;
<br>• Collapse folds it back, and a swipe dismisses a whole stack;
<br>• a push from a new conversation: the list makes room, then its card drops in.
<br>Tap or swipe the stacks yourself to take over.</p>
<div class="stage"></div>
<ul class="spec">
<li><b>Order:</b> stacks by their newest notification; inside a stack, newest on top. Up to two sheets peek 7 px each; the bubble counts the stack.</li>
<li><b>Tap a stack</b> to fan it out (560 ms spring, 40 ms stagger) under a header with the conversation and Collapse.</li>
<li><b>Open a card</b> (marks it read): its height glides open (420 ms ease-out) to show the body, the link and the conversation; cards below glide down with it. Closing reverses it.</li>
<li><b>A new push</b>: the stack glides to the top first (FLIP, 520 ms), then the card lands on it (the old top slides back into a sheet).</li>
<li><b>Swipe</b> a closed stack: the whole stack goes (your pick). Stacks are on the home feed only; the history page stays flat.</li>
<li><b>Touches</b> <code>buildFeed</code> → <code>groupByConversation</code>; a new <code>NotificationStack</code>; <code>NotificationCard</code>'s detail becomes a height-animated panel.</li>
</ul>
</section>
<!-- ─────────────────────────────────────────────── -->
<section class="ch" id="sync">
<div class="ch-head">
<div><div class="eyebrow">You asked: “synced between devices” · picked: both ways with the Android push</div><h2>Dealt with on one screen, gone from all of them</h2></div>
<button class="replay" type="button">↻ Replay</button>
</div>
<p class="lede">A push reaches the desktop, the Pixel 9's app and its Android shade. Swiping the Android push away removes the card in both apps; swiping a card on the desktop removes it from the phone's app and its shade. In the log, <span class="pill ok">today</span> already works since this evening; <span class="pill half">new</span> is what's left to build.</p>
<div class="stage"></div>
<div class="tablewrap">
<table class="sync-table">
<thead><tr><th></th><th>Today (since the notif-clear merge)</th><th>Proposed</th></tr></thead>
<tbody>
<tr><td>Android push → app</td><td>HA reports the swipe (<code>notification_cleared</code> → <code>POST /notifications/dismissed</code>); SSE <code>notif-seen</code> drops it from the open apps' New.</td><td>Unchanged.</td></tr>
<tr><td>App → Android push</td><td>Reading or swiping a card (<code>POST /notifications/seen</code>) clears the push on the phone and the other web-push devices.</td><td>Unchanged.</td></tr>
<tr><td>App → other open apps</td><td>No event: the other screens learn on reload. New / unread are lists in a whole ui-state blob each tab rewrites (last writer wins).</td><td>New / unread / dismissed per id in the server ledger, changed by small POSTs; each change publishes SSE <code>notif-state</code> and every open app patches in place, animated.</td></tr>
<tr><td>The desk phone</td><td>Reads <code>notif-read.json</code>, which only knows "seen".</td><td>Reads the same ledger.</td></tr>
</tbody>
</table>
</div>
</section>
<!-- ─────────────────────────────────────────────── -->
<section class="ch" id="running">
<div class="ch-head">
<div><div class="eyebrow">You asked: “arrive from the left and go right when done” · “notifications should move down before a new running conv is added”</div><h2>Running cards come in left, leave right</h2></div>
<button class="replay" type="button">↻ Replay</button>
</div>
<p class="lede">A new run: the rail and the notifications under it glide down first, then the card slides in from the left, its title types, and its pills pop in. Mid-run, a new pill pops onto a card. A finished run flashes a check, slides out to the right, and the gap closes behind it.</p>
<div class="stage"></div>
<ul class="spec">
<li><b>Arrive:</b> room opens (300 ms ease-out, everything below glides down), then the card slides in from the left edge (520 ms spring), then the title types (34 chars/s), then its pills pop in, 90 ms apart.</li>
<li><b>Done:</b> check + one emerald ring pulse, hold 0.5 s, slide out right (420 ms ease-in), then the gap closes (300 ms).</li>
<li><b>Order:</b> newest on top and stable (your pick); no live re-sort by cost, so a card never moves while it runs.</li>
<li><b>Pills</b> added mid-run (a task, a deploy, a worktree) pop in; the two reserved tag rows keep the card's height.</li>
<li><b>Touches</b> <code>RunningConversations</code> (enter/exit phases, stable order), <code>ConversationListElement</code> (done state), <code>TagRows</code> (pill entry).</li>
</ul>
</section>
<!-- ─────────────────────────────────────────────── -->
<section class="ch" id="pills">
<div class="ch-head">
<div><div class="eyebrow">You asked: “pills on the running conversation cards should appear with an animation”</div><h2>Three ways for a pill to arrive</h2></div>
<button class="replay" type="button">↻ Replay</button>
</div>
<p class="lede">The same card, its pills arriving one after the other. The running stage above uses A.</p>
<div class="stage"></div>
<ul class="spec">
<li><b>A · Pop:</b> scales up from 40 % with a small overshoot (320 ms, 90 ms apart).</li>
<li><b>B · Slide:</b> slides 10 px in from the left as it fades in (280 ms, 70 ms apart).</li>
<li><b>C · Unroll:</b> unrolls left to right, like its label being typed (360 ms, 120 ms apart).</li>
</ul>
</section>
<!-- ─────────────────────────────────────────────── -->
<section class="ch" id="titles">
<div class="ch-head">
<div><div class="eyebrow">You asked: “Running conversation cards title should appear with progress text” · picked: arrivals and live retitles only</div><h2>Titles type in, and retype on change</h2></div>
<button class="replay" type="button">↻ Replay</button>
</div>
<p class="lede">Left, a new conversation: its prompt's first line shows in muted italics until the auto-title lands, then it backspaces and types the title. Right, a retitle: ProgressiveText deletes back to the common prefix and types only the new tail.</p>
<div class="stage"></div>
<ul class="spec">
<li><b>No growth while typing.</b> The card measures its final title height first and reserves it, so a wrap to line two never pushes the rail.</li>
<li><b>Speed:</b> 34 characters/s typing, 120/s deleting; caret only while typing.</li>
<li><b>Titles already there</b> when the page opens appear at once.</li>
<li><b>Touches</b> <code>ConversationListElement</code> title → <code>ProgressiveText</code> (already in <code>@gabvdl/ui</code>).</li>
</ul>
</section>
<!-- ─────────────────────────────────────────────── -->
<section class="ch" id="sent">
<div class="ch-head">
<div><div class="eyebrow">Your follow-up: “animate the appearance of the message card above the prompt box” · picked: Pop</div><h2>The sent card pops from the send button</h2></div>
<button class="replay" type="button">↻ Replay</button>
</div>
<p class="lede">Once the un-send window ends, the card grows out of the send button's corner to its spot above the composer. Its status line then retypes from <i>starting session…</i> to <i>session ready — tap to open</i>.</p>
<div class="stage"></div>
<ul class="spec">
<li><b>Pop:</b> from 40 % at the send button's corner to full size (420 ms spring); the composer clears as it goes.</li>
<li><b>Pinned above the composer</b> as today, so the box never resizes.</li>
<li><b>Then:</b> the status line retypes with ProgressiveText and one primary ring pulse marks ready; a swipe or opening it sends it off to the right.</li>
<li><b>Touches</b> <code>SentPreview</code>, <code>SpawnComposer</code> (the hand-off from the held composer).</li>
</ul>
</section>
<footer>Built from screenshots of ai-agent.lab.gabvdl.xyz taken on 1 Nov 2026 · source: <span>docs/mockups/home-motion.html</span> in the ai-agent repo</footer>
</main>
<script>
(() => {
"use strict";
const ABORT = Symbol("abort");
const REDUCE = matchMedia("(prefers-reduced-motion: reduce)").matches;
let speed = 1;
const OUT = "cubic-bezier(.16,1,.3,1)";
const IN = "cubic-bezier(.55,0,.75,.2)";
const SPRING = "cubic-bezier(.22,1.25,.36,1)";
const easeOut = (t) => 1 - Math.pow(1 - t, 3);
const bg = (p) => p.catch((e) => { if (e !== ABORT) console.error(e); });
const ICONS = {
bell: '<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>',
loader: '<path d="M21 12a9 9 0 1 1-6.219-8.56"/>',
check: '<path d="M20 6 9 17l-5-5"/>',
up: '<path d="M7 7h10v10"/><path d="M7 17 17 7"/>',
x: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
radio: '<path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"/><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"/><circle cx="12" cy="12" r="2"/><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"/><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"/>',
send: '<path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/>',
laptop: '<rect x="3" y="4" width="18" height="12" rx="2"/><path d="M2 20h20"/>',
bot: '<rect width="16" height="11" x="4" y="9" rx="2"/><path d="M12 9V5"/><circle cx="12" cy="4" r="1.5"/><path d="M9 14h.01M15 14h.01"/>',
home: '<path d="m3 10 9-7 9 7v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z"/><path d="M9 21v-7h6v7"/>',
msg: '<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>',
chev: '<path d="m18 15-6-6-6 6"/>',
grid: '<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/>',
folder: '<path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9l-.8-1.2A2 2 0 0 0 7.9 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',
gear: '<circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1 7 17M17 7l2.1-2.1"/>',
gauge: '<path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/>',
help: '<circle cx="12" cy="12" r="10"/><path d="M9.1 9a3 3 0 0 1 5.8 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
clip: '<path d="m21.4 11-8.6 8.6a5.7 5.7 0 0 1-8-8l8.5-8.6a3.8 3.8 0 0 1 5.4 5.4l-8.6 8.6a1.9 1.9 0 0 1-2.7-2.7l8-8"/>',
server: '<rect x="3" y="3" width="18" height="7" rx="2"/><rect x="3" y="14" width="18" height="7" rx="2"/><path d="M7 6.5h.01M7 17.5h.01"/>',
clipboard: '<rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',
link: '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
};
const ic = (n, cls = "") => `<svg class="ic ${cls}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${ICONS[n]}</svg>`;
const TYPE = { Deploy: "var(--violet)", AI: "var(--violet)", Code: "var(--blue)", Build: "var(--amber)" };
const scaleOf = (el) => el.getBoundingClientRect().width / el.offsetWidth || 1;
const fmtEl = (s) => `${Math.floor(s / 60)}m ${String(s % 60).padStart(2, "0")}s`;
// ── typing, the way ProgressiveText does it: back to the common prefix, then forward ──
async function typeInto(c, el, text, { cps = 40, delCps = 120 } = {}) {
let cur = el.textContent;
let i = 0;
while (i < cur.length && i < text.length && cur[i] === text[i]) i++;
el.classList.add("caret");
try {
while (cur.length > i) { cur = cur.slice(0, -1); el.textContent = cur; await c.sleep(1000 / delCps); }
while (cur.length < text.length) { cur = text.slice(0, cur.length + 1); el.textContent = cur; await c.sleep(1000 / cps); }
} finally { el.classList.remove("caret"); }
}
// ── scene runner: loops while on screen, restarts on Replay, aborts cleanly ──
const scenes = {};
function scene(id, setup, play) {
const root = document.getElementById(id);
const stage = root.querySelector(".stage");
const st = { gen: 0, visible: false, waiters: [] };
const mk = (g) => {
const check = () => { if (g !== st.gen) throw ABORT; };
const c = {
sleep: (ms) => new Promise((res, rej) => setTimeout(() => (g === st.gen ? res() : rej(ABORT)), ms / speed)),
tween: (ms, fn, ease = easeOut) => new Promise((res, rej) => {
const t0 = performance.now(), d = ms / speed;
const step = (t) => {
if (g !== st.gen) return rej(ABORT);
const p = Math.min(1, (t - t0) / d);
fn(ease(p));
p < 1 ? requestAnimationFrame(step) : res();
};
requestAnimationFrame(step);
}),
anim: (el, kf, o) => el.animate(kf, { ...o, duration: o.duration / speed, delay: (o.delay || 0) / speed })
.finished.then(check, () => { throw ABORT; }),
type: (el, t, o) => typeInto(c, el, t, o),
};
return c;
};
async function run(once) {
const g = ++st.gen;
try {
do {
if (!st.visible) await new Promise((r) => st.waiters.push(r));
if (g !== st.gen) return;
setup(stage, mk(g));
stage.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 220 / speed });
await play(stage, mk(g));
} while (!once);
} catch (e) { if (e !== ABORT) console.error(e); }
}
new IntersectionObserver(([e]) => {
st.visible = e.isIntersecting;
if (st.visible) st.waiters.splice(0).forEach((r) => r());
}, { threshold: 0.12 }).observe(stage);
root.querySelector(".replay").addEventListener("click", () => run(REDUCE));
scenes[id] = { stop: () => { st.gen++; }, ctx: () => mk(st.gen) };
setup(stage, mk(st.gen));
if (!REDUCE) run(false);
}
const fadeOut = async (stage, c) => {
await c.anim(stage, [{ opacity: 1 }, { opacity: 0 }], { duration: 260, fill: "forwards" });
stage.getAnimations().forEach((a) => a.cancel());
};
// ── the two beats: make room (everything below glides down), then enter from an edge ──
// `sync` runs both together — a drawer coming down from the top of the screen.
async function enter(c, parent, html, { ref = null, from = "top", room = 240, dur = 380, mb = 0, sync = false, before } = {}) {
const w = document.createElement("div");
w.innerHTML = html;
parent.insertBefore(w, ref);
before?.(w);
const el = w.firstElementChild;
const h = w.offsetHeight;
const start = from === "left" ? "translateX(-115%)" : sync ? "translateY(-105%)" : from === "top" ? "translateY(-14px)" : "none";
const op = from === "left" || sync ? "1" : "0";
w.style.overflowY = "clip";
w.style.marginBottom = mb + "px";
el.style.transform = start;
el.style.opacity = op;
const grow = c.anim(w, [{ height: "0px", marginBottom: "0px" }, { height: h + "px", marginBottom: mb + "px" }], { duration: room, easing: OUT });
if (!sync) await grow;
el.style.transform = "";
el.style.opacity = "";
const go = c.anim(el, [{ transform: start, opacity: op }, { transform: "none", opacity: 1 }], { duration: dur, easing: from === "left" ? SPRING : OUT });
await Promise.all([grow, go]);
w.style.overflowY = "";
return w;
}
// the reverse: leave by an edge, then close the gap
async function leave(c, w, { to = "right", dur = 380, close = 280 } = {}) {
const el = w.firstElementChild || w;
const end = to === "right" ? "translateX(115%)" : to === "left" ? "translateX(-115%)" : "translateY(-105%)";
if (to === "up") w.style.overflowY = "clip";
await c.anim(el, [{ transform: "none", opacity: 1 }, { transform: end, opacity: to === "up" ? 1 : 0.2 }], { duration: dur, easing: IN, fill: "forwards" });
const h = w.offsetHeight, mb = getComputedStyle(w).marginBottom;
w.style.overflow = "hidden";
await c.anim(w, [{ height: h + "px", marginBottom: mb }, { height: "0px", marginBottom: "0px" }], { duration: close, easing: OUT, fill: "forwards" });
w.remove();
}
// pills: A pop (the default), B slide, C unroll
const PILL_KF = {
pop: { kf: [{ transform: "scale(.4)", opacity: 0 }, { transform: "scale(1.08)", opacity: 1, offset: 0.6 }, { transform: "scale(1)", opacity: 1 }], ms: 320, gap: 90, easing: "ease-out" },
slide: { kf: [{ transform: "translateX(-10px)", opacity: 0 }, { transform: "none", opacity: 1 }], ms: 280, gap: 70, easing: OUT },
unroll: { kf: [{ clipPath: "inset(0 100% 0 0 round 999px)" }, { clipPath: "inset(0 0 0 0 round 999px)" }], ms: 360, gap: 120, easing: OUT },
};
async function pillsIn(c, row, htmls, style = "pop") {
const v = PILL_KF[style];
const jobs = [];
for (const h of htmls) {
row.insertAdjacentHTML("beforeend", h);
const p = row.lastElementChild;
jobs.push(c.anim(p, v.kf, { duration: v.ms, easing: v.easing }));
await c.sleep(v.gap);
}
await Promise.all(jobs);
}
// ── shared app pieces ──
const navBar = () => `<div class="m-nav">${ic("grid")}${ic("folder")}<span class="on">${ic("msg")}</span>${ic("folder")}${ic("gear")}</div>`;
const composer = () => `<div class="m-composer"><div class="m-ctext"><span class="tx"></span><span class="ph">Start a new session…</span></div><div class="m-crow">${ic("clip")}<span class="chip">Claude Code</span><span class="chip v">opus</span><span class="send">${ic("send")}</span></div></div>`;
const header = (sub) => `<div class="m-hdr">${ic("bell")}<div class="t"><b>Notifications</b><small class="sub">${sub}</small></div><div class="tools">${ic("gauge")}${ic("msg")}${ic("radio")}</div></div>`;
const screen = (h, inner, cls = "", w = 360) => `<div class="phone ${cls}" style="--h:${h}px;--w:${w}px"><div class="screen">${inner}</div></div>`;
const lead = (icon, state = "run") => `<span class="m-lead"><span class="tile">${ic(icon)}</span><span class="stt">${state === "run" ? ic("loader", "spin") : ic("check")}</span></span>`;
const tagHTML = ([t, k = ""]) => `<span class="m-tag ${k}">${k === "task" ? ic("loader", "spin") : ""}${t}</span>`;
const runCard = (r, { tags = true } = {}) => `<div class="m-run" data-id="${r.id}">${lead(r.icon)}<div class="m-main"><div class="m-title"><span class="tt">${r.title}</span></div><div class="m-tags">${tags ? r.tags.map(tagHTML).join("") : ""}</div></div><div class="m-side"><span class="m-cost roll">€${r.cost.toFixed(2)}</span><span class="m-pct">${r.pct}% wk</span><span class="m-el" data-el="${r.el}">${fmtEl(r.el)}</span></div></div>`;
const notif = (n, g, { unread = true } = {}) => `<div class="m-notif ${unread ? "unread" : ""}"><span class="m-lead"><span class="tile">${ic(g.icon)}<i class="dot"></i></span></span><div class="m-nmain"><div class="m-ntop"><span class="m-type" style="--t:${TYPE[n.type]}">${n.type}</span><span class="m-ago">${n.at}</span></div><div class="m-ntitle">${n.title}</div><div class="m-nbody">${n.body}</div><div class="m-nconv">${ic("msg")}<span>${g.conv}</span></div><div class="m-ndetail"><div class="in"><div>${n.body}</div><div class="m-tags" style="margin:0">${tagHTML(["ai-agent"])}</div><div class="lnk">${ic("link")}ai-agent.lab.gabvdl.xyz</div><div class="foot"><span>${g.conv}</span><span>today 22:31</span></div></div></div></div></div>`;
// usage strip
const USAGE = {
g: [{ label: "5-hour", pct: 23, txt: "23%", sub: "resets in 2h 41m" }, { label: "Week", pct: 6, txt: "6.0%", sub: "resets in 6d 20h" }],
spark: [32, 51, 24, 40, 18, 96, 44],
s: [{ label: "Today", v: "€4.40", sub: "1.2M tokens" }, { label: "7 days", v: "€30.50", sub: "€4.36 / day" }, { label: "Conversations", v: "7", sub: "41 in 7 days" }],
};
const arc = 'd="M 10 50 A 40 40 0 0 1 90 50"';
const gTile = (d) => `<div class="m-tile" data-g><div class="m-g"><svg viewBox="0 0 100 56"><path class="trk" pathLength="100" ${arc}/><path class="val" pathLength="100" ${arc} stroke-dasharray="0 100"/></svg><span class="m-gv v"></span></div><div class="m-tl">${d.label}</div><div class="m-ts v2"></div></div>`;
const spTile = () => `<div class="m-tile" data-sp><div class="m-spark">${"<i></i>".repeat(7)}</div><div class="m-tl">Spend</div><div class="m-ts">last 7 days</div></div>`;
const sTile = (d) => `<div class="m-tile" data-s><div class="m-sv v"></div><div class="m-tl">${d.label}</div><div class="m-ts v2"></div></div>`;
const strip = (full = true) => `<div class="m-usage stale">${full ? gTile(USAGE.g[0]) : ""}${gTile(USAGE.g[1])}${spTile()}${full ? USAGE.s.map(sTile).join("") : ""}</div>`;
async function gaugeIn(t, d, c) {
const val = t.querySelector(".val");
await Promise.all([
c.tween(650, (p) => val.setAttribute("stroke-dasharray", `${(d.pct * p).toFixed(2)} 100`)),
c.type(t.querySelector(".v"), d.txt, { cps: d.txt.length / 0.6 }),
]);
await c.type(t.querySelector(".v2"), d.sub, { cps: 60 });
}
const sparkIn = (sp, c) => Promise.all([...sp.querySelectorAll("i")].map((b, i) =>
c.anim(b, [{ height: USAGE.spark[i] + "%" }], { duration: 520, delay: i * 45, easing: OUT, fill: "forwards" })));
async function loadStrip(el, c) {
el.classList.remove("stale");
const gs = [...el.querySelectorAll("[data-g]")], ss = [...el.querySelectorAll("[data-s]")];
const gData = gs.length === 2 ? USAGE.g : [USAGE.g[1]];
const jobs = gs.map((t, i) => c.sleep(i * 120).then(() => gaugeIn(t, gData[i], c)));
jobs.push(c.sleep(gs.length * 120).then(() => sparkIn(el.querySelector("[data-sp]"), c)));
ss.forEach((t, i) => jobs.push(c.sleep(360 + i * 120).then(async () => {
await c.type(t.querySelector(".v"), USAGE.s[i].v, { cps: USAGE.s[i].v.length / 0.6 });
await c.type(t.querySelector(".v2"), USAGE.s[i].sub, { cps: 60 });
})));
await Promise.all(jobs);
}
// ── 1 · make room, then enter ─────────────────────────────
const RUNS = [
{ id: "fr", title: "French localization for ai-agent", icon: "bot", cost: 25.89, pct: "≈0.6", el: 1645, tags: [["Translate conversation thread…", "task"], ["+5 more", "more"]] },
{ id: "guest", title: "Guest dashboard analytics", icon: "bot", cost: 8.52, pct: "≈0.3", el: 1303, tags: [["ai-agent"], ["guest-dashboard", "v"]] },
{ id: "clar", title: "Clarifier agent gains analysis", icon: "bot", cost: 3.5, pct: "≈0.1", el: 1541, tags: [["ai-agent"], ["clarifier-gains", "v"]] },
];
const PUSH = { type: "Deploy", title: "🔔 PWA pushes now match HA where a browser can", body: "Per-kind icons, images through the app, Buzz / Silent / Off.", at: "15m ago" };
const PUSH_G = { icon: "bot", conv: "Web push ↔ Home Assistant parity" };
const bannerHTML = () => `<div class="m-banner">${ic("laptop")}<span><b>Mac perso</b> is offline — its account's new runs go to the lab.</span>${ic("x")}</div>`;
const waitHTML = (tags) => `<div class="sec" data-k="wait"><div class="m-h2"><span>${ic("help")}Waiting for feedback</span><span class="r">1 to answer</span></div><div class="m-wait"><div class="m-wait-t">${ic("clipboard")}<span>Ta veille pharma : la mise en page</span><span class="ago">3d 4h</span></div><div class="m-wait-b">Deux minutes pour choisir la forme du mail.</div>${tags === "notloaded" ? '<div class="m-wait-tags">conversation not loaded</div>' : tags ? '<div class="m-wait-tags"><span class="m-tag">homelab</span><span class="m-tag">mail</span></div>' : ""}<div class="m-wait-row"><span class="m-btn">Answer ${ic("up")}</span><span>ask-form</span></div></div></div>`;
const runHead = (n = 3) => `<div class="m-h2"><span>${ic("radio")}Running</span><span class="r"><span class="roll n">${n}</span> active</span></div>`;
const runSec = () => `<div class="sec" data-k="run">${runHead()}<div class="m-runs">${RUNS.map((r) => `<div class="m-runwrap">${runCard(r)}</div>`).join("")}</div></div>`;
const newSec = () => `<div class="sec" data-k="new"><div class="m-h2"><span>New</span><span class="r">tap a stack to open it</span></div>${notif(PUSH, PUSH_G)}</div>`;
scene("no-jump", (stage) => {
const today = `<div class="m-loading">Loading notifications…</div><div class="sec" data-k="banner">${bannerHTML()}</div><div class="sec" data-k="usage">${strip(false)}</div>${waitHTML("notloaded")}${runSec()}${newSec()}`;
const prop = `<div class="sec mb22" data-k="usage">${strip(false)}</div>`;
stage.innerHTML =
`<figure class="dev today">${screen(700, header("notify-done pushes") + `<div class="m-scroll">${today}</div>` + composer() + navBar())}<figcaption>Today <span class="count bad">snaps: <b>0</b></span></figcaption></figure>` +
`<figure class="dev prop">${screen(700, header("") + `<div class="m-scroll flow">${prop}</div>` + composer() + navBar())}<figcaption>Proposed <span class="count good">snaps: 0 · glides: <b>0</b></span></figcaption></figure>`;
stage.querySelectorAll(".today .sec").forEach((s) => { s.hidden = true; });
}, async (stage, c) => {
const T = stage.querySelector(".today"), P = stage.querySelector(".prop");
const sec = (F, k) => F.querySelector(`[data-k="${k}"]`);
const snaps = T.querySelector(".count b"), glides = P.querySelector(".count b");
const glide = () => { glides.textContent = String(+glides.textContent + 1); };
const flag = (el, dy) => {
snaps.textContent = String(+snaps.textContent + 1);
el.classList.add("shifted");
const tag = document.createElement("span");
tag.className = "shift-tag";
tag.textContent = `↓ ${Math.round(dy)} px`;
el.appendChild(tag);
bg(c.sleep(1100).then(() => { el.classList.remove("shifted"); tag.remove(); }));
};
const today = async () => {
await c.sleep(900);
T.querySelector(".m-loading").remove();
["banner", "usage", "run"].forEach((k) => { sec(T, k).hidden = false; });
flag(sec(T, "usage"), 64);
T.querySelector(".sub").textContent = "3 new";
const u = sec(T, "usage").querySelector(".m-usage");
u.classList.remove("stale");
u.querySelector(".val").setAttribute("stroke-dasharray", "6 100");
u.querySelector(".v").textContent = "6.0%";
u.querySelector(".v2").textContent = "resets in 6d 20h";
await c.sleep(1100);
u.querySelectorAll(".m-spark i").forEach((b, i) => { b.style.height = USAGE.spark[i] + "%"; });
await c.sleep(1000);
let y0 = sec(T, "run").offsetTop;
sec(T, "wait").hidden = false;
flag(sec(T, "run"), sec(T, "run").offsetTop - y0);
await c.sleep(900);
y0 = sec(T, "run").offsetTop;
sec(T, "wait").querySelector(".m-wait-tags").innerHTML = '<span class="m-tag">homelab</span><span class="m-tag">mail</span>';
if (sec(T, "run").offsetTop !== y0) flag(sec(T, "run"), sec(T, "run").offsetTop - y0);
await c.sleep(700);
sec(T, "new").hidden = false;
};
const prop = async () => {
const sc = P.querySelector(".m-scroll");
const usage = sec(P, "usage");
await c.sleep(900);
bg(c.type(P.querySelector(".sub"), "3 new", { cps: 20 }));
// conversations + limits land: the worker banner comes down from the top of the screen…
const u = usage.querySelector(".m-usage");
u.classList.remove("stale");
bg(gaugeIn(u.querySelector("[data-g]"), USAGE.g[1], c));
await enter(c, sc, `<div class="sec">${bannerHTML()}</div>`, { ref: usage, sync: true, room: 360, dur: 360, mb: 22 });
glide();
// …then Running: its header, then each card from the left once its room is there
const run = await enter(c, sc, `<div class="sec" data-k="run">${runHead()}<div class="m-runs"></div></div>`, { from: "fade", room: 200, dur: 220, mb: 22 });
glide();
const list = run.querySelector(".m-runs");
for (const r of RUNS) {
bg(enter(c, list, `<div>${runCard(r)}</div>`, { from: "left", room: 220, dur: 480, mb: 8 }));
glide();
await c.sleep(330);
}
// activity lands: the bars grow in place
await c.sleep(300);
await sparkIn(u.querySelector("[data-sp]"), c);
// Waiting for feedback: Running and below glide down first, then it drops in
await c.sleep(380);
const wait = await enter(c, sc, waitHTML(false), { ref: run, from: "top", room: 300, dur: 360, mb: 22 });
glide();
// its conversation resolves: the tag row opens, then the pills pop in
await c.sleep(300);
const card = wait.querySelector(".m-wait");
const row = await enter(c, card, '<div class="m-wait-tags"></div>', { ref: card.querySelector(".m-wait-row"), from: "fade", room: 200, dur: 1 });
glide();
await pillsIn(c, row.firstElementChild, ['<span class="m-tag">homelab</span>', '<span class="m-tag">mail</span>']);
// the New notifications: room, then the card drops in
await c.sleep(300);
await enter(c, sc, newSec(), { from: "top", room: 260, dur: 360, mb: 22 });
glide();
};
await Promise.all([today(), prop()]);
await c.sleep(2600);
await fadeOut(stage, c);
});
// ── 2 · widgets: grey, then typed ─────────────────────────
scene("stale", (stage) => {
stage.innerHTML = `<figure class="dev"><div class="phone" style="--h:236px"><div class="screen" style="padding:18px 14px">${strip()}</div></div><figcaption class="vlabel">Picked<span>just grey, like empty</span></figcaption></figure>`;
}, async (stage, c) => {
await c.sleep(2200);
await loadStrip(stage.querySelector(".m-usage"), c);
await c.sleep(3200);
await fadeOut(stage, c);
});
// ── 3 · notification stacks ───────────────────────────────
const N = (type, title, body, at) => ({ type, title, body, at });
const GROUPS = () => [
{ id: "push", conv: "Web push ↔ Home Assistant parity", icon: "bot", items: [N("Deploy", "🔔 PWA pushes now match HA where a browser can", "Per-kind icons, images through the app, Buzz / Silent / Off.", "15m ago")] },
{ id: "guest", conv: "Guest dashboard analytics", icon: "bot", items: [N("AI", "📋 Guest dashboard — a few choices", "Choices for the guests' own Stats dashboard.", "16m ago"), N("Code", "Stats endpoint scoped per guest", "Each guest sees only their own runs.", "52m ago")] },
{ id: "fr", conv: "French localization for ai-agent", icon: "bot", items: [N("AI", "📋 Guest French localization", "Scope, language choice, backend strings and more.", "23m ago"), N("Code", "Conversation lists translated", "312 strings moved to fr.json.", "41m ago"), N("Build", "Build green on main", "vite build in 41 s.", "58m ago")] },
{ id: "cron", conv: "Lean cron runs", icon: "home", items: [N("AI", "✅ Crons : lean + Qwen 3.8 en local", "Les crons quotidiens tournent en mode lean.", "33m ago")] },
];
const FR_NEW = N("Deploy", "🚀 French UI deployed", "Composer, shell and conversation lists now speak French for guests.", "now");
const HOME_G = { id: "home", conv: "Homepage improvements for ai-agent", icon: "home", items: [N("AI", "📋 Home page motion — your picks", "Round 2 of the mockups is ready.", "now")] };
const PEEK = 7, GAP = 8, HEAD = 32;
const stackHTML = (g) => `<div class="st" data-id="${g.id}"><div class="st-cards"><div class="st-head"><span class="conv">${ic("msg")}<span>${g.conv}</span></span><button class="st-col" type="button">${ic("chev")}Collapse</button></div>${g.items.map((n, i) => `<div class="st-card">${notif(n, g, { unread: i === 0 })}</div>`).join("")}</div><span class="st-badge"></span></div>`;
function layoutStack(st, open, ms = 0) {
const cards = [...st.querySelectorAll(".st-card")];
const hs = cards.map((el) => el.firstElementChild.offsetHeight);
const n = cards.length;
const fan = open && n > 1;
const t = ms ? `transform ${ms / speed}ms ${SPRING}, height ${ms / speed}ms ${OUT}, opacity ${(ms * 0.5) / speed}ms ease` : "none";
let y = fan ? HEAD : 0;
cards.forEach((el, i) => {
el.style.transition = t;
el.style.transitionDelay = ms && fan && !st.classList.contains("open") ? `${(i * 40) / speed}ms` : "0ms";
el.style.zIndex = String(n - i);
if (fan || n === 1) {
el.style.height = hs[i] + "px";
el.style.transform = `translateY(${y}px)`;
el.style.opacity = "1";
el.classList.remove("sheet");
y += hs[i] + GAP;
} else {
const k = Math.min(i, 3);
el.style.height = hs[0] + "px";
el.style.transform = `translateY(${k * PEEK}px) scale(${1 - k * 0.045})`;
el.style.opacity = i > 2 ? "0" : "1";
el.classList.toggle("sheet", i > 0);
}
});
const box = st.querySelector(".st-cards");
box.style.transition = ms ? `height ${ms / speed}ms ${OUT}` : "none";
box.style.height = (fan || n === 1 ? y - GAP : hs[0] + Math.min(n - 1, 2) * PEEK) + "px";
st.classList.toggle("open", fan);
st.classList.toggle("multi", n > 1);
st.querySelector(".st-badge").textContent = String(n);
}
// open / close one card: its detail glides to its height, the stack re-lays out around it
function toggleCard(st, card, open, ms = 420) {
const det = card.querySelector(".m-ndetail");
const from = det.offsetHeight;
det.style.transition = "none";
det.style.height = open ? "auto" : "0px";
const to = det.offsetHeight;
layoutStack(st, st.classList.contains("open"), ms);
det.style.height = from + "px";
det.getBoundingClientRect();
det.style.transition = `height ${ms / speed}ms ${OUT}`;
det.style.height = to + "px";
card.classList.toggle("opened", open);
if (open) card.classList.remove("unread");
}
function flipList(list, mutate, ms) {
const s = scaleOf(list);
const before = new Map([...list.children].map((k) => [k, k.getBoundingClientRect().top]));
mutate();
const anims = [];
for (const k of list.children) {
const a = before.get(k);
if (a == null) continue;
const dy = (a - k.getBoundingClientRect().top) / s;
if (Math.abs(dy) > 0.5) anims.push(k.animate([{ transform: `translateY(${dy}px)` }, { transform: "none" }], { duration: ms / speed, easing: OUT }).finished);
}
return Promise.all(anims);
}
async function dismiss(el, c, dir = 1) {
await c.anim(el, [{ transform: "translateX(0)", opacity: 1 }, { transform: `translateX(${dir * 115}%)`, opacity: 0 }], { duration: 300, easing: IN, fill: "forwards" });
const h = el.offsetHeight, mb = getComputedStyle(el).marginBottom;
el.style.overflow = "hidden";
await c.anim(el, [{ height: h + "px", marginBottom: mb }, { height: "0px", marginBottom: "0px" }], { duration: 280, easing: OUT, fill: "forwards" });
el.remove();
}
async function tapAt(scr, el, c, fx = 0.62) {
const sr = scr.getBoundingClientRect(), r = el.getBoundingClientRect(), s = scaleOf(scr);
const f = document.createElement("i");
f.className = "finger";
f.style.left = (r.left - sr.left + r.width * fx) / s + "px";
f.style.top = (r.top - sr.top + Math.min(r.height * 0.5, 36)) / s + "px";
scr.appendChild(f);
await c.anim(f, [{ opacity: 0, transform: "translate(-50%,-50%) scale(1.7)" }, { opacity: 0.9, transform: "translate(-50%,-50%) scale(1)" }], { duration: 240, easing: OUT, fill: "forwards" });
return f;
}
async function lift(f, c) {
await c.anim(f, [{ opacity: 0.9, transform: "translate(-50%,-50%) scale(1)" }, { opacity: 0, transform: "translate(-50%,-50%) scale(1.4)" }], { duration: 240, fill: "forwards" });
f.remove();
}
const swipeFinger = (c, f, dx = 190) => c.anim(f, [{ transform: "translate(-50%,-50%)", opacity: 0.9 }, { transform: `translate(calc(-50% + ${dx}px),-50%)`, opacity: 0 }], { duration: 300, easing: IN, fill: "forwards" });
function arriveOnStack(st, n, g) {
const box = st.querySelector(".st-cards");
const el = document.createElement("div");
el.className = "st-card";
el.innerHTML = notif(n, g);
box.insertBefore(el, box.querySelector(".st-card"));
el.style.transition = "none";
el.style.height = el.firstElementChild.offsetHeight + "px";
el.style.transform = "translateY(-22px) scale(1.03)";
el.style.opacity = "0";
el.getBoundingClientRect();
layoutStack(st, st.classList.contains("open"), 520);
}
function bindStacks(stage) {
const list = stage.querySelector(".st-list");
let drag = null;
const takeOver = () => {
scenes.stacks.stop();
if (!stage.querySelector(".hint")) stage.insertAdjacentHTML("beforeend", '<span class="hint">you\'re driving · Replay restarts the demo</span>');
};
list.addEventListener("pointerdown", (e) => {
const st = e.target.closest(".st");
if (!st || e.target.closest(".st-col")) return;
drag = { st, x: e.clientX, dx: 0, moved: false, s: scaleOf(list) };
});
list.addEventListener("pointermove", (e) => {
if (!drag) return;
drag.dx = (e.clientX - drag.x) / drag.s;
if (Math.abs(drag.dx) > 8) { drag.moved = true; drag.st.style.transform = `translateX(${drag.dx}px)`; drag.st.style.opacity = String(Math.max(0.35, 1 - Math.abs(drag.dx) / 300)); }
});
const end = () => {
if (!drag) return;
const { st, dx, moved } = drag;
drag = null;
if (!moved) return;
takeOver();
st.dataset.dragged = "1";
st.style.transform = ""; st.style.opacity = "";
if (Math.abs(dx) > 90) bg(dismiss(st, scenes.stacks.ctx(), dx > 0 ? 1 : -1));
else st.animate([{ transform: `translateX(${dx}px)` }, { transform: "none" }], { duration: 260 / speed, easing: OUT });
};
list.addEventListener("pointerup", end);
list.addEventListener("pointercancel", end);
list.addEventListener("click", (e) => {
const st = e.target.closest(".st");
if (!st) return;
if (st.dataset.dragged) { delete st.dataset.dragged; return; }
takeOver();
const multi = st.querySelectorAll(".st-card").length > 1;
if (e.target.closest(".st-col")) {
st.querySelectorAll(".m-notif.opened").forEach((n) => toggleCard(st, n, false, 1));
layoutStack(st, false, 480);
} else if (multi && !st.classList.contains("open")) layoutStack(st, true, 560);
else {
const card = e.target.closest(".m-notif");
if (card) toggleCard(st, card, !card.classList.contains("opened"));
}
});
}
scene("stacks", (stage) => {
stage.innerHTML = `<figure class="dev">${screen(760, header("5 new") + `<div class="m-scroll"><div><div class="m-h2"><span>New</span><span class="r">tap a stack · swipe to dismiss</span></div><div class="st-list">${GROUPS().map(stackHTML).join("")}</div></div></div>` + navBar())}<figcaption>Pixel 9 · New feed, grouped</figcaption></figure>`;
stage.querySelectorAll(".st").forEach((st) => layoutStack(st, false, 0));
bindStacks(stage);
}, async (stage, c) => {
const scr = stage.querySelector(".screen"), list = stage.querySelector(".st-list");
const fr = list.querySelector('[data-id="fr"]');
await c.sleep(1300);
// the stack goes to the top first, then the push lands on it
await flipList(list, () => list.prepend(fr), 520);
arriveOnStack(fr, FR_NEW, GROUPS()[2]);
bg(c.type(scr.querySelector(".sub"), "6 new", { cps: 20 }));
await c.sleep(1500);
let f = await tapAt(scr, fr, c);
layoutStack(fr, true, 560);
await lift(f, c);
await c.sleep(1300);
// open one card smoothly, then close it
const second = fr.querySelectorAll(".st-card")[1].firstElementChild;
f = await tapAt(scr, second, c, 0.5);
toggleCard(fr, second, true);
await lift(f, c);
await c.sleep(2000);
f = await tapAt(scr, second, c, 0.5);
toggleCard(fr, second, false);
await lift(f, c);
await c.sleep(900);
f = await tapAt(scr, fr.querySelector(".st-col"), c, 0.5);
layoutStack(fr, false, 480);
await lift(f, c);
await c.sleep(1000);
const cron = list.querySelector('[data-id="cron"]');
f = await tapAt(scr, cron, c, 0.3);
await Promise.all([dismiss(cron, c), swipeFinger(c, f)]);
f.remove();
await c.sleep(900);
// a push from a conversation with no stack yet: the list makes room, then it drops in
const wrap = document.createElement("div");
wrap.innerHTML = stackHTML(HOME_G);
const st = wrap.firstElementChild;
list.prepend(st);
layoutStack(st, false, 0);
const h = st.offsetHeight;
st.style.overflowY = "clip";
st.querySelector(".st-cards").style.opacity = "0";
await c.anim(st, [{ height: "0px", marginBottom: "0px" }, { height: h + "px", marginBottom: "12px" }], { duration: 280, easing: OUT });
st.querySelector(".st-cards").style.opacity = "";
await c.anim(st.querySelector(".st-cards"), [{ transform: "translateY(-14px)", opacity: 0 }, { transform: "none", opacity: 1 }], { duration: 360, easing: OUT });
st.style.overflowY = "";
bg(c.type(scr.querySelector(".sub"), "6 new", { cps: 20 }));
await c.sleep(2200);
await fadeOut(stage, c);
});
// ── 4 · sync between devices (and the Android push) ───────
const syncCard = (k, n, conv, unread) => `<div class="m-runwrap" data-k="${k}">${notif(n, { icon: "bot", conv }, { unread })}</div>`;
const osn = (k, n) => `<div class="osn" data-k="${k}"><div class="app"><i></i>ai-agent · ${n.at === "now" ? "now" : "15m"}</div><b>${n.title}</b><span class="bd">${n.body}</span></div>`;
scene("sync", (stage) => {
const list = syncCard("pwa", PUSH, PUSH_G.conv, true) + syncCard("guest", N("AI", "📋 Guest dashboard — a few choices", "Choices for the guests' own Stats dashboard.", "16m ago"), "Guest dashboard analytics", false);
const body = () => header("2 new") + `<div class="m-scroll" style="gap:0"><div class="m-h2"><span>New</span><span class="r">synced</span></div><div class="m-runs">${list}</div></div>`;
const phone = `<div class="sbar"><span>22:47</span><i></i></div>` + body() + navBar() +
`<div class="hu">${osn("hu", FR_NEW)}</div>` +
`<div class="shade"><h4>Notifications</h4><div class="shade-list">${osn("pwa", PUSH)}</div></div>`;
stage.innerHTML = `<div class="sync">
<figure class="dev desk">${screen(330, body(), "wide", 560)}<figcaption>${ic("laptop")} Desktop · Chrome</figcaption></figure>
<div class="hub"><div class="wire" data-w="a"><i class="pulse"></i></div><div class="node">${ic("server")}ai-agent hub<small>ledger · SSE<br>→ HA → Android</small></div><div class="wire" data-w="b"><i class="pulse"></i></div></div>
<figure class="dev mob">${screen(600, phone)}<figcaption>Pixel 9 · app + Android shade</figcaption></figure>
</div><ol class="log" aria-live="off"></ol>`;
}, async (stage, c) => {
const D = stage.querySelector(".desk"), M = stage.querySelector(".mob");
const dl = D.querySelector(".m-runs"), ml = M.querySelector(".m-runs");
const mScr = M.querySelector(".screen"), dScr = D.querySelector(".screen");
const hu = M.querySelector(".hu"), shade = M.querySelector(".shade"), shadeList = M.querySelector(".shade-list");
const log = stage.querySelector(".log");
const t0 = performance.now();
const say = (ev, what, kind) => {
const li = document.createElement("li");
li.innerHTML = `<time>+${(((performance.now() - t0) * speed) / 1000).toFixed(1)}s</time>${kind ? `<em class="${kind}">${kind}</em>` : ""}<b>${ev}</b><span>${what}</span>`;
log.appendChild(li);
while (log.children.length > 5) log.firstElementChild.remove();
bg(c.anim(li, [{ opacity: 0, transform: "translateY(6px)" }, { opacity: 1, transform: "none" }], { duration: 260, easing: OUT }));
};
const travel = (w, toHub) => {
const wire = stage.querySelector(`[data-w="${w}"]`), p = wire.querySelector(".pulse");
const horiz = wire.offsetWidth >= wire.offsetHeight;
const len = horiz ? wire.offsetWidth : wire.offsetHeight;
const hubEnd = w === "a" ? len : 0, devEnd = w === "a" ? 0 : len;
const [a, b] = toHub ? [devEnd, hubEnd] : [hubEnd, devEnd];
const tf = (v) => (horiz ? `translateX(${v}px)` : `translateY(${v}px)`);
return c.anim(p, [{ transform: tf(a), opacity: 0 }, { opacity: 1, offset: 0.15 }, { opacity: 1, offset: 0.85 }, { transform: tf(b), opacity: 0 }], { duration: 420, easing: "ease-in-out" });
};
const ping = () => c.anim(stage.querySelector(".node"), [{ boxShadow: "0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent)" }, { boxShadow: "0 0 0 12px transparent" }], { duration: 480 });
const shadeDown = () => c.anim(shade, [{ transform: "translateY(-102%)" }, { transform: "none" }], { duration: 380, easing: OUT, fill: "forwards" });
const shadeUp = () => c.anim(shade, [{ transform: "none" }, { transform: "translateY(-102%)" }], { duration: 300, easing: IN, fill: "forwards" });
const subs = (t) => { D.querySelector(".sub").textContent = M.querySelector(".sub").textContent = t; };
// 1 · a push lands everywhere: both apps (room, then drop-in) and the Android heads-up
await c.sleep(900);
say("notify-done", "“🚀 French UI deployed” recorded by the hub", "today");
await ping();
await Promise.all([travel("a", false), travel("b", false)]);
say("SSE notification", "→ desktop + Pixel 9 app · HA push → Android", "today");
subs("3 new");
shadeList.insertAdjacentHTML("afterbegin", osn("new", FR_NEW));
await Promise.all([
enter(c, dl, syncCard("new", FR_NEW, "French localization for ai-agent", true), { ref: dl.firstElementChild, from: "top", room: 260, dur: 340, mb: 8 }),
enter(c, ml, syncCard("new", FR_NEW, "French localization for ai-agent", true), { ref: ml.firstElementChild, from: "top", room: 260, dur: 340, mb: 8 }),
c.anim(hu, [{ transform: "translateY(-160%)" }, { transform: "none" }], { duration: 380, easing: OUT, fill: "forwards" }),
]);
await c.sleep(1300);
await c.anim(hu, [{ transform: "none" }, { transform: "translateY(-160%)" }], { duration: 300, easing: IN, fill: "forwards" });
await c.sleep(500);
// 2 · the Android push swiped away → gone from both apps
await shadeDown();
await c.sleep(350);
const sn = shadeList.querySelector('[data-k="pwa"]');
let f = await tapAt(mScr, sn, c, 0.3);
await Promise.all([leave(c, sn, { to: "right", dur: 300, close: 240 }), swipeFinger(c, f)]);
f.remove();
await c.sleep(250);
await shadeUp();
say("Android swipe", "HA notification_cleared → POST /notifications/dismissed", "today");
await travel("b", true);
await ping();
await Promise.all([travel("a", false), travel("b", false)]);
say("SSE notif-seen", "both apps drop “PWA pushes…” from New", "today");
dl.querySelector('[data-k="pwa"] .m-notif').insertAdjacentHTML("beforeend", '<span class="seen-tag">swiped on Android</span>');
subs("2 new");
await Promise.all([leave(c, ml.querySelector('[data-k="pwa"]')), c.sleep(500).then(() => leave(c, dl.querySelector('[data-k="pwa"]')))]);
await c.sleep(900);
// 3 · swiped on the desktop → gone from the phone's app (new) and its shade (today)
const dc = dl.querySelector('[data-k="new"]');
f = await tapAt(dScr, dc, c, 0.3);
await Promise.all([leave(c, dc), swipeFinger(c, f)]);
f.remove();
D.querySelector(".sub").textContent = "1 new";
say("POST /notifications/state", "fr-deploy → dismissed (desktop)", "new");
await travel("a", true);
await ping();
await travel("b", false);
say("SSE notif-state", "Pixel 9 app drops it in place", "new");
M.querySelector(".sub").textContent = "1 new";
await leave(c, ml.querySelector('[data-k="new"]'));
say("HA clear_notification", "the Android push leaves the shade", "today");
await shadeDown();
await c.sleep(300);
const sn2 = shadeList.querySelector('[data-k="new"]');
sn2.querySelector(".app").insertAdjacentHTML("beforeend", '<span class="gone-tag">cleared by the hub</span>');
await c.sleep(500);
await leave(c, sn2, { to: "up", dur: 260, close: 220 });
await c.sleep(400);
await shadeUp();
await c.sleep(2400);
await fadeOut(stage, c);
});
// ── 5 · running cards in / out ────────────────────────────
const RUN_ORDER = () => [RUNS[1], RUNS[2], RUNS[0]].map((r) => ({ ...r }));
const HOME_RUN = { id: "home", title: "Homepage improvements for ai-agent", icon: "home", cost: 0.04, pct: "<0.1", el: 0, tags: [["homelab"], ["ai-agent"], ["home-motion", "v"]] };
async function roll(el, text, c) {
await c.anim(el, [{ transform: "none", opacity: 1 }, { transform: "translateY(-60%)", opacity: 0 }], { duration: 140, easing: IN });
el.textContent = text;
await c.anim(el, [{ transform: "translateY(60%)", opacity: 0 }, { transform: "none", opacity: 1 }], { duration: 200, easing: OUT });
}
async function arriveRun(c, list, r) {
// measure the card as it will finish (full title, pills), then reserve that
const probe = document.createElement("div");
probe.innerHTML = runCard(r);
probe.style.cssText = "position:absolute;visibility:hidden;left:0;right:0";
list.appendChild(probe);
const titleH = probe.querySelector(".m-title").offsetHeight;
probe.remove();
const w = await enter(c, list, `<div>${runCard({ ...r, title: "" }, { tags: false })}</div>`, {
ref: list.firstElementChild, from: "left", room: 300, dur: 520, mb: 8,
before: (el) => { el.querySelector(".m-title").style.minHeight = titleH + "px"; },
});
const run = w.querySelector(".m-run");
await c.type(run.querySelector(".tt"), r.title, { cps: 34 });
await pillsIn(c, run.querySelector(".m-tags"), r.tags.map(tagHTML));
return w;
}
async function finishRun(c, w) {
const run = w.querySelector(".m-run");
run.classList.add("done");
run.querySelector(".stt").innerHTML = ic("check");
await pillsIn(c, run.querySelector(".m-tags"), ['<span class="m-tag ok">done</span>']);
await c.anim(run, [{ boxShadow: "0 0 0 0 color-mix(in srgb, var(--emerald) 55%, transparent)" }, { boxShadow: "0 0 0 10px transparent" }], { duration: 700, easing: "ease-out" });
await c.sleep(500);
await leave(c, w, { to: "right", dur: 420, close: 300 });
}
const ticker = (root, c) => bg((async () => {
for (;;) {
await c.sleep(1000);
root.querySelectorAll(".m-run:not(.done) .m-el").forEach((el) => {
const s = +el.dataset.el + 1;
el.dataset.el = String(s);
el.textContent = fmtEl(s);
});
}
})());
scene("running", (stage) => {
stage.innerHTML = `<figure class="dev">${screen(720, header("1 new") + `<div class="m-scroll"><div class="sec">${runHead()}<div class="m-runs">${RUN_ORDER().map((r) => `<div class="m-runwrap">${runCard(r)}</div>`).join("")}</div></div>${newSec()}</div>` + navBar())}<figcaption>Pixel 9 · Running rail, newest on top</figcaption></figure>`;
}, async (stage, c) => {
const list = stage.querySelector(".m-runs"), n = stage.querySelector(".n");
ticker(stage, c);
await c.sleep(1200);
bg(roll(n, "4", c));
await arriveRun(c, list, { ...HOME_RUN });
await c.sleep(900);
// mid-run: a deploy pill pops onto the French card
await pillsIn(c, list.querySelector('[data-id="fr"] .m-tags'), [tagHTML(["deploying", "task"])]);
await c.sleep(1100);
const clar = list.querySelector('[data-id="clar"]').parentElement;
bg(c.sleep(1600).then(() => roll(n, "3", c)));
await finishRun(c, clar);
await c.sleep(2200);
await fadeOut(stage, c);
});
// ── 6 · pills: three styles ───────────────────────────────
const PILL_V = [["pop", "A · Pop", "used above"], ["slide", "B · Slide", "from the left"], ["unroll", "C · Unroll", "like typing"]];
scene("pills", (stage) => {
stage.innerHTML = `<div class="variants">${PILL_V.map(([k, name, sub]) =>
`<figure class="dev" data-v="${k}"><div class="surface">${runCard(RUNS[0], { tags: false })}</div><figcaption class="vlabel">${name}<span>${sub}</span></figcaption></figure>`).join("")}</div>`;
}, async (stage, c) => {
await c.sleep(700);
await Promise.all([...stage.querySelectorAll("[data-v]")].map((fig) =>
pillsIn(c, fig.querySelector(".m-tags"), [tagHTML(["Translate conversation thread…", "task"]), tagHTML(["ai-agent"]), tagHTML(["2 worktrees", "v"])], fig.dataset.v)));
await c.sleep(2400);
await fadeOut(stage, c);
});
// ── 7 · titles ────────────────────────────────────────────
scene("titles", (stage) => {
const a = { ...HOME_RUN, title: "", tags: [["homelab"]] }, b = { ...RUNS[1] };
stage.innerHTML =
`<figure class="dev">${screen(140, `<div style="padding:14px">${runCard(a)}</div>`)}<figcaption>A new conversation</figcaption></figure>` +
`<figure class="dev">${screen(140, `<div style="padding:14px">${runCard(b)}</div>`)}<figcaption>A retitle</figcaption></figure>`;
stage.querySelectorAll(".m-title").forEach((t) => { t.style.minHeight = "2.6em"; });
}, async (stage, c) => {
const [A, B] = stage.querySelectorAll(".m-run");
const ta = A.querySelector(".tt"), tb = B.querySelector(".tt"), boxA = A.querySelector(".m-title");
const left = async () => {
await c.sleep(500);
boxA.classList.add("prov");
await c.type(ta, "i want to improve the homepage : nothing should jump", { cps: 70 });
await pillsIn(c, A.querySelector(".m-tags"), ['<span class="m-tag naming">naming…</span>']);
await c.sleep(1300);
A.querySelector(".naming").remove();
await c.type(ta, "", { delCps: 140 });
boxA.classList.remove("prov");
await c.type(ta, "Homepage improvements for ai-agent", { cps: 34 });
};
const right = async () => {
await c.sleep(1800);
await c.type(tb, "Guest dashboard · stats per guest", { cps: 34, delCps: 120 });
await c.sleep(2200);
await c.type(tb, "Guest dashboard analytics", { cps: 34, delCps: 120 });
};
await Promise.all([left(), right()]);
await c.sleep(2400);
await fadeOut(stage, c);
});
// ── 8 · the sent card: Pop ────────────────────────────────
const SENT_TEXT = "Keep the usage strip's size while it loads";
const sentCard = () => `<div class="sent"><div class="sent-h"><span class="sh-ic">${ic("loader", "spin")}</span><span class="sh-t">starting session…</span></div><div class="sent-b">${SENT_TEXT}</div><div class="sent-tags"><span>Claude Code</span><span>opus</span></div></div>`;
scene("sent", (stage) => {
const feed = `<div class="m-scroll faint">${RUN_ORDER().slice(0, 2).map((r) => runCard(r)).join("")}</div>`;
stage.innerHTML = `<figure class="dev">${screen(420, feed + composer().replace("m-composer", "m-composer flat"))}<figcaption class="vlabel">C · Pop<span>your pick</span></figcaption></figure>`;
stage.querySelector(".m-composer").insertAdjacentHTML("beforeend", '<i class="undo"></i>');
}, async (stage, c) => {
const scr = stage.querySelector(".screen"), comp = stage.querySelector(".m-composer");
const tx = comp.querySelector(".tx"), send = comp.querySelector(".send"), undo = comp.querySelector(".undo");
const ctext = comp.querySelector(".m-ctext");
await c.sleep(500);
await c.type(tx, SENT_TEXT, { cps: 38 });
send.classList.add("armed");
await c.sleep(350);
await c.anim(send, [{ transform: "scale(1)" }, { transform: "scale(.82)" }, { transform: "scale(1)" }], { duration: 220 });
// the un-send window: the composer's own lock, as today
ctext.style.opacity = ".55";
await c.anim(undo, [{ transform: "scaleX(1)" }, { transform: "scaleX(0)" }], { duration: 1300, easing: "linear" });
const slot = document.createElement("div");
slot.className = "sent-slot";
slot.style.bottom = comp.offsetHeight + 12 + 8 + "px";
slot.innerHTML = sentCard();
scr.appendChild(slot);
const card = slot.firstElementChild;
send.classList.remove("armed");
card.style.transformOrigin = "100% 100%";
tx.textContent = "";
ctext.style.opacity = "";
await c.anim(card, [{ transform: "scale(.4)", opacity: 0 }, { transform: "scale(1)", opacity: 1 }], { duration: 420, easing: SPRING });
await c.sleep(1400);
card.querySelector(".sh-ic").innerHTML = ic("up");
await Promise.all([
c.type(card.querySelector(".sh-t"), "session ready — tap to open", { cps: 48, delCps: 140 }),
c.anim(card, [{ boxShadow: "0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent)" }, { boxShadow: "0 0 0 9px transparent" }], { duration: 650, easing: "ease-out" }),
]);
await c.sleep(1800);
await c.anim(card, [{ transform: "none", opacity: 1 }, { transform: "translateX(115%)", opacity: 0 }], { duration: 360, easing: IN, fill: "forwards" });
slot.remove();
await c.sleep(900);
await fadeOut(stage, c);
});
// ── speed switch ──
document.querySelectorAll(".speed button").forEach((b) => b.addEventListener("click", () => {
speed = +b.dataset.speed;
document.querySelectorAll(".speed button").forEach((x) => x.setAttribute("aria-pressed", String(x === b)));
}));
})();
</script>