/**
 * @file map-loading.css
 * @purpose Present measurement-blue loading rings without blocking map controls.
 * @dependencies map.html search/loader markup and the Projects startup presentation observer.
 * @public #map-loader, .map-loading-ring, and .map-loading-label.
 * @sideEffects Overrides the legacy centered startup loader's position.
 */

/* Reserve a stable slot to the left of the search field, avoiding any busy-state shift. */
.map-search { padding-left: 48px; }
#map-loader {
  position: absolute;
  z-index: 1;
  top: 3px;
  right: auto;
  bottom: auto;
  left: 0;
  transform: none;
  width: 2.55rem;
  height: 2.55rem;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 15px rgba(66, 133, 244, 0.16);
  pointer-events: none;
}

/* Show progress immediately; retain the shared gentle fade when it finishes. */
#map-loader:not(.is-hidden) {
  transition: none;
}

.map-loading-ring {
  width: 1.6rem;
  height: 1.6rem;
  border: 3px solid rgba(66, 133, 244, 0.2);
  border-top-color: #4285F4;
  border-right-color: #4285F4;
  border-radius: 50%;
  animation: map-loading-spin 800ms linear infinite;
}

/* The status remains available to assistive technology without a visual label. */
.map-loading-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

/* First Projects activation only: blur the map, never the menu/search or its geometry.
 * Pointer events pass through so an in-flight base change or camera move remains safe. */
#project-startup-loader {
  position: absolute;
  z-index: 4;
  inset: 0 0 0 var(--sidebar-collapsed-width, 56px);
  display: grid;
  place-items: center;
  background: rgba(35, 39, 43, 0.12);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}
#project-startup-loader[hidden] { display: none; }
#project-startup-loader .map-loading-ring {
  width: 44px;
  height: 44px;
  border-width: 4px;
  background: #fff;
  box-shadow: 0 0 0 12px #fff;
}

@media (prefers-reduced-motion: reduce) {
  .map-loading-ring { animation: none; }
}
