/* The guide animations (_use_case_demo.html, use-case-demo.js).
 *
 * The stage draws a browser window in em. Its font size follows the stage
 * width, so the whole drawing scales together; a narrow stage gets a taller
 * window and a larger em so its text stays legible.
 *
 * Motion vocabulary. Each element names when it happens in its scene:
 *   .demo-in    appears at --at and stays (resting style: shown)
 *   .demo-out   disappears at --at       (resting style: hidden)
 *   .demo-show  shows from --in to --out (resting style: hidden)
 *   .demo-then  appears at --at for the rest of the scene (resting: hidden)
 *   .demo-fade  fades in at --at and stays (resting style: shown)
 *   .demo-tap   a pointer glides in and presses at --at
 *   .demo-type  text is typed from --at, one character (--i) at a time;
 *               .is-fast types at AI speed
 *   .demo-grow  fills from the left at --at over --dur
 * A scene's animations restart whenever the scene is shown again. The resting
 * style is the finished state, which is what reduced motion shows.
 */

.use-case-demo { margin: 0; }
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 10px; }
.demo-toggle { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; margin-right: -7px; padding: 0; border: 0; background: transparent; color: var(--sig); cursor: pointer; }
.demo-toggle[hidden] { display: none; }
.demo-toggle > span { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line-2); border-radius: var(--radius-round); transition: border-color var(--duration-short) var(--ease-out), background var(--duration-short) var(--ease-out); }
.demo-toggle:hover > span { border-color: var(--fg-3); background: var(--bg-3); }
.demo-toggle[data-state="playing"] .play, .demo-toggle:not([data-state="playing"]) .pause { display: none; }
.demo-toggle:focus-visible { outline: 3px solid var(--sig); outline-offset: 2px; border-radius: var(--radius-round); }

.demo-stage { container-type: inline-size; }
.demo-window {
  --app-bg: oklch(98.5% 0.003 265);
  --app-side: oklch(96% 0.006 265);
  --app-line: oklch(90% 0.008 265);
  --app-fg: oklch(27% 0.02 265);
  --app-fg-2: oklch(52% 0.015 265);
  --app-accent: oklch(55% 0.17 262);
  position: relative;
  aspect-ratio: 16 / 9.5;
  overflow: hidden;
  font-size: clamp(8px, 1.9cqi, 19px);
  line-height: 1.35;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-panel);
  background: var(--bg-2);
  box-shadow: var(--shadow-md);
  user-select: none;
}
@container (max-width: 560px) {
  .demo-window { aspect-ratio: 4 / 3.6; font-size: 2.4cqi; }
}
.demo-window img { display: block; }
.demo-window small { font-size: 0.72em; }
.demo-window b { font-weight: 800; }

.demo-scene { position: absolute; inset: 0; display: flex; flex-direction: column; animation: demo-scene 0.35s var(--ease-out) both; }
.demo-scene[hidden] { display: none; }
@keyframes demo-scene { from { opacity: 0; } }

/* ---------- browser chrome ---------- */
.demo-bar { position: relative; z-index: 3; display: flex; align-items: center; gap: 0.9em; flex: none; height: 2.7em; padding: 0 0.8em 0 1em; background: var(--bg-3); border-bottom: 1px solid var(--line); }
.demo-dots { display: flex; gap: 0.4em; }
.demo-dots i { width: 0.62em; height: 0.62em; border-radius: 50%; background: var(--line-2); }
.demo-url { flex: 1; min-width: 0; max-width: 28em; overflow: hidden; padding: 0.3em 1em; border-radius: var(--radius-round); background: var(--bg); color: var(--fg-2); font-family: var(--font-mono); font-size: 0.74em; white-space: nowrap; text-overflow: ellipsis; }
.demo-ext { display: flex; align-items: center; gap: 0.35em; margin-left: auto; }
.demo-ext-icon { position: relative; display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 0.45em; color: var(--fg-2); }
.demo-ext-icon img { width: 1.25em; height: 1.25em; border-radius: 0.28em; }
.demo-ext-icon svg { width: 1.15em; height: 1.15em; }
.demo-rec { position: absolute; right: 0.12em; bottom: 0.12em; width: 0.62em; height: 0.62em; border: 0.12em solid var(--bg-3); border-radius: 50%; background: var(--danger); }
.demo-ring { position: absolute; inset: -0.2em; border: 0.14em solid var(--sig); border-radius: 0.6em; opacity: 0; animation: demo-ring 1.2s var(--ease-out) var(--at) 2; }
@keyframes demo-ring { 0% { opacity: 0.9; transform: scale(0.8); } 100% { opacity: 0; transform: scale(1.5); } }

