/* ==========================================================================
   TaskDoners: motion
   Hidden-until-revealed states only apply when <html> has the .motion class,
   which is set in <head> only when the visitor has not asked for reduced motion.
   If the scripts fail to load, a failsafe removes .motion so content stays visible.
   Only transform, opacity and clip-path are animated.
   ========================================================================== */

/* ---------- Lenis smooth scroll ---------- */

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Scroll reveals ---------- */

.motion [data-reveal] {
  opacity: 0;
  translate: 0 36px;
  transition:
    opacity var(--dur-base) var(--ease-out) calc(var(--i, 0) * 80ms),
    translate 1s var(--ease-out) calc(var(--i, 0) * 80ms),
    transform .7s var(--ease-out),
    box-shadow .45s var(--ease-out),
    background-color .45s;
}
.motion [data-reveal].is-in { opacity: 1; translate: none; }

/* Words slide up from behind their mask */
.motion .split .w > span {
  transform: translateY(108%);
  transition: transform 1s var(--ease-out);
  transition-delay: calc(var(--wi, 0) * 38ms);
}
.motion .split.is-in .w > span { transform: none; }
.motion [data-hero] .w > span { transition-duration: 1.15s; transition-delay: calc(120ms + var(--wi, 0) * 75ms); }

/* Hairlines draw in from the left */
.motion .rule, .motion .step__line { transform: scaleX(0); transition: transform 1.2s var(--ease-out) .1s; }
.motion .rule.is-in, .motion .step.is-in .step__line { transform: scaleX(1); }

/* ---------- Preloader (first visit per session) ---------- */

.motion.is-loading { overflow: hidden; }
.motion.is-loading .preloader {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--green-900);
  clip-path: inset(0 0 0 0);
  transition: clip-path .9s var(--ease-in-out);
}
.preloader__inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.preloader__word { display: flex; overflow: hidden; font-family: var(--font-display); font-weight: 800; font-size: clamp(2.4rem, 7vw, 5rem); letter-spacing: -.04em; line-height: 1.05; padding-bottom: .06em; }
.preloader__word span { display: inline-block; transform: translateY(110%); animation: pre-word .9s var(--ease-out) forwards; }
.preloader__word span:last-child { color: var(--lime); animation-delay: .12s; }
.preloader__bar { position: relative; width: min(220px, 50vw); height: 2px; background: var(--white-12); overflow: hidden; border-radius: 2px; }
.preloader__bar span { position: absolute; inset: 0; background: var(--lime); transform: scaleX(0); transform-origin: left; animation: pre-bar 1.1s var(--ease-in-out) .15s forwards; }
.motion.is-loaded .preloader { clip-path: inset(0 0 100% 0); }
.motion.is-loaded .preloader__inner { opacity: 0; transform: translateY(-40px); transition: opacity .5s var(--ease-out), transform .8s var(--ease-in-out); }

@keyframes pre-word { to { transform: none; } }
@keyframes pre-bar { to { transform: scaleX(1); } }

/* ---------- Page transitions ---------- */

.motion.is-leaving .transition__panel { transform: scaleY(1); transform-origin: bottom; transition: transform .42s var(--ease-in-out); }
.motion.is-entering .transition__panel { transform: scaleY(1); transition: none; }
.motion.is-entered .transition__panel { transform: scaleY(0); transform-origin: top; transition: transform .5s var(--ease-in-out); }

/* ---------- Custom cursor (fine pointers only) ---------- */

.has-cursor, .has-cursor a, .has-cursor button, .has-cursor [data-cursor] { cursor: none; }
.has-cursor input, .has-cursor textarea, .has-cursor select { cursor: auto; }
.has-cursor .cursor { display: block; position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; }
.cursor__dot, .cursor__ring { position: fixed; top: 0; left: 0; border-radius: 50%; will-change: transform; transform: translate3d(-120px, -120px, 0); }
.cursor__dot { width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--lime); }
.cursor__ring { width: 40px; height: 40px; margin: -20px 0 0 -20px; display: grid; place-items: center; }
.cursor__ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(135, 211, 63, .7); transition: transform .5s var(--ease-out), background-color .4s, box-shadow .4s; }
.cursor__label { position: relative; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s var(--ease-out); }
.cursor.is-link .cursor__ring::before { transform: scale(1.6); background: rgba(135, 211, 63, .12); }
.cursor.is-label .cursor__ring::before { transform: scale(2.1); background: var(--lime); box-shadow: none; }
.cursor.is-label .cursor__label { opacity: 1; transform: none; }
.cursor.is-label .cursor__dot, .cursor.is-hidden .cursor__dot, .cursor.is-hidden .cursor__ring { opacity: 0; }
.cursor__dot, .cursor__ring { transition: opacity .3s; }
.cursor.is-down .cursor__ring::before { transform: scale(.8); }

/* ---------- WhatsApp bubble ---------- */

.motion .wa-float { opacity: 0; translate: 0 28px; transition: opacity .6s var(--ease-out), translate .9s var(--ease-spring); }
.motion .wa-float.is-visible { opacity: 1; translate: none; }
.motion .wa-float.is-visible .wa-float__ring { animation: wa-pulse 4.2s var(--ease-out) 1.2s infinite; }
.wa-float.is-open .wa-float__ring { animation: none !important; }
@keyframes wa-pulse {
  0% { opacity: .7; transform: scale(1); }
  35% { opacity: 0; transform: scale(1.7); }
  100% { opacity: 0; transform: scale(1.7); }
}

/* ---------- Ambient motion ---------- */

.motion .hero__badge-text { animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.motion .marquee__track { animation: marquee 42s linear infinite; }
.marquee.is-driven .marquee__track { animation: none; }
@keyframes marquee { to { transform: translateX(-50%); } }

.motion .art--rings span:nth-child(1) { animation: breathe 9s ease-in-out infinite; }
.motion .art--rings span:nth-child(2) { animation: breathe 9s ease-in-out -3s infinite; }
@keyframes breathe { 50% { transform: scale(1.04); } }

.motion .art--stack span:nth-child(2) { animation: float 7s ease-in-out infinite; }
@keyframes float { 50% { translate: 0 -12px; } }

/* ---------- Modal ---------- */

.modal { opacity: 0; transform: translateY(18px) scale(.97); transition: opacity .35s var(--ease-out), transform .55s var(--ease-out); }
.modal.is-open { opacity: 1; transform: none; }
.modal::backdrop { opacity: 0; transition: opacity .4s var(--ease-out); }
.modal.is-open::backdrop { opacity: 1; }

/* ---------- Parallax helpers ---------- */

.motion [data-parallax] { will-change: transform; }

/* ---------- Reduced motion safety net ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .marquee__track { animation: none !important; transform: none !important; }
  .wa-float__ring { display: none; }
}
