/* FieldOps bootstrap loader — matches assets/branding/loader.png */
.fo-splash {
  --fo-loader-ring-top: 26%;
  --fo-loader-ring-size: 38%;
  --fo-loader-bar-bottom: 20%;
  --fo-loader-bar-inset: 18%;

  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  font-family: Inter, system-ui, sans-serif;
  background: #001a3d;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.fo-splash--out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fo-splash__backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #002d62 0%, #004e8c 42%, #0077b6 68%, #0ea5c9 100%);
  background-size: 220% 220%;
  animation: fo-splash-bg-shift 10s ease-in-out infinite;
}

.fo-splash__backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 65% 50% at 30% 18%, rgba(255, 255, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 55% 40% at 72% 82%, rgba(52, 211, 153, 0.18), transparent 50%);
  pointer-events: none;
}

.fo-splash__scene {
  position: relative;
  z-index: 1;
  width: min(420px, 92vw);
  line-height: 0;
}

.fo-splash__art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
  animation: fo-splash-art-breathe 2.8s ease-in-out infinite;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.35));
}

.fo-splash__glow {
  position: absolute;
  top: 18%;
  left: 50%;
  width: 55%;
  aspect-ratio: 1;
  margin-left: -27.5%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(110, 231, 183, 0.45) 0%, transparent 68%);
  animation: fo-splash-glow-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}

.fo-splash__ring {
  position: absolute;
  top: var(--fo-loader-ring-top);
  left: 50%;
  width: var(--fo-loader-ring-size);
  aspect-ratio: 1;
  margin-left: calc(var(--fo-loader-ring-size) / -2);
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #6ee7b7;
  border-right-color: rgba(34, 211, 238, 0.65);
  border-bottom-color: rgba(0, 119, 182, 0.25);
  border-left-color: rgba(0, 119, 182, 0.15);
  animation: fo-splash-ring-spin 1.35s cubic-bezier(0.5, 0.1, 0.4, 1) infinite;
  pointer-events: none;
  box-shadow: 0 0 24px rgba(110, 231, 183, 0.25);
}

.fo-splash__shimmer {
  position: absolute;
  inset: 8% 6%;
  border-radius: 16px;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.fo-splash__shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 55%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 42%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0.08) 58%,
    transparent 100%
  );
  animation: fo-splash-shimmer-sweep 2.6s ease-in-out infinite;
}

.fo-splash__bar {
  position: absolute;
  left: var(--fo-loader-bar-inset);
  right: var(--fo-loader-bar-inset);
  bottom: var(--fo-loader-bar-bottom);
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
  pointer-events: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.fo-splash__bar-fill {
  display: block;
  height: 100%;
  width: 35%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0077b6, #6ee7b7, #22d3ee, #6ee7b7);
  background-size: 200% 100%;
  animation: fo-splash-bar-slide 1.8s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(110, 231, 183, 0.55);
}

.fo-splash__status {
  position: relative;
  z-index: 1;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.15rem;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(248, 250, 252, 0.94);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.fo-splash__dots span {
  animation: fo-splash-ellipsis 1.2s ease-in-out infinite;
}

.fo-splash__dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.fo-splash__dots span:nth-child(3) {
  animation-delay: 0.3s;
}

/* Fallback when loader.png is missing — logo-only layout */
.fo-splash--fallback .fo-splash__scene {
  width: min(280px, 80vw);
  padding: 2rem;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.3);
  line-height: normal;
}

.fo-splash--fallback .fo-splash__art {
  max-width: 200px;
  margin: 0 auto;
  filter: none;
}

.fo-splash--fallback .fo-splash__ring {
  top: 12%;
  width: 48%;
  margin-left: -24%;
}

.fo-splash--fallback .fo-splash__bar {
  bottom: 12%;
}

.fo-splash--fallback .fo-splash__glow {
  top: 8%;
}

@keyframes fo-splash-bg-shift {
  0%,
  100% {
    background-position: 0% 40%;
  }
  50% {
    background-position: 100% 60%;
  }
}

@keyframes fo-splash-art-breathe {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.35)) brightness(1);
  }
  50% {
    transform: scale(1.015);
    filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.4)) brightness(1.04);
  }
}

@keyframes fo-splash-glow-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes fo-splash-ring-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fo-splash-shimmer-sweep {
  0% {
    left: -120%;
  }
  100% {
    left: 140%;
  }
}

@keyframes fo-splash-bar-slide {
  0% {
    transform: translateX(-100%);
    background-position: 0% 50%;
  }
  100% {
    transform: translateX(320%);
    background-position: 100% 50%;
  }
}

@keyframes fo-splash-ellipsis {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fo-splash__backdrop,
  .fo-splash__art,
  .fo-splash__glow,
  .fo-splash__ring,
  .fo-splash__shimmer::after,
  .fo-splash__bar-fill,
  .fo-splash__dots span {
    animation: none;
  }

  .fo-splash__ring {
    opacity: 0.5;
  }
}
