/* Dashboard charts rise in and their bars grow when the chart scrolls into view. src/lib/client/chart-motion.js sets data-shown. */
/* The chart-motion class is only added when the browser allows motion, so without it every chart shows at once. */
/* Screen only, so a printed dashboard always shows every chart in full. */
@media screen{
html.chart-motion :is([data-reveal],.portfolio-graph){transition:opacity .55s ease-out,transform .55s cubic-bezier(.2,.8,.2,1)}
html.chart-motion :is([data-reveal],.portfolio-graph):not([data-shown]){opacity:0;transform:translateY(18px)}

/* Horizontal bars grow from their start, columns grow from the baseline. */
html.chart-motion :is([data-grow],.portfolio-chart-fill,.portfolio-column,.portfolio-status-chart>button>span,.portfolio-waterfall-bar){transform-box:fill-box;
  transition:transform .9s cubic-bezier(.2,.8,.2,1);transition-delay:calc(.15s + var(--i,0) * 70ms)}
html.chart-motion :is([data-grow=x],.portfolio-chart-fill){transform-origin:left center}
html.chart-motion [data-grow=x][data-from=end]{transform-origin:right center}
html.chart-motion :is([data-grow=y],.portfolio-column,.portfolio-status-chart>button>span,.portfolio-waterfall-bar){transform-origin:center bottom}
html.chart-motion :is([data-reveal],.portfolio-graph):not([data-shown]) :is([data-grow=x],.portfolio-chart-fill){transform:scaleX(0)}
html.chart-motion :is([data-reveal],.portfolio-graph):not([data-shown]) :is([data-grow=y],.portfolio-column,.portfolio-status-chart>button>span,.portfolio-waterfall-bar){transform:scaleY(0)}

/* Stacked bars are uncovered left to right as one bar, so their segments stay joined. */
html.chart-motion :is([data-grow=clip],.portfolio-health-stack){clip-path:inset(0);transition:clip-path 1s cubic-bezier(.2,.8,.2,1) .15s}
html.chart-motion :is([data-reveal],.portfolio-graph):not([data-shown]) :is([data-grow=clip],.portfolio-health-stack){clip-path:inset(0 100% 0 0)}

/* S-Curve lines draw one after another from their first date to the right, and reading dots pop in as their line arrives.
   A keyframe animation, not a transition, so a line switched back on from the legend draws in too. The margin keeps line ends unclipped. */
html.chart-motion [data-reveal]:not([data-shown]) :is([data-line],[data-line-dot]){opacity:0}
html.chart-motion [data-reveal][data-shown] [data-line]{animation:chart-line-draw 1.4s cubic-bezier(.35,.1,.25,1) both;animation-delay:calc(.45s + var(--line,0) * .9s)}
html.chart-motion [data-reveal][data-shown] [data-line-dot]{transform-box:fill-box;transform-origin:center;animation:chart-dot-pop .4s cubic-bezier(.2,.8,.2,1.4) both;animation-delay:calc(1.2s + var(--line,0) * .9s)}

/* Gauge and donut arcs sweep from their start. The CSS value overrides the dash attribute until the chart is shown. */
html.chart-motion [data-arc]{transition:stroke-dasharray 1.1s cubic-bezier(.2,.8,.2,1);transition-delay:calc(.2s + var(--i,0) * 90ms)}
html.chart-motion [data-reveal]:not([data-shown]) [data-arc]{stroke-dasharray:0 100}

/* Planned ticks drop in after their bar. */
html.chart-motion [data-tick]{transition:opacity .35s ease-out,translate .35s ease-out;transition-delay:calc(.75s + var(--i,0) * 70ms)}
html.chart-motion [data-reveal]:not([data-shown]) [data-tick]{opacity:0;translate:0 -8px}

/* Donut slices sweep round from their start. The CSS value overrides the dash attribute until the chart is shown. */
html.chart-motion .portfolio-donut circle{transition:stroke-dasharray 1s cubic-bezier(.2,.8,.2,1);transition-delay:calc(.15s + var(--i,0) * 90ms)}
html.chart-motion .portfolio-graph:not([data-shown]) .portfolio-donut circle{stroke-dasharray:0 300}

/* Pointing at one row or column fades the others so it is easy to read across. */
:is([data-hover-focus],.portfolio-column-chart,.portfolio-status-chart,.portfolio-waterfall-chart,.portfolio-health-list)>*{transition:opacity .2s ease-out}
:is([data-hover-focus],.portfolio-column-chart,.portfolio-status-chart,.portfolio-waterfall-chart,.portfolio-health-list):hover>:not(:hover){opacity:.45}
}
@keyframes chart-line-draw{from{clip-path:inset(-12px 100% -12px -12px)}to{clip-path:inset(-12px)}}
@keyframes chart-dot-pop{from{opacity:0;transform:scale(.2)}to{opacity:1;transform:scale(1)}}
@media (prefers-reduced-motion:reduce){html.chart-motion *{transition:none!important;animation:none!important}}
