/* CWI HR - HR-MOTION (4 Nov 2026) and HR-MOTION2 (5 Nov 2026): one motion layer for the whole app, raised to the owner's reference
   clips as measured frame by frame. Motion only: no colour, size or position here differs from the page at rest. Things move by
   transform, opacity and clip-path; a page leaving and a page arriving also blur, and only they do; colour fades on hover and focus
   stay short and paint only. Under "reduce motion" none of this applies (app.css lands everything at once), and none of it reaches
   print. Built on app.css and hr.css (same tokens). Notes: docs/hr-system/phases/HR-MOTION.md and HR-MOTION2.md */

:root{
  --m-press:120ms;                    /* a press, a tick */
  --m-hover:140ms;                    /* hover and focus colour */
  --m-control:180ms;                  /* a menu, a pill under the pointer */
  --m-panel:240ms;                    /* one thing arriving */
  --m-exit:140ms;                     /* leaving is quicker than arriving */
  --m-ease:cubic-bezier(.23,1,.32,1); /* the same curve as --out in app.css: it is on the pages that draw themselves too */
  --m-expo:cubic-bezier(.16,1,.3,1);  /* a block landing: the reference's expo.out */
  --m-lift:cubic-bezier(.2,.7,.2,1);  /* a card under the pointer, a heading travelling */
  --m-gone:130ms;                     /* a page's content leaving */
  --m-land:500ms;                     /* a block landing */
  --m-step:60ms;                      /* the wait between one block and the next */
}

/* The resting state of a moving indicator stays in hr.css and nav.css, on aria-current: this only takes it off while the pill
   is on its way, on the page being left and on the page arriving. */
.tabs,nav.seg{position:relative;isolation:isolate}
.sb.m-moving a[aria-current="page"]:not(.sb-user),html.m-mv-nav .sb a[aria-current="page"]:not(.sb-user){background:transparent;box-shadow:none;transition:none}
.sb.m-landing a[aria-current="page"]{transition:none}
.tabs.m-moving a[aria-current="page"],html.m-mv-strip .tabs a[aria-current="page"]{border-bottom-color:transparent}
nav.seg.m-moving a[aria-current],html.m-mv-strip nav.seg a[aria-current]{background:transparent}
.pb.m-moving [aria-current="page"]::before,html.m-mv-pb .pb [aria-current="page"]::before{opacity:0}
.m-pill,.m-hover{position:absolute;display:block;margin:0;pointer-events:none;z-index:-1}
.m-pill-nav{background:linear-gradient(90deg,var(--champagne) 2px,var(--surface-2) 2px)}
.m-pill-bar{background:var(--champagne)}
.m-pill-seg{background:var(--surface-2)}
.m-hover{background:var(--surface);opacity:0;transition:opacity var(--m-hover) var(--m-ease),clip-path var(--m-control) var(--m-ease)}
.m-hover[data-on="1"]{opacity:1}
.m-hover.m-jump{transition:none}
nav.seg .m-hover{background:var(--surface-2);opacity:0}
nav.seg .m-hover[data-on="1"]{opacity:.55}
@media (hover:hover) and (pointer:fine){
  .sb.m-hp .sb-nav a:hover,.sb.m-hp .sb-all:hover,.sb.m-hp .sb-out button:hover,.sb.m-hp .sb-nav .nv-t:hover{background:transparent}
  .sb.m-hp .sb-nav a[aria-current="page"]:hover,.sb.m-hp .sb-all[aria-current="page"]:hover{background:var(--surface-2)}
}
a[data-m-to]{color:var(--ink)}

