/* ─────────────────────────────────────────────────────────────
   StatNavigator — animated demo mockups
   Eight CSS-only UI walkthroughs that replace static screenshots.
   Every animation ships paused; the JS controller adds
   `.is-playing` to the `.demo-frame` parent to run them.
   No hardcoded colors — every hue is a CSS variable from styles.css.
   Selectors match the markup in index.html exactly.
   Prefixes: dh hero · da analysis · dd dashboard · du upload
             dp preprocess · ds summary · dv viz · dc classify · dm mobile
   ───────────────────────────────────────────────────────────── */

/* ── Shared primitives ──────────────────────────────────────── */
.demo-frame {
  font-family: var(--font-sans); color: var(--text);
  font-size: 10px; line-height: 1.4;
  container-type: inline-size; isolation: isolate;
}
.demo-frame * { animation-play-state: paused; animation-fill-mode: both; }

/* ── Generic keyframes (shared) ─────────────────────────────── */
@keyframes d-fade-in     { from { opacity: 0 } to { opacity: 1 } }
@keyframes d-fade-up     { from { opacity: 0; transform: translateY(6px) }  to { opacity: 1; transform: none } }
@keyframes d-fade-down   { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }
@keyframes d-slide-left  { from { opacity: 0; transform: translateX(-14px) } to { opacity: 1; transform: none } }
@keyframes d-slide-right { from { opacity: 0; transform: translateX(14px) }  to { opacity: 1; transform: none } }
@keyframes d-pop         { 0% { opacity: 0; transform: scale(0.6); } 60% { opacity: 1; transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
@keyframes d-grow-x      { from { transform: scaleX(0) } to { transform: scaleX(1) } }
@keyframes d-grow-y      { from { transform: scaleY(0) } to { transform: scaleY(1) } }
@keyframes d-reveal-x    { from { clip-path: inset(0 100% 0 0) } to { clip-path: inset(0 0 0 0) } }
@keyframes d-pulse       { 0%,100% { transform: scale(1) } 50% { transform: scale(1.06) } }
@keyframes d-glow-pulse  { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); } }
@keyframes d-badge-flip {
  0%   { transform: rotateX(0deg);   background: transparent;    border-color: var(--line); color: var(--muted); }
  45%  { transform: rotateX(90deg); }
  55%  { transform: rotateX(-90deg); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
  100% { transform: rotateX(0deg);   background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
}
@keyframes du-drop-in {
  0%   { opacity: 0; transform: translateY(-38px) scale(0.9); }
  55%  { opacity: 1; transform: translateY(4px)   scale(1.02); }
  75%  {             transform: translateY(-3px)  scale(0.99); }
  100% { opacity: 1; transform: none; }
}
@keyframes dp-outlier-mark { to { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 25%, transparent); } }
@keyframes dv-bars-out     { to { opacity: 0; } }
@keyframes dv-scatter-in   { from { opacity: 0 } to { opacity: 1 } }
@keyframes dc-score-pulse  { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes dm-slide {
  0%,  30% { transform: translateX(0%); }
  36%, 63% { transform: translateX(100%); }
  69%, 96% { transform: translateX(200%); }
  100%     { transform: translateX(0%); }
}
@keyframes dm-c1 { 0%,30% { opacity: 1; transform: translateX(0); }     36%,100% { opacity: 0; transform: translateX(-8px); } }
@keyframes dm-c2 { 0%,30% { opacity: 0; transform: translateX(8px); }   36%,63%  { opacity: 1; transform: translateX(0); }   69%,100% { opacity: 0; transform: translateX(-8px); } }
@keyframes dm-c3 { 0%,63% { opacity: 0; transform: translateX(8px); }   69%,96%  { opacity: 1; transform: translateX(0); }   100%     { opacity: 0; transform: translateX(-8px); } }

/* ═════════════════════════════════════════════════════════════
   1. HERO — full pipeline inside the browser frame (~8s)
   ═════════════════════════════════════════════════════════════ */
.demo-hero {
  position: relative; display: grid;
  grid-template-columns: 62px 1fr 130px;
  grid-template-rows: 22px 1fr 32px;
  gap: 8px; width: 100%; height: 100%; padding: 10px;
  background:
    radial-gradient(80% 100% at 50% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%),
    var(--bg-soft);
}
.dh-sidebar {
  grid-column: 1; grid-row: 1 / span 3;
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 6px; border-radius: 8px;
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  border: 1px solid var(--line);
  animation: d-slide-left 0.8s var(--ease) 0s both;
}
.dh-main {
  grid-column: 2; grid-row: 1 / span 2;
  display: grid; grid-template-rows: auto 1fr; gap: 8px; min-height: 0;
}
.dh-tabs {
  display: flex; gap: 5px; align-items: center;
  padding: 4px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--panel-solid) 78%, transparent);
  border: 1px solid var(--line);
  animation: d-fade-in 0.7s var(--ease) 0.5s both;
}
.dh-tab {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.08em;
  padding: 2px 7px; border-radius: 4px;
  color: var(--muted); border: 1px solid transparent;
}
.dh-tab-active {
  color: var(--accent-ink); background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.dh-content { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.dh-result {
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 12px; border-radius: 8px;
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  border: 1px solid var(--line);
  animation: d-fade-up 0.6s var(--ease) 2.5s both;
}
.dh-result-title { font-size: 10px; font-weight: 600; color: var(--text); }
.dh-result-row {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--font-mono); font-size: 9.5px;
  animation: d-fade-in 0.4s var(--ease) both;
}
.dh-result-row:nth-of-type(2) { animation-delay: 2.9s; }
.dh-result-row:nth-of-type(3) { animation-delay: 3.1s; }
.dh-result-row:nth-of-type(4) { animation-delay: 3.3s; }
.dh-label { color: var(--muted); min-width: 10px; }
.dh-value { color: var(--text-soft); font-weight: 600; }
.dh-result-row:nth-of-type(2) .dh-value {
  font-size: 15px; font-weight: 700; color: var(--accent-ink); letter-spacing: -0.02em;
  animation: d-pop 0.5s var(--ease) 2.9s both;
}
.dh-effect-bar {
  position: relative; height: 6px; border-radius: 999px; overflow: hidden;
  margin-top: 4px;
  background: color-mix(in srgb, var(--line-strong) 60%, transparent);
}
.dh-effect-fill {
  position: absolute; inset: 0 auto 0 0; width: 72%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transform-origin: left center;
  animation: d-grow-x 1.5s var(--ease) 3.6s both;
}
.dh-assumptions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 5px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--panel-solid) 78%, transparent);
  border: 1px solid var(--line);
}
.dh-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 8.5px;
  border: 1px solid var(--line); color: var(--muted);
  animation: d-badge-flip 0.6s var(--ease) both;
}
.dh-badge:nth-of-type(1) { animation-delay: 4.0s; }
.dh-badge:nth-of-type(2) { animation-delay: 4.3s; }
.dh-badge:nth-of-type(3) { animation-delay: 4.6s; }
.dh-badge-pass {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent-ink);
}
.dh-badge-fail {
  background: color-mix(in srgb, var(--amber) 15%, transparent);
  border-color: color-mix(in srgb, var(--amber) 45%, transparent);
  color: var(--amber);
}
.dh-advisor {
  grid-column: 3; grid-row: 2 / span 2;
  display: flex; flex-direction: column; gap: 5px;
  padding: 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  animation: d-fade-in 0.5s var(--ease) 0.9s both;
}
.dh-advisor-head {
  font-family: var(--font-mono); font-size: 8px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink);
}
.dh-advisor-line {
  font-family: var(--font-mono); font-size: 7.5px; line-height: 1.45;
  color: var(--text-soft);
  animation: d-reveal-x 0.5s var(--ease) both;
}
.dh-advisor-line:nth-of-type(2) { animation-delay: 1.00s; }
.dh-advisor-line:nth-of-type(3) { animation-delay: 1.35s; color: var(--amber); }
.dh-advisor-line:nth-of-type(4) { animation-delay: 1.70s; color: var(--accent-ink); font-weight: 600; }

