/* Constellation navigation */
.constellation-nav {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  width: 200px;
  height: 212px;
  opacity: 1;
  transition: opacity 0.8s ease, visibility 0s;
}

.constellation-nav.visible {
  opacity: 1;
}

/* index.html sets gate-hold on first visits only — nav waits until revealed */
html.gate-hold .constellation-nav:not(.visible) {
  opacity: 0;
  visibility: hidden;
}

.nav-point {
  position: absolute;
  text-decoration: none;
  font-size: 20px;
  color: rgba(232, 218, 240, 0.62);
  transition: color 0.4s ease, text-shadow 0.4s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;
  padding: 0.5rem;
  margin: -0.5rem;
}

.nav-point:hover,
.nav-point:focus-visible {
  color: var(--accent);
  text-shadow: 0 0 20px rgba(192, 132, 252, 0.4);
}

.nav-point.active {
  color: rgba(232, 218, 240, 0.85);
  text-shadow: 0 0 12px rgba(192, 132, 252, 0.2);
}

.nav-label {
  font-family: 'Noto Serif', Georgia, serif;
  font-size: 0.65rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  opacity: 0.55;
  transition: opacity 0.3s ease;
  color: var(--muted);
}

.nav-point:hover .nav-label,
.nav-point:focus-visible .nav-label,
.nav-point.active .nav-label {
  opacity: 1;
}

/* Nonagon positions — 9 rooms around the ring */
.nav-point[data-page="gate"]        { top: 0;     left: 50%;  transform: translateX(-50%); }
.nav-point[data-page="garden"]      { top: 5%;    right: 2%;  }
.nav-point[data-page="library"]     { top: 32%;   right: 0;   }
.nav-point[data-page="clock"]       { top: 62%;   right: 0;   }
.nav-point[data-page="path"]        { bottom: 0;  right: 15%; }
.nav-point[data-page="observatory"] { bottom: 0;  left: 15%;  }
.nav-point[data-page="theatre"]     { top: 62%;   left: 0;    }
.nav-point[data-page="workshop"]    { top: 32%;   left: 0;    }
.nav-point[data-page="mirror"]      { top: 5%;    left: 2%;   }

/* Lines connecting stars (subtle) */
.constellation-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.constellation-lines line {
  stroke: rgba(155, 89, 182, 0.22);
  stroke-width: 1;
  transition: stroke 0.4s ease;
}

.constellation-lines line.bright {
  stroke: rgba(155, 89, 182, 0.45);
}

/* Active page nav point breathes */
.nav-point.active .nav-kanji {
  animation: breathe 4s ease-in-out infinite;
}

/* Mobile hamburger (three dots in triangle) — 44px hit area, dots centered */
.nav-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 101;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
}

.nav-toggle .dot {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(232, 218, 240, 0.7);
  border-radius: 50%;
  transition: background 0.3s ease;
}

/* Triangle arrangement, centered in the 44px box */
.nav-toggle .dot:nth-child(1) { top: 12px;  left: 50%; transform: translateX(-50%); }
.nav-toggle .dot:nth-child(2) { bottom: 12px; left: 13px; }
.nav-toggle .dot:nth-child(3) { bottom: 12px; right: 13px; }

.nav-toggle:hover .dot {
  background: var(--accent);
}

/* Mobile overlay */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99;
  background: rgba(26, 10, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.nav-overlay.open {
  opacity: 1;
}

@media (max-width: 1119px) {
  .nav-toggle {
    display: grid;
  }

  .constellation-nav {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    right: auto;
    width: 240px;
    height: 260px;
    display: none;
    opacity: 0;
  }

  .constellation-nav.mobile-open {
    display: block;
    opacity: 1;
  }

  .nav-point {
    font-size: 28px;
  }

  .nav-label {
    opacity: 1;
    font-size: 0.8rem;
  }

  .constellation-lines {
    display: none;
  }
}
