/**
 * Fusion Compute unified route transitions — soft slide + fade with translucent veil.
 * Nav (z-index 40) stays visible; veil covers content area beneath it.
 *
 * Scroll lock applies to intranet shell pages only — NOT the public homepage (dev.html).
 */
@import url('fci-nav-lock.css');

/* Intranet shell: document locked; .fci-page-main / #fci-scrollport scrolls */
html:has(body.fci-page),
html:has(body.fci-app-page),
html:has(body.fci-page-solar),
html:has(body.at-login) {
  overflow: hidden !important;
  scrollbar-gutter: stable !important;
  width: 100%;
  height: 100%;
}

html:has(body.fci-page),
html:has(body.fci-app-page),
html:has(body.fci-page-solar),
html:has(body.at-login),
html:has(body.fci-page) body,
html:has(body.fci-app-page) body,
html:has(body.fci-page-solar) body {
  overscroll-behavior: none;
}

#fci-route-veil {
  position: fixed;
  top: 41px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 39;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.42s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: opacity;
}

#fci-route-veil.fci-route-veil--cover {
  opacity: 1;
  pointer-events: auto;
}

#fci-route-veil.fci-route-veil--reveal {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.52s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Login page — veil covers full viewport (login nav is inside content stack) */
html.fci-route-login #fci-route-veil {
  top: 0;
}

/* Public site — full viewport veil; green nav stays above at z-40 */
html.fci-route-public #fci-route-veil {
  top: 0;
}

html.fci-route-pending,
html.fci-route-pending body {
  background-color: var(--fci-route-bg, #0d0f1a);
}

html.fci-route-pending .fci-page-main,
html.fci-route-pending .fci-app-main,
html.fci-route-pending #fci-scrollport,
html.fci-route-pending #content {
  opacity: 0;
}

/* Never hide the login form on backend.html — a stale route flag must not trap users */
html.fci-route-pending body.at-login #login-screen {
  opacity: 1;
}

/* Shared motion on scroll roots */
.fci-route-root {
  transition:
    opacity 0.42s cubic-bezier(0.33, 1, 0.68, 1),
    transform 0.42s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: opacity, transform;
}

.fci-page-main,
.fci-app-main,
#fci-scrollport,
#login-screen,
#fci-public-root {
  transition:
    opacity 0.42s cubic-bezier(0.33, 1, 0.68, 1),
    transform 0.42s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: opacity, transform;
}

/* Scroll roots: fade only — fixed top:41px must not translate between routes */
.fci-page-main,
.fci-app-main,
#fci-scrollport {
  transition: opacity 0.42s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: opacity;
}

.fci-route-leave,
.fci-page-leave {
  opacity: 0 !important;
  transform: none !important;
  pointer-events: none !important;
}

.fci-route-enter,
.fci-page-enter {
  opacity: 0;
  transform: none !important;
}

.fci-route-enter-active,
.fci-page-enter-active {
  opacity: 1 !important;
  transform: none !important;
}

/* Non-scroll roots (login, public) keep the soft slide */
#login-screen.fci-route-leave,
#fci-public-root.fci-route-leave {
  transform: translateY(-6px) scale(0.997) !important;
}
#login-screen.fci-route-enter,
#fci-public-root.fci-route-enter {
  transform: translateY(8px) scale(0.997);
}
#login-screen.fci-route-enter-active,
#fci-public-root.fci-route-enter-active {
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #fci-route-veil,
  .fci-route-root,
  .fci-page-main,
  .fci-app-main,
  #fci-scrollport {
    transition-duration: 0.01ms !important;
  }
  .fci-route-leave,
  .fci-page-leave,
  .fci-route-enter,
  .fci-page-enter {
    transform: none !important;
  }
}
