/* ==========================================================================
   Zoho Financial: motion engine v2 (css/motion.css)
   Pairs with js/motion.js. Pages use the data-m attribute API only.

   Rules of this file
   - Pre-enter ("hidden") states exist ONLY under html.js-m. motion.js adds that
     class first thing, and never adds it under prefers-reduced-motion, so
     no-JS and reduced-motion visitors always see the final state.
   - An element gets .m-in when it enters and .m-done once the transition has
     finished. Every rule below is scoped to :not(.m-done), so afterwards the
     element is governed purely by the page's own CSS (hover states etc).
   - Enter effects use the individual transform properties (translate, scale,
     rotate) wherever possible so they never fight a page's own `transform`.
   ========================================================================== */

:root {
  --m-ease: cubic-bezier(.22, 1, .36, 1);
  --m-ease-io: cubic-bezier(.65, .05, .36, 1);
  --m-dur: .9s;
  --page-fg: #14201B;
}
@property --md { syntax: '<time>'; inherits: false; initial-value: 0ms; }
@property --page-fg { syntax: '<color>'; inherits: true; initial-value: #14201B; }

/* ---------- Text: words / chars / lines ---------------------------------- */
html.js-m [data-m="words"]:not(.m-split),
html.js-m [data-m="chars"]:not(.m-split),
html.js-m [data-m="lines"]:not(.m-split) { visibility: hidden; }

/* the mask. overflow:clip does not turn the box into a scroll container, so the
   inline-block keeps its normal baseline. Padding gives descenders, tight
   line-heights and negative tracking room; the negative margin cancels it. */
.m-w, .m-cw > .m-c, .m-l {
  display: inline-block; overflow: hidden; overflow: clip;
  vertical-align: baseline;
  padding: .12em .06em .16em; margin: -.12em -.06em -.16em;
}
.m-cw { display: inline-block; white-space: nowrap; }
.m-l { display: block; padding-inline: 0; margin-inline: 0; }
[data-m="lines"] > span { display: block; }  /* lines are blocks with or without JS / reduced motion */
.m-wi, .m-ci, .m-li { display: inline-block; }
.m-li { display: block; }

html.js-m [data-m="words"]:not(.m-done) .m-wi {
  transform: translate3d(0, 112%, 0);
  transition: transform 1s var(--m-ease) var(--wd, 0ms);
}
html.js-m [data-m="words"].m-in:not(.m-done) .m-wi { transform: none; }

html.js-m [data-m="chars"]:not(.m-done) .m-ci {
  transform: translate3d(0, 105%, 0) rotate(8deg); transform-origin: 0 100%;
  transition: transform .95s var(--m-ease) var(--wd, 0ms);
}
html.js-m [data-m="chars"].m-in:not(.m-done) .m-ci { transform: none; }

html.js-m [data-m="lines"]:not(.m-done) .m-li {
  transform: translate3d(0, 112%, 0);
  transition: transform 1.05s var(--m-ease) var(--wd, 0ms);
}
html.js-m [data-m="lines"].m-in:not(.m-done) .m-li { transform: none; }

/* fill: outline -> solid, word by word, scrubbed by scroll */
html.js-m [data-m="fill"] .m-f {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--fc, currentColor);
  background-image: linear-gradient(90deg, var(--fc, currentColor) var(--fill, 0%), transparent var(--fill, 0%));
  -webkit-background-clip: text; background-clip: text;
  /* the paint box extends past the glyphs so italic overhangs / negative tracking are not cut off */
  padding-inline: .08em; margin-inline: -.08em; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
/* fully filled: plain solid text, no stroke or clipped layer (no edge artefacts) */
html.js-m [data-m="fill"] .m-f.m-f-full { color: var(--fc, currentColor); -webkit-text-stroke: 0; background-image: none; }

/* count */
[data-m="count"] { font-variant-numeric: tabular-nums; }

/* type: caret never moves layout */
.m-ty-c { display: inline-block; width: 0; position: relative; overflow: visible; }
.m-ty-c::after {
  content: ""; position: absolute; left: .08em; bottom: .12em; width: .08em; height: .95em;
  background: currentColor; opacity: 0; transition: opacity .5s;
}
.m-ty-c.is-on::after { opacity: 1; animation: m-caret .8s steps(1) infinite; }
.m-ty-c.is-off::after { opacity: 0; animation: none; }
.m-ty-h { visibility: hidden; }
@keyframes m-caret { 50% { opacity: 0; } }

/* ---------- Blocks and images -------------------------------------------- */
html.js-m [data-m^="wipe-"]:not(.m-done) { transition: clip-path 1.15s var(--m-ease-io) var(--md); will-change: clip-path; }
html.js-m [data-m="wipe-l"]:not(.m-in):not(.m-done) { clip-path: inset(0 100% 0 0); }
html.js-m [data-m="wipe-r"]:not(.m-in):not(.m-done) { clip-path: inset(0 0 0 100%); }
html.js-m [data-m="wipe-u"]:not(.m-in):not(.m-done) { clip-path: inset(0 0 100% 0); }
html.js-m [data-m="wipe-d"]:not(.m-in):not(.m-done) { clip-path: inset(100% 0 0 0); }
html.js-m [data-m^="wipe-"].m-in:not(.m-done) { clip-path: inset(0 0 0 0); }
html.js-m [data-m^="wipe-"]:not(.m-done) > :is(img, svg, video, .mask-img),
html.js-m [data-m="iris"]:not(.m-done) > :is(img, svg, video, .mask-img),
html.js-m [data-m="arch"]:not(.m-done) > :is(img, svg, video, .mask-img) {
  scale: 1.18; transition: scale 1.6s var(--m-ease) var(--md);
}
html.js-m [data-m="iris"]:not(.m-done) > :is(img, svg, video, .mask-img) { scale: 1.15; }
html.js-m [data-m="arch"]:not(.m-done) > :is(img, svg, video, .mask-img) { scale: 1.12; }
html.js-m [data-m^="wipe-"].m-in:not(.m-done) > :is(img, svg, video, .mask-img),
html.js-m [data-m="iris"].m-in:not(.m-done) > :is(img, svg, video, .mask-img),
html.js-m [data-m="arch"].m-in:not(.m-done) > :is(img, svg, video, .mask-img) { scale: 1; }

/* arch: the rounded top is the design, so it is permanent. The slit only exists before entering. */
[data-m="arch"] { clip-path: inset(0 round 999px 999px 0 0); }
html.js-m [data-m="arch"]:not(.m-done) { transition: clip-path 1.3s var(--m-ease-io) var(--md); will-change: clip-path; }
html.js-m [data-m="arch"]:not(.m-in):not(.m-done) { clip-path: inset(100% 30% 0 30% round 999px 999px 0 0); }
html.js-m [data-m="arch"].m-in:not(.m-done) { clip-path: inset(0 round 999px 999px 0 0); }

html.js-m [data-m="iris"]:not(.m-done) { transition: clip-path 1.3s var(--m-ease-io) var(--md); will-change: clip-path; }
html.js-m [data-m="iris"]:not(.m-in):not(.m-done) { clip-path: circle(0% at 50% 60%); }
html.js-m [data-m="iris"].m-in:not(.m-done) { clip-path: circle(75% at 50% 50%); }

html.js-m [data-m="zoom"]:not(.m-done) { transition: opacity .9s ease var(--md), scale .9s var(--m-ease) var(--md); }
html.js-m [data-m="zoom"]:not(.m-in):not(.m-done) { opacity: 0; scale: .88; }

html.js-m :is([data-m="slide-l"], [data-m="slide-r"], [data-m="slide-u"]):not(.m-done) {
  transition: opacity .95s ease var(--md), translate .95s var(--m-ease) var(--md);
}
html.js-m [data-m="slide-l"]:not(.m-in):not(.m-done) { opacity: 0; translate: -64px 0; }
html.js-m [data-m="slide-r"]:not(.m-in):not(.m-done) { opacity: 0; translate: 64px 0; }
html.js-m [data-m="slide-u"]:not(.m-in):not(.m-done) { opacity: 0; translate: 0 64px; }

/* narrow screens: no sideways entrances (a translated element near the edge would widen the page mid-animation) */
@media (max-width: 899px) {
  html.js-m [data-m="slide-l"]:not(.m-in):not(.m-done),
  html.js-m [data-m="slide-r"]:not(.m-in):not(.m-done) { translate: 0 40px; }
}

html.js-m [data-m="rise"]:not(.m-done) { transition: opacity .8s ease var(--md), translate .8s var(--m-ease) var(--md); }
html.js-m [data-m="rise"]:not(.m-in):not(.m-done) { opacity: 0; translate: 0 24px; }

html.js-m [data-m="flip"]:not(.m-done) {
  transition: opacity 1s ease var(--md), transform 1s var(--m-ease) var(--md);
  transform-origin: 50% 100%;
}
html.js-m [data-m="flip"]:not(.m-in):not(.m-done) { opacity: 0; transform: perspective(900px) rotateX(70deg); }
html.js-m [data-m="flip"].m-in:not(.m-done) { transform: perspective(900px) rotateX(0deg); }

html.js-m [data-m="stagger"] > :not([data-m]):not(.m-done) {
  transition: opacity .85s ease var(--md), translate .95s var(--m-ease) var(--md);
}
html.js-m [data-m="stagger"]:not(.m-in) > :not([data-m]):not(.m-done) { opacity: 0; translate: 0 56px; }
html.js-m [data-m="stagger"][data-m-from="left"]:not(.m-in) > :not([data-m]):not(.m-done) { translate: -56px 0; }
html.js-m [data-m="stagger"][data-m-from="right"]:not(.m-in) > :not([data-m]):not(.m-done) { translate: 56px 0; }
html.js-m [data-m="stagger"][data-m-from="center"]:not(.m-in) > :not([data-m]):not(.m-done) { translate: 0 0; scale: .9; }
html.js-m [data-m="stagger"][data-m-from="edges"]:not(.m-in) > :not([data-m]):not(.m-done) { translate: 0 0; scale: .9; }
/* narrow screens: left/right stagger enters vertically. Must come AFTER the base left/right rules above (same specificity),
   otherwise the 56px sideways start state wins and widens the page before the cards have entered (QA 2026-10-27). */
@media (max-width: 899px) {
  html.js-m [data-m="stagger"][data-m-from="left"]:not(.m-in) > :not([data-m]):not(.m-done),
  html.js-m [data-m="stagger"][data-m-from="right"]:not(.m-in) > :not([data-m]):not(.m-done) { translate: 0 40px; }
}

/* ---------- Scroll-linked ------------------------------------------------- */
/* draw: shapes get pathLength=1 from JS; --dr is the remaining (1 -> 0) */
html.js-m [data-m="draw"] :is(path, line, polyline, polygon, circle, rect, ellipse):not(.m-draw-fill) {
  stroke-dasharray: 1 2; stroke-dashoffset: var(--dr, 1);
}
html.js-m [data-m="draw"].m-draw-0 :is(path, line, polyline, polygon, circle, rect, ellipse):not(.m-draw-fill) { visibility: hidden; }
html.js-m [data-m="draw"] .m-draw-fill { opacity: var(--dp, 0); }
html.js-m [data-m="draw"] .m-draw-sf { fill-opacity: var(--dp, 0); }

/* pin */
.m-pin-on > .pin__stage, .m-pin-on.m-pin-self {
  position: sticky; top: var(--nav-h, 88px); height: calc(100vh - var(--nav-h, 88px));
}
.pin__outer { position: relative; }

/* hscroll */
.hs { position: relative; }
.hs__stage { display: flex; flex-direction: column; justify-content: center; }
.hs__track { display: flex; align-items: stretch; gap: var(--hs-gap, clamp(16px, 2.4vw, 36px)); width: max-content; padding-inline: var(--gutter, 24px); }
.hs__panel { flex: 0 0 auto; width: min(78vw, 720px); }
.m-hs-on > .hs__stage {
  position: sticky; top: var(--nav-h, 88px);
  height: calc(100vh - var(--nav-h, 88px)); overflow: hidden;
}
.m-hs-on .hs__track { will-change: transform; }
.m-hs-flow .hs__track {
  width: auto; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scroll-padding-inline: var(--gutter, 20px); scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.m-hs-flow .hs__track::-webkit-scrollbar { display: none; }
.m-hs-flow .hs__panel { width: min(82vw, 440px); scroll-snap-align: start; }
.hs__bar { display: none; height: 3px; margin: 14px var(--gutter, 20px) 0; background: rgba(127, 127, 127, .28); border-radius: 3px; overflow: hidden; }
.m-hs-flow .hs__bar { display: block; }
.hs__bar > i { display: block; height: 100%; background: var(--green, #00844E); transform-origin: 0 50%; transform: scaleX(var(--pin, 0)); }

/* stack */
.m-stack-on > .stack__card { position: sticky; transform-origin: 50% 0; will-change: transform; }
.m-stack-on > .stack__card:not(:last-child) { margin-bottom: var(--stack-gap, 14vh); }
.m-stack-on > .stack__card {
  scale: calc(1 - var(--k, 0) * .04);
  rotate: calc(var(--k, 0) * var(--rs, 1) * -.45deg);
  filter: brightness(calc(1 - var(--k, 0) * .12));
}

/* theme */
body.m-theme-has { transition: background-color .8s ease, --page-fg .8s ease; }
body.m-theme-on { color: var(--page-fg); }

/* ---------- Pointer effects ----------------------------------------------- */
[data-m="tilt"] { position: relative; transform-style: preserve-3d; }
.m-tilt-glare {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; z-index: 2;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .22), transparent 55%);
  transition: opacity .4s;
}
[data-m="tilt"].is-tilting > .m-tilt-glare { opacity: 1; }

[data-m="spot"] { position: relative; isolation: isolate; }
[data-m="spot"]::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), var(--spot-c, rgba(123, 220, 134, .22)), transparent 62%);
  opacity: 0; transition: opacity .35s ease;
}
[data-m="spot"].is-spot::before { opacity: 1; }

