/* WASLA landing — motion and interaction layer.
   Calm, purposeful motion that explains the product (trace → balance → approve).
   Reduced motion keeps the fades and final states, and drops movement and loops. */

:root {
  --m-ease-out: cubic-bezier(.16, 1, .3, 1);
  --m-ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --m-reveal: 620ms;
}

/* ---------- reading progress ---------- */
.scroll-progress {
  position: fixed; inset-inline: 0; top: 0; height: 3px; z-index: 200; pointer-events: none;
  background: linear-gradient(90deg, var(--wasla-accent), #7fc29a);
  transform: scaleX(var(--p, 0)); transform-origin: right;
}
[dir="ltr"] .scroll-progress { transform-origin: left; }

/* ---------- header ---------- */
.site-header { transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .3s var(--ease); }
.site-header.is-scrolled { box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .55); }
.nav__link { position: relative; }
.nav__link::after {
  content: ""; position: absolute; inset-inline: 14px; bottom: 7px; height: 2px; border-radius: 2px;
  background: var(--wasla-accent); transform: scaleX(0); transition: transform .35s var(--m-ease-out);
}
.nav__link.is-current { color: var(--wasla-text-on-dark); }
.nav__link.is-current::after { transform: scaleX(1); }

/* ---------- hero intro ---------- */
.js .hero__copy > * { opacity: 0; transform: translateY(18px); }
.js .hero.is-ready .hero__copy > * {
  opacity: 1; transform: none;
  transition: opacity .7s var(--m-ease-out), transform .7s var(--m-ease-out);
}
.js .hero.is-ready .hero__copy > :nth-child(2) { transition-delay: .08s; }
.js .hero.is-ready .hero__copy > :nth-child(3) { transition-delay: .18s; }
.js .hero.is-ready .hero__copy > :nth-child(4) { transition-delay: .28s; }
.hero__title .accent { background-size: 200% 100%; }

.js .hero__stage .mock { opacity: 0; transform: translateY(28px) scale(.985); }
.js .hero.is-ready .hero__stage .mock {
  opacity: 1; transform: none;
  transition: opacity .9s var(--m-ease-out) .35s, transform .9s var(--m-ease-out) .35s;
}

/* Hero mock sequence: invoice lines → traces → journal → balanced */
.js .mock .doc .rows .row,
.js .mock .journal .rows .row:not(.row--head),
.js .mock .journal__foot > * { opacity: 0; transform: translateY(6px); }
.mock.is-playing .doc .rows .row,
.mock.is-playing .journal .rows .row,
.mock.is-playing .journal__foot > * {
  opacity: 1; transform: none;
  transition: opacity .45s var(--m-ease-out), transform .45s var(--m-ease-out), background-color .25s var(--ease);
  transition-delay: calc(var(--d, 0) * 1ms);
}
.js .mock .mock__links path { stroke-dasharray: var(--len, 400); stroke-dashoffset: var(--len, 400); }
.mock.is-traced .mock__links path {
  stroke-dashoffset: 0; transition: stroke-dashoffset .9s var(--m-ease-in-out); transition-delay: calc(var(--d, 0) * 1ms);
}
.mock.is-flowing .mock__links path { stroke-dasharray: 4 5; animation: trace-flow 1.4s linear infinite; }
.js .mock .mock__links circle { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0); }
.mock.is-traced .mock__links circle { opacity: 1; transform: scale(1); transition: opacity .3s, transform .4s var(--m-ease-out); transition-delay: calc(var(--d, 0) * 1ms); }
@keyframes trace-flow { to { stroke-dashoffset: -18; } }

