/* Innovation chapters: additive spatial layer (no document reflow, no added scroll space).
   Hero copy pushes into the depth of the screen as it exits; field chapters approach from behind
   and recede past, while the navigation dock follows. All gated by html.qm-motion-ready. */

#innovation-hub.qmi-motion {
  --qmi-ease: cubic-bezier(.2, .7, .2, 1);
  --qmi-dur: 1s;
}

/* Chapter scroll writes must not interpolate. */
html.qm-motion-ready #innovation-hub.qmi-motion .ip-field {
  transition: none !important;
}

/* Fragment anchor targets must keep their native scroll-margin geometry. */
html.qm-motion-ready #innovation-hub.qmi-motion .ip-field:target {
  translate: none !important;
  rotate: none !important;
  scale: none !important;
}

/* Staged reveal: hero intro elements, section heads, field bodies, crossroads. */
html.qm-motion-ready #innovation-hub.qmi-motion .qmi-reveal {
  transition: translate var(--qmi-dur) var(--qmi-ease), opacity .8s var(--qmi-ease);
  transition-delay: var(--qmi-delay, 0ms);
}
html.qm-motion-ready #innovation-hub.qmi-motion .qmi-reveal.qmi-waiting {
  opacity: 0;
  translate: 0 36px;
}

/* Link hover. */
html.qm-motion-ready #innovation-hub.qmi-motion .ip-field-link span:last-child,
html.qm-motion-ready #innovation-hub.qmi-motion .ip-crossroads a span {
  display: inline-block;
  transition: transform .7s var(--qmi-ease);
}
@media (hover: hover) and (pointer: fine) {
  html.qm-motion-ready #innovation-hub.qmi-motion .ip-field-link:is(:hover, :focus-visible) span:last-child,
  html.qm-motion-ready #innovation-hub.qmi-motion .ip-crossroads a:is(:hover, :focus-visible) span {
    transform: translate3d(3px, -3px, 0);
  }
}

/* Dock: overlay, so original chapter geometry and anchor positions stay intact. */
#innovation-hub .qmi-dock { display: none; }
html.qm-motion-ready #innovation-hub.qmi-motion .qmi-dock {
  display: flex;
  align-items: center;
  gap: 5px;
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 30;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(23,26,32,.94);
  color: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-50%, 18px, 0);
  transition: transform .8s var(--qmi-ease), opacity .8s var(--qmi-ease), visibility .8s;
}
html.qm-motion-ready #innovation-hub.qmi-motion .qmi-dock.qmi-dock-visible {
  opacity: 1;
  visibility: visible;
  transform: translate3d(-50%, 0, 0);
}
#innovation-hub.qmi-motion .qmi-dock a {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 38px;
  border-radius: 50%;
  color: #d0d1d2;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  isolation: isolate;
  transition: transform .7s var(--qmi-ease);
}
#innovation-hub.qmi-motion .qmi-dock a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #fff;
  z-index: -1;
  opacity: 0;
  transform: scale(.72);
  transition: transform .8s var(--qmi-ease), opacity .8s var(--qmi-ease);
}
#innovation-hub.qmi-motion .qmi-dock a[aria-current="location"] {
  color: #171a20;
}
#innovation-hub.qmi-motion .qmi-dock a[aria-current="location"]::before {
  opacity: 1;
  transform: scale(1);
}
#innovation-hub.qmi-motion .qmi-dock a:hover { transform: translate3d(0, -2px, 0); }
#innovation-hub.qmi-motion .qmi-dock a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#innovation-hub.qmi-motion .qmi-dock-label {
  min-width: 148px;
  padding: 0 14px 0 10px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

/* Hero copy exit: pushes away into depth. */
@media (prefers-reduced-motion: no-preference) {
  html.qm-motion-ready #innovation-hub.qmi-motion[data-qmi-motion="active"] .ip-hero-grid > div {
    translate: 0 var(--qmi-hero-y, 0px) var(--qmi-hero-z, 0px);
    rotate: x var(--qmi-hero-rx, 0deg);
    transform-origin: 50% 30%;
  }
  html.qm-motion-ready #innovation-hub.qmi-motion[data-qmi-motion="active"] .ip-hero {
    perspective: 1400px;
  }

  /* Field chapters approach from depth, hold centered, then recede. */
  html.qm-motion-ready #innovation-hub.qmi-motion[data-qmi-motion="active"] .ip-fields {
    perspective: 1800px;
  }
  html.qm-motion-ready #innovation-hub.qmi-motion[data-qmi-motion="active"] .ip-field {
    transform-origin: 50% 60%;
    translate: 0 var(--qmi-field-y, 0px) var(--qmi-field-z, 0px);
    rotate: x var(--qmi-field-rx, 0deg);
    backface-visibility: hidden;
  }

  /* Field media parallax (independent of the chapter container's depth travel). */
  html.qm-motion-ready #innovation-hub.qmi-motion[data-qmi-motion="active"] .ip-visual,
  html.qm-motion-ready #innovation-hub.qmi-motion[data-qmi-motion="active"] .ip-energy-media {
    translate: 0 var(--qmi-media-y, 0px);
  }

  @media (max-width: 767px) {
    html.qm-motion-ready #innovation-hub.qmi-motion[data-qmi-motion="active"] :is(.ip-hero, .ip-fields) { perspective: none; }
    html.qm-motion-ready #innovation-hub.qmi-motion[data-qmi-motion="active"] :is(.ip-hero-grid > div, .ip-field, .ip-visual, .ip-energy-media) {
      translate: none;
      rotate: none;
    }
    html.qm-motion-ready #innovation-hub.qmi-motion .qmi-reveal.qmi-waiting { translate: 0 18px; }
    html.qm-motion-ready #innovation-hub.qmi-motion .qmi-dock { display: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  html.qm-motion-ready #innovation-hub.qmi-motion .qmi-reveal,
  html.qm-motion-ready #innovation-hub.qmi-motion .qmi-reveal.qmi-waiting,
  html.qm-motion-ready #innovation-hub.qmi-motion .ip-hero-grid > div,
  html.qm-motion-ready #innovation-hub.qmi-motion .ip-field,
  html.qm-motion-ready #innovation-hub.qmi-motion .ip-visual,
  html.qm-motion-ready #innovation-hub.qmi-motion .ip-energy-media {
    opacity: 1;
    translate: none;
    rotate: none;
    transition: none;
  }
  html.qm-motion-ready #innovation-hub.qmi-motion .qmi-dock { display: none; }
  html.qm-motion-ready #innovation-hub.qmi-motion .ip-field-link span:last-child,
  html.qm-motion-ready #innovation-hub.qmi-motion .ip-crossroads a span {
    transform: none;
    transition: none;
  }
}

/* Safety: content always visible without the ready gate. */
html:not(.qm-motion-ready) #innovation-hub.qmi-motion .qmi-reveal,
html:not(.qm-motion-ready) #innovation-hub.qmi-motion .qmi-reveal.qmi-waiting {
  opacity: 1 !important;
  translate: none !important;
  transition: none !important;
}

@media print {
  #innovation-hub.qmi-motion :is(.ip-hero-grid > div, .ip-field, .ip-visual, .ip-energy-media) {
    translate: none !important;
    rotate: none !important;
  }
  #innovation-hub.qmi-motion .qmi-dock { display: none !important; }
}
