/* The public site's motion. Crisp and quiet, as a system people trust with their books: things
   arrive (ease-out, never ease-in), the product's screens show their work once, the pointer gets an
   answer. Only transform, opacity and filter move. Nothing above the fold is held back (the title is
   what search engines time), and with reduced motion nothing moves at all: motion.js marks what
   enters later only when motion is allowed. */

:root {
	--ak-out: cubic-bezier(0.23, 1, 0.32, 1);
	--ak-in-out: cubic-bezier(0.77, 0, 0.175, 1);
	--ak-enter: 720ms;
}

/* ─── arriving as the page scrolls (motion.js sets data-reveal and --i) ─── */

[data-reveal="wait"] {
	opacity: 0;
	transform: translate3d(0, 18px, 0);
}

[data-reveal="wait"][data-from="start"] {
	transform: translate3d(28px, 0, 0);
}

[dir="ltr"] [data-reveal="wait"][data-from="start"] {
	transform: translate3d(-28px, 0, 0);
}

[data-reveal="wait"][data-from="end"] {
	transform: translate3d(-28px, 0, 0) scale(0.98);
}

[dir="ltr"] [data-reveal="wait"][data-from="end"] {
	transform: translate3d(28px, 0, 0) scale(0.98);
}

[data-reveal="in"] {
	opacity: 1;
	transform: none;
	transition:
		opacity var(--ak-enter) var(--ak-out),
		transform var(--ak-enter) var(--ak-out);
	transition-delay: calc(var(--i, 0) * 55ms);
}

/* the kicker's corner draws itself as its section arrives */
[data-reveal] .ak-kicker::before,
.ak-kicker[data-reveal]::before {
	transition: transform 520ms var(--ak-out) 160ms;
}

[data-reveal="wait"] .ak-kicker::before,
.ak-kicker[data-reveal="wait"]::before {
	transform: scale(0);
}

/* ─── the opening: the title comes into focus, the rest rises after it ─── */

.ak-hero-copy > *,
.ak-pagehead .ak-wrap > *,
.ak-pagehead-grid > div > * {
	animation: ak-rise 760ms var(--ak-out) both;
}

.ak-hero-copy > :nth-child(2),
.ak-pagehead .ak-wrap > :nth-child(2),
.ak-pagehead-grid > div > :nth-child(2) {
	animation-delay: 60ms;
}

.ak-hero-copy > :nth-child(3),
.ak-pagehead .ak-wrap > :nth-child(3),
.ak-pagehead-grid > div > :nth-child(3) {
	animation-delay: 120ms;
}

.ak-hero-copy > :nth-child(4),
.ak-pagehead .ak-wrap > :nth-child(4),
.ak-pagehead-grid > div > :nth-child(4) {
	animation-delay: 180ms;
}

.ak-hero-copy > :nth-child(n + 5),
.ak-pagehead .ak-wrap > :nth-child(n + 5),
.ak-pagehead-grid > div > :nth-child(n + 5) {
	animation-delay: 240ms;
}

/* the headings and the opening paragraph stay painted from the first frame (one of them is the
   page's largest text): they only
   sharpen and settle, so the time to the largest paint isn't pushed back */
.ak-hero-copy > h1,
.ak-pagehead h1,
.ak-hero-copy > .ak-lede,
.ak-pagehead .ak-lede {
	animation-name: ak-focus;
}

@keyframes ak-rise {
	from {
		opacity: 0;
		transform: translate3d(0, 14px, 0);
	}
}

@keyframes ak-focus {
	from {
		filter: blur(6px);
		transform: translate3d(0, 10px, 0);
	}
}

/* the invoice settles into place, then floats; its two notes follow it */
.ak-hero-visual {
	animation: ak-screen-in 1100ms var(--ak-out) 160ms both;
}

.ak-hero-visual .mk {
	animation: ak-float 7s ease-in-out 1.4s infinite;
}

.ak-hero-chip {
	animation: ak-chip-in 620ms var(--ak-out) both;
}

