/* Animated Worklist logo («Lag») used on the login pages.
   Markup comes from /assets/js/brand-logo.js. Full animation set: _design/logo/lag/animasjoner.html */

.brand-logo { display: block; overflow: visible; }
.brand-logo .wl, .brand-logo .l1, .brand-logo .l2, .brand-logo .l3,
.brand-logo .top, .brand-logo .check, .brand-logo .x, .brand-logo .spark {
	transform-box: fill-box;
	transform-origin: center;
}
.brand-logo .wl { transform-origin: 50% 100%; }
.brand-logo .check { stroke-dasharray: 20; stroke-dashoffset: 0; }
.brand-logo .x, .brand-logo .spark { opacity: 0; }

/* Resting: the layers breathe */
.bl-idle .l1 { animation: bl-float1 3.2s ease-in-out infinite; }
.bl-idle .l2 { animation: bl-float2 3.2s ease-in-out infinite; }

/* Waiting for the server: the layers light up from the bottom */
.bl-load .l3, .bl-load .l2, .bl-load .l1 { animation: bl-pulse 1.2s ease-in-out infinite; }
.bl-load .l2 { animation-delay: .15s; }
.bl-load .l1 { animation-delay: .3s; }

/* Wrong e-mail or password: shakes, red top with a cross */
.bl-shake.on .wl { animation: bl-shake .8s ease-out; }
.bl-shake.on .top { animation: bl-redtop 1.4s ease-out; }
.bl-shake.on .check { animation: bl-hide 1.4s; }
.bl-shake.on .x { animation: bl-show 1.4s; }

/* Logged in: jumps, green top, the check is drawn, sparks */
.bl-done.on .wl { animation: bl-jump 1s ease-out; }
.bl-done.on .top { animation: bl-greentop 1.8s ease-out; }
.bl-done.on .check { animation: bl-draw .4s ease-out .35s backwards; }
.bl-done.on .spark { animation: bl-sparkle .9s ease-out .35s backwards; }
.bl-done.on .spark:nth-child(2n) { animation-delay: .5s; }

@keyframes bl-float1 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
@keyframes bl-float2 { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.2px); } }
@keyframes bl-pulse { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes bl-shake {
	0%, 100% { transform: translateX(0) rotate(0); } 12% { transform: translateX(-6px) rotate(-6deg); } 28% { transform: translateX(6px) rotate(6deg); }
	44% { transform: translateX(-4px) rotate(-4deg); } 60% { transform: translateX(3px) rotate(3deg); } 76% { transform: translateX(-1px) rotate(-1deg); }
}
@keyframes bl-redtop { 0%, 100% { fill: #2563eb; stroke: #2563eb; } 10%, 75% { fill: #ef4444; stroke: #ef4444; } }
@keyframes bl-greentop { 0%, 100% { fill: #2563eb; stroke: #2563eb; } 20%, 75% { fill: #16a34a; stroke: #16a34a; } }
@keyframes bl-hide { 0%, 100% { opacity: 1; } 8%, 80% { opacity: 0; } }
@keyframes bl-show { 0%, 100% { opacity: 0; transform: scale(.5); } 10%, 78% { opacity: 1; transform: scale(1); } }
@keyframes bl-jump {
	0%, 100% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(0) scale(1.1, .88); } 40% { transform: translateY(-14px) scale(.94, 1.06); }
	60% { transform: translateY(-16px) scale(1, 1); } 80% { transform: translateY(0) scale(1.06, .94); } 90% { transform: translateY(0) scale(.98, 1.02); }
}
@keyframes bl-draw { 0% { stroke-dashoffset: 20; } 100% { stroke-dashoffset: 0; } }
@keyframes bl-sparkle { 0% { opacity: 0; transform: scale(0) rotate(0); } 40% { opacity: 1; transform: scale(1.2) rotate(45deg); } 100% { opacity: 0; transform: scale(.5) rotate(90deg); } }

/* Less motion: no movement, only the colour change tells what happened */
@media (prefers-reduced-motion: reduce) {
	.brand-logo * { animation: none !important; }
	.bl-shake.on .top { fill: #ef4444; stroke: #ef4444; }
	.bl-shake.on .check { opacity: 0; }
	.bl-shake.on .x { opacity: 1; }
	.bl-done.on .top { fill: #16a34a; stroke: #16a34a; }
}
