/* KNOX motion layer — tokens and choreography.
 * Durations: tap 120ms · small 220ms · move 460ms · spring 520ms · ambient 9s
 * Easing: --out for things arriving, --spring for things that land, never linear except spinners.
 * Rule: only transform and opacity move. Lists cascade 35ms apart, max 10 items. */
:root { --m-tap: 120ms; --m-sm: 220ms; --m-move: 460ms; --m-spring: 520ms; --m-step: 35ms; }

/* ambient light: a slow breathing glow at the top of the screen */
.m-amb { position: fixed; left: 0; right: 0; top: 0; height: 46vh; pointer-events: none; z-index: 1;
	background: radial-gradient(60% 70% at 50% -18%, rgba(255,255,255,.075), transparent 70%);
	animation: m-breathe 9s ease-in-out infinite; }
@keyframes m-breathe { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }

/* lists: rows no longer replay their entrance on every refresh; first show cascades in */
.pane-list .row { animation: none; }
.pane-list .row.m-in { animation: m-rise var(--m-spring) var(--spring) both; animation-delay: calc(var(--i, 0) * var(--m-step)); }
@keyframes m-rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
/* a chat that just jumped to the top gets a brief light sweep */
.row.m-new::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
	background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.07) 50%, transparent 80%); background-size: 250% 100%;
	animation: m-sweep 1.1s var(--out) both; }
@keyframes m-sweep { from { background-position: 120% 0; } to { background-position: -60% 0; } }
.row { position: relative; }
.row .badge { animation: none; }
.row:active { transform: scale(.985); transition-duration: var(--m-tap); }

