/* ── Header ── */
#hdr {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hdr-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 200;
  border-bottom: 1px solid var(--rule);
  background: rgba(3,4,10,0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#logo {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink3);
  cursor: pointer;
  transition: color 0.2s;
}
#logo:hover { color: var(--cyan); }
#logo span { color: var(--cyan); }

#nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nb {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink3);
  background: none;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.2s, background 0.2s;
}
.nb:hover { color: var(--ink); background: rgba(255,255,255,0.06); }
.nb.on { color: var(--cyan); }

/* ── Left rail ── */
#rail {
  position: fixed;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.4s;
}
#rail.vis { opacity: 1; }

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink4);
  border: 1px solid var(--ink3);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.dot:hover { transform: scale(1.4); border-color: var(--ink2); }
.dot.done { background: var(--ink3); border-color: var(--ink3); }
.dot.on   { background: var(--cyan); border-color: var(--cyan); transform: scale(1.3); }

/* ── Scroll wrapper ── */
#sw {
  width: 100%; height: 100dvh;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

/* ── Canvas layer ── */
#c3d {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#rcanv {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ── Scene cards ── */
#scards {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.scard {
  background: var(--glass2);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--cyan);
  padding: 14px 20px;
  max-width: 360px;
  width: 90vw;
  animation: scardIn 0.4s var(--ease-out) forwards;
}

.scard-label {
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 4px;
}

.scard-text {
  font-family: var(--ff-sans);
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.5;
}

@keyframes scardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Signal overlay ── */
#sov {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass2);
  border: 1px solid var(--rule);
  padding: 8px 16px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#sov.on { opacity: 1; }

.sov-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse 1.2s ease-in-out infinite;
}
#sov.ret .sov-dot { background: var(--amber); }

@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.7); }
}

/* ── Video orb ── */
#orb {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: var(--orb-size);
  height: var(--orb-size);
  border-radius: 50%;
  cursor: pointer;
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out);
}
#orb.mini { width: var(--orb-size-sm); height: var(--orb-size-sm); }

#orb-prog {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
}

#orb-vid {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  object-fit: cover;
  background: #0a0c18;
  overflow: hidden;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
}

#orb-vid video {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#orb-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink3);
  text-align: center;
  padding: 8px;
  line-height: 1.4;
}

#orb-controls {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(3,4,10,0.5);
  opacity: 0;
  transition: opacity 0.2s;
}
#orb:hover #orb-controls { opacity: 1; }

.orb-btn {
  background: none;
  border: 1px solid var(--ink3);
  color: var(--ink);
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}
.orb-btn:hover { border-color: var(--cyan); background: rgba(23,174,212,0.15); }

/* ── Milky Way background overlay — ch5 Beyond ── */
#mw-overlay {
  position: fixed;
  inset: 0;
  z-index: 2; /* above 3d canvas, below everything else */
  pointer-events: none;
  opacity: 0;
  transition: opacity 2s ease;

  /* ESO GigaGalaxy panorama — galactic plane runs horizontally */
  background-image: url('https://cdn.eso.org/images/screen/eso0932a.jpg');
  background-size: cover;
  background-position: center 40%;
  background-repeat: no-repeat;

  /* Dark blend so the stars look like background, not wallpaper */
  mix-blend-mode: screen;
  filter: brightness(0.55) saturate(1.1);
}

/* Subtle vignette on top of the MW image */
#mw-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(3,4,10,0.7) 100%);
}
