/* Hands-on task demo (I1): templates/_demo.html + static/demo.js. Light only, self-contained, class prefix "demo-".
   Sizing: the root is a size container, so it adapts to wherever it sits (hero frame, tour tab, phone).
   Override the list height with  .your-wrap .demo { --demo-list-h: 300px; }  (fixed so the page never shifts). */

.demo {
  --demo-ink: var(--ink, #0a0f1c);
  --demo-ink-2: var(--ink-2, #3b4256);
  --demo-ink-3: var(--ink-3, #5c637a);
  --demo-line: var(--line, rgba(70, 45, 10, .10));
  --demo-line-2: var(--line-2, rgba(70, 45, 10, .17));
  --demo-soft: #f8f4ec;
  --demo-ok: #0e9f6e;            /* tick fill: 3.4:1 on white (non-text contrast) */
  --demo-ok-ink: #047857;
  --demo-ring: #7a8094;          /* empty tick outline: 3.9:1 on white */
  --demo-me: #5b3df5;
  --demo-priya: #c2410c;
  --demo-liam: #047857;
  --demo-focus: var(--focus, #2563eb);
  --demo-list-h: 324px;
  container: demo / inline-size;
  width: 100%;                   /* a size container has no intrinsic width: never let a flex/grid parent shrink it to 0 */
  min-width: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  text-align: left;
  color: var(--demo-ink);
  font-family: var(--f-body, "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
  font-size: 15px;
  line-height: 1.4;
  background: #fff;
  border: 1px solid var(--demo-line);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(70, 45, 10, .05), 0 24px 48px -26px rgba(214, 51, 122, .30), 0 12px 24px -16px rgba(255, 138, 0, .22);
}
.demo--bare { border: 0; border-radius: 0; box-shadow: none; }
.demo *, .demo *::before, .demo *::after { box-sizing: border-box; }
.demo p { margin: 0; }
.demo-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.demo-js { visibility: hidden; }
.demo.is-on .demo-js { visibility: visible; }

.demo-stage { position: relative; padding: 18px 18px 12px; }

/* ---------- header: project + presence ---------- */
.demo-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.demo-proj { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #5b3df5, #b4236a); box-shadow: 0 8px 18px -10px rgba(91, 61, 245, .7); }
.demo-head-text { min-width: 0; flex: 1; }
.demo-crumb { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--demo-ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-title { font-family: var(--f-display, inherit); font-size: 1.2rem; font-weight: 720; letter-spacing: -.01em; line-height: 1.2; }

.demo-presence { flex: none; display: flex; align-items: center; gap: 10px; }
.demo-live { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650; color: var(--demo-ok-ink); background: rgba(18, 184, 134, .12); }
/* the pulse is a scaled pseudo-element (transform + opacity only), so it runs on the compositor with no style
   recalcs at idle; it stops until demo.js has started the demo (.is-on) */
.demo-live i { position: relative; width: 7px; height: 7px; border-radius: 50%; background: #12b886; }
.demo-live i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(18, 184, 134, .55);
  animation: demo-pulse 2s ease-out infinite; }
.demo:not(.is-on) .demo-live i::after { animation-play-state: paused; }
@keyframes demo-pulse { 0% { transform: scale(1); opacity: .8; } 70%, 100% { transform: scale(2.4); opacity: 0; } }
.demo-faces { display: flex; list-style: none; margin: 0; padding: 0 0 0 6px; }
.demo-face { position: relative; width: 30px; height: 30px; margin-left: -6px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 750; color: #fff; border: 2px solid #fff; letter-spacing: -.01em;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1.4); }
.demo-face-dot { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: #12b886; border: 2px solid #fff; }
.demo-face.is-acting { transform: translateY(-3px) scale(1.08); z-index: 1; }
.demo-face.is-acting::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid currentColor; opacity: 0;
  animation: demo-ripple 1.1s ease-out infinite; color: inherit; }
.demo-face[data-person="priya"].is-acting::after { border-color: var(--demo-priya); }
.demo-face[data-person="liam"].is-acting::after { border-color: var(--demo-liam); }
@keyframes demo-ripple { 0% { opacity: .7; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.35); } }

/* avatar colours: white text on each passes AA */
.demo-av--me { background: linear-gradient(135deg, #5b3df5, #b4236a); }
.demo-av--priya { background: var(--demo-priya); }
.demo-av--liam { background: var(--demo-liam); }

/* ---------- bar: progress + All/Mine ---------- */
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin: 16px 0 12px; }
.demo-stats { display: flex; align-items: center; gap: 10px; min-width: 0; }
.demo-ring { flex: none; transform: rotate(-90deg); }
.demo-ring circle { fill: none; stroke-width: 4; }
.demo-ring-bg { stroke: #efe9df; }
.demo-ring-fg { stroke: var(--demo-ok); stroke-linecap: round; stroke-dasharray: 100; transition: stroke-dashoffset .6s cubic-bezier(.2, .7, .2, 1); }
.demo-count { font-size: 14px; color: var(--demo-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.demo-count b { color: var(--demo-ink); font-weight: 700; }
.demo-pct { color: var(--demo-ink-3); }

.demo-seg { display: inline-flex; gap: 2px; margin: 0; padding: 3px; border: 0; border-radius: 999px; background: var(--demo-soft);
  box-shadow: inset 0 0 0 1px var(--demo-line); min-width: 0; }
.demo-seg label { position: relative; display: block; }
.demo-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.demo-seg span { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 13px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--demo-ink-2); transition: background .2s, color .2s, box-shadow .2s; pointer-events: none; }
.demo-seg b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 700; background: rgba(70, 45, 10, .07); color: var(--demo-ink-2); font-variant-numeric: tabular-nums; }
.demo-seg input:checked + span { background: #fff; color: var(--demo-ink); box-shadow: 0 1px 2px rgba(10, 15, 28, .08), 0 2px 8px -2px rgba(10, 15, 28, .12); }
.demo-seg input:checked + span b { background: rgba(91, 61, 245, .12); color: #4f3ff0; }
.demo-seg input:hover + span { color: var(--demo-ink); }
.demo-seg input:focus-visible + span { outline: 2px solid var(--demo-focus); outline-offset: 2px; }

/* ---------- add a task ---------- */
.demo-add { position: relative; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 6px 0 12px; border-radius: 14px;
  background: #fffdf9; border: 1px solid var(--demo-line-2); transition: border-color .2s, box-shadow .2s; }
.demo-add:focus-within { border-color: #6a5cff; box-shadow: 0 0 0 4px rgba(106, 92, 255, .16); }
.demo-add-ic { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #5b4dff, #4f63ff); }
.demo-add-in { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--demo-ink);
  font: inherit; font-size: 16px; /* 16px keeps iOS from zooming in */ }
.demo-add-in::placeholder { color: var(--demo-ink-3); opacity: 1; }
.demo-add-btn { flex: none; height: 36px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 650;
  color: #fff; background: linear-gradient(135deg, #5b4dff, #4f63ff); box-shadow: 0 6px 14px -8px rgba(79, 63, 240, .8);
  transition: transform .15s, box-shadow .2s; }
.demo-add-btn:hover { box-shadow: 0 8px 18px -8px rgba(79, 63, 240, .9); }
.demo-add-btn:active { transform: scale(.96); }
.demo-add-btn:focus-visible { outline: 2px solid var(--demo-focus); outline-offset: 2px; }
.demo-add.is-nudge { animation: demo-nudge .4s cubic-bezier(.36, .07, .19, .97); border-color: #c2410c; }
@keyframes demo-nudge { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.demo-add.is-typing { border-color: var(--typing, #6a5cff); box-shadow: 0 0 0 4px color-mix(in srgb, var(--typing, #6a5cff) 14%, transparent); }

/* ---------- task list (fixed height: rows come and go without moving the page) ---------- */
.demo-listwrap { position: relative; height: var(--demo-list-h); margin-top: 10px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(70, 45, 10, .2) transparent; padding: 2px; margin-left: -2px; margin-right: -2px; }
.demo-listwrap.can-up { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px); mask-image: linear-gradient(to bottom, transparent 0, #000 26px); }
.demo-listwrap.can-down { -webkit-mask-image: linear-gradient(to top, transparent 0, #000 26px); mask-image: linear-gradient(to top, transparent 0, #000 26px); }
.demo-listwrap.can-up.can-down { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%); }
.demo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.demo-task { --hl: rgba(106, 92, 255, .10); position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto;
  grid-template-areas: "cb t who due"; align-items: center; gap: 4px 10px; min-height: 50px; padding: 8px 10px 8px 11px; border-radius: 12px;
  background: #fff; border: 1px solid var(--demo-line); transition: border-color .2s, background-color .5s, box-shadow .3s; }
.demo-task:hover { border-color: var(--demo-line-2); box-shadow: 0 4px 14px -10px rgba(70, 45, 10, .35); }
.demo-task[hidden] { display: none; }
.demo-task.is-done { background: #fcfbf8; }
.demo-task.is-new { animation: demo-in .5s cubic-bezier(.2, .8, .2, 1) both, demo-hl 2.4s ease-out both; }
.demo-task.is-remote { animation: demo-hl 1.8s ease-out both; }
.demo-task[data-by="priya"] { --hl: rgba(194, 65, 12, .12); }
.demo-task[data-by="liam"] { --hl: rgba(4, 120, 87, .13); }
@keyframes demo-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } }
@keyframes demo-hl { 0%, 35% { background-color: var(--hl); } }

.demo-cbw { grid-area: cb; position: relative; width: 26px; height: 26px; }
.demo-cb { position: absolute; inset: -5px; width: 36px; height: 36px; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.demo-tick { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--demo-ring); background: #fff; display: grid; place-items: center;
  transition: background-color .2s, border-color .2s; }
.demo-tick svg { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20;
  transition: stroke-dashoffset .28s cubic-bezier(.65, 0, .35, 1) .06s; }
.demo-tick::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--demo-ok); opacity: 0; pointer-events: none; }
.demo-cb:hover + .demo-tick { border-color: var(--demo-ok); background: rgba(18, 184, 134, .10); }
.demo-cb:focus-visible + .demo-tick { outline: 2px solid var(--demo-focus); outline-offset: 3px; }
.demo-cb:checked + .demo-tick { background: var(--demo-ok); border-color: var(--demo-ok); }
.demo-cb:checked + .demo-tick svg { stroke-dashoffset: 0; }
.demo-task.is-pop .demo-tick { animation: demo-pop .42s cubic-bezier(.2, .8, .2, 1.4); }
.demo-task.is-pop .demo-tick::after { animation: demo-burst .6s ease-out; }
@keyframes demo-pop { 0% { transform: scale(.82); } 55% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes demo-burst { 0% { opacity: .7; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.9); } }

.demo-task-t { grid-area: t; min-width: 0; cursor: pointer; font-size: 15px; font-weight: 550; color: var(--demo-ink); overflow-wrap: anywhere; }
.demo-task-t span { background: linear-gradient(currentColor, currentColor) 0 56% / 0 1.5px no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  transition: background-size .35s cubic-bezier(.65, 0, .35, 1), color .3s; }
.demo-task.is-done .demo-task-t { color: var(--demo-ink-3); }
.demo-task.is-done .demo-task-t span { background-size: 100% 1.5px; }

.demo-meta { display: contents; }
.demo-who { grid-area: who; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px 0 3px; border-radius: 999px;
  background: var(--demo-soft); font-size: 12.5px; font-weight: 600; color: var(--demo-ink-2); white-space: nowrap; }
.demo-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 9px; font-weight: 750; color: #fff; letter-spacing: -.02em; }
.demo-due { grid-area: due; justify-self: start; display: inline-flex; align-items: center; height: 28px; padding: 0 9px; border-radius: 8px;
  background: var(--demo-soft); font-size: 12.5px; font-weight: 600; color: var(--demo-ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.demo-due--soon { background: rgba(255, 176, 32, .18); color: #8a4f00; }

.demo-empty { position: absolute; inset: 24px 16px auto; text-align: center; color: var(--demo-ink-3); font-size: 14px; padding: 22px 12px;
  border: 1.5px dashed var(--demo-line-2); border-radius: 14px; background: #fffdf9; }
.demo-empty[hidden] { display: none; }

/* ---------- activity line + all-done toast (same fixed slot) ---------- */
.demo-activity { position: relative; height: 26px; margin-top: 10px; overflow: hidden; }
.demo-activity-t { display: flex; align-items: center; gap: 7px; height: 26px; font-size: 13px; color: var(--demo-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .25s, transform .25s; }
.demo-activity-t .demo-av { width: 18px; height: 18px; font-size: 7.5px; }
.demo-activity-t b { color: var(--demo-ink-2); font-weight: 650; }
.demo-activity-t q { quotes: "\201C" "\201D"; overflow: hidden; text-overflow: ellipsis; color: var(--demo-ink-2); }
/* plain-text parts shrink and end in "…" too (a bare text node in a flex row can't) */
.demo-activity-t > span:not([class]) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.demo-activity-t.is-swap { opacity: 0; transform: translateY(4px); }
.demo-dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.demo-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: demo-dot 1s ease-in-out infinite; }
.demo-dots i:nth-child(2) { animation-delay: .15s; }
.demo-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes demo-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.demo-alldone { position: absolute; inset: 0; display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--demo-ok-ink);
  opacity: 0; transform: translateY(100%); transition: opacity .3s, transform .35s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.demo.is-alldone .demo-alldone { opacity: 1; transform: none; }
.demo.is-alldone .demo-activity-t { opacity: 0; transform: translateY(-100%); }
.demo.is-alldone .demo-ring-fg { stroke: #12b886; }

/* ---------- footer: caption + actions ---------- */
.demo-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 10px 18px; min-height: 46px;
  background: #fffaf2; border-top: 1px solid var(--demo-line); font-size: 13px; }
.demo--bare .demo-foot { background: #fffaf2; }
.demo-caption { display: flex; align-items: center; gap: 7px; color: var(--demo-ink-2); font-weight: 550; }
.demo-caption svg { flex: none; color: #c2410c; }
.demo-actions { display: flex; gap: 14px; }
.demo-link { min-height: 28px; padding: 2px 2px; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 650;
  color: var(--accent-ink, #4f3ff0); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; border-radius: 4px; }
.demo-link:hover { text-decoration-thickness: 2px; }
.demo-link:focus-visible { outline: 2px solid var(--demo-focus); outline-offset: 2px; }

/* ---------- sample teammate cursors ---------- */
.demo-cursor { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; opacity: 0;
  transform: translate3d(var(--x, 0px), var(--y, 0px), 0); will-change: transform;
  transition: transform .95s cubic-bezier(.45, .05, .2, 1), opacity .4s; }
.demo-cursor.is-shown { opacity: 1; }
.demo-cursor svg { display: block; filter: drop-shadow(0 2px 3px rgba(10, 15, 28, .25)); transform-origin: 3px 2px; transition: transform .12s; }
.demo-cursor.is-press svg { transform: scale(.82); }
.demo-cursor-tag { position: absolute; left: 14px; top: 18px; display: flex; flex-direction: column; padding: 3px 8px 4px; border-radius: 4px 10px 10px 10px;
  color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1.2; white-space: nowrap; box-shadow: 0 6px 14px -8px rgba(10, 15, 28, .5); }
.demo-cursor-tag small { font-size: 9.5px; font-weight: 600; opacity: .92; letter-spacing: .01em; }
.demo-cursor--priya { color: var(--demo-priya); }
.demo-cursor--liam { color: var(--demo-liam); }
.demo-cursor--priya .demo-cursor-tag { background: var(--demo-priya); }
.demo-cursor--liam .demo-cursor-tag { background: var(--demo-liam); }
.demo-cursor.is-flip .demo-cursor-tag { left: auto; right: 4px; border-radius: 10px 4px 10px 10px; }
.demo-cursor-say { position: absolute; left: 14px; top: -26px; padding: 3px 9px; border-radius: 10px 10px 10px 4px; background: #fff; color: var(--demo-ink);
  font-size: 12px; font-weight: 650; white-space: nowrap; box-shadow: 0 6px 16px -8px rgba(10, 15, 28, .45), 0 0 0 1px var(--demo-line);
  opacity: 0; transform: translateY(4px) scale(.95); transition: opacity .25s, transform .25s; }
.demo-cursor.is-saying .demo-cursor-say { opacity: 1; transform: none; }

/* ---------- confetti-lite ---------- */
.demo-confetti { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.demo-confetti i { position: absolute; left: var(--ox); top: var(--oy); width: 7px; height: 11px; border-radius: 2px; background: var(--c);
  animation: demo-fly 1.35s cubic-bezier(.15, .7, .3, 1) forwards; animation-delay: var(--d, 0s); opacity: 0; }
.demo-confetti i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }
@keyframes demo-fly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  55% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(calc(var(--r) * .6)); }
  100% { opacity: 0; transform: translate(calc(var(--dx) * 1.15), calc(var(--dy) + 70px)) rotate(var(--r)); }
}

/* ---------- narrow containers (phones, small frames) ---------- */
@container demo (max-width: 500px) {
  .demo-stage { padding: 14px 14px 10px; }
  .demo-foot { padding: 9px 14px; }
  .demo-task { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "cb t who" "cb due who"; padding: 8px 10px; }
  .demo-due { height: auto; padding: 0; background: none; font-size: 12px; }
  .demo-due--soon { background: none; color: #8a4f00; }
  .demo-who { padding: 0; background: none; height: auto; }
  .demo-who-n { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .demo-av { width: 26px; height: 26px; font-size: 9.5px; }
}
@container demo (max-width: 400px) {
  .demo-head { gap: 10px; }
  .demo-proj { width: 34px; height: 34px; border-radius: 10px; }
  .demo-title { font-size: 1.05rem; }
  .demo-live { padding: 0 7px; }
  .demo-crumb-x { display: none; }
  .demo-face { width: 26px; height: 26px; font-size: 9px; }
  .demo-pct { display: none; }
  .demo-seg span { padding: 0 10px; }
  .demo-add-in::placeholder { font-size: 15px; }
  .demo-caption { font-size: 12.5px; }
}
@container demo (max-width: 340px) {
  .demo-live { width: 24px; padding: 0; justify-content: center; }
  .demo-live span { display: none; }
  .demo-bar { gap: 8px; }
}

/* ---------- reduced motion: teammates still act, nothing glides, pops or flies ---------- */
@media (prefers-reduced-motion: reduce) {
  .demo *, .demo *::before, .demo *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .demo-live i::after { animation: none; opacity: 0; }
  .demo-confetti { display: none; }
}
@media (forced-colors: active) {
  .demo-tick { border-color: CanvasText; }
  .demo-cb:checked + .demo-tick { background: Highlight; border-color: Highlight; }
  .demo-seg input:checked + span { outline: 2px solid Highlight; }
}