.mock .journal__foot .badge--positive.is-pop { animation: pop .5s var(--m-ease-out); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Hover trace: hovering any line lights its counterpart and the link between them */
.mock .rows .row[data-line], .mock .journal .row[data-from] { cursor: default; }
.mock.is-hovering .doc .row[data-line]:not(.is-lit),
.mock.is-hovering .journal .row[data-from]:not(.is-lit) { opacity: .45; }
.mock .row.is-lit { background: rgba(174, 212, 186, .38) !important; }
.mock.is-hovering .mock__links path:not(.is-lit), .mock.is-hovering .mock__links circle:not(.is-lit) { opacity: .15; }
.mock .mock__links path.is-lit { stroke: var(--wasla-primary); stroke-width: 2.2; }
.mock .mock__links path, .mock .mock__links circle { transition: opacity .25s, stroke .25s, stroke-width .25s; }

/* ---------- reveal on scroll (staggered) ---------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity var(--m-reveal) var(--m-ease-out), transform var(--m-reveal) var(--m-ease-out); }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .reveal [data-stagger] > * { opacity: 0; transform: translateY(10px); }
.js .reveal.is-in [data-stagger] > * {
  opacity: 1; transform: none;
  transition: opacity .5s var(--m-ease-out), transform .5s var(--m-ease-out);
  transition-delay: calc(120ms + var(--i, 0) * 70ms);
}
.js .bento .reveal.is-in, .js .steps .reveal.is-in, .js .sec-list .reveal.is-in, .js .plans .reveal.is-in { transition-delay: calc(var(--i, 0) * 70ms); }

/* ---------- trust bar ---------- */
.trust__item { transition: transform .35s var(--m-ease-out), box-shadow .35s var(--m-ease-out), border-color .35s; }
.trust__icon { transition: transform .45s var(--m-ease-out), background-color .3s; }
.trust__item:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -22px rgba(9, 46, 50, .45); }
.trust__item:hover .trust__icon { transform: rotate(-8deg) scale(1.08); }

/* ---------- problem → solution flow ---------- */
.flow__step { transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), transform .35s var(--m-ease-out), box-shadow .35s; }
.flow__step.is-on { background: var(--wasla-accent); color: var(--wasla-sidebar); border-color: var(--wasla-accent); transform: translateY(-2px); box-shadow: 0 10px 22px -12px rgba(174, 212, 186, .9); }
.flow__arrow { transition: opacity .3s, transform .35s var(--m-ease-out); opacity: .45; }
.flow__arrow.is-on { opacity: 1; transform: translateX(-3px); }
[dir="ltr"] .flow__arrow.is-on { transform: translateX(3px); }
.ps__card { transition: transform .45s var(--m-ease-out), box-shadow .45s var(--m-ease-out); }
.ps__card--after:hover { transform: translateY(-4px); box-shadow: 0 30px 50px -30px rgba(9, 46, 50, .7); }

/* ---------- how it works: live pipeline ---------- */
.stage { transition: opacity .3s; }
.stage__dot { transition: background-color .35s var(--ease), border-color .35s var(--ease), color .35s var(--ease), transform .4s var(--m-ease-out); }
.stage.is-done .stage__dot { transform: scale(1); }
.stage.just-done .stage__dot { animation: pop .45s var(--m-ease-out); }
.stage__meta { transition: color .3s; }
.progress-card .bar i { transition: width .7s var(--m-ease-in-out); }
.step { transition: border-color .35s var(--ease), box-shadow .35s var(--ease), transform .45s var(--m-ease-out), background-color .35s; }
.step__n { transition: background-color .35s var(--ease), color .35s var(--ease), transform .45s var(--m-ease-out); }
.step.is-current { border-color: var(--wasla-accent-soft); box-shadow: 0 18px 36px -26px rgba(9, 46, 50, .55); transform: translateX(-4px); }
[dir="ltr"] .step.is-current { transform: translateX(4px); }
.step.is-current .step__n { background: var(--wasla-accent); color: var(--wasla-sidebar); transform: scale(1.06); }

/* ---------- feature cards: lift + cursor spotlight ---------- */
.feat, .plan, .step, .sec-item, .ai__demo { --mx: 50%; --my: 50%; }
.feat { position: relative; overflow: hidden; transition: transform .45s var(--m-ease-out), box-shadow .45s var(--m-ease-out), border-color .3s; }
.feat::before, .plan::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(174, 212, 186, .22), transparent 60%);
  transition: opacity .35s;
}
.feat:hover, .feat:focus-within { transform: translateY(-4px); box-shadow: 0 28px 50px -34px rgba(9, 46, 50, .55); border-color: var(--wasla-accent-soft); }
.feat:hover::before, .plan:hover::before { opacity: 1; }
.feat > * { position: relative; }
.mode { transition: transform .35s var(--m-ease-out), border-color .3s, background-color .3s; }
.mode:hover { transform: translateY(-3px); border-color: var(--wasla-accent-soft); }
.map-row .icon { transition: transform .5s var(--m-ease-out); }
.feat:hover .map-row .icon { transform: translateX(-4px); }
[dir="ltr"] .feat:hover .map-row .icon { transform: translateX(4px); }

/* Bars fill when their card comes into view */
.js .reveal .bar i { width: 0 !important; }
.js .reveal.is-in .bar i { width: var(--to, 100%) !important; transition: width 1.2s var(--m-ease-out) .25s; }
.js .reveal.is-in .meter .bar i { --to: 94.7%; }
.js .reveal.is-in .conf .bar i { --to: 91%; }

