/*
 * NARMA-Animated buttons (module narma_buttons) — the effects buttons.js puts on a button for one beat, the finger and
 * the glint layers over it, the guide of the next required field and the bar over Simple's form.
 * --nab-ring is the button's own colour ("r,g,b"), set by the script.
 */

/* ---------- the effects (one beat each; the script repeats them) ---------- */
.nab-fx-pulse { animation: nab-ring 1.6s ease-out; }
@keyframes nab-ring {
	0% { box-shadow: 0 0 0 0 rgba(var(--nab-ring, 18,18,65), .55); }
	100% { box-shadow: 0 0 0 16px rgba(var(--nab-ring, 18,18,65), 0); }
}

.nab-fx-heart { animation: nab-heart 1.3s ease-in-out; }
@keyframes nab-heart {
	0%, 28%, 70%, 100% { transform: scale(1); }
	14%, 42% { transform: scale(1.08); }
}

.nab-fx-shake { animation: nab-shake 1s ease-in-out; }
@keyframes nab-shake {
	0%, 50%, 100% { transform: translateX(0); }
	6.5% { transform: translateX(-7px) rotateY(-9deg); }
	18.5% { transform: translateX(6px) rotateY(7deg); }
	31.5% { transform: translateX(-4px) rotateY(-5deg); }
	43.5% { transform: translateX(3px) rotateY(3deg); }
}

/* the finger presses twice: the button gives a little under it */
.nab-fx-press { animation: nab-press 2.4s ease-in-out; }
@keyframes nab-press {
	0%, 18%, 29%, 33%, 44%, 100% { transform: scale(1); }
	22%, 37% { transform: scale(.96); }
}

.nab-fx-shine { }

.nab-fx-bounce { animation: nab-bounce 1.1s ease; }
@keyframes nab-bounce {
	0%, 20%, 53%, 100% { transform: translateY(0); }
	40%, 43% { transform: translateY(-9px); }
	70% { transform: translateY(-4px); }
	90% { transform: translateY(-1px); }
}

.nab-fx-glow { animation: nab-glow 2s ease-in-out; }
@keyframes nab-glow {
	0%, 100% { box-shadow: 0 0 0 0 rgba(var(--nab-ring, 18,18,65), 0); }
	50% { box-shadow: 0 0 14px 4px rgba(var(--nab-ring, 18,18,65), .55); }
}

/* once, when the button becomes the one to press */
.nab-fx-pop { animation: nab-pop .55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes nab-pop {
	0%, 100% { transform: scale(1); }
	45% { transform: scale(1.1); }
}

/* ---------- the layers over the button (fixed, follow it while they play) ---------- */
.nab-layer {
	position: fixed;
	z-index: 2147483000;
	overflow: hidden;
	pointer-events: none;
	margin: 0;
	padding: 0;
}

.nab-shine {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 40%;
	background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0));
	transform: translateX(-130%) skewX(-20deg);
	animation: nab-shine 1.1s ease-in-out forwards;
}
@keyframes nab-shine {
	from { transform: translateX(-130%) skewX(-20deg); }
	to { transform: translateX(330%) skewX(-20deg); }
}

.nab-ripple {
	position: absolute;
	width: 14px;
	height: 14px;
	margin: -7px 0 0 -7px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .75);
	opacity: 0;
	animation: nab-ripple 2.4s ease-out;
}
@keyframes nab-ripple {
	0%, 21% { opacity: 0; transform: scale(1); }
	22% { opacity: .9; transform: scale(1); }
	34% { opacity: 0; transform: scale(5); }
	36% { opacity: .9; transform: scale(1); }
	50%, 100% { opacity: 0; transform: scale(5); }
}

.nab-hand {
	position: fixed;
	z-index: 2147483001;
	width: 40px;
	height: 40px;
	pointer-events: none;
	opacity: 0;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
	animation: nab-hand 2.4s ease-in-out;
}
.nab-hand svg,
.nab-point svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: #fff;
	stroke: #121241;
	stroke-width: 1.3px;
	paint-order: stroke;
	stroke-linejoin: round;
}
@keyframes nab-hand {
	0% { opacity: 0; transform: translate(22px, 22px); }
	14% { opacity: 1; transform: translate(0, 0); }
	22% { transform: translate(-1px, 3px) scale(.9); }
	29% { transform: translate(0, 0) scale(1); }
	37% { transform: translate(-1px, 3px) scale(.9); }
	44% { transform: translate(0, 0) scale(1); }
	62% { opacity: 1; transform: translate(0, 0); }
	78%, 100% { opacity: 0; transform: translate(16px, 18px); }
}

/* ---------- the guide: the next required field ---------- */
.nab-host { position: relative; }
/* the glow around a group of floating values (the group itself has no height) */
.nab-frame {
	position: absolute;
	z-index: 1;
	pointer-events: none;
}

/* the finger tapping a step (inside the step's row, not fixed; each tap restarted by the script) */
.nab-hand.nab-hand-in {
	position: absolute;
	z-index: 31;
	animation: none;
}
.nab-hand.nab-hand-in.nab-go { animation: nab-hand 2.4s ease-in-out; }
.nab-ripple.nab-ripple-in {
	z-index: 30;
	background: rgba(18, 18, 65, .28);
	animation: none;
	pointer-events: none;
}
.nab-ripple.nab-ripple-in.nab-light { background: rgba(255, 255, 255, .8); }
.nab-ripple.nab-ripple-in.nab-go { animation: nab-ripple 2.4s ease-out; }