/* ═════════════════════════════════════════════════════════════
   2. ANALYSIS — advisor rule + result numbers
   ═════════════════════════════════════════════════════════════ */
.demo-analysis {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  width: 100%; height: 100%; padding: 14px 16px;
  background:
    radial-gradient(60% 100% at 100% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--bg-soft);
}
.da-rule {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 6px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-mono); font-size: 9px; color: var(--text-soft);
  animation: d-slide-left 0.6s var(--ease) 0s both;
}
.da-badge {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  animation: d-pop 0.7s var(--ease) 0.5s both;
}
.da-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 2px; }
.da-num {
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--accent-ink); letter-spacing: -0.01em;
  animation: d-fade-up 0.5s var(--ease) both;
}
.da-num:nth-of-type(1) { animation-delay: 1.00s; }
.da-num:nth-of-type(2) { animation-delay: 1.25s; }
.da-num:nth-of-type(3) { animation-delay: 1.50s; }
.da-bar {
  height: 8px; border-radius: 999px; position: relative; overflow: hidden;
  margin-top: auto;
  background: color-mix(in srgb, var(--line-strong) 55%, transparent);
}
.da-bar-fill {
  position: absolute; inset: 0 auto 0 0; width: 64%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transform-origin: left center;
  animation: d-grow-x 1.5s var(--ease) 2s both;
}
.da-ci {
  font-family: var(--font-mono); font-size: 8.5px;
  color: var(--muted); letter-spacing: 0.06em;
  animation: d-fade-in 0.4s var(--ease) 3.6s both;
}

