/* VANREX homepage tablet stability guard.
   Scope: homepage hero only. Navigation, footer and approved copy are untouched. */

/* Keep composited hero layers on one stable surface to avoid touch-triggered flashes. */
#v4-hero,
#v4-hero .v4-hero-display,
#v4-hero .v4-device-frame,
#v4-hero .v4-holo,
#v4-hero .v4-coin {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

#v4-hero .v4-hero-display {
  transform: translate3d(var(--parallax-x, 0px), var(--parallax-y, 0px), 0);
}

/* Tablets and coarse pointers should not use cursor parallax. Dynamic viewport units
   are avoided here because browser chrome changes during touch scrolling can reflow
   the entire first screen. */
@media (pointer: coarse), (min-width: 600px) and (max-width: 1180px) {
  #v4-hero {
    min-height: max(760px, 100svh);
    overflow: clip;
  }

  #v4-hero .v4-hero-layout {
    min-height: auto;
  }

  #v4-hero .v4-hero-display {
    --parallax-x: 0px !important;
    --parallax-y: 0px !important;
    height: clamp(430px, 62vw, 660px);
    transition: none !important;
    transform: translate3d(0, 0, 0) !important;
    touch-action: pan-y;
  }

  /* Touch tablets favour a completely stable hero. The approved artwork remains,
     while continuous transform/opacity animations are disabled. */
  #v4-hero .v4-hero-ambient,
  #v4-hero .v4-sheen,
  #v4-hero .v4-hero-display,
  #v4-hero .v4-hero-display *,
  #v4-hero .v4-hero-display *::before,
  #v4-hero .v4-hero-display *::after {
    animation: none !important;
    transition: none !important;
  }

  #v4-hero .v4-chart-line path {
    stroke-dashoffset: 0 !important;
  }

  #v4-hero.vr-touch-active .v4-hero-ambient,
  #v4-hero.vr-touch-active .v4-sheen,
  #v4-hero.vr-touch-active .v4-screen-aura,
  #v4-hero.vr-touch-active .v4-device-frame,
  #v4-hero.vr-touch-active .v4-coin,
  #v4-hero.vr-touch-active .v4-holo,
  #v4-hero.vr-touch-active .v4-lightbeam,
  #v4-hero.vr-touch-active .v4-device-bars i {
    animation-play-state: paused !important;
  }
}

/* High-resolution tablets often request a desktop-width viewport. Pointer ability,
   not width alone, decides the safe tablet layout. */
@media (pointer: coarse) and (orientation: landscape) {
  #v4-hero .v4-hero-layout {
    grid-template-columns: minmax(0, 48%) minmax(0, 52%);
    column-gap: clamp(28px, 3vw, 52px);
  }

  #v4-hero .v4-hero-copy {
    min-width: 0;
    padding-right: clamp(28px, 3vw, 48px);
    box-sizing: border-box;
  }

  #v4-hero #v4-hero-title {
    display: flex !important;
    width: auto !important;
    max-width: 100% !important;
    flex-flow: row nowrap !important;
    align-items: baseline !important;
    justify-content: flex-start !important;
  }

  #v4-hero #v4-hero-title > span {
    display: inline !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  #v4-hero .v4-hero-display {
    width: 82%;
    min-width: 0;
    justify-self: end;
    margin-right: clamp(16px, 2vw, 30px);
  }

  #v4-hero .v4-holo-left {
    left: 10% !important;
    top: 14% !important;
    width: 28% !important;
  }
}

/* Portrait tablets use a clear vertical rhythm so copy never rides on the artwork. */
@media (min-width: 600px) and (max-width: 950px) {
  #v4-hero .v4-hero-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(24px, 4vw, 44px);
    padding-top: clamp(18px, 3vw, 34px);
    padding-bottom: clamp(48px, 7vw, 78px);
  }

  #v4-hero .v4-hero-copy {
    margin-top: 0 !important;
    max-width: min(680px, 100%);
    justify-self: center;
  }

  #v4-hero .v4-hero-display {
    width: min(680px, 94%);
    margin-inline: auto;
  }
}

/* Landscape tablets retain two columns with a protected gutter. */
@media (min-width: 951px) and (max-width: 1180px) {
  #v4-hero .v4-hero-layout {
    grid-template-columns: minmax(0, 47%) minmax(0, 53%);
    column-gap: clamp(18px, 2.5vw, 34px);
  }

  #v4-hero .v4-hero-copy,
  #v4-hero .v4-hero-display {
    min-width: 0;
  }

  #v4-hero .v4-hero-display {
    width: 78%;
    justify-self: end;
    margin-right: 18px;
  }
}

/* Keep the left information card inside the artwork column on wide desktops too. */
@media (min-width: 1181px) and (pointer: fine) {
  #v4-hero .v4-holo-left {
    left: 2% !important;
    top: 14% !important;
    width: 30% !important;
  }
}

