/* ============================================================
   Constellation navigation - positioned by (time, category)
   ============================================================ */

.constellation {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: 760px;
  min-height: 560px;
  overflow: visible;
}

.constellation__stage {
  position: absolute;
  inset: 16px;
}

/* Axis ticks - time (x) and category (y) */
.axis-x, .axis-y {
  position: absolute;
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}
.axis-x {
  bottom: 16px;
  left: 32px; right: 32px;
  display: flex; justify-content: space-between;
}
.axis-x span { position: relative; }
.axis-x span::before {
  content: ""; position: absolute;
  top: -8px; left: 50%; width: 1px; height: 4px;
  background: var(--line-strong);
}

.axis-y {
  top: 48px; bottom: 48px;
  left: 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: flex-start;
}

.axis-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.axis-label--x { bottom: 16px; left: 50%; transform: translateX(-50%); color: var(--ink-3); }
.axis-label--y {
  top: 50%; left: 8px;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: left top;
  white-space: nowrap;
}

/* grid background */
.constellation__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
}

/* Connecting lines between related projects (SVG) */
.constellation__links {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.constellation__links line,
.constellation__links path {
  stroke: var(--line-strong);
  stroke-width: 1;
  fill: none;
  opacity: 0.55;
  transition: opacity var(--dur-med) var(--ease-out), stroke var(--dur-fast);
}

/* Nodes */
.node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
  gap: var(--s-1);
  cursor: pointer;
  z-index: 2;
  text-decoration: none;
  color: var(--ink);
}

.node__dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ink-3);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px transparent;
  transition: transform var(--dur-med) var(--ease-out),
              box-shadow var(--dur-fast),
              background var(--dur-fast);
  position: relative;
}
.node__dot::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, currentColor 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-med);
  pointer-events: none;
}
.node--s .node__dot { width: 8px; height: 8px; }
.node--m .node__dot { width: 12px; height: 12px; }
.node--l .node__dot { width: 16px; height: 16px; }
.node--xl .node__dot { width: 22px; height: 22px; }

.node--research .node__dot { background: var(--cat-research); color: var(--cat-research); }
.node--quant    .node__dot { background: var(--cat-quant);    color: var(--cat-quant); }
.node--ml       .node__dot { background: var(--cat-ml);       color: var(--cat-ml); }
.node--web      .node__dot { background: var(--cat-web);      color: var(--cat-web); }
.node--data     .node__dot { background: var(--cat-data);     color: var(--cat-data); }
.node--hardware .node__dot { background: var(--cat-hardware); color: var(--cat-hardware); }

/* Academic badge inside the hover tooltip */
.node__card-badge {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  background: var(--accent-wash);
  padding: 1px 5px;
  border-radius: var(--r-full);
  vertical-align: 2px;
}

.node__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color var(--dur-fast);
  padding: 2px 4px;
  border-radius: var(--r-1);
}

.node:hover { z-index: 10; }
.node:hover .node__dot {
  transform: scale(1.6);
  box-shadow: 0 0 0 2px var(--bg), 0 0 16px 2px currentColor;
}
.node:hover .node__dot::after { opacity: 0.5; }
.node:hover .node__label {
  color: var(--ink);
  background: var(--bg-2);
}

/* Card tooltip that appears on hover */
.node__card {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: 260px;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  padding: var(--s-3) var(--s-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  z-index: 20;
  box-shadow: var(--shadow-2);
}
.node__card::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: var(--bg-2);
  border-left: 1px solid var(--line-strong);
  border-top: 1px solid var(--line-strong);
}
.node:hover .node__card {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.node__card h4 {
  margin: 0 0 4px 0;
  font-size: var(--t-16);
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--ink);
}
.node__card p {
  margin: 0;
  font-size: var(--t-12);
  color: var(--ink-3);
  line-height: 1.5;
}
.node__card .meta { margin-top: 8px; font-size: 10px; }

/* Legend */
.constellation__legend {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--s-3);
  background: color-mix(in srgb, var(--bg-1) 85%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  z-index: 15;
}
.constellation__legend .swatch {
  display: inline-flex; align-items: center; gap: 6px;
}
.constellation__legend .swatch::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.lg-research { color: var(--cat-research); }
.lg-quant    { color: var(--cat-quant); }
.lg-ml       { color: var(--cat-ml); }
.lg-web      { color: var(--cat-web); }
.lg-data     { color: var(--cat-data); }
.lg-hardware { color: var(--cat-hardware); }

/* ============================================================
   Hero variant — bio at centre, projects orbiting around
   ============================================================ */

.hero-network {
  padding: var(--s-6) 0 var(--s-8);
  position: relative;
}

/* Make the constellation shape more square when used as hero,
   so orbiting nodes have room on all sides of the centred bio */
.constellation--hero {
  aspect-ratio: 1 / 1;
  max-height: min(860px, 88vh);
  min-height: 620px;
}
@media (min-width: 1100px) {
  .constellation--hero {
    aspect-ratio: 5 / 4;
    max-height: 820px;
  }
}

/* Centred bio block sits above the orbit, but does not eat hover events
   on the surrounding node field (the inner text/buttons still accept clicks). */
.constellation__center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, 68%);
  text-align: center;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
}
.constellation__center > * { pointer-events: auto; }

.constellation__center .eyebrow {
  margin: 0;
}

.constellation__center .display {
  font-size: clamp(var(--t-32), 4.2vw, var(--t-56));
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 300;
}
.constellation__center .display .dot { color: var(--accent); }

.constellation__center .lede {
  font-family: var(--font-serif);
  font-size: clamp(var(--t-14), 1.25vw, var(--t-18));
  font-weight: 300;
  color: var(--ink-2);
  line-height: 1.45;
  margin: 0;
  max-width: 460px;
}
.constellation__center .lede em {
  font-style: italic;
  color: var(--accent);
}

.constellation__center .row {
  justify-content: center;
  margin-top: var(--s-2);
}

/* Bottom-centred horizontal legend (hero variant only) */
.constellation__legend--bottom {
  top: auto;
  right: auto;
  bottom: var(--s-2);
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-2) var(--s-4);
}

/* Mobile fallback: hide orbiting stage/links/legend but keep the hero bio
   visible, and show the flat list under it. */
.constellation-list {
  display: none;
}
@media (max-width: 760px) {
  .constellation__stage,
  .constellation__links,
  .constellation__legend {
    display: none;
  }
  .constellation {
    aspect-ratio: auto;
    min-height: 0;
    max-height: none;
  }
  .constellation--hero {
    aspect-ratio: auto;
    min-height: 0;
    max-height: none;
  }
  .hero-network { padding: var(--s-8) 0 var(--s-4); }
  .hero-network .constellation__center {
    position: static;
    transform: none;
    width: 100%;
    pointer-events: auto;
    margin: 0 auto var(--s-6);
  }
  .constellation-list {
    display: grid;
    gap: var(--s-3);
  }
  .constellation-list a.card {
    padding: var(--s-4);
  }
  .constellation-list .card h4 {
    margin: 0 0 6px;
    font-family: var(--font-serif);
    font-size: var(--t-20);
    font-weight: 400;
  }
  .constellation-list .card p {
    margin: 0;
    font-size: var(--t-14);
    color: var(--ink-3);
  }
}
