/* 🎬 "How to" (js/pages/howto.js): a connector's setup as drawn scenes in a dialog. Tokens only; only opacity and
   transform move; without motion the markup is the finished frame and the buttons walk the steps. */
.dialog--howto .dialog__body { padding: var(--space-4) var(--space-5) var(--space-3); }
.dialog--howto .dialog__footer .btn, .dialog--howto .dialog__footer .help-link { min-height: var(--tap); }   /* thumb-sized */
.howto { display: grid; gap: var(--space-3); }
.howto__stage { position: relative; min-height: 280px; border-radius: var(--radius-lg); background: var(--surface-sunken); padding: var(--space-3);
  cursor: pointer; overflow: clip; outline: none; }
.howto__stage:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.howto__say { margin: 0; min-height: 2.6em; font: var(--type-label); color: var(--text); }
.howto__progress { display: flex; align-items: center; gap: var(--space-3); }
.howto__steps { display: flex; flex: 1; gap: 4px; }
.howto__steps i { position: relative; flex: 1; height: 4px; border-radius: 2px; overflow: hidden; background: var(--border); }
.howto__steps i b { position: absolute; inset: 0; border-radius: inherit; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; }
.howto__steps i.is-done b { transform: scaleX(1); }
.howto__steps i.is-on.is-running b { transform: scaleX(1); transition: transform var(--run, 4s) linear; }
.howto__count { font: var(--type-meta); color: var(--text-muted); white-space: nowrap; }

/* the mocks */
.howto__mock { display: grid; gap: var(--space-2); border-radius: var(--radius); background: var(--surface); box-shadow: var(--elev-1); overflow: clip; }
.howto__chrome { display: flex; align-items: center; gap: 6px; padding: var(--space-2) var(--space-3); background: var(--surface-2); color: var(--text-muted);
  font: var(--type-meta); border-bottom: var(--border-width) solid var(--border); }
.howto__chrome i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.howto__chrome i:nth-child(3) { margin-right: var(--space-2); }
.howto__chrome--chat { color: var(--text); }
.howto__chrome--chat svg { width: 16px; height: 16px; }
.howto__crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; color: var(--text); }
.howto__crumbs svg { width: 12px; height: 12px; color: var(--text-subtle); }
.howto__sheet { display: grid; gap: var(--space-2); padding: var(--space-2) var(--space-3) var(--space-3); }
.howto__line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.howto__label { color: var(--text-muted); overflow-wrap: anywhere; }
.howto__value { color: var(--text); font-family: var(--font-mono); font-size: var(--text-xs); overflow-wrap: anywhere; }
.howto__value.is-secret { letter-spacing: .08em; }
.howto__field { min-height: 32px; padding: 6px var(--space-2); border-radius: var(--radius-sm); border: var(--border-width) solid var(--border); background: var(--surface-sunken); }
.howto__typed { display: inline-flex; }
.howto__on::after { content: ""; display: inline-block; width: 1px; height: 1em; margin-left: 1px; vertical-align: text-bottom; background: var(--text); opacity: 0; }
.is-playing .howto__typed .howto__on::after { opacity: 1; animation: howto-blink 900ms steps(2) infinite; }
.is-playing .howto__off { visibility: hidden; }
.howto__actions { display: flex; justify-content: flex-end; }
.howto__btn { position: relative; display: inline-flex; align-items: center; min-height: 34px; padding: 0 var(--space-4); border-radius: var(--radius-pill);
  font: var(--type-label); background: var(--accent); color: var(--on-accent); }
.howto__btn.is-tapped::after { content: ""; position: absolute; inset: -5px; border-radius: inherit; border: 2px solid var(--accent); animation: howto-ripple 520ms ease-out both; }
.howto__chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-pill); font: var(--type-meta); font-size: var(--text-xs);
  background: var(--success-soft); color: var(--success); white-space: nowrap; }
