/* iadvl-ap page transitions
   Smooth fade in/out between internal navigations.
   Uses Webflow's existing `w-mod-js` class on <html> so non-JS users see content normally.

   Easing rationale:
   - Enter:  cubic-bezier(0.22, 1, 0.36, 1)   (ease-out-quint) — fast start, gentle settle.
   - Leave:  cubic-bezier(0.4, 0, 1, 1)        (ease-in)        — accelerates away cleanly.
   These two curves together produce a hand-off feel rather than a symmetrical fade. */

/* Hide body content briefly only when JS is available, until DOM is ready.
   Prevents FOUC and gives the fade-in a defined starting state.
   Background is pinned to match the design so the browser never flashes white
   between the old page tearing down and the new page revealing. */
html.w-mod-js body {
  opacity: 0;
  background-color: #fff;
  will-change: opacity;
}

html.w-mod-js body.is-page-ready {
  opacity: 1;
  transition: opacity 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

html.w-mod-js body.is-page-leaving {
  opacity: 0;
  transition: opacity 200ms cubic-bezier(0.4, 0, 1, 1);
  pointer-events: none;
}

/* Once the entrance transition completes, drop the GPU hint to free resources. */
html.w-mod-js body.is-page-settled {
  will-change: auto;
}

/* Failsafe: if JS doesn't run within 800ms, reveal the page anyway. */
html.w-mod-js.page-ready-failsafe body {
  opacity: 1 !important;
}

/* Respect reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  html.w-mod-js body,
  html.w-mod-js body.is-page-ready,
  html.w-mod-js body.is-page-leaving {
    opacity: 1 !important;
    transition: none !important;
  }
}

/* Smooth in-page anchor scrolling. */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Native View Transitions API (Chrome/Edge 111+, Safari 18+) — when supported
   by the browser AND by both pages, this provides true cross-document
   transitions. Our JS-driven fade is the fallback. */
@supports (view-transition-name: none) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 280ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
}