/* header lifts once the list scrolls under it */
.pane-list .topbar { transition: box-shadow var(--m-move) var(--out), background-color var(--m-move) var(--out); }
.pane-list.m-scrolled .topbar { box-shadow: 0 1px 0 var(--line), 0 12px 24px -18px #000; }
.pane-list .topbar .title { transition: transform var(--m-move) var(--spring); transform-origin: 0 50%; }
.pane-list.m-scrolled .topbar .title { transform: scale(.92); }

/* tab bar: one pill slides between tabs (phones) */
@media (max-width: 719px) {
	.pane-list > .tabs.m-has-ind .tab[aria-current="page"] { background: transparent; }
	.pane-list > .tabs .tab { position: relative; z-index: 1; }
	.m-ind { position: absolute; left: 0; top: 0; border-radius: 24px; background: var(--text); pointer-events: none; z-index: 0;
		transition: opacity var(--m-sm); box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 8px 18px -10px rgba(0,0,0,.8); }
	.tabs .tab:active .ic { transform: scale(.86); transition: transform var(--m-tap); }
	.pane-list > .tabs.m-dock-in { animation: m-dock .7s var(--spring) both .1s; }
	@keyframes m-dock { from { opacity: 0; transform: translate(-50%, 24px) scale(.94); } to { opacity: 1; transform: translateX(-50%); } }
}
@media (min-width: 720px) { .m-ind { display: none; } }
.tabs .tab .dot { animation: none; }

/* conversation: bubbles */
.msgs .bub:not(.flash) { animation: none; }
.msgs .bub.m-open { animation: m-rise .5s var(--spring) both; animation-delay: var(--d, 0ms); }
.msgs .bub.m-recv { transform-origin: 0 100%; animation: m-recv .55s var(--spring) both; }
.msgs .bub.m-send { transform-origin: 100% 100%; animation: m-send .5s var(--spring) both; }
@keyframes m-recv { from { opacity: 0; transform: translate(-14px, 10px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes m-send { from { opacity: 0; transform: translate(10px, 18px) scale(.9); } to { opacity: 1; transform: none; } }
.bub.locked:active:not(.open) { transform: scale(.985); transition-duration: var(--m-tap); }

/* sending: the bubble shimmers while it is being encrypted */
.bub.pending { position: relative; overflow: hidden; }
.bub.pending::after { content: ""; position: absolute; inset: 0; pointer-events: none;
	background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); background-size: 260% 100%;
	mix-blend-mode: soft-light; animation: m-enc 1.1s linear infinite; }
@keyframes m-enc { from { background-position: 130% 0; } to { background-position: -30% 0; } }
.bub.m-dlv { animation: m-land .5s var(--spring) both; }
@keyframes m-land { 0% { transform: scale(.985); } 50% { transform: scale(1.02); } 100% { transform: none; } }

/* hold to read: a ring fills under the thumb */
.m-ring { position: fixed; width: 64px; height: 64px; transform: translate(-50%, -50%); pointer-events: none; z-index: 70;
	animation: m-ring-in var(--m-sm) var(--out) both; }
.m-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.m-ring circle { fill: none; stroke: rgba(255,255,255,.18); stroke-width: 2.5; }
.m-ring circle.f { stroke: #fff; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: m-fill .2s linear forwards; }
@keyframes m-ring-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes m-fill { to { stroke-dashoffset: 0; } }

/* someone is typing: cipher glyphs that keep shifting */
.m-typing { position: absolute; left: 14px; z-index: 5; display: flex; gap: 3px; align-items: center; padding: 9px 14px; border-radius: 18px;
	background: var(--surface); box-shadow: var(--edge); font-family: var(--mono); font-size: 13px; color: var(--muted);
	animation: m-recv .45s var(--spring) both; }
.m-typing i { font-style: normal; width: 9px; text-align: center; animation: m-blink 1s ease-in-out infinite; }
.m-typing i:nth-child(2) { animation-delay: .15s; } .m-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes m-blink { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.pane-main { position: relative; }

/* send button: the icon swap and the lift-off are driven from motion.js */
.m-ghost { position: fixed; z-index: 70; pointer-events: none; color: #fff; mix-blend-mode: difference; display: block; }
.m-ghost svg { width: 100%; height: 100%; display: block; }

/* press feedback: a ripple from where you touched */
.m-rip-host { position: relative; overflow: hidden; isolation: isolate; }
.m-ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: 0; z-index: -1; }
.btn:active, .chip:active, .pick:active, .icon-btn:active { transform: scale(.97); transition: transform var(--m-tap); }

/* pull to refresh: the spinner becomes a lock ring */
.ptr-spin { border-radius: 50%; border: 2px solid rgba(255,255,255,.14); border-top-color: var(--text) !important; transition: transform .1s; }
.ptr.ready .ptr-spin { transform: scale(1.15) !important; }
.ptr-t { font-family: var(--mono); letter-spacing: .02em; }

/* toasts drop in from the top edge and settle */
.toast { animation: m-toast .5s var(--spring) both; }
@keyframes m-toast { from { opacity: 0; transform: translateY(-14px) scale(.94); } to { opacity: 1; transform: none; } }

/* status dots on the setup card and admin pills breathe gently */
.k2-pill.on::before, .k2-setup .dot-on { animation: m-pulse 2.6s ease-in-out infinite; }
@keyframes m-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* sign-in: just the mark and the form */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.signin-bare { justify-content: center; }
.signin-bare .signin-main { animation: none; }
.signin-bare .brand-lock { margin-bottom: 36px; position: relative; }
.signin-bare .brand-lock::before { content: ""; position: absolute; left: 50%; top: 42%; width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%; pointer-events: none;
	background: radial-gradient(closest-side, rgba(255,255,255,.10), transparent); animation: m-halo 6s ease-in-out infinite 1.6s; opacity: 0; }
@keyframes m-halo { 0%, 100% { opacity: .35; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.08); } }
.signin-bare .wordmark { animation: m-word .9s var(--out) both 1.05s; }
@keyframes m-word { from { opacity: 0; letter-spacing: .9em; filter: blur(6px); } to { opacity: 1; filter: none; } }
.signin-bare .alert, .signin-bare .bezel { animation: m-rise .7s var(--spring) both 1.25s; }

/* the mark assembles: bones draw, ends pop, the shackle drops shut, then clicks again every few seconds */
.logo-anim { overflow: visible; }
.logo-anim > g:nth-child(1) path { stroke-dasharray: 12; stroke-dashoffset: 12; animation: m-draw .6s var(--out) forwards .15s; }
@keyframes m-draw { to { stroke-dashoffset: 0; } }
.logo-anim > g:nth-child(2) circle { transform-box: fill-box; transform-origin: center; animation: m-knob .45s var(--spring) both .55s; }
@keyframes m-knob { from { transform: scale(0); } to { transform: none; } }
.logo-anim > path:nth-child(4) { transform-box: fill-box; transform-origin: 50% 100%; animation: m-body .7s var(--spring) both 0s; }
@keyframes m-body { from { opacity: 0; transform: translateY(10px) scale(.92); } to { opacity: 1; transform: none; } }
.logo-anim > path:nth-child(3) { animation: m-shut .55s cubic-bezier(.5,0,.75,0) both .7s, m-click 7s var(--spring) infinite 2.5s; }
@keyframes m-shut { 0% { opacity: 0; transform: translateY(-9px); } 40% { opacity: 1; } 80% { transform: translateY(1px); } 100% { opacity: 1; transform: none; } }
@keyframes m-click { 0%, 84%, 100% { transform: none; } 88% { transform: translateY(-4px); } 94% { transform: translateY(.8px); } }

/* signing in: the shackle springs up and swings open, light floods the mark, the form folds away */
.logo-anim > path:nth-child(3) { transform-box: view-box; transform-origin: 43px 20px; }
.unlocking .logo-anim > path:nth-child(3) { animation: m-open .6s var(--spring) forwards; }
@keyframes m-open { 0% { transform: none; } 35% { transform: translateY(-9px); } 100% { transform: translateY(-9px) rotate(32deg); } }
.unlocking .logo-anim > path:nth-child(4) { animation: m-thunk .5s var(--spring) both .15s; }
@keyframes m-thunk { 0% { transform: none; } 40% { transform: translateY(2px) scale(1.03, .97); } 100% { transform: none; } }
.unlocking .logo-anim { animation: m-glow .9s var(--out) both .2s; }
@keyframes m-glow { 0% { filter: none; } 50% { filter: drop-shadow(0 0 18px rgba(255,255,255,.55)); } 100% { filter: drop-shadow(0 0 8px rgba(255,255,255,.25)); } }
.unlocking .brand-lock::before { animation: m-flood .9s var(--out) forwards .2s; }
@keyframes m-flood { from { opacity: .4; transform: scale(.9); } to { opacity: 1; transform: scale(2.4); } }
.unlocking .brand-lock { animation: m-lift .9s var(--out) forwards .35s; }
@keyframes m-lift { to { transform: translateY(60px) scale(1.15); } }
.unlocking .bezel, .unlocking .alert { animation: m-fold .45s var(--out) forwards .25s; pointer-events: none; }
@keyframes m-fold { to { opacity: 0; transform: translateY(24px) scale(.96); filter: blur(4px); } }
.unlocking .wordmark { animation: m-wordout .5s var(--out) forwards .3s; }
@keyframes m-wordout { to { opacity: 0; letter-spacing: .9em; } }
.signin-bare .btn-primary .btn-ic { transition: transform .4s var(--spring); }
.unlocking .btn-primary .btn-ic { transform: translateX(6px); }

/* lock screen (PIN / Face ID): same unlock, then the pad and buttons fall away */
.lockscreen .brand-lock { position: relative; }
.lockscreen .brand-lock::before { content: ""; position: absolute; left: 50%; top: 40%; width: 180px; height: 180px; margin: -90px 0 0 -90px; border-radius: 50%; pointer-events: none; opacity: 0;
	background: radial-gradient(closest-side, rgba(255,255,255,.12), transparent); }
.lockscreen.unlocking .pin, .lockscreen.unlocking .lock-foot-wrap, .lockscreen.unlocking .lock-foot, .lockscreen.unlocking .bio-ring,
.lockscreen.unlocking .pin-msg, .lockscreen.unlocking .ban { animation: m-fold .45s var(--out) forwards .25s; pointer-events: none; }
.lockscreen.unlocking .pin .pin-dots span { background: #fff; border-color: #fff; }
.m-deny .logo-anim > path:nth-child(3) { animation: m-rattle .5s ease both; }

/* wrong password: the mark rattles and the form shakes once */
.denied .logo-anim > path:nth-child(3) { animation: m-shut .55s cubic-bezier(.5,0,.75,0) both .7s, m-rattle .5s ease both 1.3s; }
@keyframes m-rattle { 0%, 100% { transform: none; } 20% { transform: translateY(-3px) rotate(-6deg); } 45% { transform: translateY(-2px) rotate(5deg); } 70% { transform: translateY(-1px) rotate(-3deg); } }
.denied .bezel { animation: m-rise .7s var(--spring) both 1.25s, m-shake .45s ease both 1.95s; }
@keyframes m-shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

@media (prefers-reduced-motion: reduce) {
	.logo-anim *, .signin-bare * { animation: none !important; opacity: 1 !important; stroke-dashoffset: 0 !important; }
	.m-amb, .m-ring, .m-typing, .m-ripple { display: none !important; }
	.pane-list.m-scrolled .topbar .title { transform: none; }
}
