/* Unit toggle (see unit-toggle.mjs for the markup). A sliding segmented control: the thumb is one element moved with a GPU transform, 150ms.
   Site tokens only. Targets are 44px. Without JavaScript the radios still submit and :has() moves the thumb (up to four options); the script then sets --ut-i inline. */
.ut { --ut-n: 2; --ut-i: 0; position: relative; display: inline-grid; grid-template-columns: repeat(var(--ut-n), minmax(44px, 1fr)); align-items: stretch; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface-3); isolation: isolate; }
.ut-thumb { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--ut-n)); border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--border-strong); transform: translateX(calc(var(--ut-i) * 100%)); transition: transform 150ms cubic-bezier(0.2, 0, 0, 1); will-change: transform; }
.ut:has(.ut-opt:nth-of-type(2) .ut-in:checked) { --ut-i: 1; }
.ut:has(.ut-opt:nth-of-type(3) .ut-in:checked) { --ut-i: 2; }
.ut:has(.ut-opt:nth-of-type(4) .ut-in:checked) { --ut-i: 3; }
.ut-opt { position: relative; z-index: 1; display: grid; place-items: center; min-width: 44px; min-height: 40px; padding: 0 12px; cursor: pointer; }
.ut-in { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ut-lab { font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--muted); transition: color 150ms ease; pointer-events: none; }
.ut-in:checked + .ut-lab { color: var(--ink); }
.ut:has(.ut-in:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) { .ut-opt { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .ut-thumb, .ut-lab { transition: none; } }
