/* Initial Loading Spinner (shows before Angular bootstraps and CSS loads) */
#initial-loader {
  --splash-bg: #1d2957;
  --splash-accent: #00FF9F;
  --splash-mark: 120px;
  --splash-tri: 56px;

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--splash-bg);
  z-index: 99999;
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

#initial-loader .spinner-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

#initial-loader .logo-pulse {
  width: var(--splash-mark);
  height: var(--splash-mark);
  animation: pulse 2s ease-in-out infinite;
}

#initial-loader .spinner-triangle {
  display: block;
  width: var(--splash-tri);
  height: var(--splash-tri);
  animation: sans-triangle-spin 6s linear infinite;
}

#initial-loader .spinner-triangle polygon {
  fill: none;
  stroke: var(--splash-accent);
  stroke-width: 7;
  stroke-linejoin: round;
  stroke-dasharray: 229;
  animation: sans-triangle-trace 2s ease-in-out infinite;
}

#initial-loader p {
  margin-top: 1.5rem;
  margin-bottom: 0;
  color: #ccc;
  font-size: 16px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Traces the outline on, then off, so the stroke never sits still. */
@keyframes sans-triangle-trace {
  0%   { stroke-dashoffset: 229; }
  50%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -229; }
}

@keyframes sans-triangle-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.7; }
}

@media (max-width: 480px) {
  #initial-loader {
    --splash-mark: 84px;
    --splash-tri: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #initial-loader { transition-duration: 1ms; }
  #initial-loader .spinner-triangle { animation-duration: 16s; }
  #initial-loader .spinner-triangle polygon {
    animation-duration: 6s;
    animation-timing-function: linear;
  }
  #initial-loader .logo-pulse { animation: none; opacity: 1; }
}

/* Hide loader when ready class is added */
#initial-loader.loader-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Hide app-root content until CSS is loaded */
body:not(.css-loaded) app-root {
  visibility: hidden;
}
