/* Page motion. Rules:
   1. Text never slides: it may fade in once. Only pictures and marks keep moving.
   2. Only transform and opacity are animated.
   3. Everything here needs html.motion-on, which motion.js sets only when scripts run and the
      visitor has not asked for reduced motion. Without it the page is still and complete.
   4. One pause button (html.motion-paused) stops every movement. Off-screen sections and hidden tabs stop too. */
html.motion-paused *,html.motion-paused *::before,html.motion-paused *::after,
html.motion-hidden *,html.motion-hidden *::before,html.motion-hidden *::after,
.is-off-screen,.is-off-screen *,.is-off-screen *::before,.is-off-screen *::after{animation-play-state:paused!important}
html.motion-paused *,html.motion-paused *::before,html.motion-paused *::after{transition:none!important}
html:not(.motion-on) .tw3-live i{animation:none}

/* The one pause button. */
.motion-pause{position:fixed;right:16px;bottom:max(16px,env(safe-area-inset-bottom));z-index:9;display:grid;place-items:center;width:48px;height:48px;padding:0;border:1px solid var(--rule-strong);border-radius:50%;background:var(--paper);color:var(--ink);box-shadow:var(--shadow-pop);cursor:pointer}
.motion-pause:hover{border-color:var(--ink)}

/* Sections enter once: a fade, never a slide. */
html.motion-on .rv{opacity:0;transition:opacity .7s ease-out;transition-delay:calc(var(--rv-i,0)*110ms)}
html.motion-on .rv.rv-in{opacity:1}

/* A patient dot running along a rule. The track ends at the rule's end, so it never widens the page. */
@keyframes takt-run-x{0%{transform:translateX(-100%);opacity:0}6%{opacity:1}92%{opacity:1}100%{transform:translateX(0);opacity:0}}
@keyframes takt-run-y{0%{transform:translateY(-100%);opacity:0}6%{opacity:1}92%{opacity:1}100%{transform:translateY(0);opacity:0}}
@keyframes takt-ping{0%{transform:scale(1);opacity:.55}70%,100%{transform:scale(2.1);opacity:0}}
@keyframes takt-ring{0%,14%,100%{transform:scale(1)}7%{transform:scale(1.4)}}
@keyframes takt-nudge{0%,60%,100%{transform:translateX(0)}80%{transform:translateX(5px)}}

/* One thread: a thin line with patient dots down the page edge, on wide screens only. */
.tw-thread{display:none}
@media(min-width:1024px){
  html.motion-on .tw-thread{display:block;position:fixed;left:15px;top:var(--nav-h,72px);bottom:0;width:6px;z-index:4;overflow:hidden;pointer-events:none;background:linear-gradient(var(--ceil-line),var(--ceil-line)) center/1px 100% no-repeat}
  .tw-thread i{position:absolute;inset:0;animation:takt-run-y 20s linear infinite}
  .tw-thread i:nth-child(2){animation-delay:-5s}.tw-thread i:nth-child(3){animation-delay:-10s}.tw-thread i:nth-child(4){animation-delay:-15s}
  .tw-thread i::after{content:"";position:absolute;left:0;bottom:0;width:6px;height:6px;border-radius:50%;background:var(--ceil-line)}
}

/* Why now: each rule draws from left to right, then carries a dot. */
html.motion-on .tc-stat.rv{position:relative;border-top-color:transparent}
html.motion-on .tc-stat.rv::before{content:"";position:absolute;left:0;right:0;top:-2px;height:2px;background:var(--ink);transform:scaleX(0);transform-origin:left;transition:transform .9s cubic-bezier(.2,.7,.2,1);transition-delay:calc(var(--rv-i,0)*110ms)}
html.motion-on .tc-stat.rv.rv-in::before{transform:scaleX(1)}
html.motion-on .home .tc-stat::after,html.motion-on .home .sal-col::after,html.motion-on .home :is(.tw-checks,.tw-facts,.tw-faq)::after{content:"";position:absolute;left:0;top:-5px;width:100%;height:8px;pointer-events:none;background:radial-gradient(circle at calc(100% - 4px) 4px,var(--ceil-strong) 3.4px,transparent 4px) no-repeat;animation:takt-run-x 9s linear infinite}
html.motion-on .home :is(.tc-stat,.sal-col,.tw-checks,.tw-facts,.tw-faq){position:relative}
html.motion-on .home .tc-stat:nth-child(2)::after{animation-delay:-2.2s}
html.motion-on .home .tc-stat:nth-child(3)::after{animation-delay:-4.5s}
html.motion-on .home .tc-stat:nth-child(4)::after{animation-delay:-6.7s}
html.motion-on .home :is(.tw-checks,.tw-facts,.tw-faq)::after{top:-4px;animation-duration:12s}