.m-follow-img {
  position: fixed; left: 0; top: 0; width: 280px; height: auto; max-height: 360px; object-fit: cover; border-radius: 10px;
  pointer-events: none; z-index: 90; opacity: 0; transition: opacity .25s ease; will-change: transform; box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.m-follow-img.is-on { opacity: 1; }

/* ---------- Loops / ambience ---------------------------------------------- */
html.js-m [data-m="float"] { animation: m-float 6s ease-in-out var(--md) infinite; }
html.js-m [data-m="spin"] { animation: m-spin var(--spin, 40s) linear infinite; }
html.js-m [data-m="pulse"] { animation: m-pulse 2.4s ease-in-out var(--md) infinite; }
html.js-m [data-m].is-paused { animation-play-state: paused; }
@keyframes m-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes m-spin { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes m-pulse { 0%, 100% { scale: 1; opacity: 1; } 50% { scale: 1.06; opacity: .86; } }

[data-m="marquee"].m-mq { overflow: hidden; }
.m-mq__track { display: flex; flex-wrap: nowrap; width: max-content; will-change: transform; }
.m-mq__g { display: flex; flex: none; align-items: center; gap: var(--mq-gap, 3rem); padding-right: var(--mq-gap, 3rem); white-space: nowrap; }

/* ---------- Lottie ---------------------------------------------------------- */
.lt { position: relative; }
.lt svg { display: block; width: 100%; height: 100%; }
.lt .lt__fallback { display: none; width: 100%; height: 100%; object-fit: contain; }
.lt.lt--failed .lt__fallback { display: block; }

/* ---------- Utilities -------------------------------------------------------- */
[data-m="read-progress"] { display: contents; }
.m-rp {
  position: fixed; left: 0; top: 0; width: 100%; height: 3px; z-index: 9999; pointer-events: none;
  background: linear-gradient(90deg, var(--green, #00844E), var(--lime-hi, #7BDC86));
  transform-origin: 0 50%; transform: scaleX(var(--rp, 0));
}
.m-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Safety net: if IntersectionObserver never reports back, motion.js adds .m-safe
   and everything is simply shown. */
html.m-safe [data-m]:not([data-m="arch"]) { opacity: 1 !important; translate: none !important; scale: none !important; clip-path: none !important; transform: none !important; visibility: visible !important; }
html.m-safe [data-m="arch"] { clip-path: inset(0 round 999px 999px 0 0) !important; opacity: 1 !important; visibility: visible !important; }
html.m-safe [data-m] .m-wi, html.m-safe [data-m] .m-ci, html.m-safe [data-m] .m-li { transform: none !important; }
html.m-safe [data-m="stagger"] > * { opacity: 1 !important; translate: none !important; scale: none !important; }

/* ---------- Reduced motion: final state, no loops ---------------------------- */
@media (prefers-reduced-motion: reduce) {
  [data-m] { animation: none !important; }
  .hs__track { width: auto; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .hs__track::-webkit-scrollbar { display: none; }
  .hs__panel { width: min(82vw, 440px); scroll-snap-align: start; }
}

/* Entrance start states (and page-local ones) sit 56-72px outside the viewport edge before they play, which widens
   the document (measured at 1024px on legal/privacy/terms/home/HNW). Clip each top-level section sideways only:
   overflow-x: clip does not create a scroll container, so sticky / pin / hscroll keep working (QA 2026-10-27). */
html.js-m main > section { overflow-x: clip; }