/* ═════════════════════════════════════════════════════════════
   3. DASHBOARD — project cards + recent list
   ═════════════════════════════════════════════════════════════ */
.demo-dashboard {
  position: relative; display: grid;
  grid-template-columns: 1.6fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 10px; width: 100%; height: 100%; padding: 14px 16px;
  background: var(--bg-soft);
}
.dd-header {
  grid-column: 1 / span 2;
  font-size: 12px; font-weight: 620; color: var(--text); letter-spacing: -0.01em;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
  animation: d-fade-in 0.5s var(--ease) 0s both;
}
.dd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-content: start; min-height: 0; }
.dd-card {
  position: relative;
  display: flex; flex-direction: column; gap: 5px;
  padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  animation: d-fade-up 0.5s var(--ease) both;
}
.dd-card:nth-of-type(1) { animation-delay: 0.0s; }
.dd-card:nth-of-type(2) { animation-delay: 0.3s; }
.dd-card:nth-of-type(3) { animation-delay: 0.6s; }
.dd-card-title { font-size: 9.5px; font-weight: 600; color: var(--text); }
.dd-card-meta {
  align-self: flex-start;
  padding: 2px 6px; border-radius: 3px;
  font-family: var(--font-mono); font-size: 7.5px; color: var(--text-soft);
  background: color-mix(in srgb, var(--line-strong) 55%, transparent);
}
.dd-active {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-solid));
  animation: d-fade-up 0.5s var(--ease) 0.3s both, d-glow-pulse 1s var(--ease) 1.5s 2 both;
}
.dd-active .dd-card-meta { color: var(--on-accent); background: var(--accent); }
.dd-resume {
  margin-top: 4px; align-self: flex-start;
  padding: 3px 8px; border-radius: 4px;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--font-mono); font-size: 8px; font-weight: 600; letter-spacing: 0.06em;
  animation: d-pop 0.4s var(--ease) 2s both, d-pulse 1.6s var(--ease) 2.4s infinite both;
}
.dd-recent {
  display: flex; flex-direction: column; gap: 6px;
  padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 76%, transparent);
  min-height: 0;
}
.dd-recent-title {
  font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.dd-list-item {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  border-left: 2px solid var(--accent);
  font-size: 8.5px; color: var(--text-soft);
  animation: d-slide-right 0.45s var(--ease) both;
}
.dd-list-item:nth-of-type(2) { animation-delay: 1.00s; }
.dd-list-item:nth-of-type(3) { animation-delay: 1.25s; }
.dd-list-item:nth-of-type(4) { animation-delay: 1.50s; }

/* ═════════════════════════════════════════════════════════════
   4. UPLOAD — drop zone + column profiling
   ═════════════════════════════════════════════════════════════ */
.demo-upload {
  position: relative; display: grid; grid-template-columns: 1fr 1.35fr; gap: 12px;
  width: 100%; height: 100%; padding: 14px 16px;
  background: var(--bg-soft);
}
.du-zone {
  grid-column: 1; grid-row: 1;
  position: relative;
  display: grid; place-content: center; justify-items: center; gap: 8px;
  padding: 10px; border-radius: 8px;
  border: 1.5px dashed var(--line-strong);
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  overflow: hidden; min-height: 60px;
  animation: d-fade-in 0.4s var(--ease) 0s both;
}
.du-icon {
  color: var(--accent-ink);
  animation: du-drop-in 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0s both;
}
.du-drop {
  font-family: var(--font-mono); font-size: 9px; color: var(--text); font-weight: 600;
  animation: d-fade-in 0.3s var(--ease) 0.7s both;
}
.du-progress {
  width: 100%; height: 5px; border-radius: 999px;
  position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--line-strong) 55%, transparent);
}
.du-progress-fill {
  position: absolute; inset: 0 auto 0 0; width: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transform-origin: left center;
  animation: d-grow-x 1s var(--ease) 0.8s both;
}
.du-question {
  grid-column: 1; grid-row: 2; align-self: start;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 9px; border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  font-size: 9px; color: var(--text);
  animation: d-fade-in 0.3s var(--ease) 2.9s both;
}
.du-radio {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  display: grid; place-items: center; flex: 0 0 auto;
}
.du-radio::after {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); transform: scale(0);
  animation: d-pop 0.4s var(--ease) 3s both;
}
.du-q-text { font-size: 9px; color: var(--text-soft); }
.du-profile {
  grid-column: 2; grid-row: 1 / span 2;
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  min-height: 0; overflow: hidden;
  animation: d-fade-in 0.3s var(--ease) 1.4s both;
}
.du-row {
  display: grid;
  grid-template-columns: 1.4fr auto 1fr;
  gap: 8px; align-items: center;
  padding: 5px 4px;
  font-family: var(--font-mono); font-size: 8.5px;
  color: var(--text-soft); border-radius: 4px;
  animation: d-fade-up 0.4s var(--ease) both;
}
.du-row:nth-of-type(1) { animation-delay: 1.5s; }
.du-row:nth-of-type(2) { animation-delay: 1.9s; }
.du-row:nth-of-type(3) { animation-delay: 2.3s; }
.du-row:nth-of-type(4) { animation-delay: 2.7s; }
.du-col { color: var(--text); font-weight: 600; }
.du-type {
  justify-self: start; padding: 1px 5px; border-radius: 3px;
  font-size: 7.5px; font-weight: 700; letter-spacing: 0.06em;
  animation: d-pop 0.35s var(--ease) both;
}
.du-row:nth-of-type(1) .du-type { animation-delay: 1.70s; }
.du-row:nth-of-type(2) .du-type { animation-delay: 2.10s; }
.du-row:nth-of-type(3) .du-type { animation-delay: 2.50s; }
.du-row:nth-of-type(4) .du-type { animation-delay: 2.90s; }
.du-numeric { color: var(--accent-ink); background: var(--accent-soft); }
.du-categorical { color: var(--amber); background: color-mix(in srgb, var(--amber) 15%, transparent); }
.du-bar {
  height: 3px; border-radius: 999px; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--line-strong) 55%, transparent);
}
.du-bar-fill {
  position: absolute; inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: var(--amber); transform-origin: left center;
  animation: d-grow-x 0.6s var(--ease) both;
}
.du-row:nth-of-type(1) .du-bar-fill { animation-delay: 1.75s; }
.du-row:nth-of-type(2) .du-bar-fill { animation-delay: 2.15s; }
.du-row:nth-of-type(3) .du-bar-fill { animation-delay: 2.55s; }
.du-row:nth-of-type(4) .du-bar-fill { animation-delay: 2.95s; }