.status-grid .mini { transition: transform .4s var(--m-ease-out), box-shadow .4s; }
.status-grid .mini:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -24px rgba(9, 46, 50, .55); }
.status-grid .mini.is-ping .badge { animation: pop .5s var(--m-ease-out); }

/* ---------- AI demo ---------- */
.ai__demo { transition: transform .45s var(--m-ease-out); }
.js .ai__demo > * { opacity: 0; transform: translateY(12px); }
.js .ai__demo.is-in > * { opacity: 1; transform: none; transition: opacity .55s var(--m-ease-out), transform .55s var(--m-ease-out); }
.js .ai__demo.is-in > :nth-child(2) { transition-delay: .35s; }
.js .ai__demo.is-in > :nth-child(3) { transition-delay: .9s; }
.suggest__acct.is-typing::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-inline-start: 3px; vertical-align: -2px; background: currentColor; animation: caret .8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.chip { transition: background-color .25s, color .25s, transform .3s var(--m-ease-out); }
.chip:hover { transform: translateY(-2px); }

/* ---------- security vault ---------- */
.vault__lock { transition: transform .5s var(--m-ease-out), box-shadow .5s; }
.vault.is-in .vault__lock { animation: lock-in .9s var(--m-ease-out) .35s both; }
@keyframes lock-in { 0% { transform: scale(.7) rotate(-12deg); } 55% { transform: scale(1.08) rotate(4deg); } 100% { transform: none; } }
.vault:hover .vault__lock { box-shadow: 0 0 0 10px rgba(174, 212, 186, .12), 0 0 0 22px rgba(174, 212, 186, .06); }
.vault__row { transition: background-color .3s, transform .35s var(--m-ease-out); }
.vault__row:hover { transform: translateX(-3px); }
[dir="ltr"] .vault__row:hover { transform: translateX(3px); }
.sec-item { transition: transform .4s var(--m-ease-out); }
.sec-item:hover { transform: translateX(-4px); }
[dir="ltr"] .sec-item:hover { transform: translateX(4px); }
.sec-item__icon { transition: transform .45s var(--m-ease-out); }
.sec-item:hover .sec-item__icon { transform: rotate(-8deg) scale(1.08); }

/* ---------- pricing ---------- */
.plan { overflow: hidden; transition: transform .45s var(--m-ease-out), box-shadow .45s var(--m-ease-out), border-color .3s; }
.plan > * { position: relative; }
.plan:hover { transform: translateY(-6px); box-shadow: 0 36px 60px -38px rgba(9, 46, 50, .6); }
.plan--featured:hover { box-shadow: 0 40px 70px -35px rgba(9, 46, 50, .9); }

/* ---------- buttons ---------- */
.btn { position: relative; overflow: hidden; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn .icon--dir { transition: transform .35s var(--m-ease-out); }
.btn:hover .icon--dir { transform: translateX(-4px); }
[dir="ltr"] .btn:hover .icon--dir { transform: translateX(4px); }
.btn--mint { box-shadow: 0 0 0 0 rgba(174, 212, 186, .55); }
.hero .btn--mint { animation: cta-glow 3.2s ease-in-out 2.2s infinite; }
@keyframes cta-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(174, 212, 186, 0); } 50% { box-shadow: 0 0 0 10px rgba(174, 212, 186, .14); } }

/* ---------- FAQ: smooth open ---------- */
.faq details { transition: border-color .3s, box-shadow .3s; }
.faq details[open] { border-color: var(--wasla-accent-soft); box-shadow: 0 16px 30px -26px rgba(9, 46, 50, .5); }
.faq details > p { overflow: hidden; }
.faq summary .icon { transition: transform .35s var(--m-ease-out); }

/* ---------- reduced motion: keep fades and final states, drop movement and loops ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .hero__copy > *, .js .hero__stage .mock, .js .reveal, .js .reveal [data-stagger] > *, .js .ai__demo > *,
  .js .mock .doc .rows .row, .js .mock .journal .rows .row:not(.row--head), .js .mock .journal__foot > * { transform: none !important; }
  .mock.is-flowing .mock__links path, .hero .btn--mint, .vault.is-in .vault__lock, .suggest__acct.is-typing::after { animation: none !important; }
  .feat:hover, .plan:hover, .trust__item:hover, .ps__card--after:hover, .step.is-current, .sec-item:hover, .status-grid .mini:hover { transform: none; }
}
