/* Motion layer for the landing page.
   Nothing is hidden unless <html class="motion"> is set (head script: motion allowed and supported;
   it is withdrawn again if js/motion.js never arrives). Only opacity, translate, scale, clip-path
   and transform move. */
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
}

/* ── First visit: header, then the headline line by line, then the actions, then the app ── */
html.motion header { animation: m-drop 0.6s var(--ease-out) both; }
html.motion .hero-a1 { animation: m-up 0.7s var(--ease-out) 0.1s both; }
html.motion #hero-section h1 > span > span { animation: m-line 1s var(--ease-out) 0.2s both; }
html.motion #hero-section h1 > span > span + span { animation-delay: 0.36s; }
html.motion .hero-a3 { animation: m-up 0.7s var(--ease-out) 0.55s both; }
html.motion .hero-a4 > a { animation: m-pop 0.6s var(--ease-out) 0.68s backwards; }
html.motion .hero-a4 > a + a { animation-delay: 0.76s; }
html.motion p.hero-a4 { animation: m-up 0.6s var(--ease-out) 0.84s both; }
html.motion .hero-a5 > div { animation: m-up 0.55s var(--ease-out) 0.92s both; }
html.motion .hero-a5 > div:nth-child(2) { animation-delay: 1s; }
html.motion .hero-a5 > div:nth-child(3) { animation-delay: 1.08s; }
html.motion .hero-a6 { animation: m-window 1.1s var(--ease-out) 0.75s both; }
html.motion .hero-photo-wash img { animation: m-settle 2.2s var(--ease-out) both; }
html.motion .floating-whatsapp { animation: m-pop 0.5s var(--ease-out) 1.6s backwards; }

@keyframes m-drop { from { opacity: 0; translate: 0 -100%; } to { opacity: 1; translate: 0 0; } }
@keyframes m-up { from { opacity: 0; translate: 0 24px; } to { opacity: 1; translate: 0 0; } }
@keyframes m-pop { from { opacity: 0; scale: 0.9; } to { opacity: 1; scale: 1; } }
@keyframes m-line {
  from { clip-path: inset(0 -5% 100% -5%); translate: 0 55%; }
  to { clip-path: inset(-30% -5% -30% -5%); translate: 0 0; }
}
@keyframes m-window { from { opacity: 0; translate: 0 48px; } to { opacity: 1; translate: 0 0; } }
@keyframes m-settle { from { scale: 1.06; } to { scale: 1; } }

/* The signature move: the app window starts leaned back and stands up as you scroll (js sets --lean). */
html.motion .hero-a6 { perspective: 1400px; }
html.motion .hero-window {
  transform-origin: 50% 0;
  transform: rotateX(calc(var(--lean, 1) * 16deg)) scale(calc(1 - var(--lean, 1) * 0.07));
}
@media (max-width: 640px) {
  html.motion .hero-window { transform: rotateX(calc(var(--lean, 1) * 10deg)) scale(calc(1 - var(--lean, 1) * 0.03)); }
}

/* ── On scroll: each kind of content arrives in its own way ── */
html.motion [data-m] {
  opacity: 0;
  transition: opacity 0.7s var(--ease-out), translate 0.9s var(--ease-out), scale 0.9s var(--ease-out), clip-path 1.1s var(--ease-in-out);
  transition-delay: var(--delay, 0ms);
}
html.motion [data-m="up"] { translate: 0 16px; }
html.motion [data-m="title"] { translate: 0 28px; clip-path: inset(0 0 100% 0); }
html.motion [data-m="pop"] { scale: 0.86; }
html.motion [data-m="side"] { translate: -36px 0; }
html.motion[dir="rtl"] [data-m="side"] { translate: 36px 0; }
html.motion [data-m="stand"] { translate: 0 28px; scale: 0.97; }
html.motion [data-m="open"] { clip-path: inset(0 50% 0 50% round 16px); scale: 1.04; }
html.motion [data-m="draw"] { clip-path: inset(0 100% 0 0); }
html.motion[dir="rtl"] [data-m="draw"] { clip-path: inset(0 0 0 100%); }

html.motion [data-m].m-in { opacity: 1; translate: 0 0; scale: 1; }
html.motion [data-m="title"].m-in { clip-path: inset(-20% 0 -20% 0); }
html.motion [data-m="open"].m-in { clip-path: inset(0 0 0 0 round 0); }
html.motion [data-m="draw"].m-in { clip-path: inset(0 0 0 0); }

/* ── Header: reading progress and a shadow once the page moves ── */
header .m-progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: #1d72f5; transform: scaleX(0); transform-origin: 0 50%; pointer-events: none;
}
html[dir="rtl"] header .m-progress { transform-origin: 100% 50%; }
header { transition: box-shadow 0.24s ease; }
header.m-scrolled { box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.45); }

/* ── Under the hand ── */
html.motion main a[class*="rounded"]:not([data-m]), html.motion main + section a[class*="rounded"]:not([data-m]), html.motion .ss-tab:not([data-m]) {
  transition: translate 0.18s var(--ease-out), scale 0.14s var(--ease-out), box-shadow 0.18s ease,
    background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
html.motion main a[class*="rounded"]:active, html.motion main + section a[class*="rounded"]:active, html.motion .ss-tab:active { scale: 0.96; }
@media (hover: hover) and (pointer: fine) {
  html.motion main a[class*="rounded"]:hover, html.motion main + section a[class*="rounded"]:hover, html.motion .ss-tab:hover { translate: 0 -1px; }
}

/* A question opens: the answer slides into place. */
html.motion details[open] > :not(summary) { animation: m-answer 0.4s var(--ease-out) both; }
html.motion details summary .material-symbols-rounded { transition: rotate 0.24s var(--ease-out); }
@keyframes m-answer { from { opacity: 0; translate: 0 -10px; } to { opacity: 1; translate: 0 0; } }

/* A new screenshot settles in rather than just appearing. */
html.motion .ss-panel.ss-panel-active { animation: m-shot 0.7s var(--ease-out) both; }
@keyframes m-shot { from { scale: 1.035; } to { scale: 1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .ping-slow { animation: none; }
}