/* ═════════════════════════════════════════════════════════════
   5. PREPROCESS — outlier detection & imputation split view
   ═════════════════════════════════════════════════════════════ */
.demo-preprocess {
  position: relative; display: grid; grid-template-rows: 1fr auto; gap: 8px;
  width: 100%; height: 100%; padding: 14px 16px;
  background: var(--bg-soft);
}
.dp-split {
  position: relative; display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px; align-items: stretch; min-height: 0;
}
.dp-side {
  position: relative; border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
  overflow: hidden;
}
.dp-label {
  position: absolute; top: 6px; left: 8px; z-index: 1;
  font-family: var(--font-mono); font-size: 8px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  animation: d-fade-in 0.5s var(--ease) 0s both;
}
.dp-side:nth-of-type(3) .dp-label { animation-delay: 3s; color: var(--accent-ink); }
.dp-arrow {
  align-self: center;
  font-size: 13px; color: var(--muted);
  animation: d-fade-in 0.4s var(--ease) 2.6s both;
}
.dp-chart { position: absolute; inset: 22px 10px 10px 10px; }
.dp-dot {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  bottom: var(--y, 50%);
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  animation: d-pop 0.4s var(--ease) both;
}
.dp-side:nth-of-type(1) .dp-dot:nth-of-type(1) { left:  8%; animation-delay: 0.5s; }
.dp-side:nth-of-type(1) .dp-dot:nth-of-type(2) { left: 22%; animation-delay: 0.6s; }
.dp-side:nth-of-type(1) .dp-dot:nth-of-type(3) { left: 36%; animation-delay: 0.7s; }
.dp-side:nth-of-type(1) .dp-dot:nth-of-type(4) { left: 50%; animation-delay: 0.8s; }
.dp-side:nth-of-type(1) .dp-dot:nth-of-type(5) { left: 64%; animation-delay: 0.9s; }
.dp-side:nth-of-type(1) .dp-dot:nth-of-type(6) { left: 78%; animation-delay: 1.0s; }
.dp-side:nth-of-type(1) .dp-dot:nth-of-type(7) { left: 88%; animation-delay: 1.1s; }
.dp-outlier { animation: d-pop 0.4s var(--ease) 1.1s both, dp-outlier-mark 0.5s var(--ease) 2.5s both !important; }
.dp-iqr-line {
  position: absolute; left: 4%; right: 4%;
  border-top: 1px dashed var(--line-strong);
  transform-origin: left center;
  animation: d-grow-x 0.8s var(--ease) both;
}
.dp-q1 { bottom: 26%; animation-delay: 1.7s; }
.dp-q3 { top: 22%;    animation-delay: 1.5s; }
.dp-side:nth-of-type(3) .dp-dot { opacity: 0; }
.dp-side:nth-of-type(3) .dp-dot:nth-of-type(1) { left:  8%; animation: d-fade-in 0.4s var(--ease) 3.0s both; }
.dp-side:nth-of-type(3) .dp-dot:nth-of-type(2) { left: 22%; animation: d-fade-in 0.4s var(--ease) 3.1s both; }
.dp-side:nth-of-type(3) .dp-dot:nth-of-type(3) { left: 36%; animation: d-fade-in 0.4s var(--ease) 3.2s both; }
.dp-side:nth-of-type(3) .dp-dot:nth-of-type(4) { left: 50%; animation: d-fade-in 0.4s var(--ease) 3.3s both; }
.dp-side:nth-of-type(3) .dp-dot:nth-of-type(5) { left: 64%; animation: d-fade-in 0.4s var(--ease) 3.4s both; }
.dp-side:nth-of-type(3) .dp-dot:nth-of-type(6) { left: 78%; animation: d-fade-in 0.4s var(--ease) 3.5s both; }
.dp-side:nth-of-type(3) .dp-dot:nth-of-type(7) { left: 88%; animation: d-fade-in 0.4s var(--ease) 3.6s both; }
.dp-imputed { background: var(--accent-strong); }
.dp-status {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--font-mono); font-size: 8.5px; color: var(--muted);
}
.dp-check {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: 8.5px; font-weight: 600; letter-spacing: 0.04em;
  animation: d-pop 0.5s var(--ease) 4.5s both;
}

