/* The viewport stays dark in both themes, like the 3D viewport of a modelling tool:
   the planet is lit for a dark backdrop. */
.planet {
  --planet-backdrop: radial-gradient(120% 95% at 50% 42%, #2a2a33 0%, #17171b 55%, #101013 100%);
  --planet-text: #a3a3ab;
  --planet-track: #323237;
  --planet-fill: #62a0ff;
  --planet-danger: #ff7b72;
}

.planet__stage {
  position: relative;
  aspect-ratio: 16 / 10;
  max-height: min(620px, 64svh);
  overflow: hidden;
  background: var(--planet-backdrop);
}

.planet__stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  opacity: 0;
  touch-action: none;
  transition: opacity 0.5s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.planet__stage canvas:active {
  cursor: grabbing;
}

.planet__stage[data-ready] canvas {
  opacity: 1;
}

.planet__stage canvas:focus-visible {
  outline: 2px solid var(--planet-fill);
  outline-offset: -4px;
}

/* Phones get a square viewport; the camera in planet.js fits either shape. */
@media (max-width: 640px) {
  .planet__stage {
    aspect-ratio: 1;
  }
}

.planet__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--planet-text);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.planet__loading[data-state="done"] {
  opacity: 0;
}

.planet__loading[data-state="error"] {
  color: var(--planet-danger);
}

.planet__progress {
  width: min(180px, 60%);
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--planet-track);
}

.planet__progress > span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--planet-fill);
  transition: width 0.2s linear;
}

/* Without a length from the server there is no percentage to show. */
.planet__progress:not([aria-valuenow]) > span {
  width: 100%;
  opacity: 0.5;
  animation: window-pulse 0.9s ease-in-out infinite alternate;
}

.planet__loading[data-state="error"] .planet__progress {
  display: none;
}

@media (max-width: 640px) {
  .planet .window__statusbar {
    gap: 2px 10px;
    font-size: 11px;
  }
}
