/*!
 * wx-motion.css — companion styles for wx-motion.js
 * ---------------------------------------------------------------------------
 * Every hidden starting state is scoped to html.wx-js (added by the script,
 * or by the inline snippet in <head>), so content is visible if JS fails.
 * A 3s failsafe un-hides anything wx-motion never got to (html:not(.wx-ready)).
 * Only transform, opacity and clip-path are animated (plus mask for the
 * image wipe and height for the accordion, which Mobius also animates).
 * Spring curves are written to :root by the script as --wx-<name>.
 * ------------------------------------------------------------------------- */

:root {
  --wx-bg: var(--paper, #d9d9de);
  --wx-ink: var(--ink, #111111);
  --wx-cover: var(--ink, #111111);
  --wx-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Failsafe: if the script never initialises, show everything after 3s. */
html.wx-js:not(.wx-ready) [data-wx-anim],
html.wx-js:not(.wx-ready) [class*="wx-"] {
  animation: wx-failsafe 0s linear 3s forwards;
}
@keyframes wx-failsafe {
  to { opacity: 1; transform: none; clip-path: none; -webkit-mask-image: none; mask-image: none; }
}

/* ── Smooth scroll (Lenis) ─────────────────────────────────────────────── */
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: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ── 2. Page intro: scale 1.6 → 1 (spring .8s) ─────────────────────────── */
html.wx-js [data-wx-anim~="intro"], html.wx-js .wx-intro {
  opacity: 0.001;
  transform: scale(1.6);
  transform-origin: 50% 50vh;
  transition: opacity var(--wx-intro-d, 0.8s) var(--wx-intro, var(--wx-out)),
    transform var(--wx-intro-d, 0.8s) var(--wx-intro, var(--wx-out));
}
html.wx-js [data-wx-anim~="intro"].is-in, html.wx-js .wx-intro.is-in { opacity: 1; transform: none; }
html.wx-js [data-wx-anim~="intro-text"], html.wx-js .wx-intro-text {
  opacity: 0.001;
  transition: opacity var(--wx-text-d, 0.6s) var(--wx-text, var(--wx-out));
}
html.wx-js [data-wx-anim~="intro-text"].is-in, html.wx-js .wx-intro-text.is-in { opacity: 1; }

/* Preloader (opt-in). */
.wx-preloader, [data-wx-anim~="preloader"] {
  position: fixed; inset: 0; z-index: 9998;
  display: grid; place-items: center;
  background: var(--wx-cover); color: var(--wx-bg);
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.8s var(--wx-menu-ease, cubic-bezier(0.8, 0, 0.2, 1));
}
.wx-preloader.is-out, [data-wx-anim~="preloader"].is-out { clip-path: inset(0 0 100% 0); }
html:not(.wx-js) .wx-preloader, html:not(.wx-js) [data-wx-anim~="preloader"] { display: none; }

/* ── 3. Page transition cover (opt-in) ─────────────────────────────────── */
.wx-page-cover {
  position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  background: var(--wx-cover);
  clip-path: inset(100% 0 0 0);
}
.wx-page-cover.is-covering {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.8s var(--wx-menu-ease, cubic-bezier(0.8, 0, 0.2, 1));
}
.wx-page-cover.is-leaving {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.8s var(--wx-menu-ease, cubic-bezier(0.8, 0, 0.2, 1));
}

/* ── 5. Rolling letters ────────────────────────────────────────────────── */
.wx-roll-wrap { display: inline-flex; white-space: nowrap; }
.wx-roll-l {
  position: relative; display: inline-block; overflow: hidden;
  /* room for negative tracking, like Framer's clip inset */
  clip-path: inset(0 -0.1em 0 -0.1em);
  overflow: clip;
}
.wx-roll-l > span {
  display: block;
  transition: transform 0.4s var(--wx-roll-ease, cubic-bezier(0.8, 0, 0.4, 1));
  transition-delay: calc(var(--i, 0) * 30ms);
}
.wx-roll-l > .wx-roll-dup { position: absolute; left: 0; top: 100%; }
.is-rolling .wx-roll-l > span { transform: translateY(-100%); }
.is-reset .wx-roll-l > span { transition: none !important; transform: none !important; }

/* ── 6. Menu overlay: curtain from the top, collapses to the bottom ───── */
.wx-menu, [data-wx-anim~="menu"] {
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition: clip-path 0.8s var(--wx-menu-ease, cubic-bezier(0.8, 0, 0.2, 1)), visibility 0s linear 0.8s;
}
.wx-menu.is-open, [data-wx-anim~="menu"].is-open {
  clip-path: inset(0 0 0 0);
  visibility: visible;
  transition: clip-path 0.8s var(--wx-menu-ease, cubic-bezier(0.8, 0, 0.2, 1)), visibility 0s;
}
/* Links need a box for transforms; :where() keeps this overridable (0,0,0). */
:where(.wx-menu .wx-menu-link, [data-wx-anim~="menu"] [data-wx-menu-link]) { display: block; }
.wx-menu .wx-menu-link, [data-wx-anim~="menu"] [data-wx-menu-link] {
  transform: translateY(110%);
  transition: transform 0.8s var(--wx-menu-ease, cubic-bezier(0.8, 0, 0.2, 1));
  transition-delay: calc(var(--i, 0) * 50ms);
}
.wx-menu.is-open .wx-menu-link, [data-wx-anim~="menu"].is-open [data-wx-menu-link] {
  transform: none;
  transition-delay: calc(0.15s + var(--i, 0) * 50ms);
}
.wx-menu-mask { display: block; overflow: hidden; }

/* ── 7. Stagger text: lines / words ────────────────────────────────────── */
.wx-line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.wx-li { display: block; }
.wx-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.wx-wi { display: inline-block; }
.wx-open .wx-w { overflow: visible; }

html.wx-js [data-wx-anim~="split-lines"]:not(.wx-split):not(.is-done),
html.wx-js [data-wx-anim~="split-words"]:not(.wx-split):not(.is-done),
html.wx-js [data-wx-anim~="split-chars"]:not(.wx-split):not(.is-done),
html.wx-js [data-wx-anim~="chars-soft"]:not(.wx-split):not(.is-done),
html.wx-js [data-wx-anim~="madlib"]:not(.wx-split):not(.is-done) {
  opacity: 0; /* held until the split is ready: no flash of unsplit text */
}
.wx-split .wx-li {
  transform: translateY(100%);
  transition-property: transform;
  transition-timing-function: var(--wx-lines-ease, cubic-bezier(0.4, 1, 0.4, 1));
}
[data-wx-anim~="split-words"].wx-split .wx-wi {
  transform: translateY(100%);
  transition-property: transform;
  transition-timing-function: var(--wx-lines-ease, cubic-bezier(0.4, 1, 0.4, 1));
}
.wx-split.is-in .wx-li, [data-wx-anim~="split-words"].wx-split.is-in .wx-wi { transform: none; }

/* ── 8. Character rise ─────────────────────────────────────────────────── */
.wx-c { display: inline-block; }
:is([data-wx-anim~="split-chars"], [data-wx-anim~="chars-soft"]).wx-split .wx-c {
  transform: translateY(var(--wx-chars-y, 200px));
}
:is([data-wx-anim~="split-chars"], [data-wx-anim~="chars-soft"]).wx-split.is-in .wx-c { transform: none; }

/* ── 10. Word reveal ───────────────────────────────────────────────────── */
.wx-word-reveal .wx-wi { opacity: 0; transition: opacity 0.4s ease-out; }
.wx-word-reveal .wx-wi.is-on { opacity: 1; }

/* ── 11. Rise / drop ───────────────────────────────────────────────────── */
html.wx-js .wx-armed:is([data-wx-anim~="rise"], .wx-rise, [data-wx-anim~="drop"], .wx-drop) {
  opacity: 0;
  transform: translate3d(0, var(--wx-y, 100px), 0);
  transition: opacity var(--wx-rise-d, 1.15s) var(--wx-rise, var(--wx-out)),
    transform var(--wx-rise-d, 1.15s) var(--wx-rise, var(--wx-out));
}
html.wx-js .wx-armed:is([data-wx-anim~="drop"], .wx-drop) {
  opacity: 1;
  transition: transform var(--wx-drop-d, 1.1s) var(--wx-drop, var(--wx-out));
}
html.wx-js .wx-armed.is-in { opacity: 1; transform: none; }

/* ── 12. Image reveals ─────────────────────────────────────────────────── */
@property --wx-wipe { syntax: "<percentage>"; inherits: false; initial-value: 100%; }
html.wx-js .wx-armed:is([data-wx-anim~="img-wipe"], .wx-img-wipe):not(.is-done) {
  --wx-wipe: 0%;
  -webkit-mask-image: linear-gradient(90deg, #000 var(--wx-wipe), transparent var(--wx-wipe));
  mask-image: linear-gradient(90deg, #000 var(--wx-wipe), transparent var(--wx-wipe));
  transition: --wx-wipe 1.2s var(--wx-wipe-ease, cubic-bezier(0.6, 0, 0.4, 1));
}
html.wx-js .wx-armed:is([data-wx-anim~="img-wipe"], .wx-img-wipe).is-in { --wx-wipe: 100%; }

html.wx-js .wx-armed:is([data-wx-anim~="img-clip"], .wx-img-clip):not(.is-done) {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.2s var(--wx-out);
}
html.wx-js .wx-armed:is([data-wx-anim~="img-clip"], .wx-img-clip):not(.is-done) :is(img, video) {
  transform: scale(1.2);
  transition: transform 1.4s var(--wx-out);
}
html.wx-js .wx-armed:is([data-wx-anim~="img-clip"], .wx-img-clip).is-in { clip-path: inset(0 0 0 0); }
html.wx-js .wx-armed:is([data-wx-anim~="img-clip"], .wx-img-clip).is-in :is(img, video) { transform: none; }

/* ── 13. Marquee ───────────────────────────────────────────────────────── */
.wx-marquee-on { display: flex; overflow: hidden; }
.wx-marquee-on > * { flex: none; animation: none !important; }

/* ── 14. Video modal ───────────────────────────────────────────────────── */
.wx-video-modal {
  position: fixed; inset: 0; z-index: 9990;
  display: grid; place-items: center; padding: 4vw;
  background: rgba(0, 0, 0, 0.92);
  opacity: 0; transition: opacity 0.4s ease;
}
.wx-video-modal.is-open { opacity: 1; }
.wx-video-modal video { width: min(100%, 1400px); max-height: 86vh; }
.wx-video-close { position: absolute; top: 20px; right: 20px; color: #fff; background: none; border: 0; font: inherit; cursor: pointer; }

/* ── Services sticky column (Mobius: 100vh, top 0) ─────────────────────── */
.wx-sticky { position: sticky; top: 0; align-self: flex-start; }

/* ── 15. Stack (opt-in) ────────────────────────────────────────────────── */
[data-wx-anim~="stack"] .wx-stack-card { position: sticky; top: var(--wx-stack-top, 80px); transform-origin: 50% 0; }

/* ── 16. Digits ────────────────────────────────────────────────────────── */
.wx-digits-on { display: inline-flex; align-items: flex-start; }
.wx-digit { display: inline-block; height: 1em; line-height: 1; overflow: hidden; }
.wx-digit-col { display: flex; flex-direction: column; will-change: transform; }
.wx-digit-col > span { display: block; height: 1em; line-height: 1; text-align: center; }
.wx-digit-static { line-height: 1; }
[data-wx-stat-image] {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.8, 0, 1, 0.7);
}
[data-wx-stat-image].is-active { opacity: 1; transition-timing-function: var(--wx-out); }
html:not(.wx-js) [data-wx-stat-image="0"] { opacity: 1; }

/* ── 17. Rows ──────────────────────────────────────────────────────────── */
.wx-row { position: relative; transition: opacity 0.4s ease, transform 0.6s var(--wx-s6, var(--wx-out)); }
.wx-row::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: currentColor; opacity: 0.2;
  transform: scaleX(0); transform-origin: left;
  transition: transform 1.2s var(--wx-wipe-ease, cubic-bezier(0.6, 0, 0.4, 1));
  transition-delay: calc(var(--i, 0) * 60ms);
}
html:not(.wx-js) .wx-row::after, .wx-row.is-in::after { transform: none; }
@media (hover: hover) {
  [data-wx-anim~="rows"]:has(.wx-row:hover) .wx-row:not(:hover) { opacity: 0.35; }
  [data-wx-anim~="rows"] .wx-row:hover { transform: translateX(12px); }
}

/* ── 18–19. Hover image + image trail ──────────────────────────────────── */
.wx-hover-float {
  position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none;
  width: 280px; aspect-ratio: 3 / 4; margin: -140px 0 0 24px; overflow: hidden;
  opacity: 0; transition: opacity 0.3s ease;
}
.wx-hover-float.is-on { opacity: 1; }
.wx-hover-float img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.15); transition: transform 0.6s var(--wx-out); }
.wx-hover-float.is-on img { transform: none; }
.wx-hover-inline { display: block; width: min(60vw, 260px); margin-top: 12px; }
[data-wx-anim~="image-trail"] { position: relative; overflow: hidden; }
.wx-trail {
  position: absolute; pointer-events: none; object-fit: cover; z-index: 1;
  opacity: 0; transform: scale(0.5); filter: blur(10px);
  transition: opacity 0.4s var(--wx-trail-ease), transform 0.4s var(--wx-trail-ease), filter 0.4s var(--wx-trail-ease);
}
.wx-trail.is-in { opacity: 1; transform: none; filter: none; }
.wx-trail.is-out { opacity: 0; }

/* ── 20. Slider ────────────────────────────────────────────────────────── */
[data-wx-anim~="slider"] { touch-action: pan-y; user-select: none; }
[data-wx-anim~="slider"] .wx-slides { display: grid; }
[data-wx-anim~="slider"] .wx-slide { grid-area: 1 / 1; visibility: hidden; }
[data-wx-anim~="slider"] .wx-slide.is-active,
[data-wx-anim~="slider"] .wx-slide.is-leaving { visibility: visible; }
[data-wx-anim~="slider"] .wx-slide.is-leaving { z-index: 0; }
[data-wx-anim~="slider"] .wx-slide.is-active { z-index: 1; }
[data-wx-anim~="slider"] .wx-slide-media { clip-path: inset(0 0 0 0); }
[data-wx-anim~="slider"] .wx-slide.is-active .wx-slide-media {
  animation: wx-slide-in 0.9s var(--wx-slider, var(--wx-out)) both;
}
@keyframes wx-slide-in { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
[data-wx-anim~="slider"] .wx-slide.is-leaving .wx-slide-quote { opacity: 0; transition: opacity 0.3s ease; }

/* ── 21. Toggle ────────────────────────────────────────────────────────── */
[data-wx-anim~="toggle"] { position: relative; display: inline-flex; }
[data-wx-anim~="toggle"] [data-wx-toggle-option] { position: relative; z-index: 1; }
.wx-toggle-pill {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 0; border-radius: 999px;
  background: var(--wx-ink);
  transition: transform var(--wx-toggle-d, 0.4s) var(--wx-toggle, var(--wx-out)),
    width var(--wx-toggle-d, 0.4s) var(--wx-toggle, var(--wx-out));
}

/* ── 22. Accordion ─────────────────────────────────────────────────────── */
.wx-acc-panel { overflow: hidden; }
html.wx-js .wx-acc-item:not(.is-open) .wx-acc-panel { height: 0; }
.wx-acc-panel > * { opacity: 0; transform: translateY(-8px); transition: opacity 0.5s ease, transform 0.8s var(--wx-acc-ease); }
.wx-acc-item.is-open .wx-acc-panel > * { opacity: 1; transform: none; transition-delay: 0.1s; }
html:not(.wx-js) .wx-acc-panel > * { opacity: 1; transform: none; }
.wx-acc-icon { display: inline-block; transition: transform 0.8s var(--wx-acc-ease, cubic-bezier(0.6, 0, 0.4, 1)); }
.wx-acc-item.is-open .wx-acc-icon { transform: rotate(135deg); }

/* ── 23. Madlib form ───────────────────────────────────────────────────── */
.wx-split.wx-madlib, [data-wx-anim~="madlib"].wx-split { overflow: visible; }
[data-wx-anim~="madlib"].wx-split .wx-madlib-part {
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.6s var(--wx-lines-ease);
  transition-delay: var(--wx-d, 0ms);
}
[data-wx-anim~="madlib"].wx-split.is-in .wx-madlib-part { opacity: 1; transform: none; }
.wx-field { position: relative; display: inline-block; }
.wx-field::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--wx-ink);
  transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--wx-s6, var(--wx-out));
}
.wx-field:focus-within::after { transform: none; }
form[data-wx-state="loading"] [type="submit"] { opacity: 0.6; pointer-events: none; }
form[data-wx-state="success"] [type="submit"] { animation: wx-pop 0.6s var(--wx-s6, var(--wx-out)); }
form[data-wx-state="error"] [type="submit"] { animation: wx-shake 0.4s ease; }
@keyframes wx-pop { 50% { transform: scale(1.06); } }
@keyframes wx-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ── 24. Footer reveal ─────────────────────────────────────────────────── */
html.wx-footer-reveal-on :is([data-wx-anim~="footer-reveal"], .wx-footer-reveal) {
  position: sticky; bottom: 0; z-index: 0;
}
html.wx-footer-reveal-on :is(main, .wx-above-footer) {
  position: relative; z-index: 1; background: var(--wx-bg);
}

/* ── 25. Cursor ────────────────────────────────────────────────────────── */
.wx-cursor {
  position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none;
  opacity: 0; transition: opacity 0.25s ease;
}
.wx-cursor.is-on { opacity: 1; }
.wx-cursor-dot {
  position: absolute; left: 0; top: 0; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border-radius: 50%; background: var(--wx-ink);
  transition: transform 0.4s var(--wx-s4, var(--wx-out)), background-color 0.3s ease;
}
.wx-cursor-label {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  font-size: 13px; font-weight: 600; color: var(--wx-bg); white-space: nowrap;
  opacity: 0; transition: opacity 0.2s ease;
}
.wx-cursor[data-mode="link"] .wx-cursor-dot { transform: scale(2); }
.wx-cursor:is([data-mode="play"], [data-mode="drag"], [data-mode="view"]) .wx-cursor-dot { transform: scale(6); } /* 20 → 120px */
.wx-cursor:is([data-mode="play"], [data-mode="drag"], [data-mode="view"]) .wx-cursor-label { opacity: 1; }
.wx-cursor[data-mode="white"] .wx-cursor-dot { background: #fff; }
.wx-cursor[data-mode="hidden"] .wx-cursor-dot { transform: scale(0.1); }
.wx-cursor.is-down .wx-cursor-dot { transform: scale(0.7); }
html.wx-has-cursor [data-wx-cursor], html.wx-has-cursor [data-wx-cursor] * { cursor: none; }

/* ── Buttons & links (Mobius Button A/B/C, footer links, cards) ────────── */
/* Fill slide + arrow swap */
.wx-btn { position: relative; overflow: hidden; isolation: isolate; }
.wx-btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--wx-fill, var(--wx-ink));
  transform: translateY(101%); transition: transform 0.4s var(--wx-s4, var(--wx-out));
}
.wx-btn:hover::before, .wx-btn:focus-visible::before { transform: none; }
.wx-btn .wx-arrow { display: inline-grid; overflow: hidden; vertical-align: middle; }
.wx-btn .wx-arrow > * { grid-area: 1 / 1; transition: transform 0.4s var(--wx-s4, var(--wx-out)); }
.wx-btn .wx-arrow > :last-child { transform: translateX(-120%); }
.wx-btn:hover .wx-arrow > :first-child { transform: translateX(120%); }
.wx-btn:hover .wx-arrow > :last-child { transform: none; }