.howto__chip svg { width: 12px; height: 12px; }
.howto__note { display: flex; gap: var(--space-2); margin: 0; padding: 0 var(--space-3) var(--space-3); font: var(--type-meta); color: var(--text-muted); }
.howto__note svg { flex: none; width: 14px; height: 14px; margin-top: 2px; }

.howto__thread { display: grid; gap: var(--space-2); padding: var(--space-3); }
.howto__bubble { justify-self: start; max-width: 85%; padding: var(--space-2) var(--space-3); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 6px;
  background: var(--surface-raised); font-size: var(--text-sm); overflow-wrap: anywhere; }
.howto__bubble small { display: block; color: var(--hero); font-weight: var(--weight-semibold); font-size: var(--text-xs); }
.howto__bubble--me { justify-self: end; border-radius: var(--radius-lg) var(--radius-lg) 6px var(--radius-lg); background: var(--accent-soft); }
.howto__bubble .howto__chip { margin-left: var(--space-2); }

.howto__rowhead { display: flex; align-items: center; gap: var(--space-3); padding-bottom: var(--space-2); border-bottom: var(--border-width) solid var(--border); }
.howto__rowhead > svg { width: 22px; height: 22px; color: var(--text); }
.howto__rowname { flex: 1; font: var(--type-title); }
.howto__status { display: inline-flex; align-items: center; gap: var(--space-2); font: var(--type-meta); color: var(--text-muted); }
.howto__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); }
.howto__status.is-swapped { color: var(--success); }
.howto__status.is-swapped .howto__dot { background: var(--success); }
.howto__swap.is-swapped, .howto__status.is-swapped .howto__swap { display: inline-block; animation: howto-pop 340ms cubic-bezier(.2,.9,.2,1.3) backwards; }

.howto__mock--done { place-items: center; padding: var(--space-5) var(--space-4); text-align: center; }
.howto__check { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--success-soft); color: var(--success); }
.howto__check svg { width: 28px; height: 28px; }
.howto__done-say { margin: 0; font: var(--type-title); }
.howto__mock--done .howto__line { width: 100%; max-width: 420px; text-align: start; }

/* beats: only what is playing moves; the finished frame is the markup itself */
.is-playing [data-at] { opacity: 0; transform: translate3d(0, 8px, 0); }
.is-playing [data-at].is-in, .is-playing [data-at].is-on { opacity: 1; transform: none; transition: opacity 320ms var(--ease), transform 420ms cubic-bezier(.2,.8,.2,1.05); }
.is-playing [data-do="tap"] { opacity: 1; transform: none; }
.is-playing .howto__chip[data-at]:not(.is-in) { display: none; }
.howto__finger { position: absolute; left: 0; top: 0; z-index: 3; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; pointer-events: none; opacity: 0;
  border: 2px solid var(--on-accent); background: color-mix(in oklab, var(--accent) 35%, transparent); transform: translate3d(var(--fx, 50%), var(--fy, 110%), 0) scale(var(--fs, 1));
  transition: transform 420ms cubic-bezier(.3,.7,.2,1), opacity 180ms var(--ease); }
.howto__finger.is-on { opacity: 1; }
.howto__finger.is-down { --fs: .72; transition-duration: 110ms; }
@keyframes howto-ripple { from { opacity: .9; transform: scale(.92); } to { opacity: 0; transform: scale(1.14); } }
@keyframes howto-pop { from { opacity: 0; transform: scale(.7); } }
@keyframes howto-blink { 50% { opacity: 0; } }

@media (max-width: 720px) {
  .howto__line { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .howto__stage { min-height: 240px; }
  .dialog--howto .dialog__footer { flex-wrap: wrap; }                       /* Read more on its own line; the walk below */
  .dialog--howto .dialog__footer .help-link { flex: 1 1 100%; }
  .dialog--howto .dialog__footer .spacer { display: none; }
  .dialog--howto .dialog__footer .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .howto__steps i b, .howto__finger, .is-playing [data-at] { transition: none; animation: none; }
}
