/* ==========================================================================
   Animated galaxy viewer (Milky Way / Andromeda)
   Reuses the solar-system interaction language: moving visual + labelled
   hotspots + a compact control strip.
   ========================================================================== */

.galaxy-viz {
  position: relative;
  height: clamp(340px, 52vh, 560px);
  margin: 26px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, rgba(46, 52, 78, 0.35), transparent 72%),
    #05070d;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.galaxy-canvas {
  position: absolute;
  inset: 0;
  display: block;
}

.galaxy-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.galaxy-spot {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
  cursor: pointer;
}

.galaxy-spot-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 12px rgba(190, 210, 255, 0.7);
}

.galaxy-spot-tip {
  position: absolute;
  left: 14px;
  top: 50%;
  width: min(250px, calc(100vw - 48px));
  transform: translate(4px, -50%);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(10, 13, 22, 0.94);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: #eaf1fd;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translate(4px, -50%);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.galaxy-spot-tip strong {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.galaxy-spot-tip span {
  color: rgba(231, 237, 248, 0.72);
  font-size: 11px;
  line-height: 1.55;
}

.galaxy-spot:hover .galaxy-spot-tip,
.galaxy-spot:focus-visible .galaxy-spot-tip {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

.galaxy-spot:hover .galaxy-spot-dot,
.galaxy-spot:focus-visible .galaxy-spot-dot {
  background: rgba(255, 255, 255, 0.75);
}

.galaxy-spot:focus-visible {
  outline: none;
}

.galaxy-spot:focus-visible .galaxy-spot-dot {
  outline: 2px solid rgba(198, 220, 255, 0.75);
  outline-offset: 4px;
}

.galaxy-viz.is-labels-hidden .galaxy-spot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.galaxy-controls {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(10, 13, 22, 0.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  backdrop-filter: blur(12px) saturate(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.galaxy-ctl {
  display: grid;
  place-items: center;
  height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: transparent;
  color: rgba(234, 241, 253, 0.85);
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}

.galaxy-ctl:hover,
.galaxy-ctl:focus-visible {
  border-color: rgba(255, 255, 255, 0.32);
  color: #ffffff;
}

.galaxy-ctl-play {
  width: 28px;
  padding: 0;
}

.galaxy-ctl-play svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.galaxy-ctl-play .g-pause {
  display: block;
}

.galaxy-ctl-play .g-play {
  display: none;
}

.galaxy-viz.is-paused .galaxy-ctl-play .g-pause {
  display: none;
}

.galaxy-viz.is-paused .galaxy-ctl-play .g-play {
  display: block;
}

.galaxy-speed {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.galaxy-speed button {
  height: 22px;
  min-width: 30px;
  padding: 0 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(234, 241, 253, 0.7);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.galaxy-speed button:hover,
.galaxy-speed button:focus-visible {
  color: #ffffff;
}

.galaxy-speed button.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.galaxy-caption {
  margin: -12px 0 0;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.03em;
}

@media (max-width: 700px) {
  .galaxy-viz {
    height: clamp(300px, 56vh, 460px);
    border-radius: 14px;
  }

  .galaxy-controls {
    left: 8px;
    bottom: 8px;
    gap: 6px;
  }

  .galaxy-ctl {
    height: 28px;
    padding: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .galaxy-spot-tip {
    transition: none;
  }
}