/* Underline that grows to full width (Button B / footer links) */
.wx-link-line { position: relative; }
.wx-link-line::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1px; width: 100%; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--wx-s6, var(--wx-out));
}
.wx-link-line:hover::after, .wx-link-line:focus-visible::after { transform: none; }

/* Card hover: image to 120%, title underline draws */
.wx-card .wx-card-media { overflow: hidden; }
.wx-card .wx-card-media :is(img, video) { transition: transform 0.6s var(--wx-s6, var(--wx-out)); }
.wx-card:hover .wx-card-media :is(img, video) { transform: scale(1.2); }
.wx-card .wx-card-title {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.6s var(--wx-s6, var(--wx-out));
}
.wx-card:hover .wx-card-title { background-size: 100% 1px; }

/* ── Reduced motion: show everything, move nothing ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html.wx-js [data-wx-anim], html.wx-js [class*="wx-"] { animation: none !important; }
  html.wx-js :is([data-wx-anim~="intro"], .wx-intro, [data-wx-anim~="intro-text"], .wx-intro-text,
    [data-wx-anim~="split-lines"], [data-wx-anim~="split-words"], [data-wx-anim~="split-chars"],
    [data-wx-anim~="chars-soft"], [data-wx-anim~="madlib"]) { opacity: 1 !important; transform: none !important; }
  .wx-li, .wx-wi, .wx-c, .wx-armed { opacity: 1 !important; transform: none !important; transition: none !important; }
  .wx-armed { clip-path: none !important; -webkit-mask-image: none !important; mask-image: none !important; }
  .wx-roll-l > span, .wx-menu-link, .wx-btn::before { transition: none !important; }
}
