/*
 * ContractorFlo page transitions, shared by the landing and the app.
 * Browsers with cross-document View Transitions (Chrome/Edge 126+, Safari 18.2+)
 * animate between pages natively; others get an enter animation and a loading bar.
 */

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: cf-vt-out .22s cubic-bezier(.4, 0, 1, 1) both;
}

::view-transition-new(root) {
  animation: cf-vt-in .38s cubic-bezier(.2, .7, .2, 1) both;
}

/* The header and the brand mark stay put while the page underneath changes */
.cf-app-header,
.cf-landing-header {
  view-transition-name: cf-header;
}

.cf-app-brand .cf-brand-mark,
.cf-landing-brand .cf-landing-mark {
  view-transition-name: cf-mark;
}

::view-transition-group(cf-header),
::view-transition-group(cf-mark) {
  animation-duration: .35s;
  animation-timing-function: cubic-bezier(.2, .7, .2, 1);
}

@keyframes cf-vt-out {
  to { opacity: 0; transform: translateY(-8px); }
}

@keyframes cf-vt-in {
  from { opacity: 0; transform: translateY(14px); }
}

/* Fallback for browsers without cross-document View Transitions */
html.cf-js:not(.cf-vt) main {
  animation: cf-vt-in .38s cubic-bezier(.2, .7, .2, 1) both;
}

html.cf-leaving:not(.cf-vt) main {
  opacity: .45;
  transition: opacity .18s ease;
}

/* Top loading bar while the next page is on its way */
.cf-nav-loader {
  background: linear-gradient(90deg, #38bdf8, #facc15);
  box-shadow: 0 0 12px rgba(56, 189, 248, .6);
  height: 3px;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  top: 0;
  transform: scaleX(0);
  transform-origin: left;
  width: 100%;
  z-index: 2000;
}

html.cf-leaving .cf-nav-loader {
  animation: cf-loader 2.4s cubic-bezier(.1, .7, .2, 1) forwards;
  opacity: 1;
}

@keyframes cf-loader {
  0% { transform: scaleX(0); }
  40% { transform: scaleX(.55); }
  100% { transform: scaleX(.9); }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  html.cf-js main {
    animation: none !important;
  }

  html.cf-leaving .cf-nav-loader {
    animation: none;
    transform: scaleX(.9);
  }
}
