.app-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--primary-background);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.loading-navbar-height {
  height: 4rem !important;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.loader-stage {
  position: relative;
  width: 320px;
  height: 320px;
  display: grid;
  place-items: center;
}

.logo-svg {
  width: 280px;
  height: 280px;
  color: var(--primary-color);
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--primary-color) 35%, transparent));
  z-index: 1;
  overflow: visible;
}

.logo-gear {
  transform-origin: center;
  transform-box: fill-box;
  animation: gear-spin 5s linear infinite;
}

.logo-iris {
  transform-origin: center;
  transform-box: fill-box;
  animation: iris-pulse 2s ease-in-out infinite;
}

.logo-eye {
  stroke-dasharray: 250;
  stroke-dashoffset: 0;
  animation: eye-breath 3s ease-in-out infinite;
}

@keyframes gear-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes iris-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(0.85); opacity: 0.85; }
}

@keyframes eye-breath {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

.loading-text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 1;
}

.loading-text__brand {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  color: var(--primary-color);
  text-shadow: 0 0 30px color-mix(in srgb, var(--primary-color) 40%, transparent);
  padding-left: 0.4em;
}

.loading-text__sub {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--primary-color) 70%, #888);
  display: inline-flex;
}

.loading-text__dots {
  display: inline-block;
  width: 1.5em;
  text-align: left;
}

.loading-text__dots::after {
  content: '';
  animation: dots 1.6s steps(4, end) infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

.loading-error {
  display: none;
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #c0392b;
  font-size: 0.9rem;
  z-index: 2;
}

.loading-error a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.loading-error a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .logo-gear   { animation-duration: 12s; }
  .logo-iris,
  .logo-eye    { animation: none; }
  .loading-text__dots::after { animation-duration: 3s; }
}
