/* Samskara motion. The rules are documentation/motion.md; this file is the
   half a browser can read. Springs are linear() curves sampled from a real
   spring's step response, so one token carries both the ease and the tiny
   overshoot. Nothing here animates blur, glow or a gradient.

   Role tokens are what surfaces use. Under reduced motion each role swaps to
   its substitute in the block at the end, so a surface never writes its own
   media query for these. */
/* spring tokens: generated by scripts/motion_springs.py, do not hand-edit */
:root{
  --spring-snappy: linear(0, 0.0135, 0.0486, 0.0987, 0.1584, 0.2237, 0.2915, 0.3592, 0.4253, 0.4884, 0.5477, 0.6028, 0.6533, 0.6992, 0.7405, 0.7774, 0.8101, 0.839, 0.8642, 0.8862, 0.9052, 0.9216, 0.9356, 0.9475, 0.9576, 0.966, 0.9731, 0.979, 0.9838, 0.9878, 0.991, 0.9936, 1);
  --spring-snappy-d: 220ms;
  --spring-smooth: linear(0, 0.0238, 0.0816, 0.1582, 0.2431, 0.3294, 0.4129, 0.4909, 0.562, 0.6256, 0.6819, 0.731, 0.7736, 0.8101, 0.8412, 0.8677, 0.89, 0.9088, 0.9246, 0.9377, 0.9487, 0.9578, 0.9653, 0.9716, 0.9767, 0.9809, 0.9844, 0.9873, 0.9896, 0.9916, 0.9931, 0.9944, 1);
  --spring-smooth-d: 360ms;
  --spring-gentle: linear(0, 0.0231, 0.0795, 0.1545, 0.2379, 0.323, 0.4055, 0.4829, 0.5537, 0.6174, 0.6738, 0.7233, 0.7663, 0.8033, 0.835, 0.8621, 0.885, 0.9043, 0.9206, 0.9342, 0.9456, 0.9551, 0.963, 0.9695, 0.9749, 0.9794, 0.9831, 0.9862, 0.9887, 0.9908, 0.9925, 0.9938, 1);
  --spring-gentle-d: 650ms;
}
/* end spring tokens */
:root{
  /* role tokens */
  --m-press-ease: var(--spring-snappy);  --m-press-d: var(--spring-snappy-d);  --m-press-scale: .97;
  --m-morph-ease: var(--spring-smooth);  --m-morph-d: var(--spring-smooth-d);
  --m-pop-ease: var(--spring-snappy);    --m-pop-d: var(--spring-snappy-d);    --m-pop-rise: 4px;
  --m-toast-ease: var(--spring-smooth);  --m-toast-d: var(--spring-smooth-d);  --m-toast-rise: 12px;
  --m-list-ease: var(--spring-smooth);   --m-list-d: var(--spring-smooth-d);
  --m-camera-ease: var(--spring-gentle); --m-camera-d: var(--spring-gentle-d);
  /* the content swap: the old content leaves first, then the new arrives,
     so two texts never share a frame */
  --m-swap-out-ease: cubic-bezier(.4,0,1,1); --m-swap-out-d: 90ms;
  --m-swap-in-ease: var(--spring-smooth);    --m-swap-in-d: 180ms;
  --m-swap-shift: 2px;
  --m-exit-ease: cubic-bezier(.4,0,1,1); --m-exit-d: 150ms;
}

/* press: the control gives under the pointer and springs back on release */
.m-press{transition:transform var(--m-press-d) var(--m-press-ease)}
.m-press:active:not(:disabled){transform:scale(var(--m-press-scale))}

/* popover and menu-like floats: fade and a 4px rise in, a plain fade out. A dialog or popover goes from
   display none to shown in one step, so its first frame is named by @starting-style and its display and
   top layer wait for the fade out (transition-behavior: allow-discrete); a browser without either shows it
   at once, as before */
.m-pop{opacity:0;transform:translateY(var(--m-pop-rise));pointer-events:none;
  transition:opacity var(--m-exit-d) var(--m-exit-ease),transform var(--m-exit-d) var(--m-exit-ease),
    display var(--m-exit-d) allow-discrete,overlay var(--m-exit-d) allow-discrete}
.m-pop.is-open,.m-pop[open],.m-pop:popover-open{opacity:1;transform:none;pointer-events:auto;
  transition:opacity var(--m-pop-d) var(--m-pop-ease),transform var(--m-pop-d) var(--m-pop-ease)}
@starting-style{.m-pop.is-open,.m-pop[open],.m-pop:popover-open{opacity:0;transform:translateY(var(--m-pop-rise))}}

/* toast: rises from the bottom edge, leaves by fading */
.m-toast{opacity:0;transform:translateY(var(--m-toast-rise));
  transition:opacity var(--m-exit-d) var(--m-exit-ease),transform var(--m-exit-d) var(--m-exit-ease)}
.m-toast.is-shown{opacity:1;transform:none;
  transition:opacity var(--m-toast-d) var(--m-toast-ease),transform var(--m-toast-d) var(--m-toast-ease)}

/* list rows: motion.js sets --m-list-from on a moved row and clears it */
.m-list > *{transition:transform var(--m-list-d) var(--m-list-ease),opacity var(--m-list-d) var(--m-list-ease)}
.m-list > .m-entering{opacity:0;transform:translateY(-4px);transition:none}
.m-list > .m-leaving{opacity:0;transition:opacity var(--m-exit-d) var(--m-exit-ease)}

/* the content swap that motion.js drives */
.m-swap-out{opacity:0;transform:translateY(calc(var(--m-swap-shift) * -1));
  transition:opacity var(--m-swap-out-d) var(--m-swap-out-ease),transform var(--m-swap-out-d) var(--m-swap-out-ease)}
