/* wui-motion.css — pohybove tokeny opsane ze zdrojaku WinUI 3.
   Jedine misto, kde jsou hodnoty. Zdroje a zduvodneni: _projekt/EXPLORER_MOTION.md
   Nazvy odpovidaji klicum WinUI, ne vlastni fantazii. */

:root {
  /* controls/dev/CommonStyles/Common_themeresources_any.xaml */
  --wui-faster: 83ms;               /* ControlFasterAnimationDuration  00:00:00.083 */
  --wui-fast: 167ms;                /* ControlFastAnimationDuration    00:00:00.167 */
  --wui-fast-after: 168ms;          /* ControlFastAnimationAfterDuration 00:00:00.168 */
  --wui-normal: 250ms;              /* ControlNormalAnimationDuration  00:00:00.250 */
  --wui-fast-out-slow-in: cubic-bezier(0, 0, 0, 1);   /* ControlFastOutSlowInKeySpline  0,0,0,1 */

  /* dxaml/xcp/components/comptree/SharedTransitionAnimations.cpp:22
     CreateCubicBezierEasingFunction(compositor, {0.8, 0.0}, {0.2, 1.0}) */
  --wui-implicit: cubic-bezier(0.8, 0, 0.2, 1);

  /* dxaml/xcp/dxaml/themes/generic.xaml */
  --wui-pane-open: 200ms;           /* SplitViewPaneAnimationOpenDuration */
  --wui-pane-close: 100ms;          /* SplitViewPaneAnimationCloseDuration */
  --wui-scrollbar: 100ms;           /* ScrollBarExpandDuration / ContractDuration */

  /* controls/dev/TabView/TabView.xaml */
  --wui-tab-reposition: 200ms;      /* Duration="0:0:0.2" */
  --wui-tab-opacity: 240ms;         /* Duration="0:0:0.240" */

  /* controls/dev/ProgressBar/ProgressBar.xaml, stav Indeterminate */
  --wui-progress-cycle: 2000ms;     /* RepeatBehavior="Forever", cyklus 2 s */
  --wui-progress-spline: cubic-bezier(0.4, 0, 0.6, 1);   /* KeySpline="0.4,0.0,0.6,1.0" */
  --wui-progress-color: 167ms;      /* Duration="0:0:0.167" na (Shape.Fill) */

  /* dxaml/xcp/dxaml/lib/ToolTipService_Partial.cpp:1793 — SPI_GETMOUSEHOVERTIME */
  --wui-tooltip-delay: 400ms;

  /* prepinac: 1 = pohyb zapnuty, 0 = vypnuty (nasobi se do trvani) */
  --wui-on: 1;
}

/* ── vypnuti pohybu ────────────────────────────────────────────────
   Tri cesty ke stejnemu vysledku: systemove nastaveni, prepinac
   v Nastaveni a atribut na <html> pro zpomaleni v /motion-lab. */

html.wui-bez-pohybu,
html[data-wui-motion="off"] {
  --wui-faster: 0ms;
  --wui-fast: 0ms;
  --wui-fast-after: 0ms;
  --wui-normal: 0ms;
  --wui-pane-open: 0ms;
  --wui-pane-close: 0ms;
  --wui-scrollbar: 0ms;
  --wui-tab-reposition: 0ms;
  --wui-tab-opacity: 0ms;
  --wui-progress-cycle: 0ms;
  --wui-progress-color: 0ms;
  --wui-on: 0;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-wui-motion="on"]) {
    --wui-faster: 0ms;
    --wui-fast: 0ms;
    --wui-fast-after: 0ms;
    --wui-normal: 0ms;
    --wui-pane-open: 0ms;
    --wui-pane-close: 0ms;
    --wui-scrollbar: 0ms;
    --wui-tab-reposition: 0ms;
    --wui-tab-opacity: 0ms;
    --wui-progress-cycle: 0ms;
    --wui-progress-color: 0ms;
    --wui-on: 0;
  }
}

/* Zpomaleni pro /motion-lab. Nemeni hodnoty, jen je nasobi. */
html[data-wui-slow="4"] {
  --wui-faster: 332ms;
  --wui-fast: 668ms;
  --wui-fast-after: 672ms;
  --wui-normal: 1000ms;
  --wui-pane-open: 800ms;
  --wui-pane-close: 400ms;
  --wui-tab-reposition: 800ms;
  --wui-tab-opacity: 960ms;
  --wui-progress-cycle: 8000ms;
  --wui-progress-color: 668ms;
}

/* ── sdilene animace ───────────────────────────────────────────────
   Nabidka / flyout: prolnuti 83 ms linear + posun 167 ms fast-out-slow-in.
   Odvozeno z ContentDialog (jediny plne zdrojovany open/close ve WinUI),
   viz EXPLORER_MOTION.md bod 4.1. */

@keyframes wui-flyout-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes wui-flyout-slide {
  from { transform: translateY(-8px); }
  to { transform: translateY(0); }
}

/* Dialog: ContentDialog_themeresources.xaml — scale 1.05 -> 1.0 / 250 ms
   fast-out-slow-in, opacity 0 -> 1 / 83 ms linear. */

@keyframes wui-dialog-in {
  from { transform: scale(1.05); }
  to { transform: scale(1); }
}
@keyframes wui-dialog-out {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}
@keyframes wui-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes wui-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Neurcity indikator: ProgressBar.xaml, stav Indeterminate, cyklus 2 s.
   1. indikator 0 -> 1,5 s, pak drzi do 2 s. 2. indikator drzi do 0,75 s,
   pak 0,75 -> 2 s. Obe s KeySpline 0.4,0.0,0.6,1.0. */

@keyframes wui-indeterminate-1 {
  0%    { transform: translateX(var(--wui-ind-start, -100%)); animation-timing-function: var(--wui-progress-spline); }
  75%   { transform: translateX(var(--wui-ind-end, 100%)); }
  100%  { transform: translateX(var(--wui-ind-end, 100%)); }
}
@keyframes wui-indeterminate-2 {
  0%    { transform: translateX(var(--wui-ind2-start, -160%)); }
  37.5% { transform: translateX(var(--wui-ind2-start, -160%)); animation-timing-function: var(--wui-progress-spline); }
  100%  { transform: translateX(var(--wui-ind2-end, 100%)); }
}

.wui-progress {
  position: relative;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
}
.wui-progress > span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: var(--wui-progress-fill, #60cdff);
  will-change: transform;
}
.wui-progress > span:nth-child(1) { animation: wui-indeterminate-1 var(--wui-progress-cycle) linear infinite; }
.wui-progress > span:nth-child(2) { animation: wui-indeterminate-2 var(--wui-progress-cycle) linear infinite; }
html.wui-bez-pohybu .wui-progress > span,
html[data-wui-motion="off"] .wui-progress > span { animation: none; transform: translateX(0); width: 100%; opacity: .35; }
