/* ============================================================
   local-group.css — page styles for the Local Group map.
   Loads after styles.css; stage layout mirrors the solar page,
   because the two are the same instrument at different zooms.
   ============================================================ */

/* ---------- stage ---------------------------------------------- */

.stage {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 100svh;
  padding: calc(var(--rail-h) + 2rem) var(--gutter);
  overflow: hidden;
}

.stage__chart {
  --chart-opacity: 1;
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: var(--chart-opacity);
  animation: chart-in 1100ms var(--ease) both;
}

#group {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;   /* the canvas owns the drag; the page cannot scroll */
}
#group:active { cursor: grabbing; }

.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(97deg,
    rgba(5, 6, 13, 0.82) 0%,
    rgba(5, 6, 13, 0.55) 28%,
    rgba(5, 6, 13, 0.18) 48%,
    rgba(5, 6, 13, 0) 64%);
}

.stage__copy {
  position: relative;
  z-index: 2;
  max-width: 30rem;
  pointer-events: none;
}
.stage__copy a { pointer-events: auto; }

.stage .headline__name { font-size: clamp(1.35rem, 3.9vw, 3.7rem); }
.stage .headline__lede { max-width: 28ch; }
.stage .sub { max-width: 26rem; }

/* ---------- bottom-rail cluster -------------------------------- */

.rail__tools {
  display: flex;
  align-items: center;
  gap: 1.3rem;
  flex: none;
}

.rail__meta--note { color: var(--dim); }

/* Screen-reader channel for event-driven lines; the ticking counter
   stays in the plain readout so it cannot spam. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.noscript {
  position: fixed;
  left: var(--gutter);
  bottom: calc(var(--rail-h) + 1rem);
  z-index: 20;
  max-width: 34rem;
  margin: 0;
  color: var(--dim);
  font-size: 0.95rem;
}

/* ---------- narrow screens ------------------------------------- */

@media (max-width: 900px) {
  .stage { align-content: start; }

  .stage::before {
    inset: 0 0 auto 0;
    height: 58%;
    background: linear-gradient(to bottom,
      rgba(5, 6, 13, 0.90) 0%,
      rgba(5, 6, 13, 0.80) 44%,
      rgba(5, 6, 13, 0.45) 72%,
      rgba(5, 6, 13, 0) 100%);
  }

  .stage__copy { max-width: none; }
  .stage .headline__name { font-size: clamp(1.2rem, 5.4vw, 2.3rem); }

  /* The distance line is the page's evidence; it stays on mobile. */
  .rail__group .rail__readout { display: block; }
  .rail__meta--note { display: none; }
}

/* ---------- short viewports ------------------------------------ */

@media (max-height: 620px) {
  .stage { padding: calc(var(--rail-h) + 0.9rem) var(--gutter); }
  .stage .headline__name { font-size: clamp(1.2rem, 5.4vh, 2.1rem); }
}
