/* Credits: a passive-tree constellation (UberExile keystone, four clusters) + tooltip of the
   selected credit. Narrow screens and no-JS get the tooltips as a plain list. */
.constellation {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  padding-bottom: 5rem;
}

.tree {
  position: relative;
  aspect-ratio: 1000 / 740;
  margin: 1rem 3rem 2.5rem;
  background: radial-gradient(closest-side, #c8a45a12, transparent);
}

.tree svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tree line {
  stroke: #3d3328;
  stroke-width: 2.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke 250ms;
}

.tree line.is-lit {
  stroke: var(--accent);
  filter: drop-shadow(0 0 4px #e2bf70aa);
}

.tree [data-node] {
  position: absolute;
  left: calc(var(--x) * 0.1%);
  top: calc(var(--y) / 7.4 * 1%);
  translate: -50% -50%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
}

.dot {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid #6b5a43;
  background: radial-gradient(circle at 40% 35%, #3a2e21, #120f0c 75%);
  box-shadow: inset 0 0 6px #000;
  transition:
    border-color 200ms,
    box-shadow 200ms,
    scale 200ms var(--ease-out);
}

.label {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  padding: 0 0.3rem;
  border-radius: 3px;
  background: var(--bg);
  font-size: 0.8rem;
  transition: color 200ms;
}

.hub .dot {
  width: 1.1rem;
  height: 1.1rem;
}

.hub .label {
  font: italic 0.95rem var(--serif);
  color: var(--unique);
}

.keystone .dot {
  display: grid;
  place-items: center;
  width: 5rem;
  height: 5rem;
  border: 3px double var(--accent);
  box-shadow:
    0 0 0 6px #0f0d0b,
    0 0 0 7px #5a3a20,
    0 0 40px #c8a45a55;
}

.keystone img {
  width: 2.6rem;
  height: 2.6rem;
}

.keystone .label {
  font: 600 1.05rem var(--serif);
  color: var(--text);
}

button[data-node] {
  cursor: pointer;
}

button[data-node]:hover .dot {
  scale: 1.15;
  border-color: var(--accent);
}

[data-node]:not(.keystone).is-lit .dot {
  border-color: var(--accent-strong);
  box-shadow:
    0 0 0 4px #c8a45a26,
    0 0 18px #e2bf7080,
    inset 0 0 6px #000;
}

[data-node].is-lit .label {
  color: var(--text);
}

button[data-node][aria-selected="true"]:not(.keystone) .dot {
  background: radial-gradient(circle at 40% 35%, #f0d08a, #b8863a 70%);
  animation: allocated 2.4s ease-in-out infinite;
}

@keyframes allocated {
  50% {
    box-shadow:
      0 0 0 7px #c8a45a14,
      0 0 26px #e2bf70aa,
      inset 0 0 6px #0000;
  }
}

/* Load: lines grow outward from the keystone, nodes light up ring by ring. */
.js .tree line {
  stroke-dashoffset: 1;
  transition:
    stroke-dashoffset 600ms var(--ease-out) calc(var(--d) * 320ms - 200ms),
    stroke 250ms;
}

.js .tree.is-in line {
  stroke-dashoffset: 0;
}

.js .tree [data-node] {
  opacity: 0;
  scale: 0.6;
  transition:
    opacity 400ms var(--ease-out) calc(var(--d) * 320ms + 150ms),
    scale 400ms var(--ease-out) calc(var(--d) * 320ms + 150ms);
}

.js .tree.is-in [data-node] {
  opacity: 1;
  scale: 1;
}

.credit-panels .tip-body a {
  font-size: 0.9rem;
}

@media (max-width: 56rem) {
  .constellation {
    grid-template-columns: 1fr;
  }

  .tree {
    display: none;
  }

  .js .credit-panels > * {
    grid-area: auto;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .credit-panels {
    gap: 1.5rem;
  }
}

html:not(.js) .tree {
  display: none;
}

html:not(.js) .constellation {
  grid-template-columns: 1fr;
}

html:not(.js) .credit-panels {
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
  button[data-node][aria-selected="true"]:not(.keystone) .dot {
    animation: none;
  }

  .js .tree line,
  .js .tree [data-node] {
    opacity: 1;
    scale: 1;
    stroke-dashoffset: 0;
    transition: none;
  }
}