.ak-hero-chip-a {
	animation-delay: 2.1s;
}

.ak-hero-chip-b {
	animation-delay: 2.5s;
}

@keyframes ak-screen-in {
	from {
		opacity: 0;
		transform: translate3d(0, 34px, 0) scale(0.97);
	}
}

@keyframes ak-float {
	0%,
	100% {
		translate: 0 0;
	}
	50% {
		translate: 0 -7px;
	}
}

@keyframes ak-chip-in {
	from {
		opacity: 0;
		transform: translate3d(0, 10px, 0) scale(0.92);
	}
}

/* the hero's soft light drifts */
.ak-hero {
	isolation: isolate;
}

.ak-hero::before,
.ak-zatca::before,
.ak-final::before {
	content: "";
	position: absolute;
	z-index: -1;
	width: 46vmax;
	height: 46vmax;
	border-radius: 50%;
	background: radial-gradient(circle, rgb(2 136 209 / 0.16), transparent 62%);
	inset-inline-end: -12vmax;
	top: -22vmax;
	animation: ak-drift 18s ease-in-out infinite alternate;
	pointer-events: none;
}

.ak-zatca,
.ak-final {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

.ak-zatca::before,
.ak-final::before {
	background: radial-gradient(circle, rgb(56 189 248 / 0.22), transparent 62%);
}

.ak-final::before {
	inset-inline-end: auto;
	inset-inline-start: 30%;
	top: -30vmax;
}

@keyframes ak-drift {
	to {
		transform: translate3d(-6vmax, 5vmax, 0) scale(1.08);
	}
}

/* ─── the product's screens show their work (motion.js adds mk-play when one is seen) ─── */

.mk-play .mk-table tbody tr,
.mk-play .mk-list li,
.mk-play .mk-files li,
.mk-play .mk-cart p,
.mk-play .mk-items li,
.mk-play .mk-tree li {
	animation: ak-row-in 560ms var(--ak-out) both;
}

.mk-play :is(tbody tr, .mk-list li, .mk-files li, .mk-cart p, .mk-items li, .mk-tree li):nth-child(1) {
	animation-delay: 260ms;
}

.mk-play :is(tbody tr, .mk-list li, .mk-files li, .mk-cart p, .mk-items li, .mk-tree li):nth-child(2) {
	animation-delay: 360ms;
}

.mk-play :is(tbody tr, .mk-list li, .mk-files li, .mk-cart p, .mk-items li, .mk-tree li):nth-child(3) {
	animation-delay: 460ms;
}

.mk-play :is(tbody tr, .mk-list li, .mk-files li, .mk-cart p, .mk-items li, .mk-tree li):nth-child(4) {
	animation-delay: 560ms;
}

.mk-play :is(tbody tr, .mk-list li, .mk-files li, .mk-cart p, .mk-items li, .mk-tree li):nth-child(n + 5) {
	animation-delay: 660ms;
}

@keyframes ak-row-in {
	from {
		opacity: 0;
		transform: translate3d(0, 8px, 0);
	}
}

.mk-play .mk-foot,
.mk-play tfoot {
	animation: ak-row-in 560ms var(--ak-out) 760ms both;
}

.mk-play .mk-qr i {
	animation: ak-pop 380ms var(--ak-out) both;
	animation-delay: calc(900ms + var(--q, 0) * 45ms);
}

.mk-qr i:nth-child(2) { --q: 3; }
.mk-qr i:nth-child(3) { --q: 5; }
.mk-qr i:nth-child(4) { --q: 1; }
.mk-qr i:nth-child(5) { --q: 7; }
.mk-qr i:nth-child(6) { --q: 2; }
.mk-qr i:nth-child(7) { --q: 6; }
.mk-qr i:nth-child(8) { --q: 4; }
.mk-qr i:nth-child(9) { --q: 8; }

@keyframes ak-pop {
	from {
		opacity: 0;
		transform: scale(0.6);
	}
}

/* the invoice's ZATCA state: «sending» with a breathing dot, then «reported» comes into focus */
.mk-status {
	display: inline-grid;
}

.mk-status > span {
	grid-area: 1 / 1;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	justify-content: center;
}

.mk-status-a {
	visibility: hidden;
}

.mk-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
}