/* Hospitals are full of waiting: each wait line draws, a clock rides its end, then the waiting end pulses. */
.vig-fill,.vig-clock{display:none}
html.motion-on .tw-vig-gap.is-film{background:var(--rule)}
html.motion-on .tw-vig-gap.is-film::after{opacity:0}
html.motion-on .vig-fill{display:block;position:absolute;inset:0;border-radius:inherit;background:var(--amber);transform:scaleX(0);transform-origin:left}
html.motion-on .vig-clock{display:block;position:absolute;left:0;top:50%;width:100%;height:0;transform:translateX(-100%)}
html.motion-on .vig-fill,html.motion-on .vig-clock{transition:transform 1.8s cubic-bezier(.35,.1,.25,1);transition-delay:calc(var(--vi,0)*1.5s)}
html.motion-on .is-drawn .vig-fill{transform:scaleX(1)}
html.motion-on .is-drawn .vig-clock{transform:translateX(0)}
.vig-face{position:absolute;right:-12px;top:-12px;width:24px;height:24px;box-sizing:border-box;border:3px solid var(--ink);border-radius:50%;background:var(--paper)}
.vig-face::after{content:"";position:absolute;inset:-3px;border-radius:50%;background:var(--amber);opacity:0;z-index:-1}
html.motion-on .is-drawn .vig-face::after{animation:takt-ping 2.8s ease-out infinite;animation-delay:calc(var(--vi,0)*1.5s + 1.8s)}
.vig-hand{position:absolute;left:50%;bottom:50%;width:2px;margin-left:-1px;border-radius:1px;background:var(--ink);transform-origin:50% 100%;transform:rotate(var(--from,0deg))}
.vig-hand.is-hour{height:5px}
.vig-hand.is-minute{height:7px;background:var(--amber-text)}
html.motion-on .vig-hand{transition:transform 1.8s cubic-bezier(.35,.1,.25,1);transition-delay:calc(var(--vi,0)*1.5s)}
html.motion-on .is-drawn .vig-hand{transform:rotate(var(--to,0deg))}

/* The bottleneck plays by itself. Bars and the hot node move by transform; patients flow along the pipe. */
.bn-fill{height:100%!important;width:100%!important;transform:translateY(calc(100% - var(--w)));transition:transform .6s ease-out}
.bn-node{position:relative;z-index:1;transition:transform .4s ease-out}
.bn-step{transition:none}
.is-bn .bn-node{width:28px;height:28px;margin-top:6px;transform:scale(1.2857)}
.bn-flow{display:none}
html.motion-on .is-bn .bn-node::after{content:"";position:absolute;inset:-10px;border:5px solid var(--amber);border-radius:50%;opacity:0;animation:takt-ping 1.8s ease-out infinite}
html.motion-on .bn-flow{display:block;position:absolute;left:0;right:0;top:228px;height:6px;pointer-events:none}
html.motion-on .bn-flow i{position:absolute;inset:0;animation:takt-run-x 8s linear infinite}
html.motion-on .bn-flow i::after{content:"";position:absolute;right:0;top:-1px;width:8px;height:8px;border-radius:50%;background:var(--ceil-strong)}
.bn-flow i:nth-child(2){animation-delay:-1.6s!important}.bn-flow i:nth-child(3){animation-delay:-3.2s!important}.bn-flow i:nth-child(4){animation-delay:-4.8s!important}.bn-flow i:nth-child(5){animation-delay:-6.4s!important}
@media(max-width:760px){
  .bn-fill{transform:translateX(calc(var(--w) - 100%))}
  .is-bn .bn-node{width:20px;height:20px;margin:0;transform:scale(1.1)}
  html.motion-on .bn-flow{left:7px;right:auto;top:22px;bottom:22px;width:6px;height:auto;background:linear-gradient(var(--ceil-line),var(--ceil-line)) center/2px 100% no-repeat}
  html.motion-on .bn-flow i{animation-name:takt-run-y}
  html.motion-on .bn-flow i::after{right:auto;left:-1px;top:auto;bottom:0}
  html.motion-on .is-bn .bn-node::after{inset:-7px;border-width:3px}
}

