/* ============================================================
   CONSTELLATION WEB
   ============================================================ */
.constellation-web { position: fixed; inset: 0; z-index: 9; pointer-events: none }
.constellation-web line {
  stroke: var(--constellation); stroke-width: .4;
  opacity: 0; transition: opacity 1.5s ease;
}
.constellation-web.visible line { opacity: .2 }
.constellation-web .web-cross { opacity: .08 }

/* ============================================================
   STAR NAVIGATION
   ============================================================ */
.star-nav { position: fixed; inset: 0; z-index: 15; pointer-events: none }

.star-hotspot {
  position: absolute; pointer-events: auto; cursor: pointer;
  width: 80px; height: 80px;
  transform: translate(-50%,-50%);
  display: flex; align-items: center; justify-content: center;
  outline: none; padding: 0; background: none; border: none;
}
body.panel-open .star-hotspot { pointer-events: none; }
.star-hotspot:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 10px; border-radius: 50%;
}

/* Visited star indicator */
.star-hotspot.visited .star-core {
  box-shadow:
    0 0 8px 3px rgba(196,169,106,.8),
    0 0 25px 6px rgba(196,169,106,.3),
    0 0 50px 12px rgba(196,169,106,.15);
}

/* Pulse rings */
.star-ring-outer {
  position: absolute; width: 50px; height: 50px; border-radius: 50%;
  border: 1.5px solid rgba(196,169,106,.15);
  animation: ringExpand 3s cubic-bezier(.4,0,.2,1) infinite;
}
.star-ring-inner {
  position: absolute; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(196,169,106,.2);
  animation: ringExpand 3s cubic-bezier(.4,0,.2,1) .8s infinite;
}
.star-ring-glow {
  position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle, rgba(196,169,106,.08) 0%, transparent 70%);
  animation: glowPulse 3s ease infinite;
}

/* Core */
.star-core {
  width: 8px; height: 8px;
  background: var(--star-bright); border-radius: 50%;
  position: relative; transition: all .5s var(--ease-expo);
  box-shadow:
    0 0 6px 2px rgba(240,234,212,.6),
    0 0 18px 4px rgba(240,234,212,.2),
    0 0 35px 8px rgba(196,169,106,.1);
  animation: coreBreath 2.5s ease infinite;
}

.star-hotspot:hover .star-core, .star-hotspot:focus-visible .star-core {
  width: 12px; height: 12px; background: #fff;
  box-shadow:
    0 0 12px 4px rgba(255,255,255,.9),
    0 0 35px 10px rgba(255,250,235,.35),
    0 0 70px 20px rgba(196,169,106,.2);
}

.star-hotspot:hover .star-ring-outer, .star-hotspot:focus-visible .star-ring-outer {
  border-color: rgba(196,169,106,.3);
}
.star-hotspot:hover .star-ring-inner, .star-hotspot:focus-visible .star-ring-inner {
  border-color: rgba(196,169,106,.35);
}

/* Label */
.star-label {
  position: absolute; bottom: -34px; left: 50%; transform: translateX(-50%);
  font-family: var(--sans); font-size: .7rem; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase;
  color: rgba(232,229,223,.45); white-space: nowrap;
  text-shadow: 0 0 12px rgba(7,7,11,.9), 0 1px 3px rgba(7,7,11,.8);
  opacity: 1; transition: all .5s var(--ease-expo); pointer-events: none;
}
.star-hotspot:hover .star-label, .star-hotspot:focus-visible .star-label {
  color: var(--text); transform: translateX(-50%) translateY(-3px);
}

/* Roman numeral */
.star-numeral {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  font-family: var(--serif); font-size: .75rem; font-weight: 400;
  color: var(--accent); opacity: .5; letter-spacing: .1em;
  transition: opacity .4s ease;
  text-shadow: 0 0 10px rgba(7,7,11,.9);
}
.star-hotspot:hover .star-numeral { opacity: .85 }

/* ============================================================
   CONSTELLATION OVERLAY
   ============================================================ */
.constellation-overlay {
  position: fixed; z-index: 14; pointer-events: none;
  opacity: 0; transition: opacity .8s ease;
}
.constellation-overlay.always-on { opacity: .35 }
.constellation-overlay.visible { opacity: 1 }
.constellation-overlay svg { overflow: visible }

.constellation-line {
  stroke: var(--constellation); stroke-width: .8; fill: none;
  stroke-dasharray: 0; stroke-dashoffset: 0;
  transition: stroke-width .5s ease, stroke .5s ease;
}
.constellation-overlay.visible .constellation-line {
  stroke-width: 1.2; stroke: rgba(196,169,106,.3);
}