/* ---------- motion vocabulary ---------- */
.demo-in { animation: demo-in 0.34s var(--ease-out) var(--at) backwards; }
@keyframes demo-in { from { opacity: 0; transform: translateY(0.4em); } }
.demo-pop { animation-name: demo-pop; animation-duration: 0.42s; }
@keyframes demo-pop { 0% { opacity: 0; transform: scale(0.3); } 70% { opacity: 1; transform: scale(1.14); } }
.demo-out { opacity: 0; animation: demo-out 0.18s ease-out var(--at) backwards; }
@keyframes demo-out { from { opacity: 1; } }
.demo-show { visibility: hidden; opacity: 0; animation: demo-show calc(var(--out) - var(--in)) ease-out var(--in); }
@keyframes demo-show {
  0% { visibility: visible; opacity: 0; transform: translateY(-0.4em) scale(0.97); }
  10%, 90% { visibility: visible; opacity: 1; transform: none; }
  100% { visibility: visible; opacity: 0; transform: none; }
}
.demo-type { white-space: nowrap; }
.demo-type > span { animation: demo-char 1ms calc(var(--at) + var(--i) * var(--char, 85ms)) backwards; }
.demo-type.is-fast { --char: 40ms; }
@keyframes demo-char { from, to { opacity: 0; } }
.demo-grow { transform-origin: left center; animation: demo-grow var(--dur, 0.7s) var(--ease-out) var(--at) backwards; }
@keyframes demo-grow { from { transform: scaleX(0); } }
.demo-fade { animation: demo-fade 0.3s var(--ease-out) var(--at) backwards; }
@keyframes demo-fade { from { opacity: 0; } }
.demo-then { opacity: 0; animation: demo-then 0.4s var(--ease-out) var(--at) forwards; }
@keyframes demo-then { to { opacity: 1; } }

/* The pointer's tip is the element's top-left corner; it glides in from
   (--dx, --dy), presses at --at (0.8 s into its own run), then fades. */
.demo-tap {
  position: absolute; z-index: 6; left: var(--x, 58%); top: var(--y, 62%);
  width: 1.35em; height: 1.35em; opacity: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M2.2 1.6v15.3l4.2-3.9 2.7 6 2.6-1.2-2.6-5.9h5.9z' fill='%23fff' stroke='%23111524' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / contain no-repeat;
  filter: drop-shadow(0 0.15em 0.25em oklch(6% 0.02 265 / 0.45));
  animation: demo-tap 1.4s calc(var(--at) - 0.8s) both;
}
.demo-tap::after { content: ""; position: absolute; left: -0.95em; top: -0.95em; width: 1.9em; height: 1.9em; border: 0.16em solid var(--sig); border-radius: 50%; opacity: 0; animation: demo-ripple 0.55s var(--ease-out) var(--at) both; }
@keyframes demo-tap {
  0% { opacity: 0; transform: translate(var(--dx, 2.6em), var(--dy, 2em)); animation-timing-function: var(--ease-out); }
  8% { opacity: 1; }
  50% { transform: none; }
  57% { transform: scale(0.8); }
  64% { transform: none; }
  75% { opacity: 1; }
  86%, 100% { opacity: 0; transform: none; }
}
@keyframes demo-ripple { 0% { opacity: 1; transform: scale(0.3); } 100% { opacity: 0; transform: scale(1.6); } }
.demo-flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; animation: demo-flash 0.45s ease-out var(--at); }
@keyframes demo-flash { 0% { opacity: 0; } 25% { opacity: 0.6; } 100% { opacity: 0; } }

/* ---------- shared pieces ---------- */
.demo-page { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.demo-btn { position: relative; display: inline-grid; place-items: center; min-height: 2.3em; padding: 0 1.1em; border: 1px solid var(--line-2); border-radius: 0.55em; color: var(--fg); font-size: 0.82em; font-weight: 800; white-space: nowrap; }
.demo-btn > span { grid-area: 1 / 1; }
.demo-btn.is-sig { border-color: var(--sig); background: var(--sig); color: var(--bg); }

/* ---------- 01 install ---------- */
.demo-site { display: flex; flex-direction: column; justify-content: center; padding: 2em 2.6em 2.6em; background: var(--bg); }
.demo-kicker { color: var(--sig); font-family: var(--font-mono); font-size: 0.72em; font-weight: 700; letter-spacing: 0.08em; }
.demo-title { margin-top: 0.3em; font-family: var(--font-display); font-size: 1.9em; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.demo-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1em; margin-top: 1.6em; max-width: 40em; }
.demo-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3em; padding: 1.2em; border: 1px solid var(--line); border-radius: 0.8em; background: var(--bg-2); }
.demo-card b { font-size: 1.15em; }
.demo-card small { color: var(--fg-2); }
.demo-card .demo-btn { margin-top: 0.9em; }
.demo-card-icon { width: 1.9em; height: 1.9em; margin-bottom: 0.3em; color: var(--fg-2); }
.demo-menu { position: absolute; z-index: 5; top: 3em; right: 0.6em; width: 15em; padding: 0.7em; border: 1px solid var(--line-2); border-radius: 0.7em; background: var(--bg-4); box-shadow: var(--shadow-md); }
.demo-menu-head { display: block; padding: 0 0.3em 0.5em; color: var(--fg-3); font-size: 0.7em; font-weight: 700; }
.demo-menu-row { display: flex; align-items: center; gap: 0.6em; padding: 0.5em 0.4em; border-radius: 0.45em; background: var(--bg-3); font-size: 0.8em; }
.demo-menu-row img { width: 1.4em; height: 1.4em; border-radius: 0.3em; }
.demo-menu-row b { flex: 1; font-weight: 700; white-space: nowrap; }
.demo-menu-pin { position: relative; display: grid; width: 1.3em; height: 1.3em; color: var(--fg-2); }
.demo-menu-pin svg { grid-area: 1 / 1; width: 100%; height: 100%; }
.demo-menu-pin svg.demo-in { color: var(--sig); }
.demo-callout { position: absolute; z-index: 4; top: 3.35em; right: 3.5em; padding: 0.55em 0.9em; border-radius: 0.55em; background: var(--sig); color: var(--bg); font-size: 0.78em; font-weight: 800; white-space: nowrap; box-shadow: var(--shadow-sm); }
.demo-callout::before { content: ""; position: absolute; top: -0.4em; right: 1.15em; border: 0.45em solid transparent; border-top: 0; border-bottom-color: var(--sig); }

