/* motion: version 6's motion system (../../old/explore/DIRECTION-v6.md section 2), loaded last. app/motion.js runs it.
   The tokens; the page transitions (the View Transitions API; html.vt-on and html.vt-<kind> while one runs, html.vt-chrome
   when both pages have the side menu); the side menu's gliding tab and the tab bar's mark; bars that grow on a page's first
   render (html.mo-enter); the buy card's wipe; the overlays; checks that draw; the green moment.
   html.mo-still (Motion: off, or prefers-reduced-motion) keeps every change and drops the movement: nothing here runs under
   it, and a page change is a plain cross-fade of the whole page in --dur-1 (html.vt-fade). Durations that aren't tokens are
   multiplied by --mo-k, which window.__moSlow(factor) sets. No font-size in this file. */

:root {
  --dur-1: 120ms;   /* color: hover, press */
  --dur-2: 200ms;   /* small things: menus, toasts, chips */
  --dur-3: 280ms;   /* pages and flows */
  --dur-4: 420ms;   /* figures, bars, things that move in a list */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: linear(0, 0.18 8%, 0.62 20%, 0.93 33%, 1.04 45%, 1.02 60%, 1);   /* a soft overshoot, for the green moment only */
  --mo-k: 1;
}

/* A figure that counts keeps its width while it counts */
[data-num] { font-variant-numeric: tabular-nums; }

/* =================================================================
   Page transitions
   ================================================================= */
@keyframes mo-in { from { opacity: 0; } }
@keyframes mo-out { to { opacity: 0; } }
@keyframes mo-in-up8 { from { opacity: 0; transform: translateY(8px); } }
@keyframes mo-in-up12 { from { opacity: 0; transform: translateY(12px); } }
@keyframes mo-up16 { from { transform: translateY(16px); } }
@keyframes mo-out-down16 { to { opacity: 0; transform: translateY(16px); } }
@keyframes mo-from-right { from { transform: translateX(24px); } }
@keyframes mo-from-left { from { transform: translateX(-24px); } }
@keyframes mo-out-left { to { opacity: 0; transform: translateX(-24px); } }
@keyframes mo-out-right { to { opacity: 0; transform: translateX(24px); } }

/* Every group moves on the page's clock unless its kind says otherwise */
::view-transition-group(*) { animation-duration: var(--dur-3); animation-timing-function: var(--ease-out); }

/* The hand-over, for every kind below: the page leaving is gone in about 100ms (it fades fast, so it's out of the way at once),
   and the page arriving starts at 80, when the other is all but gone. Two pages, two titles or two sets of buttons never show
   at once, and the arrival still reads. Chrome sends every click to <html> while a transition runs, so motion.js ends one that
   a click lands on and passes the click to the page under it */

/* Always, while a transition runs: the switcher and a toast stay put, above everything */
html.vt-on .proto { view-transition-name: vt-proto; }
html.vt-on .toast { view-transition-name: vt-toast; }
::view-transition-group(vt-proto), ::view-transition-group(vt-toast) { z-index: 9; }

/* Between two pages with the side menu: the menu and the phone's bars don't move; the white tab and the tab bar's mark glide.
   The tab sits over the menu's gray and under its labels, so the groups stack: the menu, the tab, then the two lists */
html.vt-chrome .rail { view-transition-name: vt-rail; }
html.vt-chrome .rail .nav:not(.nav-2) { view-transition-name: vt-nav; }
html.vt-chrome .rail .nav-2 { view-transition-name: vt-nav2; }
html.vt-chrome .nav-tab { view-transition-name: nav-tab; }
html.vt-chrome .topbar { view-transition-name: vt-top; }
html.vt-chrome .tabbar { view-transition-name: vt-tabbar; }
html.vt-chrome .tab-mark { view-transition-name: tab-mark; }
::view-transition-group(vt-rail) { z-index: 1; }
::view-transition-group(nav-tab) { z-index: 2; }
::view-transition-group(vt-nav), ::view-transition-group(vt-nav2) { z-index: 3; }
::view-transition-group(vt-title) { z-index: 4; }
::view-transition-group(vt-top), ::view-transition-group(vt-tabbar) { z-index: 5; }
::view-transition-group(tab-mark) { z-index: 6; }
/* The tab changes height between an item (40) and a sub-item (36): its picture fills the moving box */
::view-transition-old(nav-tab), ::view-transition-new(nav-tab) { height: 100%; }

