/* ==========================================================================
   PROJECT CONSTELLATION — night-sky PCB over the bench
   The viewport stays a CRT even with shop lights on, matching the hero scope.
   ========================================================================== */

.constellation-hero {
  padding: 0 0 4px;
}
.constellation-hero .hero__badge { margin-bottom: 14px; }
.constellation-hero .hero__title { margin-bottom: 12px; }
.constellation-hero .hero__sub { max-width: 46rem; font-size: clamp(1rem, 1.8vw, 1.18rem); }

.constellation {
  display: grid;
  gap: 18px;
  margin: 8px 0 12px;
}

.constellation__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.constellation__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.constellation__tools {
  display: flex;
  gap: 8px;
}

.constellation__tool {
  min-width: 44px;
  justify-content: center;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.constellation__instrument {
  padding: 0;
  overflow: hidden;
  background: #07090d;
  border-color: rgba(243, 234, 216, 0.16);
}

[data-theme="light"] .constellation__instrument {
  border-width: 3px;
  border-color: var(--ink);
}

.constellation__chrome,
.constellation__readouts {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243, 234, 216, 0.55);
  background: #0a0c10;
}

.constellation__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--laser);
  letter-spacing: 0.14em;
}

.constellation__readouts {
  color: var(--laser);
  letter-spacing: 0.12em;
}

.constellation__readouts em {
  font-style: normal;
  color: #f3ead8;
  margin-left: 6px;
}

.constellation__stage {
  position: relative;
  height: min(64vh, 620px);
  min-height: 380px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background:
    radial-gradient(ellipse at 50% 40%, #0c1a16 0%, #07090d 62%, #050608 100%);
}

.constellation__stage:active { cursor: grabbing; }

.constellation__stage:focus-visible {
  outline: 2px solid var(--laser);
  outline-offset: -2px;
}

.constellation__canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.constellation__world {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-origin: 0 0;
  z-index: 2;
}

.cnode {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
  transform: translate(calc(var(--x) * 1px), calc(var(--y) * 1px)) translate(-50%, -50%) scale(calc(1 / var(--cam-scale, 1)));
  transform-origin: center center;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: #f3ead8;
  z-index: 2;
}

.cnode.is-dim { opacity: 0.28; z-index: 1; }
.cnode.is-hot { z-index: 4; }

.cnode__pad {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6ea, var(--node, var(--laser)) 46%, #1a120c 72%);
  box-shadow:
    0 0 0 2px #c47a3a,
    0 0 0 4px #2a1a10,
    0 0 16px color-mix(in srgb, var(--node, var(--laser)) 80%, transparent);
  transition: transform 0.25s var(--snap), box-shadow 0.25s var(--smooth);
}

.cnode:hover .cnode__pad,
.cnode:focus-visible .cnode__pad,
.cnode.is-hot .cnode__pad {
  transform: scale(1.28);
  box-shadow:
    0 0 0 2px var(--node, var(--laser)),
    0 0 0 5px #2a1a10,
    0 0 28px var(--node, var(--laser));
}

.cnode__label {
  position: absolute;
  top: calc(100% - 2px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 8px #050608, 0 0 12px #050608;
  pointer-events: none;
}

.constellation__hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(7, 9, 13, 0.72);
  border: 1px solid rgba(61, 255, 197, 0.2);
  color: rgba(243, 234, 216, 0.7);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.constellation__hud {
  padding: 22px 22px 20px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.constellation__hud.is-idle .btn { display: none; }

.constellation__hud-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--laser);
}

.constellation__hud-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  line-height: 1.1;
}

.constellation__hud-summary {
  margin: 0;
  color: var(--muted);
}

.constellation__hud-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.constellation__hud-tags .chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}

.constellation__hud .btn { justify-self: start; margin-top: 6px; }

.constellation__caption {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted2);
}

.constellation__caption kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.constellation-index { margin-top: 72px; }

.constellation-index__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.constellation-index__link {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 18px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: var(--border-w) solid var(--border);
  background: var(--paper);
  transition: transform 0.2s var(--snap), box-shadow 0.2s var(--snap);
}

.constellation-index__link:hover,
.constellation-index__link:focus-visible,
.constellation-index__link.is-hot {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hard-sm);
  border-color: var(--laser);
}

.constellation-index__name {
  font-family: var(--font-display);
  font-weight: 700;
}

.constellation-index__meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.constellation__noscript {
  color: var(--muted);
  font-family: var(--font-mono);
}

@media (min-width: 960px) {
  .constellation {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    grid-template-areas:
      "toolbar toolbar"
      "instrument hud"
      "caption caption";
    align-items: start;
  }
  .constellation__toolbar { grid-area: toolbar; }
  .constellation__instrument { grid-area: instrument; }
  .constellation__hud { grid-area: hud; min-height: 220px; position: sticky; top: 108px; }
  .constellation__caption { grid-area: caption; }
  .constellation__hud.is-idle { opacity: 0.55; }
  .constellation__hud.is-idle .constellation__hud-title { font-size: 1.2rem; }
}

@media (max-width: 959px) {
  .constellation-hero .hero__badge { margin-bottom: 10px; }
  .constellation-hero .hero__title { margin-bottom: 8px; }
  .constellation-hero .hero__sub { display: none; }
  .constellation__stage {
    height: min(58vh, 520px);
    min-height: 380px;
  }
  .constellation__hint { display: none; }
  .cnode { width: 48px; height: 48px; }
  .cnode__pad { width: 18px; height: 18px; }
  .constellation__hud.is-idle { display: none; }
  .constellation__toolbar { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .cnode,
  .cnode__pad,
  .constellation-index__link {
    transition: none;
  }
}