/* ---------- 02 record ---------- */
.demo-popup { position: absolute; z-index: 5; top: 3em; right: 1.2em; display: flex; flex-direction: column; gap: 0.5em; width: 15em; padding: 0.9em; border: 1px solid var(--line-2); border-radius: 0.8em; background: var(--bg-2); box-shadow: var(--shadow-md); }
.demo-popup-head { display: flex; align-items: center; gap: 0.5em; font-size: 0.9em; font-weight: 800; }
.demo-popup-head img { width: 1.3em; height: 1.3em; border-radius: 0.3em; }
.demo-popup small { color: var(--fg-2); }
.demo-popup-btn { position: relative; display: grid; place-items: center; min-height: 2.6em; margin-top: 0.2em; border-radius: 0.55em; background: var(--sig); color: var(--bg); font-size: 0.85em; font-weight: 800; }
.demo-popup-btn.is-stop { background: var(--danger); color: var(--fg); }

.demo-app { display: flex; background: var(--app-bg); color: var(--app-fg); }
.demo-app-nav { display: flex; flex-direction: column; gap: 0.25em; flex: none; width: 11em; padding: 1.1em 0.7em; border-right: 1px solid var(--app-line); background: var(--app-side); }
.demo-app-brand { display: flex; align-items: center; gap: 0.45em; margin-bottom: 0.8em; font-size: 0.78em; white-space: nowrap; }
.demo-app-brand i { width: 1.3em; height: 1.3em; border-radius: 0.35em; background: var(--app-accent); }
.demo-app-link { position: relative; isolation: isolate; padding: 0.45em 0.6em; border-radius: 0.4em; color: var(--app-fg-2); font-size: 0.78em; font-weight: 600; }
.demo-app-on { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: oklch(55% 0.17 262 / 0.12); }
.demo-app-main { position: relative; flex: 1; min-width: 0; }
.demo-app-view { position: absolute; inset: 0; padding: 1.4em 1.6em; }
.demo-app-title { display: block; font-size: 1.15em; }
.demo-app-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8em; margin-top: 1.1em; }
.demo-app-cards span { display: flex; flex-direction: column; gap: 0.45em; padding: 0.8em; border: 1px solid var(--app-line); border-radius: 0.6em; background: #fff; }
.demo-app-cards b { overflow: hidden; font-size: 0.72em; white-space: nowrap; text-overflow: ellipsis; }
.demo-app-cards i { height: 0.4em; border-radius: 0.2em; background: var(--app-line); }
.demo-app-cards i + i { width: 60%; }
.demo-app-row { display: flex; align-items: center; gap: 0.7em; padding: 0.7em 0; border-bottom: 1px solid var(--app-line); font-size: 0.8em; }
.demo-app-row.is-head { justify-content: space-between; padding-top: 0; font-size: 1em; }
.demo-app-row b { font-weight: 700; }
.demo-app-row small { margin-left: auto; color: var(--app-fg-2); font-size: 0.9em; }
.demo-avatar { width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--app-accent); }
.demo-avatar.is-green { background: oklch(62% 0.14 155); }
.demo-avatar.is-orange { background: oklch(70% 0.15 60); }
.demo-avatar.is-violet { background: oklch(60% 0.15 300); }
.demo-app-sub { display: block; margin: 1.6em 0 0.3em; font-size: 0.85em; }
.demo-app-line { flex: 1; max-width: 22em; height: 0.45em; border-radius: 0.2em; background: var(--app-line); }
.demo-app-line.is-short { max-width: 14em; }
.demo-app-btn { position: relative; display: inline-grid; place-items: center; min-height: 2.2em; padding: 0 0.9em; border-radius: 0.5em; background: var(--app-accent); color: #fff; font-size: 0.75em; font-weight: 800; white-space: nowrap; }
.demo-app-modal { position: absolute; z-index: 2; top: 3.6em; left: 50%; display: flex; flex-direction: column; gap: 0.45em; width: min(17em, 80%); margin-left: max(-8.5em, -40%); padding: 1.1em; border-radius: 0.8em; background: #fff; box-shadow: 0 1.2em 2.6em oklch(20% 0.02 265 / 0.28); }
.demo-app-modal b { font-size: 0.95em; }
.demo-app-modal small { margin-top: 0.3em; color: var(--app-fg-2); }
.demo-app-field { padding: 0.5em 0.7em; border: 0.12em solid var(--app-accent); border-radius: 0.45em; font-size: 0.75em; }
.demo-app-modal .demo-app-btn { align-self: flex-end; margin-top: 0.4em; }
.demo-shots { position: absolute; z-index: 4; left: 0; right: 0; bottom: 1em; display: flex; align-items: center; gap: 0.5em; width: max-content; margin: 0 auto; padding: 0.5em 0.9em 0.5em 1.1em; border: 1px solid var(--line-2); border-radius: var(--radius-round); background: var(--bg-2); color: var(--fg); box-shadow: var(--shadow-md); }
.demo-shots-label { margin-right: 0.2em; color: var(--fg-2); font-size: 0.75em; font-weight: 700; }
.demo-shot { display: grid; place-items: end start; width: 2.8em; height: 1.75em; padding: 0.15em 0.3em; border: 1px solid var(--line-2); border-radius: 0.3em; background: linear-gradient(90deg, var(--app-side) 0 28%, var(--app-bg) 28%); color: var(--app-fg); font-family: var(--font-mono); font-size: 0.68em; font-weight: 700; }
.demo-shots-done { margin-left: 0.3em; color: var(--sig); font-size: 0.75em; font-weight: 800; white-space: nowrap; }

/* ---------- 03 studio ---------- */
.demo-studio { display: flex; flex-direction: column; background: var(--bg); }
.demo-studio-top { display: flex; align-items: center; gap: 0.6em; flex: none; height: 2.6em; padding: 0 1em; border-bottom: 1px solid var(--line); font-size: 0.85em; }
.demo-studio-top img { width: 1.3em; height: 1.3em; border-radius: 0.3em; }
.demo-studio-top small { color: var(--fg-3); font-size: 0.85em; }
.demo-studio-share { margin-left: auto; padding: 0.3em 0.9em; border-radius: 0.45em; background: var(--sig); color: var(--bg); font-size: 0.85em; font-weight: 800; }
.demo-studio-body { display: flex; flex: 1; min-height: 0; }
.demo-canvas { display: grid; place-items: center; flex: 1; min-width: 0; padding: 1em 1.2em; background: var(--bg-2); container-type: size; }
/* Fit the shot inside the canvas both ways at its own aspect ratio. */
.demo-canvas .demo-shot-mini { width: min(100cqw, 100cqh * 16 / 9.5); }
.demo-panel { display: grid; grid-template-rows: auto minmax(0, 1fr); flex: none; width: 16em; border-left: 1px solid var(--line); background: var(--bg); }
.demo-tabs { display: flex; border-bottom: 1px solid var(--line); font-size: 0.8em; font-weight: 800; }
.demo-tabs > span { position: relative; flex: 1; padding: 0.75em 0; text-align: center; }
.demo-tab-line { position: absolute; left: 20%; right: 20%; bottom: -1px; height: 0.2em; border-radius: 0.1em; background: var(--sig); }
.demo-tabs .demo-tap { left: 60%; top: 55%; }
.demo-panel-body { grid-area: 2 / 1; display: flex; flex-direction: column; gap: 0.5em; padding: 1em; }
.demo-panel-body > small { color: var(--fg-3); font-weight: 700; }
.demo-field { position: relative; display: grid; align-items: center; min-height: 2.5em; padding: 0.5em 0.7em; border: 1px solid var(--line-2); border-radius: 0.5em; background: var(--bg-2); font-size: 0.78em; }
.demo-field > span { grid-area: 1 / 1; overflow: hidden; }
.demo-field.is-focus { border-color: var(--sig); box-shadow: 0 0 0 0.18em var(--sig-dim); }
.demo-field.is-tall { align-items: start; min-height: 5.2em; line-height: 1.5; }
.demo-placeholder { color: var(--fg-3); }
.demo-slider { position: relative; height: 0.35em; margin: 0.4em 0; border-radius: 0.2em; background: var(--bg-4); }
.demo-slider i { position: absolute; top: 0; bottom: 0; left: 0; width: 55%; border-radius: inherit; background: var(--sig); }
.demo-panel-body .demo-btn { align-self: flex-start; margin-top: 0.4em; }

.demo-shot-mini { position: relative; display: flex; width: 100%; max-width: 36em; aspect-ratio: 16 / 9.5; overflow: hidden; border-radius: 0.5em; background: var(--app-bg); box-shadow: var(--shadow-sm); }
.demo-mini-nav { display: flex; flex-direction: column; gap: 0.6em; flex: none; width: 24%; padding: 1em 0.8em; background: var(--app-side); border-right: 1px solid var(--app-line); }
.demo-mini-nav > i { position: relative; height: 0.6em; border-radius: 0.25em; background: var(--app-line); }
.demo-mini-nav > i:first-child { width: 70%; margin-bottom: 0.5em; background: var(--app-accent); }
.demo-mini-nav > i.is-target { background: oklch(55% 0.17 262 / 0.35); }
.demo-mini-main { display: flex; flex-direction: column; flex: 1; min-width: 0; padding: 1em 1.2em; }
.demo-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5em; }
.demo-mini-head > i:first-child { width: 28%; height: 0.8em; border-radius: 0.3em; background: var(--app-fg); }
.demo-mini-btn { position: relative; width: 4.4em; height: 1.4em; border-radius: 0.35em; background: var(--app-accent); }
.demo-mini-row { display: flex; align-items: center; gap: 0.6em; height: 2.2em; border-bottom: 1px solid var(--app-line); }
.demo-mini-row::before { content: ""; width: 1.1em; height: 1.1em; border-radius: 50%; background: var(--app-accent); }
.demo-mini-row::after { content: ""; width: 32%; height: 0.45em; border-radius: 0.2em; background: var(--app-line); }
.demo-mini-row:nth-child(3)::before { background: oklch(62% 0.14 155); }
.demo-mini-row:nth-child(4)::before { background: oklch(70% 0.15 60); }
/* The click target and its label sit on the element they point at, so they
   stay put however the shot is sized. */
.demo-hotspot { position: absolute; left: 50%; top: 50%; width: 2.4em; height: 2.4em; margin: -1.2em 0 0 -1.2em; border: 0.2em solid var(--sig); border-radius: 50%; box-shadow: 0 0 0 0.35em var(--sig-dim); }
.demo-bubble { position: absolute; z-index: 1; left: calc(100% + 1.6em); top: -1.1em; padding: 0.6em 0.9em; border-radius: 0.55em; background: var(--bg); color: var(--fg); font-size: 0.82em; font-style: normal; font-weight: 800; white-space: nowrap; box-shadow: var(--shadow-sm); }
.demo-mini-btn .demo-bubble { left: auto; right: -0.5em; top: calc(100% + 1.5em); }

.demo-timeline { position: relative; display: flex; flex-direction: column; gap: 0.45em; flex: none; padding: 0.7em 1em 0.8em; border-top: 1px solid var(--line); background: var(--bg-2); }
.demo-track { display: flex; gap: 0.4em; height: 2.1em; }
.demo-clip { display: flex; align-items: center; flex: 1; min-width: 0; overflow: hidden; padding: 0 0.7em; border: 1px solid var(--clip-border); border-radius: 0.45em; background: var(--clip-bg); color: var(--fg-2); font-family: var(--font-mono); font-size: 0.68em; font-weight: 700; white-space: nowrap; }
.demo-clip.is-selected { border-color: var(--clip-border-selected); background: var(--clip-bg-selected); color: var(--fg); }
.demo-wave { display: block; width: 72%; height: 100%; padding: 0.3em 0.6em; border: 1px solid oklch(74% 0.14 232 / 0.6); border-radius: 0.45em; background: oklch(74% 0.14 232 / 0.14); }
.demo-wave svg { display: block; width: 100%; height: 100%; fill: none; stroke: var(--data); stroke-width: 1.6; stroke-linecap: round; }
.demo-playhead { position: absolute; top: 0.35em; bottom: 0.35em; left: 1em; right: 1em; pointer-events: none; animation: demo-sweep 2.4s linear var(--at) both; }
.demo-playhead i { position: absolute; top: 0; bottom: 0; left: -1px; width: var(--playhead-width); background: var(--playhead); }
.demo-playhead i::before { content: ""; position: absolute; top: -0.2em; left: -0.32em; width: 0.7em; height: 0.5em; border-radius: 0.15em; background: var(--playhead); }
@keyframes demo-sweep { from { transform: translateX(0); } to { transform: translateX(72%); } }

/* ---------- 04 share ---------- */
.demo-share { display: flex; align-items: center; justify-content: center; gap: 2em; padding: 1.6em 2em; background: var(--bg); }
.demo-share-card { display: flex; flex-direction: column; gap: 0.6em; flex: 1; max-width: 24em; padding: 1.4em; border: 1px solid var(--line-2); border-radius: 0.9em; background: var(--bg-2); box-shadow: var(--shadow-md); }
.demo-share-title { font-family: var(--font-display); font-size: 1.25em; letter-spacing: -0.02em; }
.demo-share-card > small { margin-top: 0.4em; color: var(--fg-3); font-weight: 700; }
.demo-link-row { display: flex; align-items: center; gap: 0.5em; }
.demo-link { flex: 1; min-width: 0; overflow: hidden; padding: 0.6em 0.8em; border: 1px solid var(--line); border-radius: 0.5em; background: var(--bg); color: var(--fg-2); font-family: var(--font-mono); font-size: 0.72em; white-space: nowrap; text-overflow: ellipsis; }
.demo-share-update { display: flex; align-items: center; flex-wrap: wrap; gap: 0.7em; margin-top: 0.6em; padding-top: 1em; border-top: 1px solid var(--line); }
.demo-share-note { color: var(--sig); font-size: 0.78em; font-weight: 800; white-space: nowrap; }
.demo-viewer { display: flex; flex-direction: column; gap: 0.6em; flex: 1; max-width: 22em; padding: 0.7em; border: 1px solid var(--line-2); border-radius: 0.9em; background: var(--bg-3); box-shadow: var(--shadow-md); }
.demo-viewer-bar { display: flex; align-items: center; gap: 0.6em; overflow: hidden; padding: 0.3em 0.8em; border-radius: var(--radius-round); background: var(--bg); color: var(--fg-2); font-family: var(--font-mono); font-size: 0.66em; white-space: nowrap; }
.demo-viewer-new { margin-left: auto; padding: 0.1em 0.6em; border-radius: var(--radius-round); background: var(--sig); color: var(--bg); font-family: var(--font-body); font-style: normal; font-weight: 800; }
.demo-viewer .demo-shot-mini { max-width: none; font-size: 0.7em; }
.demo-viewer-steps { display: flex; gap: 0.35em; }
.demo-viewer-steps i { flex: 1; height: 0.3em; overflow: hidden; border-radius: 0.15em; background: var(--bg-4); }
.demo-viewer-steps b { display: block; height: 100%; background: var(--sig); }

/* A narrow stage has room for one card, so the viewer drops below it. */
@container (max-width: 560px) {
  .demo-site { padding: 1.8em 1.6em; }
  .demo-app-nav { width: 9.5em; }
  .demo-app-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo-app-cards span:nth-child(3) { display: none; }
  .demo-panel { width: 14em; }
  .demo-share { flex-direction: column; align-items: stretch; gap: 1em; padding: 1.2em 1.4em; }
  .demo-share-card, .demo-viewer { max-width: none; flex: none; }
  .demo-share-card { padding: 1em; gap: 0.45em; }
  .demo-viewer { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .demo-viewer .demo-shot-mini { flex: 1 1 100%; aspect-ratio: 16 / 7; }
}

/* ---------- product photo Shorts ---------- */
/* guide-mug.webp holds three portrait photos side by side. */
.mug-shot { display: block; background: #d3bf9e url("guide-mug.webp") 0 50% / 300% auto no-repeat; }
.mug-shot.is-2 { background-position: 50% 50%; }
.mug-shot.is-3 { background-position: 100% 50%; }
/* A 9:16 frame is a little narrower than one photo, so the sprite fills its
   height and each photo is centred. */
.mug-frame { position: absolute; inset: 0; background: #c9aa87 url("guide-mug.webp") 1.2% 0 / auto 100% no-repeat; }
.mug-frame.is-2 { background-position-x: 50%; }
.mug-frame.is-3 { background-position-x: 98.8%; }
.pp-cap { position: absolute; z-index: 1; inset: auto 0 0; display: grid; padding: 2.4em 0.6em 1.1em; background: linear-gradient(transparent, oklch(16% 0.02 100 / 0.85)); color: #fff; font-size: 9cqi; line-height: 1.25; text-align: center; text-wrap: balance; }
.pp-cap > span { grid-area: 1 / 1; }
.pp-cap .demo-type { white-space: normal; }

.pp-page { background: var(--bg); font-size: 1.08em; }
.pp-col { display: flex; flex-direction: column; gap: 0.55em; min-width: 0; }
.pp-col > small { color: var(--fg-2); }
.pp-step { display: flex; align-items: center; gap: 0.5em; font-size: 0.9em; white-space: nowrap; }
.pp-step i { display: grid; place-items: center; flex: none; width: 1.55em; height: 1.55em; border-radius: 50%; background: var(--bg-4); font-family: var(--font-mono); font-size: 0.8em; font-style: normal; }
.pp-col > .pp-step:not(:first-child) { margin-top: 0.7em; }
.pp-note { display: grid; color: var(--sig); font-weight: 700; }
.pp-note > span { grid-area: 1 / 1; }
.pp-meter { display: block; height: 0.4em; overflow: hidden; border-radius: 0.2em; background: var(--bg-4); }
.pp-meter i { display: block; height: 100%; background: var(--sig); animation-timing-function: linear; }

/* 01 photos, purpose and copy */
.pp-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: center; gap: 2.4em; padding: 1.4em 2.4em; }
.pp-drop { position: relative; display: grid; place-items: center; min-height: 7em; padding: 0.6em; border: 0.12em dashed var(--line-2); border-radius: 0.7em; background: var(--bg-2); }
.pp-drop > * { grid-area: 1 / 1; }
.pp-drop-hint { display: flex; flex-direction: column; align-items: center; gap: 0.5em; color: var(--fg-2); font-size: 0.78em; font-weight: 700; text-align: center; }
.pp-drop-hint svg { width: 2.2em; height: 2.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pp-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5em; width: 100%; }
.pp-thumb { position: relative; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 0.45em; }
.pp-thumb .mug-shot { position: absolute; inset: 0; }
.pp-thumb em { position: absolute; left: 0.4em; top: 0.4em; padding: 0.1em 0.55em; border-radius: var(--radius-round); background: var(--sig); color: var(--bg); font-size: 0.62em; font-style: normal; font-weight: 800; }
.pp-upload { position: absolute; left: 0.5em; right: 0.5em; bottom: 0.5em; height: 0.3em; border-radius: 0.15em; background: #fff; opacity: 0; transform-origin: left center; animation: pp-upload 1s var(--ease-out) var(--at) backwards; }
@keyframes pp-upload { 0% { opacity: 1; transform: scaleX(0); } 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: none; } }
.pp-count { align-self: flex-end; font-family: var(--font-mono); }
.pp-chips { display: flex; gap: 0.45em; }
.pp-chip { position: relative; isolation: isolate; flex: 1 1 auto; padding: 0.6em 0.7em; border: 1px solid var(--line-2); border-radius: 0.55em; color: var(--fg); font-size: 0.74em; font-weight: 700; text-align: center; white-space: nowrap; }
.pp-chip-on { position: absolute; inset: -1px; z-index: -1; border: 0.14em solid var(--sig); border-radius: inherit; background: var(--sig-dim); }
.pp-copy-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6em; }
.pp-ai { position: relative; padding: 0.35em 0.8em; border: 1px solid var(--sig); border-radius: var(--radius-round); color: var(--sig); font-size: 0.72em; font-weight: 800; white-space: nowrap; }
.pp-form .demo-field { min-height: 2.3em; padding-block: 0.4em; }
.pp-shimmer { align-self: stretch; margin-right: 35%; border-radius: 0.3em; overflow: hidden; background: var(--bg-4); }
.pp-shimmer::before, .pp-skeleton::before { content: ""; display: block; height: 100%; background: linear-gradient(100deg, transparent 30%, oklch(100% 0 0 / 0.14) 50%, transparent 70%) 0 0 / 200% 100%; animation: pp-shimmer 1s linear infinite; }
@keyframes pp-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.pp-create { align-self: flex-end; margin-top: 0.5em; }

/* 02 AI builds the scenes */
.pp-run { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); align-items: center; gap: 2.4em; padding: 1.4em 2.4em; }
.pp-run .pp-col { gap: 0.7em; }
.pp-run-head { display: flex; align-items: center; gap: 0.55em; font-size: 0.95em; }
.pp-live { width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--sig); animation: pp-pulse 1.2s ease-in-out infinite; }
@keyframes pp-pulse { 50% { opacity: 0.3; } }
.pp-meter-row { display: flex; align-items: center; gap: 0.8em; }
.pp-meter-row .pp-meter { flex: 1; }
.pp-percent { display: grid; min-width: 2.8em; font-family: var(--font-mono); font-size: 0.78em; font-weight: 700; text-align: right; }
.pp-percent > span { grid-area: 1 / 1; }
.pp-process { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.pp-process li { display: flex; align-items: center; gap: 0.7em; padding: 0.5em 0; border-bottom: 1px solid var(--line); color: var(--fg-2); font-size: 0.8em; font-weight: 700; }
.pp-state { position: relative; flex: none; width: 1.5em; height: 1.5em; border: 0.12em solid var(--line-2); border-radius: 50%; }
.pp-state > i { position: absolute; inset: -0.12em; border-radius: 50%; }
.pp-busy::before { content: ""; position: absolute; inset: 0; border: 0.14em solid transparent; border-top-color: var(--sig); border-radius: 50%; animation: pp-spin 0.8s linear infinite; }
@keyframes pp-spin { to { transform: rotate(1turn); } }
.pp-done { display: grid; place-items: center; background: var(--sig); color: var(--bg); font-style: normal; font-weight: 900; }
.pp-ready { color: var(--sig); font-size: 0.85em; font-weight: 800; }
.pp-run .demo-btn { align-self: flex-start; }
.pp-board-title { font-weight: 700; }
.pp-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7em; }
.pp-card { position: relative; aspect-ratio: 9 / 16; overflow: hidden; border: 1px dashed var(--line-2); border-radius: 0.6em; background: var(--bg-2); container-type: inline-size; }
.pp-card em { position: absolute; z-index: 2; left: 0.5em; top: 0.5em; padding: 0.1em 0.45em; border-radius: 0.3em; background: oklch(16% 0.02 100 / 0.6); color: #fff; font-family: var(--font-mono); font-size: 0.62em; font-style: normal; font-weight: 700; }
.pp-skeleton { position: absolute; inset: 0; background: var(--bg-3); }
.pp-frame { position: absolute; inset: 0; }

/* 03 Studio: caption edit and playback */
.pp-canvas { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5em; }
.pp-preview { position: relative; height: calc(100cqh - 2.2em); aspect-ratio: 9 / 16; overflow: hidden; border-radius: 0.5em; background: #c9aa87; box-shadow: var(--shadow-sm); container-type: inline-size; }
/* Each layer stacks its own caption, so a later scene covers an earlier one. */
.pp-layer { position: absolute; inset: 0; isolation: isolate; }
.pp-kb { animation: pp-kb 5s linear var(--at) both; }
@keyframes pp-kb { from { transform: none; } to { transform: scale(1.12); } }
.pp-controls { display: flex; align-items: center; gap: 0.6em; color: var(--fg-2); font-family: var(--font-mono); font-size: 0.68em; }
.pp-play { position: relative; display: grid; place-items: center; width: 2.2em; height: 2.2em; border-radius: 50%; background: var(--bg-4); color: var(--fg); }
.pp-play svg { grid-area: 1 / 1; width: 1.1em; height: 1.1em; fill: currentColor; }
.pp-focus { position: absolute; inset: -1px; border: 1px solid var(--sig); border-radius: inherit; box-shadow: 0 0 0 0.18em var(--sig-dim); pointer-events: none; }
.pp-clip { gap: 0.6em; padding-left: 0.3em; }
.pp-clip .mug-shot { flex: none; width: 2.6em; height: 2.2em; border-radius: 0.3em; }
.pp-wave { width: 100%; }
.pp-playhead { animation-name: pp-sweep; animation-duration: 6s; }
@keyframes pp-sweep { from { transform: none; } to { transform: translateX(100%); } }
.demo-studio-share { position: relative; }

/* 04 render and download */
.pp-export { display: flex; align-items: center; justify-content: center; gap: 2.6em; flex: 1; min-height: 0; padding: 1.2em 2em; container-type: size; }
.pp-export-card { display: flex; flex-direction: column; gap: 0.7em; flex: 1; max-width: 21em; padding: 1.3em; border: 1px solid var(--line-2); border-radius: 0.9em; background: var(--bg-2); box-shadow: var(--shadow-md); }
.pp-export-title { font-family: var(--font-display); font-size: 1.2em; letter-spacing: -0.02em; }
.pp-format { display: flex; align-items: center; gap: 0.7em; }
.pp-format small { color: var(--fg-2); font-family: var(--font-mono); }
.pp-format .pp-chip { flex: none; }
.pp-export-card .demo-btn { align-self: flex-start; }
.pp-btn-label { display: flex; align-items: center; gap: 0.45em; }
.pp-btn-label svg, .pp-file svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pp-file { display: flex; align-items: center; gap: 0.6em; padding: 0.6em 0.8em; border: 1px solid var(--line); border-radius: 0.55em; background: var(--bg); font-size: 0.8em; }
.pp-file svg { flex: none; color: var(--sig); }
.pp-file small { margin-left: auto; color: var(--fg-3); font-size: 0.85em; white-space: nowrap; }
.pp-phone { flex: none; padding: 0.9em 0.45em; border: 1px solid var(--line-2); border-radius: 1.5em; background: oklch(12% 0.01 265); box-shadow: var(--shadow-md); }
.pp-screen { position: relative; display: block; height: calc(100cqh - 2.2em); aspect-ratio: 9 / 16; overflow: hidden; border-radius: 1em; background: #c9aa87; container-type: inline-size; }
/* The finished Short plays on a loop: three photos, two seconds each. */
.pp-reel { position: absolute; inset: 0; opacity: 0; animation: pp-reel 6s linear infinite; }
.pp-reel:first-child { opacity: 1; }
.pp-reel:nth-child(2) { animation-delay: 2s; }
.pp-reel:nth-child(3) { animation-delay: 4s; }
.pp-reel .mug-frame { animation: pp-reel-kb 6s linear infinite; animation-delay: inherit; }
@keyframes pp-reel { 0% { opacity: 0; } 6%, 33% { opacity: 1; } 40%, 100% { opacity: 0; } }
@keyframes pp-reel-kb { from { transform: none; } 40%, to { transform: scale(1.1); } }
.pp-reel-bar { position: absolute; z-index: 2; left: 0.7em; right: 0.7em; top: 0.7em; height: 0.2em; overflow: hidden; border-radius: 0.1em; background: oklch(100% 0 0 / 0.35); }
.pp-reel-bar i { display: block; height: 100%; background: #fff; transform-origin: left center; animation: pp-reel-bar 6s linear infinite; }
@keyframes pp-reel-bar { from { transform: scaleX(0); } }

@container (max-width: 560px) {
  .pp-page { font-size: 1.2em; }
  .pp-form, .pp-run { gap: 1.2em; padding: 1em 1.2em; }
  .pp-run { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pp-export { gap: 1.2em; padding: 1em 1.2em; }
  .pp-export-card { padding: 1em; gap: 0.55em; }
  .pp-step { font-size: 0.85em; }
}

/* ---------- step list ---------- */
.demo-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0 0; padding: 0; list-style: none; }
.demo-step { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; height: 100%; padding: 0 0 6px; border: 0; background: transparent; color: var(--fg-2); font: inherit; text-align: left; cursor: pointer; }
.demo-step-bar { position: relative; display: block; width: 100%; height: 3px; margin-bottom: 10px; overflow: hidden; border-radius: 2px; background: var(--line); }
.demo-step-bar i { position: absolute; inset: 0; background: var(--sig); transform: scaleX(0); transform-origin: left center; }
.demo-step.is-past .demo-step-bar i { transform: none; background: var(--line-2); }
.use-case-demo[data-state] .demo-step[aria-current="step"] .demo-step-bar i { animation: demo-progress var(--demo-ms) linear both; }
@keyframes demo-progress { from { transform: scaleX(0); } to { transform: none; } }
.demo-step-num { color: var(--fg-3); font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.demo-step-title { color: var(--fg-2); font-size: 16px; font-weight: 800; line-height: 1.35; }
.demo-caption { margin-top: 12px; min-height: 1.6em; color: var(--fg); line-height: 1.6; }
.use-case-demo[data-state] .demo-step-text { display: none; }
.demo-step-text { font-size: 14px; line-height: 1.6; }
.demo-step[aria-current="step"] .demo-step-num { color: var(--sig); }
.demo-step[aria-current="step"] .demo-step-title { color: var(--fg); }
.demo-step:hover .demo-step-title { color: var(--fg); }
.demo-step:focus-visible { outline: 3px solid var(--sig); outline-offset: 4px; border-radius: 4px; }

@media (max-width: 760px) {
  .demo-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
}

/* Paused: every animation in the figure holds where it is, including the
   step bar whose end advances to the next step. */
.use-case-demo[data-state="paused"] *,
.use-case-demo[data-state="paused"] *::before,
.use-case-demo[data-state="paused"] *::after { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .demo-window *, .demo-window *::before, .demo-window *::after { animation: none !important; }
}