@media screen and (prefers-reduced-motion:no-preference){

  /* ── leaving and the crossing: the menu and the top bar never move; the content blurs out at once and is gone within 130 ms ── */
  /* The opt-in itself is in crossing.css, for the pages that have motion.js. */
  /* Only the page being left is a picture. A page that is captured takes no clicks while the picture is up: everything lands on
     html, however the pseudo-elements are set (measured 4 Nov 2026, a second click within 160 ms of the first was lost). So the new
     page is never captured: it is live under the old picture from its first frame, and the picture lets clicks through to it.
     The old page takes part only if it started a crossing itself (motion.js, pageswap). */
  html{view-transition-name:none}
  html.m-leave,html.m-leave-tab{view-transition-name:root}
  ::view-transition{pointer-events:none}
  ::view-transition-group(root){animation:none}
  /* A quick server answers before the old content has gone. The picture finishes the leaving for what is left of it (--m-old, from motion.js), and
     nothing new lands until it has (--m-after), so the two are never seen through each other. */
  ::view-transition-old(root){animation:m-old calc(var(--m-old,0ms) + 20ms) linear both;mix-blend-mode:normal;clip-path:inset(max(var(--m-cut,0px),calc(56px + env(safe-area-inset-top,0px))) 0 calc(61px + env(safe-area-inset-bottom,0px)) 0)}
  html.m-tab::view-transition-old(root){animation-name:m-old-tab}
  /* The menu, the top bar, the phone bar and the add button are never in the old picture: what is there is the new page, live, with the pill on its
     way. A name of its own would not do: the picture would still hold the page behind it and cover the live one. (A picture of the menu also loses
     everything below its fold in WebKit once it is scrolled: seen in the captures, 4 Nov 2026.) */
  @media (min-width:1024px){::view-transition-old(root){clip-path:inset(max(var(--m-cut,0px),56px) 0 0 252px)}}
  @media (max-width:600px){::view-transition-old(root){mask:radial-gradient(circle 29px at calc(100% - 44px) calc(100% - 104px - env(safe-area-inset-bottom,0px)),transparent 28px,#000 29px)}}
  @keyframes m-old{to{opacity:0;filter:blur(10px)}}
  @keyframes m-old-tab{to{opacity:0}}
  /* The click answers at once, however long the server takes. Whatever is position:fixed stays out of .shell (the message pill, the
     phone bar, the add button, the tooltips and the small toasts are all outside it, and hrM_screens.js holds every page to that),
     because a transform or a filter here would make .shell the box such a thing is placed in, and it would jump. */
  html.m-leave .shell{opacity:0;transform:translateY(-8px);filter:blur(10px);
    transition:opacity var(--m-gone) cubic-bezier(.5,0,.9,.4),transform 150ms cubic-bezier(.5,0,1,1),filter var(--m-gone) linear}
  html.m-leave-tab .shell > :not(.ph,.tabs,:has(> .tabs),.flash,script,style),html.m-leave-tab .shell > :has(> .tabs) > .tabs ~ *{opacity:0;transform:translateY(-6px);filter:blur(6px);
    transition:opacity 140ms cubic-bezier(.5,0,.9,.4),transform 160ms cubic-bezier(.5,0,1,1),filter 140ms linear}
  /* a server slower than this: a thin line under the top bar says the page is on its way */
  .m-wait{position:fixed;left:0;right:0;height:2px;overflow:hidden;z-index:16;pointer-events:none;opacity:0;animation:m-wait-in 150ms linear 300ms forwards}
  @media (min-width:1024px){.m-wait{left:252px}}
  .m-wait::before{content:"";display:block;width:40%;height:100%;background:var(--champagne);border-radius:2px;animation:m-wait 1100ms cubic-bezier(.45,0,.55,1) infinite}
  @keyframes m-wait-in{to{opacity:.75}}
  @keyframes m-wait{from{transform:translateX(-100%)}to{transform:translateX(250%)}}

  /* ── the page entrance: heading, tiles, filter row, panels left to right, cards top to bottom, the main button last ──
     First paint already holds the final layout and each thing waits at its start, so nothing shifts. Blocks rise 24 px, a little small
     and soft, as the reference's do. Five places in the order, everything after arrives with the last of them, a table's rows never one
     by one, and it is all settled by 800 ms (60 ms + 4 steps of 60 ms + 500 ms): motion.js ends the entrance a moment after that. */
  @keyframes m-head{from{transform:translateY(105%);clip-path:inset(-.25em -2em 105% -2em)}to{transform:none;clip-path:inset(-.25em -2em -.3em -2em)}}
  @keyframes m-rise{from{opacity:0;transform:translateY(24px) scale(.985);filter:blur(8px)}}
  @keyframes m-rise-flat{from{opacity:0;transform:translateY(12px);filter:blur(6px)}}
  @keyframes m-fade{from{opacity:0}}
  html.m-enter:not(.m-flip,.m-flew) .ph h1{animation:m-head 600ms var(--m-expo) var(--m-after,0ms) backwards}
  /* a heading the clicked link named: motion.js has it travel from that link (m-flip holds it for the moment that takes to decide) */
  html.m-flip .ph h1{opacity:0}
  .m-flying{position:relative;z-index:2}
  html.m-enter .ph :is(.eyebrow,.crumb){animation:m-fade 400ms var(--m-ease) var(--m-after,0ms) backwards}
  html.m-enter .ph .lede{animation:m-rise-flat 500ms var(--m-expo) calc(var(--m-after,0ms) + 80ms) backwards}
  html.m-enter .ph .acts > *{animation:m-rise-flat 500ms var(--m-expo) calc(var(--m-after,0ms) + 200ms) backwards}
  /* a row of buttons lands left to right, as the clips' does, wherever the primary sits */
  html.m-enter .ph .acts > :nth-child(2){animation-delay:calc(var(--m-after,0ms) + 240ms)}
  html.m-enter .ph .acts > :nth-child(3){animation-delay:calc(var(--m-after,0ms) + 280ms)}
  html.m-enter .ph .acts > :nth-child(n+4){animation-delay:calc(var(--m-after,0ms) + 320ms)}

  html.m-enter .shell > :not(.ph,.pv-banner,.flash,script,.kpis,.grid,.wk-pgrid,.wk-mine,.wk-board,.feat-groups,.mt-week,.stack,.dv-drives,dl.stats,div:not([class])),
  html.m-enter .shell > :is(.kpis,.grid,.wk-pgrid,.wk-mine,.wk-board,.feat-groups,.mt-week,.stack,.dv-drives,dl.stats) > :not(.grid,div:not([class])),
  html.m-enter .shell > :is(.grid,div:not([class])) > :is(.grid,div:not([class])) > :not(.ph),
  html.m-enter .shell > div:not([class]) > :not(.ph,.grid,div:not([class])){
    animation:m-rise var(--m-land) var(--m-expo) backwards;
    transform-origin:50% 120px;
    animation-delay:calc(var(--m-after,0ms) + 60ms + var(--m-step) * min(4, var(--m-i,0) + var(--m-j,0) + var(--m-k,0) + var(--m-w,0)));
  }
  /* --m-i: the place in the page; --m-j: left to right in a row; --m-k: top to bottom in a column */
  /* only blocks that land hold a place: a banner or the heading in front must not push the tiles back (5 Nov, seen beside Pembra: tiles at 700 ms, its cards at 400 to 500) */
  .shell > :nth-child(2 of :not(.ph,.pv-banner,.flash,script,style)){--m-i:1}.shell > :nth-child(3 of :not(.ph,.pv-banner,.flash,script,style)){--m-i:2}.shell > :nth-child(4 of :not(.ph,.pv-banner,.flash,script,style)){--m-i:3}.shell > :nth-child(n+5 of :not(.ph,.pv-banner,.flash,script,style)){--m-i:4}
  .shell > * > :nth-child(2){--m-j:1}.shell > * > :nth-child(3){--m-j:2}.shell > * > :nth-child(4){--m-j:3}.shell > * > :nth-child(5){--m-j:4}.shell > * > :nth-child(n+6){--m-j:5}
  .shell > * > * > :nth-child(2){--m-k:1}.shell > * > * > :nth-child(3){--m-k:2}.shell > * > * > :nth-child(n+4){--m-k:3}
  /* the clip's order: panels wait for the tiles above them */
  .shell > .kpis ~ *{--m-w:3}

  /* a tab, or the same page with a different address: the heading and the strip stay, what changed arrives flat and quicker. The old picture stops at the
     strip (--m-cut), so a heading that changes is never seen through the old one: it comes up in its own mask, as on a new page (m-tab-head, motion.js) */
  html.m-tab .shell > :not(.ph,.tabs,:has(> .tabs),.flash,.pv-banner,script,style),html.m-tab .shell > :has(> .tabs) > .tabs ~ *{animation:m-rise-flat 360ms var(--m-expo) calc(var(--m-after,0ms) + 30ms) backwards}
  /* the phone's week has no box of its own (meet.css), so its days go and come one by one here */
  @media (max-width:600px){html.m-tab .shell > .mt-week > *{animation:m-rise-flat 360ms var(--m-expo) calc(var(--m-after,0ms) + 30ms) backwards}
    html.m-leave-tab .shell > .mt-week > *{opacity:0;transform:translateY(-6px);transition:opacity 140ms cubic-bezier(.5,0,.9,.4),transform 160ms cubic-bezier(.5,0,1,1)}}
  html.m-tab-head .ph h1{animation:m-head 420ms var(--m-expo) backwards}
  html.m-tab-head .ph :is(.lede,.acts > *){animation:m-rise-flat 360ms var(--m-expo) 40ms backwards}

  /* ── numbers that count up: the real number is in the HTML from the start; this draws over it for at most 800 ms ── */
  html.m-count .kpi b[data-count]{position:relative;color:transparent}
  html.m-count .kpi b[data-count]::after{content:attr(data-n);position:absolute;left:0;top:0;color:var(--ink)}

  /* ── charts draw in ── */
  @keyframes m-grow-x{from{transform:scaleX(0)}}
  @keyframes m-draw-x{from{clip-path:inset(-2px 100% -2px 0)}to{clip-path:inset(-2px 0 -2px 0)}}
  html.m-enter :is(.bar .tr i,.wk-bars .bar i,.wl .bar i,.dv-bar i,.wk-prog i,.stat .mini i){transform-origin:left center;
    animation:m-grow-x 540ms var(--m-expo) calc(var(--m-after,0ms) + 240ms) backwards}
  html.m-enter .bars .bar:nth-child(2) .tr i{animation-delay:calc(var(--m-after,0ms) + 285ms)}html.m-enter .bars .bar:nth-child(3) .tr i{animation-delay:calc(var(--m-after,0ms) + 330ms)}
  html.m-enter .bars .bar:nth-child(n+4) .tr i{animation-delay:calc(var(--m-after,0ms) + 375ms)}
  html.m-enter .wk-bars > :nth-child(2) .bar i{animation-delay:calc(var(--m-after,0ms) + 285ms)}html.m-enter .wk-bars > :nth-child(3) .bar i{animation-delay:calc(var(--m-after,0ms) + 330ms)}
  html.m-enter .wk-bars > :nth-child(n+4) .bar i{animation-delay:calc(var(--m-after,0ms) + 375ms)}
  html.m-enter .ci-spark{animation:m-draw-x 620ms cubic-bezier(.77,0,.175,1) calc(var(--m-after,0ms) + 240ms) backwards}
  html.m-enter .chartwrap g.db-row{animation:m-fade 420ms var(--m-ease) calc(var(--m-after,0ms) + 200ms) backwards}
  html.m-enter .chartwrap g.db-row:nth-of-type(2){animation-delay:calc(var(--m-after,0ms) + 260ms)}html.m-enter .chartwrap g.db-row:nth-of-type(3){animation-delay:calc(var(--m-after,0ms) + 320ms)}
  html.m-enter .chartwrap g.db-row:nth-of-type(4){animation-delay:calc(var(--m-after,0ms) + 380ms)}html.m-enter .chartwrap g.db-row:nth-of-type(n+5){animation-delay:calc(var(--m-after,0ms) + 440ms)}

  /* ── buttons, inputs, ticks: a press answers at once and nothing moves anything else ── */
  input[type=checkbox],input[type=radio]{transition:transform var(--m-press) var(--m-ease)}
  input[type=checkbox]:active,input[type=radio]:active{transform:scale(.9)}
  @keyframes m-tick{from{transform:scale(.86)}}
  input[type=checkbox]:checked:focus,input[type=radio]:checked:focus{animation:m-tick 160ms var(--m-ease)}
  .sb-nav a:active,.sb-all:active,.sb-out button:active,.pb a:active,.pb button:active,.tabs a:active,nav.seg a:active,.tb-help:active,.tb-bell:active,.tb-add:active,.tb-menu:active,.qadd-fab:active,.wk-check:active{transform:scale(.97)}
  .sb-nav a,.sb-all,.sb-out button,.pb a,.pb button,.tabs a,nav.seg a,.tb-help,.tb-bell,.tb-add,.tb-menu,.qadd-fab{transition:transform var(--m-press) var(--m-ease),background var(--m-hover) var(--m-ease),color var(--m-hover) var(--m-ease),border-color var(--m-hover) var(--m-ease)}
  .tabs a{transition:transform var(--m-press) var(--m-ease),color var(--m-hover) var(--m-ease),border-color var(--m-control) var(--m-ease)}
  input:not([type=checkbox],[type=radio],[type=range],[type=hidden]),select,textarea{transition:border-color var(--m-hover) var(--m-ease),box-shadow var(--m-hover) var(--m-ease),background-color var(--m-hover) var(--m-ease)}
  button[data-label],.btn[data-label]{animation:m-working 1.2s ease-in-out infinite}
  @keyframes m-working{50%{opacity:.62}}

  /* ── tiles, cards and rows ── */
  /* a card that opens something lifts under the pointer; the depth at rest is in hr.css. No new colour and no change of layout */
  a.kpi,a.card,a.orgc,.qa-grid a{transition:transform 320ms var(--m-lift),box-shadow 320ms var(--m-lift),border-color var(--m-control) var(--m-ease)}
  @media (hover:hover) and (pointer:fine){
    a.kpi:hover,a.card:hover,a.orgc:hover,.qa-grid a:hover{transform:translateY(-4px);box-shadow:0 1px 0 rgba(255,255,255,.05) inset,0 20px 34px -16px var(--sh-85)}
  }
  a.kpi:active,a.card:active,a.orgc:active,.qa-grid a:active{transform:scale(.985);transition-duration:var(--m-press)}
  table.t tbody td,.list > li{transition:background-color var(--m-press) ease}
  @media (hover:hover) and (pointer:fine){
    table.t tbody tr:hover td,.list > li:has(> a.t):hover{background-color:var(--hover)}
  }

  /* ── menus that open out of a button, and the sections behind a summary ── */
  details::details-content{opacity:0;transition:opacity var(--m-exit) var(--m-ease),content-visibility var(--m-exit) allow-discrete}
  details[open]::details-content{opacity:1;transition:opacity var(--m-control) var(--m-ease)} /* opening: what it holds is there at once, for a script and a reader too; only the fade takes time. Closing keeps it for the fade */
  @starting-style{details.m-opened[open]::details-content{opacity:0}}
  html.js .wk-fd:not([data-folded])::details-content{transition:none} /* folding the phone filters on arrival shows nothing: see work.js */
  details > .wk-pop{transform-origin:top left}
  details.m-opened[open] > .wk-pop{animation:m-pop var(--m-control) var(--m-ease)} /* an animation, not @starting-style: a menu inside a closed section already has a style, so that never fires */
  @keyframes m-pop{from{opacity:0;transform:translateY(-4px) scale(.98)}}
  .ph .acts .wk-more > .wk-pop{transform-origin:top right}
  .sb-nav .nv-g.m-opening > .nv-i{animation:m-rise-flat var(--m-control) var(--m-ease) backwards}

  /* ── dialogs and drawers open and close; a modal stays centred, a keyboard shortcut gets no animation ── */
  dialog.qadd,dialog.tour-dlg,dialog.help-dlg{transition:opacity var(--m-exit) var(--m-ease),transform var(--m-exit) var(--m-ease),overlay var(--m-exit) allow-discrete,display var(--m-exit) allow-discrete}
  dialog.qadd::backdrop,dialog.help-dlg::backdrop{opacity:0;transition:opacity var(--m-exit) var(--m-ease),overlay var(--m-exit) allow-discrete,display var(--m-exit) allow-discrete}
  dialog.qadd[open]::backdrop,dialog.help-dlg[open]::backdrop{opacity:1;transition-duration:var(--m-panel)}
  @starting-style{dialog.qadd[open]::backdrop,dialog.help-dlg[open]::backdrop{opacity:0}}
  dialog.qadd:not([open]){opacity:0;transform:translateY(6px) scale(.985)}
  dialog.qadd[open]{opacity:1;transform:none;transition-duration:220ms}
  @starting-style{dialog.qadd[open]{opacity:0;transform:translateY(10px) scale(.985)}}
  dialog.qadd.m-instant,dialog.qadd.m-instant::backdrop{transition:none}
  dialog.help-dlg.m-instant[open]{animation:none}
  dialog.help-dlg.m-instant,dialog.help-dlg.m-instant::backdrop{transition:none}
  dialog.help-dlg:not([open]){opacity:0;transform:translateX(24px)}
  dialog.tour-dlg:not([open]){opacity:0;transform:translateY(4px)}
  dialog.tour-dlg.m-instant{transition:none}
  dialog.m-instant *{transition:none}
  dialog.qadd:not([open]),dialog.help-dlg:not([open]),dialog.tour-dlg:not([open]){pointer-events:none}
  /* WebKit and Firefox: see motion.js. It is out of the top layer, so its dimmed page is drawn with it, and it takes no clicks */
  dialog.m-closing{display:block;position:fixed;inset:auto;margin:0;max-width:none;max-height:none;overflow:hidden;pointer-events:none;z-index:900}
  dialog.qadd.m-closing{box-shadow:0 0 0 100vmax rgba(0,0,0,.55)}
  dialog.help-dlg.m-closing{box-shadow:0 0 0 100vmax var(--sh-50)}
  .scrim{opacity:0;transition:opacity 220ms var(--m-ease),display 220ms allow-discrete}
  body.menu-open .scrim{opacity:1}
  @starting-style{body.menu-open .scrim{opacity:0}}

  /* ── messages: a message pill rises in and leaves the way it came, a button that saved says so where it is, an error nudges once ── */
  @keyframes m-flash{from{opacity:0;transform:translateY(16px) scale(.97)}}
  @keyframes m-nudge{0%{opacity:0;transform:translateX(0)}18%{opacity:1;transform:translateX(-4px)}45%{transform:translateX(3px)}72%{transform:translateX(-1.5px)}100%{transform:none}}
  .flash{animation:m-flash 320ms var(--m-expo) backwards}
  .flash.m-toast{transition:opacity var(--m-control) var(--m-ease),transform var(--m-control) var(--m-ease)}
  .flash.m-toast.m-out{opacity:0;transform:translateY(10px)}
  /* the button that was pressed, once the server has said so: the words stay in the page and the look says Saved. hr.css has the look */
  .btn.m-saved{animation:m-saved 270ms var(--m-ease) backwards;transition:background-color var(--m-press) ease,border-color var(--m-press) ease,color var(--m-press) ease,box-shadow var(--m-press) ease}
  @keyframes m-saved{0%{transform:scale(.94)}55%{transform:scale(1.015)}100%{transform:none}}
  .acts:has(> .m-saved) > :not(.m-saved){opacity:.45;transition:opacity var(--m-control) var(--m-ease)}
  .flash.err{animation:m-nudge 320ms ease-out backwards}
  .wk-toast{transition:opacity var(--m-control) var(--m-ease),transform var(--m-control) var(--m-ease)}
  @starting-style{.wk-toast{opacity:0;transform:translateY(10px) scale(.98)}}
  .wk-toast.out{opacity:0;transform:translateY(6px);transition-duration:var(--m-exit)}
  .tip{transition:opacity var(--m-exit) var(--m-ease)}

  /* ── something is loading: a soft sweep across the space it will fill; the words stay for anyone who needs them ── */
  @keyframes m-sweep{from{transform:translateX(-100%)}to{transform:translateX(100%)}}
  [data-preview][aria-busy="true"]{position:relative;overflow:hidden}
  [data-preview][aria-busy="true"]::after{content:"";position:absolute;inset:0;pointer-events:none;
    background:linear-gradient(100deg,transparent 20%,var(--hover-2) 50%,transparent 80%);animation:m-sweep 1.3s linear infinite}
}
