/*
  Phones in "mobile-live" (set on <html> by index.html and kept in step by
  zeeb-mobile.jsx): the same scroll-driven page as desktop, composed for a
  tall screen. Everything here is scoped to html.mobile-live inside the
  phone breakpoint, so desktop and the plain phone fallback are untouched.

  Loaded after the inline styles in index.html, whose phone rules pin the
  hero in place with !important; the selectors below out-rank them.
*/

/* Outside mobile-live these two take no part in layout. */
.hero-track { display: contents; }
.hero-stage-host { display: none; }

@media (max-width: 768px) {
  /* ── Hero: a pinned full-screen stage ─────────────────────
     The stage stays put while the first 65% of a screen scrolls by. Over
     that distance the 3D camera pulls back from the notes to the whole
     device and the hand reaches down; then the track ends and the stage
     scrolls away with the device in the hand's grip.

     Heights are the LARGE viewport (lvh; plain vh means the same on phones
     that lack it). The browser's bars slide away as soon as the visitor
     scrolls, and a pinned stage sized for the small viewport would leave a
     strip of bare page under itself for the whole animation. */
  html.mobile-live .hero-track {
    display: block;
    position: relative;
    z-index: 30;
    height: 165vh;
    height: 165lvh;
  }
  html.mobile-live .stage {
    position: sticky !important;
    top: 0;
    height: 100vh;
    height: 100lvh;
    overflow: hidden;
  }
  /* the box that marks where the device ends up; the hand is sized against it */
  html.mobile-live .stage-content {
    transform: scale(calc(1 - var(--shrink, 0) * 0.4)) !important;
    transition: none;
  }
  html.mobile-live .device-glow { display: none; }
  html.mobile-live .device-bob { animation: none; }
  /* The hand is moved by the scroll itself, not by a timer. A flick can carry the stage off
     the screen a third of a second after it lets go, so the hand has to have closed on the
     device by then: it comes down over the last stretch of the pinned scroll (--shrink 0.6 → 0.98)
     and goes back up the same way. */
  html.mobile-live .hand-wrap,
  html.mobile-live .stage.grabbed .hand-wrap {
    --reach: clamp(0, calc((var(--shrink, 0) - 0.6) / 0.38), 1);
    display: block !important;
    transform: translateY(calc((1 - var(--reach)) * -490px));
    opacity: clamp(0, calc(var(--reach) * 4), 1);
    transition: none;
  }

  html.mobile-live .hero-stage-host {
    display: block;
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 50%;
    width: 100vw;
    height: 100vh;
    height: 100lvh;
    transform: translate(-50%, -50%);
  }
  /* soft light behind the device, standing in for the desktop glow */
  html.mobile-live .hero-stage-host::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 150vw;
    height: 150vw;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle,
      rgba(225, 238, 255, 0.9) 0%,
      rgba(195, 219, 250, 0.5) 26%,
      rgba(160, 198, 240, 0.16) 52%,
      rgba(150, 190, 235, 0) 72%);
    pointer-events: none;
  }

  /* ── App icons and the three lines ──────────────────────── */
  html.mobile-live .mrv {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    /* never shorter than the tiles and the lines need, even with the browser bars up */
    min-height: max(100vh, 740px);
    min-height: max(100svh, 740px);
    overflow: hidden;
    background: #ffffff;
  }
  html.mobile-live .mrv-icons {
    position: absolute;
    inset: 64px 16px 40px;
    pointer-events: none;
  }
  /* Tiles wait in the middle, then spring out to their places one after
     another. Each sits where it lands and is pulled back to the middle by
     --dx/--dy (measured in zeeb-mobile.jsx), so the burst is transform and
     opacity only: it keeps its pace even while the tour's 3D is starting
     up further down the page. */
  html.mobile-live .mrv-icon {
    position: absolute;
    left: var(--x);
    top: var(--y);
    opacity: 0;
    transform: translate3d(var(--dx, 0px), var(--dy, 0px), 0) scale(0.35);
    transition:
      transform 0.9s cubic-bezier(0.34, 1.45, 0.45, 1),
      opacity 0.35s ease;
    transition-delay: calc(var(--i) * 55ms);
  }
  html.mobile-live .mrv.is-in .mrv-icon {
    opacity: 1;
    transform: none;
  }
  /* each tile drifts at its own speed as the section scrolls past… */
  html.mobile-live .mrv-drift {
    transform: translate3d(0, calc(var(--sy, 0) * var(--depth) * -1px), 0);
    will-change: transform;
  }
  /* …and bobs gently on its own */
  html.mobile-live .mrv-float {
    animation: mrvFloat calc(5.2s + var(--i) * 0.37s) ease-in-out calc(var(--i) * -0.9s) infinite;
  }
  @keyframes mrvFloat {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
    50% { transform: translate3d(3px, -9px, 0) rotate(2.5deg); }
  }

  html.mobile-live .mrv-text {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 0 20px;
    text-align: center;
  }
  html.mobile-live .mrv-line {
    margin: 18px 0;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: clamp(23px, 6.8vw, 34px);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #111111;
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  html.mobile-live .mrv-line em { font-style: italic; }
  html.mobile-live .mrv.is-in .mrv-line { opacity: 1; transform: none; }
  html.mobile-live .mrv.is-in .mrv-line:nth-child(1) { transition-delay: 0.45s; }
  html.mobile-live .mrv.is-in .mrv-line:nth-child(2) { transition-delay: 0.85s; }
  html.mobile-live .mrv.is-in .mrv-line:nth-child(3) { transition-delay: 1.25s; }
}