/* See, Act, Learn: a dot crosses the three rules in turn. */
@keyframes takt-relay{0%{transform:translateX(-100%);opacity:0}2%{opacity:1}31%{opacity:1}33.3%,100%{transform:translateX(0);opacity:0}}
html.motion-on .home .sal-col::after{top:-7px;animation:takt-relay 10.5s linear infinite backwards}
html.motion-on .home .sal-col:nth-child(2)::after{animation-delay:3.5s}
html.motion-on .home .sal-col:nth-child(3)::after{animation-delay:7s}

/* What to expect: the week line fills from week 1 to week 8 and repeats slowly. */
@keyframes takt-weeks-x{0%{transform:scaleX(0);opacity:1}72%,90%{transform:scaleX(1);opacity:1}100%{transform:scaleX(1);opacity:0}}
@keyframes takt-weeks-y{0%{transform:scaleY(0);opacity:1}72%,90%{transform:scaleY(1);opacity:1}100%{transform:scaleY(1);opacity:0}}
html.motion-on .home .tw-step{z-index:1}
html.motion-on .home .tw-steps::after{content:"";position:absolute;left:10px;right:0;top:7px;height:6px;border-radius:var(--radius-pill);background:var(--ink);transform-origin:left;animation:takt-weeks-x 14s ease-in-out infinite}
@media(max-width:860px){html.motion-on .home .tw-steps::after{left:7px;right:auto;top:10px;bottom:10px;width:6px;height:auto;transform-origin:top;animation-name:takt-weeks-y}}

/* Weekly results: the line draws behind a sliding cover, then a dot keeps traveling it. */
@keyframes takt-score{0%{transform:translate(1.33%,86.8%);opacity:0}4%{opacity:1}20%{transform:translate(18.33%,78.9%)}40%{transform:translate(36.67%,63.2%)}60%{transform:translate(55%,46.1%)}80%{transform:translate(73.33%,28.9%)}96%{opacity:1}100%{transform:translate(92%,13.2%);opacity:0}}
.tw-score-cover,.tw-score-run{display:none}
html.motion-on .tw-score-chart.is-film{position:relative}
html.motion-on .tw-score-cover{display:block;position:absolute;left:0;top:0;width:100%;height:60px;background:var(--night);transform-origin:right;transition:transform 1.6s cubic-bezier(.4,0,.2,1) .2s}
html.motion-on .is-drawn .tw-score-cover{transform:scaleX(0)}
html.motion-on .tw-score-run{display:block;position:absolute;left:0;top:0;width:100%;height:76px;pointer-events:none;opacity:0}
html.motion-on .is-drawn .tw-score-run{animation:takt-score 7s linear 1.8s infinite}
.tw-score-run::after{content:"";position:absolute;left:-5px;top:-5px;width:10px;height:10px;border-radius:50%;background:var(--night-ceil);box-shadow:0 0 0 3px var(--night)}

/* Quiet sections still breathe: list marks tick in turn, arrows nudge. */
html.motion-on .home .tw-checks li .tw-ring{animation:takt-ring 8.4s ease-in-out infinite}
html.motion-on .home .tw-checks li:nth-child(2) .tw-ring{animation-delay:1.2s}
html.motion-on .home .tw-checks li:nth-child(3) .tw-ring{animation-delay:2.4s}
html.motion-on .home .tw-checks li:nth-child(4) .tw-ring{animation-delay:3.6s}
html.motion-on .home .tw-checks li:nth-child(5) .tw-ring{animation-delay:4.8s}
html.motion-on .home .tw-checks li:nth-child(6) .tw-ring{animation-delay:6s}
html.motion-on .home :is(.tw-strip,.tw-cta) .tc-btn-arrow{animation:takt-nudge 3.2s ease-in-out infinite}

@media(prefers-reduced-motion:reduce){.bn-fill,.bn-node{transition:none}}
