/*
 * The boot screen (index.html #boot): what shows while the app's code and the signed-in session
 * load, instead of a blank page. It stays invisible for the first 400 ms, so a fast start opens
 * straight into the app with no loader flash; a slower one fades the logo and spinner in.
 * src/utils/boot-screen.ts removes it once the app (or its shell) is on screen.
 *
 * A file, not an inline <style>, to match the scripts (public/boot.js): the Content-Security-
 * Policy (scripts/config/nginx/9bx-http.conf.tpl) loads both from 'self'. Self-contained on
 * purpose: it must look right before (and without) the app's own stylesheet.
 */
#boot {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: #fafbfc;
  opacity: 0;
  animation: boot-in 240ms ease-out 400ms forwards;
}

/* Leaving (src/utils/boot-screen.ts): the app shows through while it fades. */
#boot.boot-leaving {
  animation: none;
  transition: opacity 200ms ease-out;
  pointer-events: none;
}

html[data-mode='dark'] #boot {
  background: #08090b;
}

.boot-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 6px 24px rgba(11, 26, 58, 0.14);
}

html[data-mode='dark'] .boot-logo {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

/* A workspace's own logo (a tenant's domain) may be any shape: shown as it is. */
html[data-host-brand] .boot-logo {
  border-radius: 0;
  box-shadow: none;
}

.boot-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.1);
  /* The workspace's brand colour on a tenant's own domain (public/host-branding.js), else 9bx navy. */
  border-top-color: var(--brand-500, #2469dd);
  animation: boot-spin 800ms linear infinite;
}

html[data-mode='dark'] .boot-spinner {
  border-color: rgba(255, 255, 255, 0.12);
  border-top-color: var(--brand-400, #5b8fea);
}

@keyframes boot-in {
  to {
    opacity: 1;
  }
}

@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #boot {
    animation-duration: 1ms;
  }
  .boot-spinner {
    animation-duration: 2400ms;
  }
}