/* delivery / payment: the finger (the hand) going over every method — glides, one tap each */
.nab-hand.nab-hand-in.nab-seq,
.nab-point.nab-seq {
	opacity: 0;
	transition: left .35s ease, top .35s ease, opacity .25s ease;
}
.nab-hand.nab-hand-in.nab-seq { animation: none; }
.nab-hand.nab-hand-in.nab-seq.nab-on,
.nab-point.nab-seq.nab-on { opacity: 1; }
.nab-hand.nab-hand-in.nab-seq.nab-tap1 { animation: nab-tap1 .45s ease-in-out; }
@keyframes nab-tap1 {
	0%, 100% { transform: none; }
	45% { transform: translate(-1px, 3px) scale(.9); }
}
.nab-ripple.nab-ripple-in.nab-tap1 { animation: nab-ripple1 .6s ease-out; }
@keyframes nab-ripple1 {
	0% { opacity: .9; transform: scale(1); }
	100% { opacity: 0; transform: scale(4.5); }
}

.nab-next-field {
	border-color: #121241 !important;
	animation: nab-field 1.8s ease-in-out infinite;
}
@keyframes nab-field {
	0%, 100% { box-shadow: 0 0 0 0 rgba(18, 18, 65, 0); }
	50% { box-shadow: 0 0 0 4px rgba(18, 18, 65, .18); }
}

.nab-next-area {
	border-radius: 4px;
	animation: nab-area 1.8s ease-in-out infinite;
}
@keyframes nab-area {
	0%, 100% { box-shadow: 0 0 0 0 rgba(18, 18, 65, 0); }
	50% { box-shadow: 0 0 0 6px rgba(18, 18, 65, .12); }
}

.nab-tip {
	position: absolute;
	z-index: 30;
	display: block;
	/* its own width, not the rest of the narrow column it stands in */
	width: -webkit-max-content;
	width: max-content;
	max-width: 320px;
	padding: 5px 10px;
	border-radius: 4px;
	background: #121241;
	color: #fff;
	font-size: 13px;
	font-weight: 400;
	line-height: 18px;
	text-align: left;
	text-transform: none;
	white-space: normal;
	pointer-events: none;
	box-shadow: 0 3px 10px rgba(0, 0, 0, .15);
	animation: nab-tipin .35s ease-out, nab-tipbob 2.4s ease-in-out .35s infinite;
}
.nab-tip:after {
	content: "";
	position: absolute;
	top: 100%;
	left: var(--nab-arrow, 16px);
	border: 6px solid transparent;
	border-top-color: #121241;
}
/* under the SMS button: the arrow up */
.nab-tip.nab-below:after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #121241; }
/* right of a choice's text: the arrow left */
.nab-tip.nab-side:after { top: 50%; left: auto; right: 100%; margin-top: -6px; border-top-color: transparent; border-right-color: #121241; }
@keyframes nab-tipin {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}
@keyframes nab-tipbob {
	0%, 100% { transform: none; }
	50% { transform: translateY(-3px); }
}

.nab-point {
	position: absolute;
	z-index: 30;
	width: 34px;
	height: 34px;
	pointer-events: none;
	filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3));
	animation: nab-point-l 1.1s ease-in-out infinite;
}
.nab-point.nab-pr { animation-name: nab-point-r; }
.nab-point.nab-pu { animation-name: nab-point-u; }
/* the hand points up; turned to point left (it stands right of the field) or right */
@keyframes nab-point-l {
	0%, 100% { transform: translateX(0) rotate(-90deg); }
	50% { transform: translateX(-7px) rotate(-90deg); }
}
@keyframes nab-point-r {
	0%, 100% { transform: translateX(0) rotate(90deg); }
	50% { transform: translateX(7px) rotate(90deg); }
}
@keyframes nab-point-u {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-6px); }
}

/* ---------- the bar over Simple's form ---------- */
.nab-progress {
	margin: 0 0 14px;
	padding: 10px 14px;
	border: 1px solid #e8e8e8;
	border-radius: 4px;
	background: #fff;
}
.nab-progress-bar {
	height: 6px;
	border-radius: 3px;
	background: #eee;
	overflow: hidden;
}
.nab-progress-bar i {
	display: block;
	width: 0;
	height: 100%;
	background: #00a614;
	transition: width .4s ease;
}
.nab-progress-t {
	margin-top: 4px;
	color: #666;
	font-size: 12px;
	line-height: 16px;
}
.nab-progress.nab-done .nab-progress-t { color: #00a614; }

/* ---------- "reduce motion" in the system: nothing moves, the guide stays still ---------- */
@media (prefers-reduced-motion: reduce) {
	.nab-fx-pulse, .nab-fx-heart, .nab-fx-shake, .nab-fx-press, .nab-fx-bounce, .nab-fx-glow, .nab-fx-pop,
	.nab-shine, .nab-ripple, .nab-hand, .nab-tip, .nab-point, .nab-next-area { animation: none !important; }
	.nab-hand, .nab-layer { display: none !important; }
	.nab-next-field { animation: none !important; box-shadow: 0 0 0 3px rgba(18, 18, 65, .25); }
	.nab-next-area { box-shadow: 0 0 0 4px rgba(18, 18, 65, .15); }
	.nab-point { transform: rotate(-90deg); }
	.nab-point.nab-pr { transform: rotate(90deg); }
	.nab-point.nab-pu { transform: none; }
	.nab-progress-bar i { transition: none; }
}
