/* chartmotion.css — subtle entrance motion for the charts drawn by charts.js.
 * Only active while the <svg> carries .zm-in (set by chartmotion.js for
 * ~0.8 s after a draw with new data; never on resize or a language switch).
 * Animates only opacity, transform and stroke-dashoffset. Every keyframe
 * animates FROM a hidden state TO the element's normal style, so the resting
 * chart is pixel-identical to today's. Users who ask for reduced motion get
 * no motion at all (the class is never set, and the rules sit behind
 * no-preference as a second guard).
 */
/* :root:not([data-motion="off"]): the header switch (nav.js) stops it too */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="off"]) .zm-in .ser .line {
    stroke-dasharray: 1;
    animation: zm-draw var(--zm-t, var(--dur-slower)) linear var(--zm-d, 0ms) both;
  }
  /* the band grows out of the line (SMIL, see chartmotion.js); a lone
     bucket's whisker grows out of its marker */
  :root:not([data-motion="off"]) .zm-in .ser .whisk {
    transform-box: fill-box;
    transform-origin: center;
    animation: zm-grow var(--dur-slow) var(--ease-out) var(--dur-slow) backwards;
  }
  :root:not([data-motion="off"]) .zm-in .ser .pt, :root:not([data-motion="off"]) .zm-in.sbars .seg {
    transform-box: fill-box;
  }
  :root:not([data-motion="off"]) .zm-in .ser .pt {
    transform-origin: center;
    animation: zm-pop var(--dur-slow) var(--ease-spring) var(--zm-d, 0ms) backwards;
  }
  :root:not([data-motion="off"]) .zm-in .marks, :root:not([data-motion="off"]) .zm-in .ref {
    animation: zm-fade var(--dur-slow) var(--ease-out) var(--dur-slow) backwards;
  }
  /* a forecast fades in once the history has been drawn */
  :root:not([data-motion="off"]) .zm-in .fcarea, :root:not([data-motion="off"]) .zm-in .ser .fband,
  :root:not([data-motion="off"]) .zm-in .ser .fline {
    animation: zm-fade var(--dur-slow) var(--ease-out) var(--dur-slower) backwards;
  }
  /* stacked bars: per bar the bottom segment grows from the axis, then the
     middle one on top of it, then the top one; bars start left to right */
  :root:not([data-motion="off"]) .zm-in.sbars .seg {
    transform-origin: bottom;
    animation: zm-grow var(--dur-base) var(--ease-out) var(--zm-d, 0ms) backwards;
  }
  /* heat grid: empty tiles first, then each cell fills through the scale at
     the same pace (STEP per step) and stops at its own step */
  :root:not([data-motion="off"]) .zm-in.hgrid { --zm-step: var(--dur-step); }
  :root:not([data-motion="off"]) .zm-in.hgrid .cells rect[data-k] {
    animation-timing-function: linear; animation-fill-mode: both; animation-delay: var(--zm-d, 0ms);
  }
  :root:not([data-motion="off"]) .zm-in.hgrid .cells .q1 { animation-name: zm-h1; animation-duration: var(--zm-step); }
  :root:not([data-motion="off"]) .zm-in.hgrid .cells .q2 { animation-name: zm-h2; animation-duration: calc(2 * var(--zm-step)); }
  :root:not([data-motion="off"]) .zm-in.hgrid .cells .q3 { animation-name: zm-h3; animation-duration: calc(3 * var(--zm-step)); }
  :root:not([data-motion="off"]) .zm-in.hgrid .cells .q4 { animation-name: zm-h4; animation-duration: calc(4 * var(--zm-step)); }
  :root:not([data-motion="off"]) .zm-in.hgrid .cells .q5 { animation-name: zm-h5; animation-duration: calc(5 * var(--zm-step)); }
  :root:not([data-motion="off"]) .zm-in.hgrid .cells .hatch { animation: zm-fade var(--dur-base) var(--ease-out) var(--zm-d, 0ms) backwards; }
  /* old weekday x hour heatmap: the grid fades in as one */
  :root:not([data-motion="off"]) .zm-in.hmap .cells {
    animation: zm-fade var(--dur-slow) var(--ease-out) backwards;
  }
  /* perf.js request timeline: marks pop in with the sweep, the running
     median draws along */
  :root:not([data-motion="off"]) .zm-in.zp-chart .zp-pt, :root:not([data-motion="off"]) .zm-in.zp-chart .zp-fail, :root:not([data-motion="off"]) .zm-new .zm-fresh {
    transform-box: fill-box;
    transform-origin: center;
  }
  :root:not([data-motion="off"]) .zm-in.zp-chart .zp-pt, :root:not([data-motion="off"]) .zm-in.zp-chart .zp-fail {
    animation: zm-pop var(--dur-slow) var(--ease-spring) var(--zm-d, 0ms) backwards;
  }
  :root:not([data-motion="off"]) .zm-in .zp-trend path {
    stroke-dasharray: 1;
    animation: zm-draw var(--zm-t, var(--dur-slower)) linear var(--zm-d, 0ms) both;
  }
  /* the p25–p75 band grows out of its line (SMIL, see chartmotion.js); one
     cut at a focused range's top edge shows once the line has drawn */
  :root:not([data-motion="off"]) .zm-in .zp-band path.zm-fd {
    animation: zm-fade var(--dur-slow) var(--ease-out) var(--dur-slow) backwards;
  }
  /* perf.js axis change: requests, ticks and grid lines slide to their new
     place (the lines and bands morph, SMIL); what is new fades in */
  :root:not([data-motion="off"]) .zm-rs .zm-mv {
    animation: zm-slide var(--dur-slow) var(--ease-out) backwards;
  }
  :root:not([data-motion="off"]) .zm-rs .zm-fd {
    animation: zm-fade var(--dur-slow) var(--ease-out) backwards;
  }
  :root:not([data-motion="off"]) .zm-new .zp-pt.zm-fresh, :root:not([data-motion="off"]) .zm-new .zp-fail.zm-fresh {
    animation: zm-pop var(--dur-slow) var(--ease-spring) backwards;
  }
  /* live view: only the newest points pop in */
  :root:not([data-motion="off"]) .zm-new .ser .pt.zm-fresh {
    transform-box: fill-box;
    transform-origin: center;
    animation: zm-pop var(--dur-slow) var(--ease-spring) backwards;
  }
  /* donut: the ring draws clockwise, part after part (chartmotion.js sets
     each arc's length, start and duration) */
  :root:not([data-motion="off"]) .zm-in.donut .arc {
    animation: zm-arc var(--zm-t, var(--dur-slow)) linear var(--zm-d, 0ms) both;
  }
  /* meters: each part grows from the left */
  :root:not([data-motion="off"]) .zm-in .meter .mseg {
    transform-origin: left;
    animation: zm-grow-x var(--dur-slow) var(--ease-out) var(--zm-d, 0ms) backwards;
  }
  /* tooltip: fades in instead of blinking in (it is aria-hidden; the data
     table carries the same values) */
  :root:not([data-motion="off"]) .ctip:not([hidden]) { animation: zm-tip var(--dur-fast) var(--ease-out); }
}
@keyframes zm-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes zm-fade { from { opacity: 0; } }
@keyframes zm-slide { from { transform: translate(var(--zm-dx, 0px), var(--zm-dy, 0px)); } }
@keyframes zm-pop { from { opacity: 0; transform: scale(0.35); } }
@keyframes zm-grow { from { transform: scaleY(0); } }
@keyframes zm-grow-x { from { transform: scaleX(0); } }
@keyframes zm-arc { from { stroke-dashoffset: var(--zm-len, 0); } }
/* heat grid fill: first leg turns the empty tile into the lightest step, each
   further leg darkens one step (equal time per step = the same pace) */
@keyframes zm-h1 {
  0% { fill: var(--sunken); }
  100% { fill: var(--heat-1); }
}
@keyframes zm-h2 {
  0% { fill: var(--sunken); }
  50% { fill: var(--heat-1); }
  100% { fill: var(--heat-2); }
}
@keyframes zm-h3 {
  0% { fill: var(--sunken); }
  33.33% { fill: var(--heat-1); }
  66.67% { fill: var(--heat-2); }
  100% { fill: var(--heat-3); }
}
@keyframes zm-h4 {
  0% { fill: var(--sunken); }
  25% { fill: var(--heat-1); }
  50% { fill: var(--heat-2); }
  75% { fill: var(--heat-3); }
  100% { fill: var(--heat-4); }
}
@keyframes zm-h5 {
  0% { fill: var(--sunken); }
  20% { fill: var(--heat-1); }
  40% { fill: var(--heat-2); }
  60% { fill: var(--heat-3); }
  80% { fill: var(--heat-4); }
  100% { fill: var(--heat-5); }
}
@keyframes zm-tip { from { opacity: 0; transform: translateY(3px); } }
