/* The mark moves (BB-122, web/motion.js). Only transform and opacity move. With «reduce motion» the mark stands
   still in its final pose and no impulse runs. */

/* ── the mark of moving parts: the colours of logo.svg, and of logo-dark.svg in the dark ────────────────────────── */
.bm { display: block; overflow: visible; }
.bm .bm-g { fill: #9A9A9A; }
.bm .bm-i, .bm .bm-e { fill: #18181B; }
:root[data-mode="dark"] .bm .bm-g { fill: #8A8A90; }
:root[data-mode="dark"] .bm .bm-i { fill: #EDEDEA; }
.bm .bm-bar, .bm .bm-hand, .bm .bm-e { transform-box: fill-box; }
.bm .bm-bar, .bm .bm-e { transform-origin: center; }
.bm .bm-hand { transform-origin: 50% 80%; }

/* ── the first screen (index.html #boot): it stands over the page until the app has drawn it, then lets it through ── */
#boot { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 105; height: auto; }
#boot.bye { pointer-events: none; }
#boot .bm-lock { width: min(375px, 86vw); height: auto; }
/* the landing's first paint (data-land) and a page loaded again by «Оновити» (data-reload, the brain is drawn over it,
   web/app.js) have no logo on it */
html[data-land] #boot .bm, html[data-reload] #boot .bm { visibility: hidden; }
/* (the three links for a visitor without script stand over it) */
.boot-links { z-index: 106; }
/* the bar is drawn from its middle, the hands take it, the brain peeks over and opens its eyes; then, while the page
   is on its way, it blinks, looks left and right and breathes */
#boot .bm-bar { animation: bm-bar 240ms var(--enter) both; }
#boot .bm-hl { animation: bm-hand 340ms var(--spring) 60ms both; }
#boot .bm-hr { animation: bm-hand 340ms var(--spring) 110ms both; }
#boot .bm-rise { animation: bm-rise 460ms cubic-bezier(.3, 1.3, .5, 1) 100ms both; }
#boot .bm-e { animation: bm-wake 160ms ease-out 400ms both, bm-blink 4.2s ease 1.5s infinite; }
#boot .bm-look { animation: bm-look 5.6s ease-in-out 1.1s infinite; }
#boot .bm-bob { animation: bm-bob 2.6s ease-in-out 900ms infinite alternate; }
#boot .bm-word { animation: bm-word 420ms var(--enter) 160ms both; }
@keyframes bm-bar { from { transform: scaleX(0); } }
@keyframes bm-hand { from { transform: translateY(10px) scale(.4); opacity: 0; } }
@keyframes bm-rise { from { transform: translateY(96px); } }
@keyframes bm-wake { from { transform: scaleY(.12); } }
@keyframes bm-blink { 0%, 91%, 97%, 100% { transform: none; } 94% { transform: scaleY(.12); } }
@keyframes bm-look { 0%, 14%, 86%, 100% { transform: none; } 22%, 40% { transform: translateX(-3px); } 52%, 74% { transform: translateX(3px); } }
@keyframes bm-bob { to { transform: translateY(2px); } }
@keyframes bm-word { from { opacity: 0; transform: translateX(-10px); } }

/* ── a toast of a success: the brain peeks over its top edge (web/motion.js toastWin) ───────────────────────────── */
/* 60 px wide: the box runs from y -90 to 16 in the mark's units, so the edge (y 0) is 22.9 px under its top */
.toast.win { position: relative; margin-top: 22px; }
.toast .mo-peek { position: absolute; left: 20px; top: -22.9px; width: 60px; height: 26.95px; pointer-events: none; }
.toast .mo-peek .bm-rise { animation: bm-rise 420ms cubic-bezier(.3, 1.3, .5, 1) 140ms both; }
.toast .mo-peek .bm-hl { animation: bm-hand 320ms var(--spring) 60ms both; }
.toast .mo-peek .bm-hr { animation: bm-hand 320ms var(--spring) 100ms both; }
.toast .mo-peek .bm-e { animation: bm-wake 140ms ease-out 460ms both, bm-blink 3.2s ease 1.6s infinite; }
.toast.out .mo-peek .bm-rise { animation: bm-duck 200ms var(--exit) forwards; }
@keyframes bm-duck { to { transform: translateY(96px); } }

/* ── «Усе розібрано»: the brain over its bar instead of a tick (doneMark) ──────────────────────────────────────── */
.empty .mo-done { width: 92px; height: auto; aspect-ratio: 236 / 106; margin: 0 auto 12px; }
.empty .mo-done .bm-bar { animation: bm-bar 260ms var(--enter) both; }
.empty .mo-done .bm-hl { animation: bm-hand 340ms var(--spring) 80ms both; }
.empty .mo-done .bm-hr { animation: bm-hand 340ms var(--spring) 130ms both; }
.empty .mo-done .bm-rise { animation: bm-rise 520ms cubic-bezier(.3, 1.3, .5, 1) 160ms both; }
.empty .mo-done .bm-e { animation: bm-wake 160ms ease-out 520ms both, bm-blink 4.8s ease 2s infinite; }
.empty .mo-done .bm-look { animation: bm-look 7s ease-in-out 2.4s infinite; }

/* ── the moment's sky: impulses over everything, never in the way (salute, intoBrain) ──────────────────────────── */
.mo-sky { position: fixed; left: 0; top: 0; z-index: 125; pointer-events: none; }
/* a section's place took what came: its icon jumps once, a ring of the signal colour goes out */
.mo-got > svg { animation: mo-jump 460ms var(--spring); }
.mo-ring { position: absolute; width: 0; height: 0; pointer-events: none; }
.mo-ring::before { content: ''; position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--signal); opacity: 0; animation: mo-ring 720ms var(--enter); }
@keyframes mo-jump { 40% { transform: scale(1.28); } }
@keyframes mo-ring { from { transform: scale(.4); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  #boot .bm *, .toast .mo-peek *, .empty .mo-done *, .mo-got > svg, .mo-ring::before { animation: none !important; }
}
