/* The typing indicator: the one owner of how "someone is typing" looks. Every Messages demo and the blog's static threads use
   it; none draws its own. Hosts set only the size (and may point --ty-fill at their thread's incoming grey).

   Markup (a flex or block child of the thread):
     <div class="ty">
       <span class="ty-pill"><i></i><i></i><i></i></span><b class="ty-big"></b><b class="ty-small"></b>
     </div>
   The pill, the big thought circle and the small one are separate nodes so a host can pop them one after another (js/hero-sim.js).
   The indicator is always the other person's: grey, on the left, circles at its lower left. iOS never shows the phone's owner their own
   typing, so there is no right-hand variant.

   Host contract: --ty-size, an ABSOLUTE length (px, cqw, or a calc of --kT) = the pill's height. Every other length is written in
   --ty-u, one hundredth of that height, so the shape scales as one piece. The box is the pill; the circles hang outside it,
   and the .ty margin-bottom (10 u) is the room the small circle needs below.

   MEASURED from a real iOS 26 typing indicator (Ryan's screenshot 17.png, light mode, 1062 x 688 px, pill height 463 px = 100 u):
     pill          771 x 463 px  = 166.5 x 100 u, a full stadium (radius 50 u)
     dots          108 px = 23.3 u across, three equal; pitch 167 px (centres 400, 565, 734) so the gap is 12.6 u; the first dot starts 165 px = 35.6 u in
     big circle    centre 43.6 u right of the pill's left edge, 84.9 u below its top, radius 15.6 u (least-squares fit of the outline);
                   its bottom meets the pill's bottom, so it hangs nothing below
     small circle  centre 11.0 u left of the pill's left edge, 101.4 u below its top, radius 8.3 u: it hangs 9.7 u below the pill
     colours       pill #E5E6EB; dots #9E9DA0 (the first, caught at the top of its pulse) and #B6B5B9 (the other two, at rest)
   Not measured: the dark values below (derived: the pill is the iOS dark incoming grey tapback.css already uses, #262629; the dots
   are the hero's earlier dark greys, in proportion to it) and the animation. The pulse is the hero's earlier colour pulse (1.2 s,
   .2 s staggers) kept until Ryan's recording gives the real timing. Only colour is animated; nothing runs per frame in JS. */

:root {
  --ty-fill: #E5E6EB;            /* the pill and both circles: the incoming-bubble grey (measured; hosts may point it at their own) */
  --ty-dot: #B6B5B9;             /* a dot at rest (measured) */
  --ty-dot-hi: #9E9DA0;          /* a dot at the top of its pulse (measured) */
  --ty-size: 35px;
}
[data-theme="dark"] { --ty-fill: #262629; --ty-dot: #5E5E63; --ty-dot-hi: #98989D; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ty-fill: #262629; --ty-dot: #5E5E63; --ty-dot-hi: #98989D; }
}

.ty {
  --ty-u: calc(var(--ty-size) / 100);
  position: relative; flex: none; box-sizing: border-box; display: block;
  width: calc(166.5 * var(--ty-u)); height: var(--ty-size); margin-bottom: calc(10 * var(--ty-u));
  align-self: flex-start;
}
.ty-pill {
  position: absolute; inset: 0; display: flex; align-items: center; gap: calc(12.6 * var(--ty-u));
  padding-left: calc(35.6 * var(--ty-u)); border-radius: calc(50 * var(--ty-u)); background: var(--ty-fill); transform-origin: 0 100%;
}
.ty-pill i {
  flex: none; display: block; width: calc(23.3 * var(--ty-u)); height: calc(23.3 * var(--ty-u)); border-radius: 50%;
  background: var(--ty-dot); animation: ty-pulse 1.2s ease-in-out infinite;
}
.ty-pill i:nth-child(2) { animation-delay: .2s; }
.ty-pill i:nth-child(3) { animation-delay: .4s; }
@keyframes ty-pulse { 0%, 60%, 100% { background-color: var(--ty-dot); } 30% { background-color: var(--ty-dot-hi); } }
@media (prefers-reduced-motion: reduce) { .ty-pill i { animation: none; } }
.ty-big, .ty-small { position: absolute; border-radius: 50%; background: var(--ty-fill); }
.ty-big   { left: calc(-6.2 * var(--ty-u));  top: calc(69.3 * var(--ty-u)); width: calc(31.2 * var(--ty-u)); height: calc(31.2 * var(--ty-u)); }
.ty-small { left: calc(-19.3 * var(--ty-u)); top: calc(93.1 * var(--ty-u)); width: calc(16.6 * var(--ty-u)); height: calc(16.6 * var(--ty-u)); }
