/* 30.11 speed pass. Desktop: GPU layers only while their scene is on screen; reveals fade and lift without blur.
   Phone: 3D comes back as compositor-only CSS (transform + opacity), driven by the scroll itself where supported. */

/* ---------- desktop: fewer permanent layers ---------- */
.btn { will-change: auto; }
@media (hover: hover) { .btn:hover { will-change: transform; } }
.h-group { will-change: auto; }
.hero.live .h-group { will-change: transform; }
.h-fly .hx, .sc { will-change: auto; }
.hero.live .h-fly .hx, .hero.live .sc { will-change: transform, opacity; }
.tour.drive .t-title .si { will-change: auto; }
.tour.drive .t-item.live .t-title .si { will-change: transform, opacity; }
.ai-card, .ai.pin .demo { will-change: auto; }
.ai.live .ai-card { will-change: transform; }
.ai.pin.live .demo { will-change: transform, opacity; }
.nx-card, .nx-art { will-change: auto; }
.nx.art-visible .nx-card, .nx.art-visible .nx-art { will-change: transform; }
.bl { filter: none; transition: opacity 1s var(--ease), transform 1.1s var(--ease); }
.t-text, .t-item.gone .t-text { filter: none; }
.da .acur { filter: none; }
/* weak devices: the cursor route is the only extra effect we drop */
.fx-lite .trail { display: none; }

/* ---------- phone / touch: 3D without JavaScript ---------- */
.tz-stream { display: none; }
@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .touch-hero-art { position: relative; perspective: 900px; container-type: inline-size; }
  .tz-stream { display: block; position: absolute; inset: 0; pointer-events: none; transform-style: preserve-3d; }
  .tz-c {
    position: absolute; left: 0; top: 0; transform-origin: 0 0;
    display: grid; gap: 3px;
    padding: 9px 11px 8px; border-radius: 10px;
    background: #fffdf8; color: var(--ink);
    box-shadow: 0 0 0 1px rgba(21,19,15,.07), 0 14px 30px -16px rgba(80,35,10,.5);
    font: 500 11px/1.2 var(--sans); white-space: nowrap;
    opacity: 0;
    backface-visibility: hidden;
  }
  .tz-c b { font-weight: 650; font-size: 10px; letter-spacing: .02em; text-transform: uppercase; color: var(--mute); }
  .tz-out { background: #f3fbf5; }
  .tz-out b { color: #2f9e5b; }
}
@media (max-width: 760px) and (prefers-reduced-motion: no-preference),
       (hover: none) and (pointer: coarse) and (prefers-reduced-motion: no-preference) {
  /* an order email flies into the CRM screen in depth, a shipment draft comes out: two layers, one loop */
  .tz-in  { animation: tz-in 6.4s cubic-bezier(.45,.05,.35,1) infinite; }
  .tz-out { animation: tz-out 6.4s cubic-bezier(.45,.05,.35,1) 3.2s infinite; }
  .touch-hero:not(.tz-live) .tz-c { animation-play-state: paused; }
  /* paths stay inside the picture: in from above the email, into the CRM screen; the draft drops out below it */
  @keyframes tz-in {
    0%   { transform: translate3d(-4px, -14px, 60px) rotateY(-24deg) rotateX(8deg) scale(.86); opacity: 0; }
    14%  { opacity: 1; }
    55%  { transform: translate3d(min(150px, calc(100cqw - 210px)), -18px, -160px) rotateY(-14deg) rotateX(4deg) scale(.86); opacity: 1; }
    80%, 100% { transform: translate3d(calc(100cqw - 150px), 30px, -480px) rotateY(-8deg) scale(.86); opacity: 0; }
  }
  @keyframes tz-out {
    0%   { transform: translate3d(calc(100cqw - 165px), 100px, -480px) rotateY(-16deg) scale(.86); opacity: 0; }
    22%  { opacity: 1; }
    70%  { transform: translate3d(calc(100cqw - 172px), calc(70cqw - 30px), 10px) rotateY(-10deg) rotateX(-6deg) scale(.86); opacity: 1; }
    88%, 100% { transform: translate3d(calc(100cqw - 176px), calc(70cqw - 18px), 60px) rotateY(-8deg) scale(.86); opacity: 0; }
  }

  /* one-shot 3D arrival where scroll timelines are missing (set by IntersectionObserver) */
  .touch-revealed { animation: touch-arrive-3d 620ms cubic-bezier(.2,.65,.35,1); }
  @keyframes touch-arrive-3d {
    from { transform: perspective(1000px) rotateX(16deg) translateY(22px) scale(.97); opacity: .55; }
    to   { transform: none; opacity: 1; }
  }

  @supports (animation-timeline: view()) {
    /* the hero screen lays back into depth as you scroll past it */
    .touch-hero-art picture { display: block; transform-origin: 50% 100%;
      animation: th-lay linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
    @keyframes th-lay { to { transform: perspective(900px) rotateX(22deg) translateZ(-60px); opacity: .7; } }

    /* CRM screens stand up from the table as they come in, alternating sides like a deck */
    .touch-chapter { perspective: 1100px; }
    .touch-frame, .touch-frame.touch-revealed {
      transform-origin: 50% 100%;
      animation: tf-up linear both; animation-timeline: view(); animation-range: entry 0% cover 34%;
    }
    .touch-chapter:nth-child(even) .touch-frame { animation-name: tf-up-r; }
    @keyframes tf-up   { from { transform: rotateX(24deg) rotateY(-8deg) translate3d(0, 30px, -50px); opacity: .7; } to { transform: none; opacity: 1; } }
    @keyframes tf-up-r { from { transform: rotateX(24deg) rotateY(8deg)  translate3d(0, 30px, -50px); opacity: .7; } to { transform: none; opacity: 1; } }

    /* the "next" cards arrive as a stack in depth */
    #touch-next .nx-deck { perspective: 1000px; }
    #touch-next .nx-card { transform-origin: 50% 0;
      animation: nx-in linear both; animation-timeline: view(); animation-range: entry 10% cover 38%; }
    @keyframes nx-in { from { transform: rotateX(-34deg) translate3d(0, 28px, -40px); opacity: .3; } to { transform: none; opacity: 1; } }

    /* the company name tips up into place */
    #touch-company .giant { transform-origin: 50% 100%;
      animation: gi-up linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
    @keyframes gi-up { from { transform: perspective(700px) rotateX(55deg) translateY(30%); opacity: .2; } to { transform: none; opacity: 1; } }
  }
}