/* ═════════════════════════════════════════════════════════════
   6. SUMMARY — narrative timeline + citation
   ═════════════════════════════════════════════════════════════ */
.demo-summary {
  position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 12px;
  width: 100%; height: 100%; padding: 14px 18px;
  background:
    radial-gradient(50% 100% at 0% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%),
    var(--bg-soft);
}
.ds-timeline {
  grid-column: 1; position: relative;
  border-right: 1px solid var(--line);
  padding-right: 10px; min-height: 0;
}
.ds-line {
  position: absolute; top: 6px; bottom: 6px; right: -1px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), color-mix(in srgb, var(--accent) 25%, transparent));
  transform-origin: top center;
  animation: d-grow-y 1.5s var(--ease) 0s both;
}
.ds-node {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  height: 25%;
  font-family: var(--font-mono); font-size: 7px; line-height: 1.3;
  letter-spacing: 0.02em; color: var(--muted); text-align: left;
  animation: d-fade-in 0.4s var(--ease) both;
}
.ds-node::after {
  content: ""; position: absolute; right: -14px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg-soft);
  border: 2px solid var(--accent);
}
.ds-node:nth-of-type(2) { animation-delay: 0.5s; }
.ds-node:nth-of-type(3) { animation-delay: 1.0s; }
.ds-node:nth-of-type(4) { animation-delay: 1.5s; }
.ds-node:nth-of-type(5) { animation-delay: 2.0s; }
.ds-narrative {
  grid-column: 2; display: flex; flex-direction: column; gap: 5px; min-height: 0;
}
.ds-text-line {
  font-size: 8.5px; line-height: 1.5; color: var(--text-soft);
  transform-origin: left center;
  animation: d-reveal-x 0.5s var(--ease) both;
}
.ds-text-line:nth-of-type(1) { animation-delay: 2.00s; }
.ds-text-line:nth-of-type(2) { animation-delay: 2.25s; }
.ds-text-line:nth-of-type(3) { animation-delay: 2.50s; }
.ds-text-line:nth-of-type(4) { animation-delay: 2.75s; }
.ds-text-line:nth-of-type(5) {
  animation-delay: 3s;
  color: var(--accent-ink); font-weight: 600;
}
.ds-citation {
  grid-column: 2; align-self: end;
  margin-top: auto; padding: 8px 10px; border-radius: 6px;
  display: flex; flex-direction: column; gap: 6px;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  animation: d-fade-up 0.5s var(--ease) 3.5s both;
}
.ds-cite-text {
  font-family: var(--font-mono); font-size: 8.5px; line-height: 1.55;
  color: var(--text-soft);
}
.ds-copy {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--line-strong); background: transparent;
  color: var(--text-soft);
  font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.06em;
  animation: d-fade-in 0.3s var(--ease) 3.8s both;
}
.ds-checkmark {
  color: var(--on-accent); background: var(--accent);
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 7.5px; font-weight: 700;
  animation: d-pop 0.4s var(--ease) 4.7s both;
}

