/* Motion for every signed-in page (owner, 4 Nov 2026: tabs, dropdowns and the
   rest "se fluid mungkin"). One file, loaded last, so each component keeps its
   own look and only gains how it arrives, leaves and moves.

   Rules of the layer:
   - Everything that moves is inside prefers-reduced-motion: no-preference, so a
     visitor who asked for less motion gets the interface exactly as before.
   - Popovers animate with @starting-style plus a discrete display transition:
     the open and close code stays the same (.hidden or [hidden]) and a browser
     without support simply shows and hides them as it always did.
   - Only opacity, translate and scale move, the properties the compositor can
     run without layout. Independent translate/scale compose with any transform
     a component already uses for its position.
   - Sliding tab highlights, the rail tooltip, view fades and exits that need a
     moment before removal live in motion.js. */

:root{
  --mo-ease:cubic-bezier(.2,.75,.15,1);   /* the sidebar rail's curve */
  --mo-out:cubic-bezier(.16,1,.3,1);      /* arriving: quick start, long settle */
  --mo-exit:cubic-bezier(.4,0,1,1);       /* leaving: gathers speed */
  --mo-spring:cubic-bezier(.34,1.36,.64,1); /* a press releasing, a hair of overshoot */
}

/* Rail tooltip (motion.js): the collapsed sidebar shows icons only, so each one
   names itself on hover and on keyboard focus, sooner than the browser's own. */
.mo-tip{position:fixed;left:0;top:0;z-index:var(--z-tooltip,1000);padding:6px 10px;border:1px solid var(--border-2);
  border-radius:9px;background:var(--pop);color:var(--ink);font:500 12.5px/1.25 var(--sans);white-space:nowrap;
  box-shadow:0 12px 32px -14px rgba(0,0,0,.7);pointer-events:none;opacity:0;visibility:hidden;translate:-4px -50%}
.mo-tip.show{opacity:1;visibility:visible;translate:0 -50%}
:root[data-theme="light"] .mo-tip{box-shadow:0 10px 28px -14px rgba(16,24,32,.32)}

/* Sliding highlight for tabs and segmented controls (motion.js draws it only
   while it travels, then hands back to the component's own active style). */
.mo-ghost{position:absolute;z-index:-1;margin:0;box-sizing:border-box;pointer-events:none}
/* !important: the bar's own rules can be more specific (the Library filters are
   pinned to position:static), and the copy must be positioned inside the bar.
   A static bar may still carry offsets meant for another layout (the filters
   inherit left:50% from .mode-toolbar); they did nothing while it was static
   and must keep doing nothing once it is relative. */
.mo-sliding{isolation:isolate!important}
.mo-sliding.mo-static{position:relative!important;inset:auto!important}
.mo-sliding .mo-hide-ind{background:transparent!important;box-shadow:none!important;border-color:transparent!important}
.mo-sliding .mo-hide-ind::after{opacity:0!important}
/* a highlight handing over to the travelling copy does it in one frame */
.mo-snap,.mo-snap::after{transition:none!important}