.constellation-dot { fill: rgba(240,234,212,.25); transition: fill .4s ease }
.constellation-overlay.visible .constellation-dot { fill: rgba(240,234,212,.6) }

.constellation-info {
  position: absolute;
  font-family: var(--serif-it); font-style: italic;
  font-size: .7rem; color: var(--text-muted);
  line-height: 1.5; max-width: 200px; letter-spacing: .02em;
  opacity: 0; transition: opacity .5s ease .3s;
  background: rgba(7,7,11,.75); padding: .6rem .8rem;
  border-radius: 2px; border: 1px solid var(--border);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.constellation-overlay.visible .constellation-info { opacity: 1 }

/* ============================================================
   SUB-CONSTELLATION HUB (2-level navigation)
   ============================================================ */
.hub-view {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 100%;
  text-align: center; position: relative;
}
.hub-header { margin-bottom: clamp(1.5rem, 4vh, 2.4rem) }
/* --- Bounded Constellation Stage (hub-view--stage) --- */

.hub-view--stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding-top: clamp(4.2rem, 8vh, 6rem);
}

.hub-view--stage .hub-header {
  position: relative;
  width: min(92vw, 780px);
  text-align: center;
  margin: 0 auto clamp(1rem, 2.5vh, 1.6rem);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .26s ease-out, transform .26s ease-out;
  z-index: 4;
}
.hub-view--stage .hub-header .panel-subtitle {
  margin-bottom: 0;
}

.constellation-stage {
  position: relative;
  width: min(92vw, 680px);
  height: clamp(280px, 42vh, 420px);
  margin: 0 auto;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(.97);
  transition: opacity .26s ease-out .1s, transform .3s ease-out .1s;
}
.constellation-stage.is-visible {
  opacity: 1;
  transform: scale(1);
}

.cstage-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* --- Stage Stars --- */

.cstage-star {
  position: absolute;
  left: calc(var(--sx) * 1%);
  top: calc(var(--sy) * 1%);
  width: 92px;
  height: 92px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  padding: 0;
  pointer-events: auto;
  cursor: none;
  opacity: .72;
  transition: opacity .22s ease-out;
  touch-action: manipulation;
}

.cstage-glow {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  animation: none;
  background: radial-gradient(circle, rgba(196,169,106,.06) 0%, rgba(196,169,106,.02) 40%, transparent 70%);
  pointer-events: none;
  transition: opacity .22s ease-out, transform .22s ease-out, background .22s ease-out;
}

.cstage-core {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--star-bright, rgba(240,234,212,.92));
  box-shadow:
    0 0 6px 2px rgba(240,234,212,.4),
    0 0 16px 4px rgba(196,169,106,.1);
  transition: all .22s ease-out;
}

.cstage-numeral {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-size: .62rem;
  color: rgba(196,169,106,.72);
  letter-spacing: .12em;
  text-shadow: 0 0 10px rgba(7,7,11,.9);
}

.cstage-label {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: .6rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(232,229,223,.62);
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(7,7,11,.9);
  transition: color .2s ease-out, opacity .2s ease-out;
}

.cstage-label--hub {
  top: calc(100% + 8px);
  font-size: .56rem;
  letter-spacing: .17em;
}

/* Hub star: larger, brighter, non-clickable */
.cstage-star--hub {
  width: 114px;
  height: 114px;
  opacity: .92;
  pointer-events: none;
  cursor: default;
}
.cstage-star--hub .cstage-core {
  width: 10px;
  height: 10px;
  box-shadow:
    0 0 12px 4px rgba(240,234,212,.6),
    0 0 28px 8px rgba(196,169,106,.2);
}

/* Child star default */
.cstage-star--child {
  opacity: .65;
}

/* Stagger fade-in for child nodes */
.cstage-star--child:nth-child(2) { transition-delay: 60ms; }
.cstage-star--child:nth-child(3) { transition-delay: 120ms; }
.cstage-star--child:nth-child(4) { transition-delay: 180ms; }
.cstage-star--child:nth-child(5) { transition-delay: 240ms; }

/* Dim state */
.cstage-star.is-dim {
  opacity: .35;
}
.cstage-star.is-dim .cstage-core {
  box-shadow:
    0 0 4px 1px rgba(240,234,212,.2),
    0 0 10px 3px rgba(196,169,106,.05);
}

/* Hover / Focus / Active state */
.cstage-star:hover,
.cstage-star:focus-visible,
.cstage-star.is-active {
  opacity: 1;
}

.cstage-star:hover .cstage-glow,
.cstage-star:focus-visible .cstage-glow,
.cstage-star.is-active .cstage-glow {
  background: radial-gradient(circle, rgba(196,169,106,.12) 0%, rgba(196,169,106,.04) 45%, transparent 75%);
  transform: scale(1.3);
}