/* ═════════════════════════════════════════════════════════════
   7. VIZ — histogram → scatter cross-fade (~5s)
   ═════════════════════════════════════════════════════════════ */
.demo-viz {
  position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px;
  width: 100%; height: 100%; padding: 12px 16px 14px;
  background: var(--bg-soft);
}
.dv-tabs { display: flex; gap: 4px; animation: d-fade-in 0.5s var(--ease) 0s both; }
.dv-tab {
  padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 8px;
  color: var(--muted); letter-spacing: 0.06em;
}
.dv-tab-active {
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
}
.dv-title {
  font-size: 11px; font-weight: 620; color: var(--text); letter-spacing: -0.01em;
  animation: d-fade-in 0.5s var(--ease) 0.5s both;
}
.dv-chart {
  position: relative; border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 78%, transparent);
  padding: 10px 12px 18px 22px;
  min-height: 0; overflow: hidden;
}
.dv-y-axis {
  position: absolute; top: 10px; bottom: 18px; left: 4px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--font-mono); font-size: 7.5px;
  color: var(--muted); letter-spacing: 0.08em;
  animation: d-fade-in 0.6s var(--ease) 1s both;
}
.dv-x-axis {
  display: flex; justify-content: space-between;
  padding: 0 12px 0 22px;
  font-family: var(--font-mono); font-size: 7.5px;
  color: var(--muted); letter-spacing: 0.08em;
  animation: d-fade-in 0.6s var(--ease) 1s both;
}
.dv-bars {
  position: absolute; inset: 10px 12px 18px 22px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 4px;
  animation: dv-bars-out 0.6s var(--ease) 3s both;
}
.dv-bar {
  flex: 1 1 0;
  height: var(--h, 50%);
  background: linear-gradient(to top, var(--accent-strong), var(--accent));
  border-radius: 3px 3px 0 0;
  transform-origin: bottom center;
  animation: d-grow-y 0.7s var(--ease) both;
}
.dv-bar:nth-of-type(1) { animation-delay: 0.50s; }
.dv-bar:nth-of-type(2) { animation-delay: 0.65s; }
.dv-bar:nth-of-type(3) { animation-delay: 0.80s; }
.dv-bar:nth-of-type(4) { animation-delay: 0.95s; }
.dv-bar:nth-of-type(5) { animation-delay: 1.10s; }
.dv-bar:nth-of-type(6) { animation-delay: 1.25s; }
.dv-bar:nth-of-type(7) { animation-delay: 1.40s; }
.dv-bar:nth-of-type(8) { animation-delay: 1.55s; }
.dv-scatter-layer {
  position: absolute; inset: 10px 12px 18px 22px;
  opacity: 0;
  animation: dv-scatter-in 0.7s var(--ease) 3s both;
}
.dv-dot {
  position: absolute;
  left: var(--x, 50%); bottom: var(--y, 50%);
  width: 6px; height: 6px; border-radius: 50%;
  margin-left: -3px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  opacity: 0;
  animation: d-pop 0.35s var(--ease) both;
}
.dv-dot:nth-of-type(1) { animation-delay: 3.1s; }
.dv-dot:nth-of-type(2) { animation-delay: 3.2s; }
.dv-dot:nth-of-type(3) { animation-delay: 3.3s; }
.dv-dot:nth-of-type(4) { animation-delay: 3.4s; }
.dv-dot:nth-of-type(5) { animation-delay: 3.5s; }
.dv-dot:nth-of-type(6) { animation-delay: 3.6s; }
.dv-dot:nth-of-type(7) { animation-delay: 3.7s; }
.dv-dot:nth-of-type(8) { animation-delay: 3.8s; }

