.brand-loader {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 6rem;
  color: #2864ff;
}
.brand-loader::before {
  content: "";
  display: block;
  width: min(9rem, 84%);
  aspect-ratio: 700 / 99;
  background: url("/assets/brand-logo.webp") center / contain no-repeat;
}
.brand-loader__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.brand-loader--compact { min-height: 1.75rem; }
.brand-loader--compact::before { width: min(6rem, 84%); }
.brand-loader--page { min-height: 45vh; }
.brand-loader--page::before { width: clamp(10rem, 22vw, 14rem); max-width: 85%; }

/* The page's real status element owns the loader. Replacing it reveals the page. */
main:not([data-ll-workspace]):has(.brand-loader--page):not(:has([hidden] .brand-loader--page)):not(:has(#hosted-login-message:not(:empty))) {
  position: relative;
  min-height: clamp(14rem, 64svh, 52rem);
  visibility: hidden;
}
main:not([data-ll-workspace]) .brand-loader--page {
  position: absolute;
  inset: 0;
  z-index: 1;
  visibility: visible;
  pointer-events: none;
}
[data-auth-callback]:has(#hosted-login-message:not(:empty)) .brand-loader { display: none; }

/* The hosted sign-in button is reset by the existing authentication flow on failure or Back. */
.auth-layout:has(#hosted-login:disabled):not(:has(#hosted-login-message:not(:empty))) {
  position: relative;
  min-height: 64svh;
  visibility: hidden;
}
.auth-layout > .brand-signin-wait { display: none; }
.auth-layout:has(#hosted-login:disabled):not(:has(#hosted-login-message:not(:empty))) > .brand-signin-wait {
  display: grid;
  position: absolute;
  inset: 0;
  visibility: visible;
}
.brand-signin-wait::before { width: clamp(10rem, 22vw, 14rem); }

@media (prefers-reduced-motion: no-preference) {
  .brand-loader::before { animation: brand-logo-pulse 1.8s ease-in-out infinite; }
  main.portal-shell:not(.employee-shell):not(.auth-layout):not(:has(.brand-loader--page)) {
    animation: brand-content-in 160ms ease-out;
  }
  @keyframes brand-content-in { from { opacity: .4; } to { opacity: 1; } }
  @keyframes brand-logo-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .68; transform: scale(.985); }
  }
}

/* Page layout stays interactive while its data region is loading. */
main[data-ll-workspace] .brand-loader--page { position: static; min-height: clamp(8rem,32svh,20rem); }
.ll-initial-view { display:none; }
main:has(#account-gate .brand-loader--page):not(:has(#account-gate h1)) > .ll-initial-view,
main:has(#owner-root > .brand-loader--page, #owner-root > #owner-message:only-child) > .ll-initial-view,
main:has(#provider-gate .brand-loader--page) > .ll-initial-view { display:block; }
.ll-initial-view nav { margin-block:1rem; }
.employee-opening .employee-shell > h1.visually-hidden { position:relative; width:auto; height:auto; margin:0 0 .75rem; clip-path:none; white-space:normal; z-index:2; }
.employee-opening .employee-loader { top:4rem; }
