/*
 * Injected into the SuperSplat viewer by scripts/sync-supersplat-viewer.mjs.
 * The scan is meant to be looked at, not navigated: the only interaction we
 * keep is orbiting the scene, so every control that changes the camera mode or
 * opens viewer chrome is removed.
 */

#play,
#pause,
#orbitCamera,
#flyCamera,
#fpsCamera,
#info,
#settings,
#enterFullscreen,
#exitFullscreen {
  display: none !important;
}

/*
 * The viewer collapses a button group once all its children carry .hidden.
 * Ours are hidden by id instead, so the same rule is restated with those ids
 * treated as invisible — otherwise an empty translucent pill would be left
 * floating over the scan.
 */
#controlsWrap
  > #buttonsContainer
  .buttonGroup:not(
    :has(
      > :not(
        .hidden,
        #play,
        #pause,
        #orbitCamera,
        #flyCamera,
        #fpsCamera,
        #info,
        #settings,
        #enterFullscreen,
        #exitFullscreen
      )
    )
  ) {
  display: none;
}

/*
 * Caricamento: la stessa linea di frame.ekua.app (ekua-frontend-frame,
 * .replate-loader-spinner) al posto della barra di SuperSplat, con la
 * percentuale e il riempimento arancione. Una riga sottile al centro, con un
 * tratto che scorre: dice "sta caricando" senza una cifra che a volte si
 * ferma e a volte salta. I colori sono quelli del tema scuro del frame, perché
 * qui lo sfondo del viewer è sempre nero (settings.json).
 *
 * Il riempimento lo scrive lo script nello stile in linea (background-image a
 * ogni avanzamento): solo un !important nel foglio lo scavalca. Il viewer
 * nasconde #loadingWrap da sé al primo fotogramma, come prima.
 */
#loadingWrap {
  inset: 0;
  bottom: auto;
  left: 0;
  transform: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 0;
  pointer-events: none;
}

#loadingWrap > #loadingText {
  display: none;
}

#loadingWrap > #loadingBar {
  position: relative;
  width: 160px;
  height: 3px;
  margin: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15) !important;
}

#loadingWrap > #loadingBar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  border-radius: 3px;
  background: #fff;
  animation: ekua-loader-slide 1.1s ease-in-out infinite;
}

@keyframes ekua-loader-slide {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #loadingWrap > #loadingBar::before {
    animation-duration: 2.4s;
  }
}