/* ═════════════════════════════════════════════════════════════
   8. CLASSIFY — supervised learning pipeline
   ═════════════════════════════════════════════════════════════ */
.demo-classify {
  position: relative; display: flex; flex-direction: column; gap: 7px;
  width: 100%; height: 100%; padding: 12px 16px;
  background: var(--bg-soft);
}
.dc-target {
  display: flex; flex-direction: column; gap: 4px;
  animation: d-fade-in 0.4s var(--ease) 0s both;
}
.dc-label {
  font-family: var(--font-mono); font-size: 7.5px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.dc-columns { display: flex; flex-wrap: wrap; gap: 4px; }
.dc-col {
  padding: 4px 7px; border-radius: 4px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
  font-family: var(--font-mono); font-size: 8.5px; color: var(--text-soft);
  animation: d-slide-left 0.35s var(--ease) both;
}
.dc-col:nth-of-type(1) { animation-delay: 0.05s; }
.dc-col:nth-of-type(2) { animation-delay: 0.15s; }
.dc-col:nth-of-type(3) { animation-delay: 0.25s; }
.dc-col:nth-of-type(4) { animation-delay: 0.35s; }
.dc-selected {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent) !important;
  background: var(--accent-soft) !important;
  color: var(--accent-ink) !important;
  font-weight: 600;
  animation: d-slide-left 0.35s var(--ease) 0.25s both, d-pop 0.4s var(--ease) 0.9s both;
}
.dc-algos {
  display: flex; flex-direction: column; gap: 4px;
  animation: d-fade-in 0.4s var(--ease) 1.2s both;
}
.dc-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.dc-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
  font-family: var(--font-mono); font-size: 8px; color: var(--text-soft);
  animation: d-slide-right 0.4s var(--ease) both;
}
.dc-chip:nth-of-type(1) { animation-delay: 1.50s; }
.dc-chip:nth-of-type(2) { animation-delay: 1.75s; }
.dc-chip:nth-of-type(3) { animation-delay: 2.00s; }
.dc-chip-active {
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
  color: var(--accent-ink) !important;
  font-weight: 600;
  animation: d-slide-right 0.4s var(--ease) 1.5s both, d-pop 0.4s var(--ease) 2.5s both;
}
.dc-banner {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 9px; border-radius: 5px;
  border-left: 2px solid var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  font-family: var(--font-mono); font-size: 8px; color: var(--text-soft);
  animation: d-fade-down 0.5s var(--ease) 3s both;
}
.dc-training {
  display: flex; align-items: center; gap: 10px;
  margin-top: auto;
  animation: d-fade-in 0.3s var(--ease) 3.7s both;
}
.dc-progress {
  flex: 1 1 auto;
  height: 5px; border-radius: 999px; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--line-strong) 55%, transparent);
}
.dc-progress-fill {
  position: absolute; inset: 0 auto 0 0; width: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transform-origin: left center;
  animation: d-grow-x 1.2s var(--ease) 3.8s both;
}
.dc-score {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: var(--accent-ink); letter-spacing: -0.02em; line-height: 1;
  animation: d-fade-in 0.4s var(--ease) 5s both, dc-score-pulse 0.6s var(--ease) 5.1s 2 both;
}
.dc-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 3px; max-width: 180px; justify-self: end; align-self: end;
}
.dc-cell {
  padding: 5px 8px; border-radius: 4px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  font-family: var(--font-mono); font-size: 8px; font-weight: 700; color: var(--muted);
  display: flex; justify-content: center; gap: 6px;
  animation: d-pop 0.35s var(--ease) both;
}
.dc-cell:nth-of-type(1) { animation-delay: 5.5s; }
.dc-cell:nth-of-type(2) { animation-delay: 5.7s; }
.dc-cell:nth-of-type(3) { animation-delay: 5.9s; }
.dc-cell:nth-of-type(4) { animation-delay: 6.1s; }
.dc-tp, .dc-tn {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent-ink);
}
.dc-fp, .dc-fn { color: var(--amber); }

