/* ===================================================================
   CARTFIT.AI · fx-text.css — support for scripts/fx-text.js,
   the founder photo treatment and the hero exit.
   =================================================================== */

/* ── per-character type ─────────────────────────────────────────── */
.fx-split { perspective: 900px; white-space: nowrap; }
.fx-ch {
  display: inline-block;
  text-align: center;
  white-space: pre;
  backface-visibility: hidden;
  transition: translate .45s cubic-bezier(.2, .7, .2, 1), scale .45s cubic-bezier(.2, .7, .2, 1);
  will-change: transform;
}
.fx-ch--space { width: auto; }
.hero__h-jp.fx-split { perspective: none; }
.hero__h-jp .fx-ch { will-change: transform, opacity; }

/* ── hero exit: the stage pushes toward the viewer while leaving ── */
.hero { --leave: 0; }
.hero.is-inview .hero__type {
  scale: calc(1 + var(--leave) * 0.42);
  filter: blur(calc(var(--leave) * 9px));
  opacity: calc(1 - var(--leave) * 1.4);
  transform-origin: 30% 60%;
}
.hero-media__video { scale: calc(1 + var(--leave) * 0.22); }

/* ── founder photo: natural colour, scan-line reveal ───────────── */
.tm-photo::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
@media (prefers-reduced-motion: no-preference) {
  .has-motion #team .tm-photo img { clip-path: inset(0 0 100% 0); }
  .has-motion #team.is-inview .tm-photo img {
    animation: tmReveal 1.2s cubic-bezier(.65, 0, .35, 1) .2s forwards;
  }
  .has-motion #team.is-inview .tm-photo::after {
    animation: tmScan 1.2s cubic-bezier(.65, 0, .35, 1) .2s forwards;
  }
}
@keyframes tmReveal {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes tmScan {
  0%   { top: 0;    opacity: 1; }
  92%  { top: 100%; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ── contact warp corridor (scripts/contact-warp.js) ───────────── */
.ct-section { isolation: isolate; overflow: hidden; }
.ct-warp { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.ct-warp canvas { display: block; width: 100%; height: 100%; }
.ct-section > :not(.ct-warp):not(.corner) { position: relative; z-index: 1; }

/* ── title techniques (fx-text.js) ──────────────────────────────── */
.fx-ch { transition: translate .45s cubic-bezier(.2, .7, .2, 1), scale .45s cubic-bezier(.2, .7, .2, 1), color .7s ease, -webkit-text-stroke-color .7s ease; }
.fx-ch--wait { opacity: 0; }
/* plot: outline first, fill floods in after the sweep */
.fx-ch--outline { color: transparent; -webkit-text-stroke: 1px var(--fg-1); }
/* teleprinter carriage */
.fx-caret {
  display: inline-block;
  width: .08em; min-width: 2px;
  height: .9em;
  margin-left: .04em;
  vertical-align: -.08em;
  background: var(--accent);
}
.fx-caret.is-blink { animation: fxBlink .8s steps(1) infinite; }
@keyframes fxBlink { 50% { opacity: 0; } }
/* signal glitch: channel split + row slices, then lock */
.fx-glitch { position: relative; }
.fx-glitch > .fx-ch { animation: fxFlicker .9s steps(1) both; }
.fx-glitch::before,
.fx-glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  white-space: pre;
  pointer-events: none;
}
.fx-glitch::before { color: var(--accent); animation: fxSliceA .9s steps(1) both; }
.fx-glitch::after  { color: var(--fg-0); opacity: .55; animation: fxSliceB .9s steps(1) both; }
@keyframes fxFlicker {
  0% { opacity: 0; } 12% { opacity: 1; } 18% { opacity: .2; } 30% { opacity: 1; } 44% { opacity: .5; } 52%, 100% { opacity: 1; }
}
@keyframes fxSliceA {
  0%   { clip-path: inset(0 0 72% 0);  transform: translate(-14px, 0); }
  14%  { clip-path: inset(40% 0 38% 0); transform: translate(10px, 0); }
  28%  { clip-path: inset(70% 0 6% 0);  transform: translate(-6px, 0); }
  42%  { clip-path: inset(12% 0 60% 0); transform: translate(18px, 0); }
  58%  { clip-path: inset(55% 0 25% 0); transform: translate(-4px, 0); }
  74%  { clip-path: inset(0 0 90% 0);   transform: translate(3px, 0); }
  100% { clip-path: inset(0 0 100% 0);  transform: none; }
}
@keyframes fxSliceB {
  0%   { clip-path: inset(60% 0 10% 0); transform: translate(16px, 0); }
  18%  { clip-path: inset(8% 0 70% 0);  transform: translate(-12px, 0); }
  34%  { clip-path: inset(30% 0 45% 0); transform: translate(7px, 0); }
  50%  { clip-path: inset(80% 0 2% 0);  transform: translate(-16px, 0); }
  66%  { clip-path: inset(20% 0 66% 0); transform: translate(5px, 0); }
  100% { clip-path: inset(0 0 100% 0);  transform: none; }
}

/* ── news halftone sweep (scripts/news-halftone.js) ─────────────── */
.nw-item__thumb { position: relative; }
.nw-halftone { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* split titles: keep only the original accent dot in accent */
#product .product-head__title > .fx-ch { color: var(--fg-0); }
.cf-partners .cfp-title > .fx-ch,
.cf-partners .cfp-title > .fx-ch:first-child { color: var(--fg-0); }
.cf-partners .cfp-title > span:not(.fx-ch):not(.d-title__rule) { color: var(--accent); }

/* network title: nodes link up and converge into letters */
.cf-partners .cfp-title { position: relative; }
.fx-net { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 1; }
.fx-net line { stroke: var(--line-3); stroke-width: 1; }
.fx-net .fx-net__chain { stroke: var(--fg-2); }
.fx-net circle { fill: var(--fg-0); }
.fx-net .fx-net__packet { fill: var(--accent); }