.mk-play .mk-status {
	animation: ak-status-tint 400ms ease 2.2s both;
}

.mk-play .mk-status-a {
	visibility: visible;
	animation: ak-status-out 280ms var(--ak-out) 2.2s both;
}

.mk-play .mk-status-a .mk-dot {
	animation: ak-breathe 900ms ease-in-out infinite;
}

.mk-play .mk-status-b {
	animation: ak-status-in 420ms var(--ak-out) 2.3s both;
}

@keyframes ak-status-tint {
	from {
		background: var(--ak-tint);
		color: var(--ak-sky-deep);
	}
}

@keyframes ak-status-out {
	to {
		opacity: 0;
		filter: blur(3px);
		transform: scale(0.96);
	}
}

@keyframes ak-status-in {
	from {
		opacity: 0;
		filter: blur(3px);
		transform: scale(1.04);
	}
}

@keyframes ak-breathe {
	50% {
		opacity: 0.35;
		transform: scale(0.7);
	}
}

/* commission meters fill from where the reader starts */
.mk-meter::after {
	transform-origin: right center;
}

[dir="ltr"] .mk-meter::after {
	transform-origin: left center;
}

.mk-play .mk-meter::after {
	animation: ak-fill 1100ms var(--ak-out) 500ms both;
}

@keyframes ak-fill {
	from {
		transform: scaleX(0);
	}
}

/* the till's pay button answers once the cart is full */
.mk-play .mk-pay {
	animation: ak-row-in 520ms var(--ak-out) 760ms both, ak-press 520ms var(--ak-out) 1.9s;
}

@keyframes ak-press {
	40% {
		transform: scale(0.96);
	}
}

/* ─── the pointer's answers ─── */

.ak-btn {
	transition:
		background-color 180ms ease,
		border-color 180ms ease,
		color 180ms ease,
		box-shadow 220ms ease,
		transform 160ms var(--ak-out);
}

.ak-btn:active {
	transform: scale(0.97);
}

/* the large call to action catches the light as the pointer reaches it */
.ak-btn-primary.ak-btn-lg {
	position: relative;
	overflow: hidden;
	isolation: isolate;
}

.ak-btn-primary.ak-btn-lg::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / 0.28) 50%, transparent 70%);
	transform: translateX(-120%);
	pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
	.ak-btn-primary:hover {
		box-shadow: 0 1px 0 rgb(255 255 255 / 0.2) inset, 0 12px 26px -12px rgb(2 119 189 / 0.85);
	}

	.ak-btn-primary.ak-btn-lg:hover::after {
		transform: translateX(120%);
		transition: transform 900ms var(--ak-out);
	}

	.ak-card a .ak-card-icon,
	.ak-tiles a > .i:first-child {
		transition: background-color 220ms ease, color 220ms ease, transform 320ms var(--ak-out);
	}

	.ak-card a:hover .ak-card-icon,
	.ak-tiles a:hover > .i:first-child {
		background: var(--ak-sky);
		color: #fff;
		transform: scale(1.06) rotate(-4deg);
	}

	.ak-card-more .i {
		transition: transform 260ms var(--ak-out);
	}

	.ak-card a:hover .ak-card-more .i {
		transform: translateX(-4px);
	}

	[dir="ltr"] .ak-card a:hover .ak-card-more .i {
		transform: translateX(4px);
	}

	.ak-pillars li,
	.ak-features li,
	.ak-startsteps li,
	.ak-solutions li,
	.ak-contact li {
		transition: border-color 220ms ease, box-shadow 320ms var(--ak-out), transform 320ms var(--ak-out);
	}

	.ak-pillars li:hover,
	.ak-features li:hover,
	.ak-startsteps li:hover,
	.ak-solutions li:hover,
	.ak-contact li:hover {
		border-color: var(--ak-sky-soft);
		box-shadow: var(--ak-shadow);
		transform: translateY(-3px);
	}

	/* the screens lean toward the reader */
	.ak-spot-visual .mk,
	.ak-pagehead-visual .mk {
		transition: transform 600ms var(--ak-out), box-shadow 600ms var(--ak-out);
	}

	.ak-spot-visual .mk:hover,
	.ak-pagehead-visual .mk:hover {
		transform: translateY(-4px) scale(1.01);
	}

	/* the footer's links underline from where the reader starts */
	.ak-footer-col a {
		background: linear-gradient(currentColor, currentColor) no-repeat right bottom / 0 1px;
		transition: background-size 320ms var(--ak-out), color 180ms ease;
	}

	[dir="ltr"] .ak-footer-col a {
		background-position: left bottom;
	}

	.ak-footer-col a:hover {
		background-size: 100% 1px;
	}
}