/* ═════════════════════════════════════════════════════════════
   9. MOBILE — 9:16 phone with cycling hypothesis tabs
   ═════════════════════════════════════════════════════════════ */
.demo-mobile {
  position: relative; display: flex; flex-direction: column;
  width: 100%; height: 100%;
  background: var(--bg-soft); overflow: hidden; font-size: 9px;
}
.dm-statusbar {
  flex: 0 0 auto;
  padding: 5px 10px 3px;
  font-family: var(--font-mono); font-size: 7px;
  color: var(--muted); letter-spacing: 0.06em;
  animation: d-fade-in 0.3s var(--ease) 0s both;
}
.dm-header {
  flex: 0 0 auto;
  padding: 4px 10px 8px;
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 620; color: var(--text); letter-spacing: -0.01em;
  animation: d-fade-down 0.3s var(--ease) 0s both;
}
.dm-tabs {
  position: relative; flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px 0;
  background: color-mix(in srgb, var(--panel-solid) 78%, transparent);
  animation: d-fade-in 0.5s var(--ease) 0.3s both;
}
.dm-tab {
  padding: 5px 0 8px; text-align: center;
  font-family: var(--font-mono); font-size: 8.5px;
  color: var(--muted); letter-spacing: 0.06em;
}
.dm-indicator {
  position: absolute; bottom: 0; left: 8px;
  width: calc((100% - 16px) / 3); height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
  box-shadow: 0 -2px 8px color-mix(in srgb, var(--accent) 55%, transparent);
  transform-origin: left center;
  animation: dm-slide 5s var(--ease) 0.8s infinite both;
}
.dm-viewport { position: relative; flex: 1 1 auto; min-height: 0; }
.dm-panel {
  position: absolute; inset: 8px 10px 10px;
  display: flex; flex-direction: column; gap: 6px;
  padding: 7px 9px; border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  opacity: 0;
}
.dm-panel-1 { animation: dm-c1 5s var(--ease) 0.8s infinite both; }
.dm-panel-2 { animation: dm-c2 5s var(--ease) 0.8s infinite both; }
.dm-panel-3 { animation: dm-c3 5s var(--ease) 0.8s infinite both; }
.dm-panel-title {
  font-family: var(--font-mono); font-size: 7px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.dm-panel-test {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  color: var(--accent-ink); margin-top: 2px; letter-spacing: -0.01em;
}
.dm-panel-p {
  align-self: flex-start;
  margin-top: auto;
  padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-family: var(--font-mono); font-size: 7.5px; font-weight: 600; letter-spacing: 0.06em;
}

/* ── Reduced motion — show the final frame, no animation ────── */
@media (prefers-reduced-motion: reduce) {
  .demo-frame *,
  .demo-frame *::before,
  .demo-frame *::after {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
  .demo-frame .dv-scatter-layer { opacity: 1 !important; }
  .demo-frame .dv-bars          { opacity: 0.35 !important; }
  .demo-frame .dp-side:nth-of-type(3) .dp-dot { opacity: 1 !important; }
  .demo-frame .dp-outlier {
    background: var(--amber) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 25%, transparent) !important;
  }
  .demo-frame .dm-panel-1 { opacity: 1 !important; }
  .demo-frame .dm-panel-2,
  .demo-frame .dm-panel-3 { opacity: 0 !important; }
  .demo-frame .dm-indicator { transform: translateX(0) !important; }
}