.cstage-star:hover .cstage-core,
.cstage-star:focus-visible .cstage-core,
.cstage-star.is-active .cstage-core {
  width: 9px;
  height: 9px;
  background: rgba(255,252,245,.97);
  box-shadow:
    0 0 10px 4px rgba(255,252,245,.6),
    0 0 28px 10px rgba(196,169,106,.22);
}

.cstage-star:hover .cstage-label,
.cstage-star:focus-visible .cstage-label,
.cstage-star.is-active .cstage-label {
  color: rgba(238,234,226,.95);
}

.cstage-star:focus-visible {
  outline: 2px solid rgba(196,169,106,.45);
  outline-offset: 4px;
  border-radius: 50%;
}

/* Touch devices: reset sticky hover */
@media (pointer: coarse) {
  .cstage-star:hover .cstage-core {
    width: 7px;
    height: 7px;
    background: var(--star-bright, rgba(240,234,212,.92));
    box-shadow:
      0 0 6px 2px rgba(240,234,212,.4),
      0 0 16px 4px rgba(196,169,106,.1);
  }
  .cstage-star:hover .cstage-glow {
    background: radial-gradient(circle, rgba(196,169,106,.06) 0%, rgba(196,169,106,.02) 40%, transparent 70%);
    transform: none;
  }
  .cstage-star.is-active:hover .cstage-core {
    width: 9px;
    height: 9px;
    background: rgba(255,252,245,.97);
    box-shadow:
      0 0 10px 4px rgba(255,252,245,.6),
      0 0 28px 10px rgba(196,169,106,.22);
  }
  .cstage-star.is-active:hover .cstage-glow {
    background: radial-gradient(circle, rgba(196,169,106,.12) 0%, rgba(196,169,106,.04) 45%, transparent 75%);
    transform: scale(1.3);
  }
}

/* Entry animation */
.hub-view--stage.is-settled .hub-header {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive: tablet */
@media (max-width: 980px) {
  .hub-view--stage .hub-header {
    width: min(92vw, 620px);
  }
  .constellation-stage {
    width: min(92vw, 560px);
    height: clamp(260px, 38vh, 380px);
  }
  .cstage-star {
    width: 88px;
    height: 88px;
  }
  .cstage-label {
    font-size: .56rem;
    letter-spacing: .11em;
  }
}

/* Responsive: mobile */
@media (max-width: 768px) {
  .hub-view--stage {
    padding-top: calc(env(safe-area-inset-top) + 3.4rem);
  }
  .hub-view--stage .hub-header {
    width: min(93vw, 460px);
  }
  .constellation-stage {
    width: min(94vw, 420px);
    height: clamp(240px, 38vh, 340px);
  }
  .cstage-star {
    width: 106px;
    height: 106px;
  }
  .cstage-star--hub {
    width: 122px;
    height: 122px;
  }
  .cstage-label {
    font-size: .52rem;
    letter-spacing: .1em;
    max-width: 132px;
    text-align: center;
    white-space: normal;
    line-height: 1.28;
  }
  .cstage-numeral {
    top: 15px;
    font-size: .6rem;
  }
}

/* Detail view */
.detail-view {
  opacity: 0; transform: translateY(30px);
  transition: all .8s var(--ease-expo);
  pointer-events: none;
  position: relative;
  width: min(100%, 760px);
  margin: 0 auto;
}
.detail-view.active { opacity: 1; transform: translateY(0); pointer-events: auto }

/* Back to hub button */
.detail-back {
  position: fixed; top: 1.5rem; left: 1.5rem; z-index: 36;
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--sans); font-size: .6rem; font-weight: 400;
  letter-spacing: .15em; text-transform: uppercase; color: var(--text-muted);
  background: rgba(7,7,11,.6); border: 1px solid var(--border);
  border-radius: 100px; padding: .5rem 1rem;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: all .3s ease; cursor: none;
  pointer-events: none; opacity: 0;
}
.detail-back.visible { pointer-events: auto; opacity: 1 }
.detail-back:hover {
  color: var(--text); border-color: var(--border-light);
  background: rgba(14,14,20,.8);
}
.detail-back svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.5 }

.hub-view.fading { opacity: 0; transform: scale(.96); transition: all .6s var(--ease-expo); pointer-events: none }

/* ============================================================
   CLICK RIPPLE
   ============================================================ */
.ripple {
  position: fixed; pointer-events: none; z-index: 50;
  width: 0; height: 0; border-radius: 50%;
  border: 1px solid rgba(196,169,106,.25);
  animation: ripple .9s var(--ease-expo) forwards;
}
