/* partials/tutorial_graph.html and the data-cluster-graph block in lesson bodies —
   the unit path. Nodes use the audio control treatment (partials/lesson-audio.css);
   completed nodes are Sage with a check-mark glyph. */

.tutorial-graph {
  margin: 1.75rem 0 0;
}

.cluster-graph__canvas {
  position: relative;
  padding: 1.25rem 0.5rem 1.75rem;
}

.cluster-graph__edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.cluster-graph__edges path {
  fill: none;
  stroke: var(--color-rule);
  stroke-width: 1.75;
  stroke-linecap: round;
}

.cluster-graph__arrow {
  fill: var(--color-rule);
}

.cluster-graph__edges .cluster-graph__edge--sidequest {
  stroke: var(--color-text-muted);
  stroke-dasharray: 5 6;
  stroke-width: 1.5;
}

.cluster-graph__edge--from-sidequest {
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.cluster-graph__layers {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

.cluster-graph__layer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.15rem;
  min-width: 0;
}

.cluster-graph__side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
  align-items: stretch;
  gap: 0.85rem 1.15rem;
  width: 15rem;
  max-width: 15rem;
  min-width: 0;
}

.cluster-graph__core {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.85rem 1.15rem;
}

.cluster-graph__node {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: min(17.5rem, 100%);
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-text);
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--motion-fast);
}

.cluster-graph__node--start {
  box-shadow: 0 0 0 2px var(--color-text);
}

.cluster-graph__node:hover,
.cluster-graph__node:focus-visible {
  background: var(--color-surface-muted);
}

.cluster-graph__node.is-complete {
  background: var(--color-complete-background);
}

.cluster-graph__step {
  flex-shrink: 0;
  min-width: 1.35rem;
  color: var(--color-ink);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.cluster-graph__glyph {
  flex-shrink: 0;
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.4em;
  border-radius: 50%;
  background: var(--color-text);
}

.cluster-graph__node.is-complete .cluster-graph__glyph {
  width: 0.85rem;
  height: 0.85rem;
  margin-top: 0.3em;
  border-radius: 0;
  -webkit-mask: var(--image-check) center / contain no-repeat;
  mask: var(--image-check) center / contain no-repeat;
}

.cluster-graph__copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.cluster-graph__title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

@media (max-width: 640px) {
  .cluster-graph__canvas {
    padding: 0.75rem 0 1.25rem;
  }

  .cluster-graph__layers {
    gap: 2rem;
  }

  .cluster-graph__layer {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.85rem;
  }

  .cluster-graph__side {
    justify-content: center;
    justify-self: stretch;
    width: auto;
    max-width: none;
  }

  .cluster-graph__node {
    width: 100%;
  }
}