@media (prefers-reduced-motion:no-preference){

  /* ---------- page to page: the sidebar stays, the content arrives ----------
     Every signed-in page shares the sidebar, so only the content under the
     header fades in when a page or a workspace view opens. (The browser's own
     cross-page transition was tried first, 4 Nov: it skipped itself on any
     navigation that was not preceded by a click on the page, and each skip left
     an error in the console.) */
  /* backwards, not both: an opacity animation still in effect would keep the
     view a stacking context and trap the menus that open inside it */
  .dashboard-utility .page-wrap{animation:mo-page-in .3s var(--mo-out) backwards}
  .dashboard .view.active{animation:mo-fade-in .26s var(--mo-ease) backwards}
  /* the theme switch reveals the new palette from the clicked option */
  html.mo-theme-vt::view-transition-old(root),html.mo-theme-vt::view-transition-new(root){animation:none;mix-blend-mode:normal}

  .mo-tip{transition:opacity .14s var(--mo-ease),translate .2s var(--mo-out),visibility .14s,top .2s var(--mo-out)}

  /* ---------- press: every control answers the finger or the click ---------- */
  .dashboard :is(.btn,.ibtn,.chip,.mode-btn,.submode,.tile-btn,.term-switch button,.dev-tabs a,.dev-mode-tabs button,.mp-tab,.mp-chip,.csel-trigger,.mp-trigger,.side-topup,.nav-item,.side-help,.side-billing,.acct-more,.lang-btn,.mobile-nav a,.tema-opt){
    transition:color .16s var(--mo-ease),background-color .16s var(--mo-ease),border-color .16s var(--mo-ease),box-shadow .16s var(--mo-ease),opacity .16s var(--mo-ease),scale .24s var(--mo-spring)}
  .dashboard :is(.btn,.ibtn,.chip,.mode-btn,.submode,.seg-btn,.tile-btn,.term-switch button,.dev-tabs a,.dev-mode-tabs button,.mp-tab,.mp-chip,.csel-trigger,.mp-trigger,.side-topup,.nav-item,.side-help,.side-billing,.lang-btn,.mobile-nav a):active:not(:disabled,[aria-disabled="true"]){
    scale:.96;transition-duration:.16s,.16s,.16s,.16s,.16s,.08s}
  /* large cards only dip a little */
  .dashboard .tema-opt:active{scale:.985;transition-duration:.16s,.16s,.16s,.16s,.16s,.1s}

  /* ---------- dropdowns and popovers: grow from where they were opened ---------- */
  .dashboard :is(.csel-menu,.am-pop,.cs-pop,.popover,.acct-menu,.lang-menu){
    transform-origin:var(--mo-origin,50% 0);
    transition:opacity .16s var(--mo-ease),scale .22s var(--mo-out),translate .22s var(--mo-out),display .22s allow-discrete}
  .dashboard :is(.csel-menu.hidden,.am-pop.hidden,.cs-pop.hidden,.popover.hidden,.acct-menu[hidden]){
    opacity:0;scale:var(--mo-scale,.96);translate:0 var(--mo-dy,-6px);pointer-events:none;
    transition-timing-function:var(--mo-exit);transition-duration:.12s,.14s,.14s,.14s}
  @starting-style{
    .dashboard :is(.csel-menu,.am-pop,.cs-pop,.popover,.acct-menu,.lang-menu){opacity:0;scale:var(--mo-scale,.96);translate:0 var(--mo-dy,-6px)}
  }
  /* menus that open upward grow from their bottom edge */
  .dashboard :is(.acct-menu,.popover.up){--mo-origin:50% 100%;--mo-dy:6px}
  .dashboard .csel-menu{--mo-dy:0px}
  .dashboard .csel-menu[style*="top: auto"]{--mo-origin:50% 100%}
  .dashboard .app.nav-collapsed .acct-menu{--mo-origin:0 100%;--mo-dy:0px}

  /* ---------- the model picker ---------- */
  .dashboard .mp-overlay{transition:opacity .15s var(--mo-ease),display .26s allow-discrete}
  .dashboard .mp-overlay.hidden{opacity:0;pointer-events:none;transition-duration:.12s,.18s}
  .dashboard .mp-overlay .mp-dialog{transition:opacity .2s var(--mo-ease),scale .28s var(--mo-out),translate .28s var(--mo-out)}
  .dashboard .mp-overlay.hidden .mp-dialog{opacity:0;scale:var(--mo-scale,.97);translate:0 var(--mo-dy,10px);transition-timing-function:var(--mo-exit);transition-duration:.14s,.16s,.16s}
  @starting-style{
    .dashboard .mp-overlay{opacity:0}
    .dashboard .mp-overlay .mp-dialog{opacity:0;scale:var(--mo-scale,.97);translate:0 var(--mo-dy,10px)}
  }

  /* ---------- native dialogs (search, view prompt, developer, phone sheets) ---------- */
  .dashboard dialog{transition:opacity .18s var(--mo-ease),scale .26s var(--mo-out),translate .26s var(--mo-out),display .26s allow-discrete,overlay .26s allow-discrete}
  .dashboard dialog:not([open]){opacity:0;scale:.97;translate:0 8px;transition-timing-function:var(--mo-exit);transition-duration:.12s,.16s,.16s,.16s,.16s}
  .dashboard dialog::backdrop{transition:opacity .22s var(--mo-ease),display .26s allow-discrete,overlay .26s allow-discrete}
  .dashboard dialog:not([open])::backdrop{opacity:0}
  @starting-style{
    .dashboard dialog[open]{opacity:0;scale:.97;translate:0 8px}
    .dashboard dialog[open]::backdrop{opacity:0}
  }

  /* ---------- payment choice and the support panel ---------- */
  .dashboard .uz-pay-backdrop{transition:opacity .2s var(--mo-ease),display .24s allow-discrete}
  .dashboard .uz-pay-backdrop[hidden]{opacity:0;pointer-events:none}
  .dashboard .uz-pay-backdrop .uz-pay{transition:opacity .2s var(--mo-ease),scale .28s var(--mo-out),translate .28s var(--mo-out)}
  .dashboard .uz-pay-backdrop[hidden] .uz-pay{opacity:0;scale:.97;translate:0 10px}
  @starting-style{
    .dashboard .uz-pay-backdrop{opacity:0}
    .dashboard .uz-pay-backdrop .uz-pay{opacity:0;scale:.97;translate:0 10px}
  }
  .sup-wrap{transition:display .18s allow-discrete}
  .sup-wrap .sup-panel{transition:opacity .16s var(--mo-exit),translate .18s var(--mo-exit),scale .18s var(--mo-exit)}
  .sup-wrap[hidden] .sup-panel{opacity:0;translate:0 8px;scale:.985}
  .sup-panel{animation:mo-pop-in .3s var(--mo-out) backwards}

  /* ---------- modal, toast, viewers: arrive and leave (motion.js adds .is-leaving) ----------
     Arrivals fill backwards only: a scale still in effect after it ends would
     make the element a containing block for anything fixed inside it. Exits
     hold their last frame until the element is removed. */
  .modal-backdrop{animation:mo-fade-in .18s var(--mo-ease) backwards}
  .modal{animation:mo-pop-in .3s var(--mo-out) backwards}
  .modal-backdrop.is-leaving{animation:mo-fade-out .16s var(--mo-exit) both;pointer-events:none}
  .modal-backdrop.is-leaving .modal{animation:mo-pop-out .16s var(--mo-exit) both}
  .toast{animation:mo-toast-in .34s var(--mo-out) backwards}
  .toast.is-leaving{animation:mo-toast-out .22s var(--mo-exit) both}
  .lb,.lightbox,.aset-latar{animation:mo-fade-in .2s var(--mo-ease) backwards}
  .lb .lb-stage,.lightbox>:is(img,video),.aset-latar .aset-kotak{animation:mo-zoom-in .34s var(--mo-out) backwards}
  .lb .lb-panel{animation:mo-rise-in .36s var(--mo-out) .04s backwards}
  :is(.lb,.lightbox,.aset-latar).is-leaving{animation:mo-fade-out .18s var(--mo-exit) both;pointer-events:none}
  .lb.is-leaving .lb-stage,.lightbox.is-leaving>:is(img,video),.aset-latar.is-leaving .aset-kotak{animation:mo-zoom-out .18s var(--mo-exit) both}
  .lb.is-leaving .lb-panel{animation:mo-fade-out .14s var(--mo-exit) both}
  @media (max-width:999px){
    /* phone sheets slide up from the bottom edge instead of growing */
    .dashboard :is(.popover,.cs-pop,.am-pop){--mo-origin:50% 100%;--mo-dy:40px;--mo-scale:1}
    .dashboard .mp-overlay{--mo-dy:48px;--mo-scale:1}
    .aset-latar .aset-kotak{animation-name:mo-sheet-in}
  }

  /* ---------- details: height opens and closes instead of jumping ---------- */
  .dashboard details{interpolate-size:allow-keywords}
  .dashboard details::details-content{block-size:0;overflow-y:clip;opacity:0;
    transition:block-size .3s var(--mo-out),opacity .22s var(--mo-ease),content-visibility .3s allow-discrete}
  .dashboard details[open]::details-content{block-size:auto;opacity:1}

  /* ---------- in-page links on Help and the other long pages glide ---------- */
  html:has(body.dashboard-utility),.dashboard-utility .main{scroll-behavior:smooth}
  .dashboard-utility :target{animation:mo-target 1.6s var(--mo-ease) .3s backwards}

  /* ---------- images arriving over the network fade in (motion.js marks them) ---------- */
  .dashboard img.mo-img-wait{opacity:0}
  .dashboard img.mo-img-in{transition:opacity .36s var(--mo-ease)}
}

@keyframes mo-fade-in{from{opacity:0}}
@keyframes mo-fade-out{to{opacity:0}}
@keyframes mo-pop-in{from{opacity:0;scale:.96;translate:0 10px}}
@keyframes mo-pop-out{to{opacity:0;scale:.97;translate:0 6px}}
@keyframes mo-toast-in{from{opacity:0;scale:.94;translate:0 12px}}
@keyframes mo-toast-out{to{opacity:0;scale:.97;translate:0 8px}}
@keyframes mo-zoom-in{from{opacity:0;scale:.965}}
@keyframes mo-zoom-out{to{opacity:0;scale:.975}}
@keyframes mo-rise-in{from{opacity:0;translate:0 14px}}
@keyframes mo-page-in{from{opacity:0;translate:0 6px}}
@keyframes mo-sheet-in{from{translate:0 100%}}
/* no closing keyframe: the highlight settles into the element's own background */
@keyframes mo-target{from{background-color:var(--veil-3,rgba(127,127,127,.18))}}