/* The page itself (the root). Lateral: the old page fades (100), the new one fades in rising 8px (220, from 80) */
html.vt-lateral::view-transition-old(root) { animation: calc(100ms * var(--mo-k)) var(--ease-out) both mo-out; mix-blend-mode: normal; }
html.vt-lateral::view-transition-new(root) { animation: calc(220ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-in-up8; mix-blend-mode: normal; }
/* Forward: the old page slides 24px left as it fades (80); the new one slides in 24px from the right (240, from 80) and fades
   in (180). Back is its mirror. With a title flying (vt-titled) the new page comes from 120, when the title is all but home, so
   it never lands across the lines around it */
html.vt-forward::view-transition-old(root) { animation: calc(80ms * var(--mo-k)) var(--ease-out) both mo-out-left; mix-blend-mode: normal; }
html.vt-forward::view-transition-new(root) { animation: calc(240ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-from-right, calc(180ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-in; mix-blend-mode: normal; }
html.vt-back::view-transition-old(root) { animation: calc(80ms * var(--mo-k)) var(--ease-out) both mo-out-right; mix-blend-mode: normal; }
html.vt-back::view-transition-new(root) { animation: calc(240ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-from-left, calc(180ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-in; mix-blend-mode: normal; }
html.vt-titled.vt-forward::view-transition-new(root) { animation: calc(240ms * var(--mo-k)) var(--ease-out) calc(120ms * var(--mo-k)) both mo-from-right, calc(180ms * var(--mo-k)) var(--ease-in-out) calc(120ms * var(--mo-k)) both mo-in; }
html.vt-titled.vt-back::view-transition-new(root) { animation: calc(240ms * var(--mo-k)) var(--ease-out) calc(120ms * var(--mo-k)) both mo-from-left, calc(180ms * var(--mo-k)) var(--ease-in-out) calc(120ms * var(--mo-k)) both mo-in; }
/* Into a flow: the page fades (90), and the flow rises 16px like a sheet (280, from 50), opaque within 140 of its start, so the
   page never shows through it */
html.vt-into-flow::view-transition-old(root) { animation: calc(90ms * var(--mo-k)) var(--ease-out) both mo-out; mix-blend-mode: normal; }
html.vt-into-flow::view-transition-new(root) { animation: var(--dur-3) var(--ease-out) calc(50ms * var(--mo-k)) both mo-up16, calc(140ms * var(--mo-k)) var(--ease-out) calc(50ms * var(--mo-k)) both mo-in; mix-blend-mode: normal; }
/* Out of a flow: the flow sinks 16px and fades (120), and only then the page fades in (200, from 100) */
html.vt-out-of-flow::view-transition-old(root) { z-index: 1; animation: calc(120ms * var(--mo-k)) var(--ease-in-out) both mo-out-down16; mix-blend-mode: normal; }
html.vt-out-of-flow::view-transition-new(root) { animation: var(--dur-2) var(--ease-out) calc(100ms * var(--mo-k)) both mo-in; mix-blend-mode: normal; }

/* A step in a flow: the question column, its foot and buttons included, slides 24px (Continue from the right, Back from the
   left): the old step goes (100), the new one comes from 80 (240, fading in over 160). The two columns are separate pictures,
   each in its own place, so a page scrolled down to Continue doesn't slide up. At 1024 and wider the dark panel stays (it's
   fixed beside the question) and what changes in it cross-fades (200); narrower, it scrolls with the page and goes with it. The
   frame, the progress line with it, cross-fades in --dur-1. motion.js adds vt-new to <html> once the new step is in */
html:is(.vt-step-next, .vt-step-back):not(.vt-new) .flow-main { view-transition-name: vt-q-old; }
html:is(.vt-step-next, .vt-step-back).vt-new .flow-main { view-transition-name: vt-q-new; }
@media (min-width: 1024px) { html:is(.vt-step-next, .vt-step-back) #panel { view-transition-name: vt-panel; } }
::view-transition-group(vt-panel) { animation-duration: var(--dur-2); }
html:is(.vt-step-next, .vt-step-back)::view-transition-old(root), html:is(.vt-step-next, .vt-step-back)::view-transition-new(root) { animation-duration: var(--dur-1); }
html.vt-step-next::view-transition-old(vt-q-old) { animation: calc(100ms * var(--mo-k)) var(--ease-out) both mo-out-left; }
html.vt-step-next::view-transition-new(vt-q-new) { animation: calc(240ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-from-right, calc(160ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-in; }
html.vt-step-back::view-transition-old(vt-q-old) { animation: calc(100ms * var(--mo-k)) var(--ease-out) both mo-out-right; }
html.vt-step-back::view-transition-new(vt-q-new) { animation: calc(240ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-from-left, calc(160ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-in; }
/* A frame without the dark panel (none today) lets it go, or come, with the step */
::view-transition-old(vt-panel):only-child { animation: calc(100ms * var(--mo-k)) var(--ease-out) both mo-out; }
::view-transition-new(vt-panel):only-child { animation: calc(160ms * var(--mo-k)) var(--ease-out) calc(80ms * var(--mo-k)) both mo-in; }
/* Continue fills the new step's segment of the progress line */
html.vt-step-next:not(.mo-still) .progress li.now { transform-origin: 0 50%; animation: mo-grow var(--dur-3) var(--ease-out) calc(80ms * var(--mo-k)) both; }

/* The shared title: the element she clicked (motion.js gives it .mo-vt-title) morphs into the new page's h1, and back. Its box
   hugs its text for the capture, so the picture scales like the type does. It flies as one picture, the arriving page's title
   scaled from the other's box: the leaving one hands over in place in the first 60ms, so two type sizes never show at once.
   It waits 30 for the old page to be all but gone, so it crosses nothing, and lands at 210 */
#app .mo-vt-title { view-transition-name: vt-title; width: fit-content; max-width: 100%; padding-inline-end: 0; }   /* a door's title keeps 80 clear of its art: not in its picture */
::view-transition-group(vt-title) { animation-duration: calc(180ms * var(--mo-k)); animation-delay: calc(30ms * var(--mo-k)); }
::view-transition-old(vt-title) { animation: calc(60ms * var(--mo-k)) linear both mo-out; }
::view-transition-new(vt-title) { animation: calc(60ms * var(--mo-k)) linear both mo-in; }
/* A title with no partner on the other page leaves with its page */
html.vt-forward::view-transition-old(vt-title):only-child { animation: calc(80ms * var(--mo-k)) var(--ease-out) both mo-out-left; }
html.vt-back::view-transition-old(vt-title):only-child { animation: calc(80ms * var(--mo-k)) var(--ease-out) both mo-out-right; }

/* Motion off, or reduced motion (html.mo-still): a page change is a plain cross-fade of the whole page in --dur-1, with nothing
   named, so the change is still signalled and nothing moves (the browser's own fade, which keeps what's the same on both pages
   steady instead of dimming it) */
html.vt-fade::view-transition-group(*) { animation-duration: var(--dur-1); }
html.vt-fade::view-transition-old(root), html.vt-fade::view-transition-new(root) { animation-duration: var(--dur-1); animation-timing-function: linear; }

/* =================================================================
   The side menu's tab and the tab bar's mark (motion.js puts them in after each render)
   ================================================================= */
/* One white tab under the current item or sub-item; the item's own fill and edge go transparent while it's there */
.rail .nav-sub a { position: relative; }
.nav-tab { position: absolute; inset: 0; z-index: -1; border-radius: var(--r-md); background: var(--canvas); box-shadow: inset 0 0 0 1px var(--rail-line); pointer-events: none; }
.rail .nav-item.mo-tabbed[aria-current], .rail .nav-sub a.mo-tabbed[aria-current="page"] { background: transparent; box-shadow: none; }
/* Under 1024: a 32 by 3 green bar on the tab bar's top edge, over the current section's green icon */
.tab-mark { position: absolute; top: -1px; left: calc(50% - 16px); width: 32px; height: 3px; border-radius: 0 0 2px 2px; background: var(--green); pointer-events: none; }

/* =================================================================
   Inside a page
   ================================================================= */
@keyframes mo-grow { from { transform: scaleX(0); } }
/* Bars grow on a page's first render (html.mo-enter for 700ms after a path change), 40ms apart per bar; motion.js sets each
   segment's origin at its bar's left edge, so the green and the lime grow as one bar */
html.mo-enter:not(.mo-still) .casebar > i { transform-origin: 0 50%; animation: mo-grow var(--dur-4) var(--ease-out) both; animation-delay: calc(var(--mo-i, 0) * 40ms * var(--mo-k)); }
/* The claim tracker's done segments fill left to right */
html.mo-enter:not(.mo-still) .tracker > .on { transform-origin: 0 50%; animation: mo-grow var(--dur-3) var(--ease-out) both; }
html.mo-enter:not(.mo-still) .tracker > .on:nth-child(2) { animation-delay: calc(100ms * var(--mo-k)); }
html.mo-enter:not(.mo-still) .tracker > .on:nth-child(3) { animation-delay: calc(200ms * var(--mo-k)); }
html.mo-enter:not(.mo-still) .tracker > .on:nth-child(4) { animation-delay: calc(300ms * var(--mo-k)); }

/* Checks draw: a done mark's check (motion.js gives its path pathLength 1 and .mo-drawing) */
@keyframes mo-draw { from { stroke-dashoffset: 1.05; } to { stroke-dashoffset: 0; } }
.mo-drawing { stroke-dasharray: 1 3; animation: mo-draw calc(160ms * var(--mo-k)) var(--ease-out) both; }
/* A checkbox's tick: a green cover over the tick slides off to the right, so the tick appears from its left end */
@keyframes mo-tick { from { background-position: 0 0, center; } to { background-position: 24px 0, center; } }
html:not(.mo-still) input.cbox.mo-tick:checked {
  background-image: linear-gradient(var(--green), var(--green)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E");
  background-size: 100% 100%, 20px; background-repeat: no-repeat;
  animation: mo-tick calc(160ms * var(--mo-k)) var(--ease-out) both;
}

/* =================================================================
   Overlays
   ================================================================= */
@keyframes mo-pop { from { transform: scale(0.98); } }
/* The command bar fades in and grows from 0.98 at its top (200); it leaves as a fading copy in 120 (motion.js) */
html:not(.mo-still) .scrim:not(.mo-ghost) { animation: mo-in var(--dur-2) var(--ease-out); }
html:not(.mo-still) .scrim:not(.mo-ghost) > .cmdk { transform-origin: 50% 0; animation: mo-pop var(--dur-2) var(--ease-out); }
.mo-ghost { pointer-events: none; }
/* The profile menu grows from its button's corner (200) and leaves faster (120) */
.rail .pmenu { transform-origin: 0 100%; }
.topbar .pmenu { transform-origin: 100% 0; }
html:not(.mo-still) .pmenu { transition: opacity var(--dur-1) var(--ease-in-out), transform var(--dur-1) var(--ease-in-out), display var(--dur-1) allow-discrete; }
html:not(.mo-still) .pmenu:not([hidden]) { transition-duration: var(--dur-2); transition-timing-function: var(--ease-out); }
html:not(.mo-still) .pmenu[hidden] { opacity: 0; transform: scale(0.98); pointer-events: none; }
@starting-style { html:not(.mo-still) .pmenu:not([hidden]) { opacity: 0; transform: scale(0.98); } }
/* Toasts rise 12px into place (200) and fade out (120); with motion off they only fade */
html:not(.mo-still) .toast { transform: translate(-50%, 12px); transition: opacity var(--dur-1) var(--ease-in-out), transform var(--dur-1) var(--ease-in-out), visibility 0s var(--dur-1); }
html:not(.mo-still) .toast.on { transform: translate(-50%, 0); transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), visibility 0s; }
html.mo-still .toast { transform: translate(-50%, 0); }
/* The tour's card and its spotlight fade in */
html:not(.mo-still) .coach, html:not(.mo-still) .coach-hole { animation: mo-in var(--dur-2) var(--ease-out); }

/* =================================================================
   The green moment: once per order (.gm-play), the buildings rise out of their own bottom edge one after another, 60ms
   apart, with a soft overshoot, and the headline fades up
   ================================================================= */
@keyframes mo-rise { from { transform: translateY(100%); } }
@keyframes mo-rise-svg { from { transform: translateY(64px); } }
html:not(.mo-still) .gm-play .gm-b > img { animation: mo-rise calc(560ms * var(--mo-k)) var(--ease-spring) both; animation-delay: calc((120ms + var(--i, 0) * 60ms) * var(--mo-k)); }
html:not(.mo-still) .gm-play g.gm-b { animation: mo-rise-svg calc(560ms * var(--mo-k)) var(--ease-spring) both; animation-delay: calc((120ms + var(--i, 0) * 60ms) * var(--mo-k)); }
html:not(.mo-still) .gm-play .gm-msg h1 { animation: mo-in-up12 var(--dur-4) var(--ease-out) both; }