/* ─── menus open from their own button ─── */

.ak-panel {
	transform-origin: top right;
	animation: ak-panel-in 200ms var(--ak-out);
}

[dir="ltr"] .ak-panel {
	transform-origin: top left;
}

@keyframes ak-panel-in {
	from {
		opacity: 0;
		transform: translate3d(0, -4px, 0) scale(0.98);
	}
}

/* ─── questions open smoothly where the browser can size to their content ─── */

@supports (interpolate-size: allow-keywords) {
	:root {
		interpolate-size: allow-keywords;
	}

	.ak-faq-item::details-content {
		height: 0;
		overflow: clip;
		transition: height 300ms var(--ak-out), content-visibility 300ms allow-discrete;
	}

	.ak-faq-item[open]::details-content {
		height: auto;
	}

	.ak-faq-item p {
		transition: opacity 300ms ease 60ms, transform 300ms var(--ak-out) 60ms;
	}

	.ak-faq-item:not([open]) p {
		opacity: 0;
		transform: translate3d(0, -4px, 0);
	}
}

/* ─── the counts count up as they are seen (motion.js) ─── */

.ak-count {
	font-variant-numeric: tabular-nums;
	display: inline-block;
	min-width: 2ch;
}

/* ─── a guide's reading progress, on the header's lower edge ─── */

.ak-progress {
	display: none;
}

@supports (animation-timeline: scroll()) {
	:is(.page-guide, .page-privacy, .page-terms) .ak-progress {
		display: block;
		position: absolute;
		inset-inline: 0;
		bottom: -1px;
		height: 2px;
		background: var(--ak-sky);
		transform-origin: right center;
		animation: ak-read linear both;
		animation-timeline: scroll(root);
	}

	[dir="ltr"] :is(.page-guide, .page-privacy, .page-terms) .ak-progress {
		transform-origin: left center;
	}
}

@keyframes ak-read {
	from {
		transform: scaleX(0);
	}
}

/* ─── moving between pages: the header stays, the page eases in ─── */

@view-transition {
	navigation: auto;
}

.ak-header {
	view-transition-name: ak-header;
}

::view-transition-old(root) {
	animation: ak-vt-out 160ms ease both;
}

::view-transition-new(root) {
	animation: ak-vt-in 340ms var(--ak-out) both;
}

@keyframes ak-vt-out {
	to {
		opacity: 0;
	}
}

@keyframes ak-vt-in {
	from {
		opacity: 0;
		transform: translate3d(0, 10px, 0);
	}
}

/* ─── reduced motion: everything in place at once; colours may still change ─── */

@media (prefers-reduced-motion: reduce) {
	@view-transition {
		navigation: none;
	}

	.ak-hero-copy > *,
	.ak-pagehead .ak-wrap > *,
	.ak-pagehead-grid > div > *,
	.ak-hero-visual,
	.ak-hero-visual .mk,
	.ak-hero-chip,
	.ak-hero::before,
	.ak-zatca::before,
	.ak-final::before,
	.ak-panel,
	.ak-progress {
		animation: none !important;
	}
}
