/* SMOOTH: the feel of the Smooth UI parts in the design library (:2010), on the CRM's own
   controls. Timings are the library's own notes: dialog settles from .96 in 200 ms and leaves
   in 140 ms; a menu arrives in 150 ms and closes in 100 ms.

   Loaded after every other stylesheet. Office screens only: the technician's and the driver's
   screens stay exactly as they are.

   The app closes things by putting .hidden or [hidden] back, and its code carries on at once.
   The fades below are pure styling, so the code sees the box as closed from the first moment,
   and pointer-events:none means a box on its way out can never catch a press.
   Zen and Firefox do not delay display:none, so js/smooth.js holds the box there for the fade.
   A browser too old for this simply closes at once, as before. */
@media (prefers-reduced-motion:no-preference){

  /* A pop-up arrives */
  @keyframes suDialogIn{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}
  :where(body:not(.role-tech):not(.role-driver)) .modal{animation:suDialogIn .2s var(--ease-out)}

  /* A pop-up leaves */
  :where(body:not(.role-tech):not(.role-driver)) .ov{transition:opacity .14s ease,display .14s allow-discrete}
  :where(body:not(.role-tech):not(.role-driver)) .ov.hidden{opacity:0;pointer-events:none}
  :where(body:not(.role-tech):not(.role-driver)) .ov.hidden .modal{transform:scale(.98);transition:transform var(--mo-pop-out)}

  /* A menu arrives. Height only, so the check that keeps a menu inside its box still reads
     the true width. */
  @keyframes suMenuIn{from{opacity:0;transform:translateY(-4px) scaleY(.97)}to{opacity:1;transform:none}}
  :where(body:not(.role-tech):not(.role-driver)) .mp-menu:not([hidden]),
  :where(body:not(.role-tech):not(.role-driver)) .tv-menu:not(.hidden),
  :where(body:not(.role-tech):not(.role-driver)) .mfmenu:not(.hidden){animation:suMenuIn .15s var(--ease-out);transform-origin:top left}

  /* A menu leaves */
  :where(body:not(.role-tech):not(.role-driver)) :is(.mp-menu,.tv-menu,.mfmenu,#appbars .tb-menu,#maintManageMenu,#shipManageMenu){
    transition:opacity .1s ease,transform .1s ease,display .1s allow-discrete}
  :where(body:not(.role-tech):not(.role-driver)) .mp-menu[hidden],
  :where(body:not(.role-tech):not(.role-driver)) :is(.tv-menu,.mfmenu,#appbars .tb-menu,#maintManageMenu,#shipManageMenu).hidden{
    opacity:0;transform:translateY(-3px);pointer-events:none}

  /* A row lights at once under the mouse and lets go softly */
  @media (hover:hover) and (pointer:fine){
    :where(body:not(.role-tech):not(.role-driver)) :is(.dirrow,.mtrow,.mlrow,.jrow,.mrow,.ov-frow,.ov-nrow,.ov-sumrow,.rlrow){transition:background-color .14s ease}
    :where(body:not(.role-tech):not(.role-driver)) :is(.dirrow,.mtrow,.mlrow,.jrow,.mrow,.ov-frow,.ov-nrow,.ov-sumrow,.rlrow):hover{transition-duration:0s}
  }

  /* Suggestion lists also leave softly */
  :where(body:not(.role-tech):not(.role-driver)) :is(.tp-sugg,.inb-ddl){transition:opacity .1s ease,display .1s allow-discrete}
  :where(body:not(.role-tech):not(.role-driver)) :is(.tp-sugg,.inb-ddl)[hidden]{opacity:0;pointer-events:none}

  /* Tabs (library Tabs): js/smooth.js slides the underline across. While it does, the old
     tab's line must not also shrink away by itself. */
  :where(body:not(.role-tech):not(.role-driver)) .su-tab-jump .tab::after{transition:none}

  /* Ticks draw themselves from the left (library Checkbox): 200 ms on, quicker off. Transitions,
     not animations, so a list that redraws does not replay every tick. */
  :where(body:not(.role-tech):not(.role-driver)) .cg-box svg{opacity:1;transform:none;clip-path:inset(0 100% 0 0);transition:clip-path .1s ease}
  :where(body:not(.role-tech):not(.role-driver)) [aria-checked="true"] > .cg-box svg{opacity:1;transform:none;clip-path:inset(0 0 0 0);transition:clip-path .2s var(--ease-out)}
  :where(body:not(.role-tech):not(.role-driver)) .msbox::after{opacity:1;transform:none;clip-path:inset(0 100% 0 0);transition:clip-path .1s ease}
  :where(body:not(.role-tech):not(.role-driver)) .msbox:checked::after{clip-path:inset(0 0 0 0);transition:clip-path .2s var(--ease-out)}
  :where(body:not(.role-tech):not(.role-driver)) .mp-row .ck svg{clip-path:inset(0 100% 0 0);transition:clip-path .1s ease}
  :where(body:not(.role-tech):not(.role-driver)) .mp-row.on .ck svg{clip-path:inset(0 0 0 0);transition:clip-path .2s var(--ease-out)}

  /* Fold arrows turn with the fold (library Accordion: 220 ms) */
  :where(body:not(.role-tech):not(.role-driver)) :is(.oa,.ship-grp) > summary::before{transition:transform .22s var(--ease-out)}

  /* Error lines rise in (library Field: 200 ms). Opacity and movement only, so nothing jumps. */
  @keyframes suErrIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
  :where(body:not(.role-tech):not(.role-driver)) [role="alert"]:not(:empty){animation:suErrIn .2s var(--ease-out)}

  /* Faces on a job spread under the mouse (library Avatar group) */
  @media (hover:hover) and (pointer:fine){
    :where(body:not(.role-tech):not(.role-driver)) .jd-faces .jd-face+.jd-face{transition:margin-left .2s var(--ease-out)}
    :where(body:not(.role-tech):not(.role-driver)) .jd-faces:hover .jd-face+.jd-face{margin-left:2px}
  }

  /* The import drop box lifts its edge when a file is over it (library File upload: 140 ms) */
  :where(body:not(.role-tech):not(.role-driver)) .imp-drop{transition:border-color .14s ease,background-color .14s ease}

  /* Progress and meter bars fill in 300 ms (library Meter), they took .42 to .6 s */
  :where(body:not(.role-tech):not(.role-driver)) :is(.tv-cbar i,.mi-bar i,.bd-dayline i){transition-duration:.3s}

  /* The app's tooltip (js/m3.js) on the library Tooltip timing (library Tooltip: 120 ms in, 80 ms out; instant once one has shown) */
  :where(body:not(.role-tech):not(.role-driver)) #m3tip{transition:opacity .08s ease,transform .08s ease}
  :where(body:not(.role-tech):not(.role-driver)) #m3tip.on{transition:opacity .12s var(--ease-out),transform .12s var(--ease-out)}
  :where(body:not(.role-tech):not(.role-driver)) #m3tip.now{transition:none}

  /* Slow leftovers: page width and side panel took .42 s, and badges moved every property */
  :where(body:not(.role-tech):not(.role-driver)) .sb{transition-duration:.24s}
  :where(body:not(.role-tech):not(.role-driver)) .wrap{transition-duration:.24s}
  :where(body:not(.role-tech):not(.role-driver)) :is(.badge,.geo-badge,.status){transition:background-color .16s ease,border-color .16s ease,color .16s ease}
}

/* A toast can be swiped away sideways (library Toast); up and down still scroll the page */
.toast.su-swipe{touch-action:pan-y;cursor:grab}
.toast.su-dragging{cursor:grabbing;user-select:none;animation:none}