.m-swap-in-start{opacity:0;transform:translateY(var(--m-swap-shift));transition:none}
.m-swap-in{opacity:1;transform:none;
  transition:opacity var(--m-swap-in-d) var(--m-swap-in-ease),transform var(--m-swap-in-d) var(--m-swap-in-ease)}

/* the morph: one element carries its box from one state to the next */
.m-morph{transition:width var(--m-morph-d) var(--m-morph-ease),height var(--m-morph-d) var(--m-morph-ease),
  border-radius var(--m-morph-d) var(--m-morph-ease),background-color var(--m-morph-d) var(--m-morph-ease),
  color var(--m-morph-d) var(--m-morph-ease),transform var(--m-morph-d) var(--m-morph-ease)}
::view-transition-group(*){animation-duration:var(--m-morph-d);animation-timing-function:var(--m-morph-ease)}
::view-transition-old(*),::view-transition-new(*){animation-duration:var(--m-swap-in-d)}

/* The shell's recipes (documentation/motion.md, "Motion for lanes"): on the
   --os-d-* scale of system.css, with its values standing in on a page that
   loads motion.css alone. */
:root{
  --m-d-1: var(--os-d-1, 160ms); --m-d-2: var(--os-d-2, 240ms); --m-d-3: var(--os-d-3, 480ms);
  --m-ease: var(--os-ease, cubic-bezier(.2,.7,.2,1)); --m-ease-in: cubic-bezier(.4,0,1,1);
  --m-give: .97;
  --m-menu-from: .96; --m-menu-in-d: 100ms; --m-menu-out-d: 80ms;
  --m-seg-d: var(--m-d-1);
  --m-fill-d: var(--m-d-2);
  --m-bar-d: var(--m-d-2);
  --m-check-d: var(--m-d-3);
}
/* a shell page's root: the list and press roles run on the shell's scale */
.m-os{--m-list-d: var(--m-d-2); --m-list-ease: var(--m-ease); --m-press-d: var(--m-d-1); --m-press-ease: var(--m-ease)}

/* the shell's press: a button gives to 97 percent while it is held */
.m-give{transition:scale var(--m-d-1) var(--m-ease)}
.m-give:active:not(:disabled):not([aria-disabled="true"]){scale:var(--m-give)}

/* a menu or popover grows from the control that opened it (motion.js menu()
   sets --m-origin there) and leaves a fifth faster on the exit curve */
.m-menu{transform-origin:var(--m-origin, top left); opacity:0; scale:var(--m-menu-from); pointer-events:none;
  transition:opacity var(--m-menu-out-d) var(--m-ease-in),scale var(--m-menu-out-d) var(--m-ease-in)}
.m-menu.is-open{opacity:1; scale:1; pointer-events:auto;
  transition:opacity var(--m-menu-in-d) ease,scale var(--m-menu-in-d) var(--m-ease)}

/* a segmented control: the one mark under the chosen segment moves to the
   next one at the press duration (motion.js seg()); the segments never move */
.m-seg{position:relative; isolation:isolate}
.m-seg-mark{position:absolute; z-index:-1; top:0; left:0; transform-origin:0 0; pointer-events:none;
  transition:background-color var(--m-seg-d) ease,box-shadow var(--m-seg-d) ease,opacity var(--m-seg-d) ease}

/* a module whose read is on its way holds still in its own shape, then its
   content fades in over --os-d-2 (motion.js pending()) */
.m-skel-ph{display:grid; gap:8px; padding:4px 0; transition:opacity var(--m-fill-d) ease}
.m-skel-ph i{display:block; width:82%; height:10px; border-radius:5px; background:color-mix(in srgb, currentColor 9%, transparent)}
.m-skel-ph i:first-child{width:38%; height:13px}
.m-skel-ph i:last-child{width:64%}
.m-fill-start{opacity:0; transition:none}
.m-fill{transition:opacity var(--m-fill-d) ease}

/* a determinate bar: the fill scales along its length, never its width */
.m-bar{display:block; height:3px; border-radius:2px; overflow:hidden; background:color-mix(in srgb, currentColor 14%, transparent)}
.m-bar > i{display:block; height:100%; background:AccentColor; transform-origin:left; scale:var(--m-p, 0) 1;
  transition:scale var(--m-bar-d) var(--m-ease)}

/* the drawn check: one stroke over --os-d-3 (motion.js check()) */
.m-check{display:inline-block; flex:none; width:14px; height:14px; vertical-align:-2px; overflow:visible}
.m-check path{fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;
  stroke-dasharray:1; stroke-dashoffset:1; transition:stroke-dashoffset var(--m-check-d) var(--m-ease)}
.m-check.is-drawn path{stroke-dashoffset:0}

/* a figure written in place keeps its width as its digits change */
.m-num{font-variant-numeric:tabular-nums}

/* reduced motion: travel and scale go, a fade stays where the state change
   needs one, and the morph lands at once */
@media (prefers-reduced-motion: reduce){
  :root, .m-os{
    --m-press-scale: 1; --m-press-d: 0s;
    --m-morph-d: 0s;
    --m-pop-rise: 0px; --m-pop-ease: linear; --m-pop-d: 150ms;
    --m-toast-rise: 0px; --m-toast-d: 0s;
    --m-list-d: 0s;
    --m-camera-d: 0s;
    --m-swap-shift: 0px; --m-swap-out-d: 0s; --m-swap-in-ease: linear; --m-swap-in-d: 150ms;
    --m-give: 1; --m-menu-from: 1; --m-seg-d: 0s; --m-bar-d: 0s; --m-check-d: 0s;
  }
  ::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}
}
