.knowledge-graph {
  position: relative;
  overflow: auto;
  isolation: isolate;
}

.knowledge-graph-completion { max-height: 70vh; }
.knowledge-graph-completion .knowledge-graph-canvas { margin-inline: auto; }

.knowledge-graph-canvas { position: relative; }
.knowledge-graph-canvas > svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.knowledge-graph-card {
  box-sizing: border-box;
  position: absolute;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: start;
  gap: 6px 10px;
  width: 240px;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  color: #0f172a;
  font: 400 16px/1.5 system-ui, sans-serif;
  text-align: left;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: default;
}

.knowledge-graph-card:where(
  :not(.knowledge-graph-student-card),
  :has(.knowledge-graph-actions:not([hidden]) :is(button:enabled, a[href]))
):hover { border-color: #4c6fff; }
.knowledge-graph-card:focus-visible,
.knowledge-graph-link:focus-visible {
  outline: 3px solid #4c6fff;
  outline-offset: 3px;
}

.knowledge-graph-dot {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border: 1px solid #64748b;
  border-radius: 50%;
}

.knowledge-graph-rating {
  grid-column: 2;
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

.knowledge-graph-actions {
  grid-column: 2;
  display: flex;
  gap: 16px;
}

.knowledge-graph-actions[hidden] { display: none; }

.knowledge-graph-student-card .knowledge-graph-actions {
  align-items: baseline;
  gap: 16px;
}

.knowledge-graph-link {
  cursor: pointer;
  white-space: nowrap;
  color: #4338ca;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.knowledge-graph-target-action {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.knowledge-graph-target-action:disabled {
  color: #64748b;
  text-decoration: none;
  cursor: default;
}

.knowledge-graph-card[aria-busy="true"] {
  opacity: 0.75;
  cursor: progress;
}
.knowledge-graph-card[aria-busy="true"] .knowledge-graph-target-action {
  cursor: progress;
}
.knowledge-graph-card[aria-busy="true"]::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid #c7d2fe;
  border-top-color: #4338ca;
  border-radius: 50%;
  animation: knowledge-graph-loading 0.8s linear infinite;
}
@keyframes knowledge-graph-loading {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .knowledge-graph-card[aria-busy="true"]::after { animation: none; }
}

.knowledge-graph-measurement {
  position: absolute;
  top: 0;
  left: 0;
  width: 240px;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.knowledge-graph-measurement .knowledge-graph-card { position: relative; }

.knowledge-graph-status {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 1;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 8px 12px;
  background: #f8fafc;
  color: #0f172a;
}
.knowledge-graph-status:empty { display: none; }

/* Flaticon Uicons 3.3.1, regular rounded. See vendor/flaticon/LICENSE. */
@font-face {
  font-family: "uicons-regular-rounded";
  src: url("/assets/fonts/uicons-regular-rounded-3.3.1-75ecfd3a.woff2") format("woff2");
  font-display: block;
}

.knowledge-graph-student-card {
  grid-template-columns: 18px minmax(min-content, 1fr);
  min-width: min-content;
}
.knowledge-graph-student-card[data-prerequisites-incomplete="true"] {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}
.knowledge-graph-student-card[data-prerequisites-incomplete="true"] .knowledge-graph-icon:not(.fi-rr-target) {
  color: #64748b;
}
.knowledge-graph-student-card[data-target-path="true"] {
  border-color: #a5b4fc;
  background: #f5f7ff;
}
.knowledge-graph-student-card[aria-current="true"] {
  border-color: #4338ca;
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px #4338ca;
}
.knowledge-graph-prerequisites {
  grid-column: 2;
  margin: 0;
  font-size: 14px;
  font-style: italic;
  line-height: 20px;
}
.knowledge-graph-icon {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  color: #4338ca;
}
.knowledge-graph-icon::before {
  font-family: "uicons-regular-rounded";
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
}
.knowledge-graph-icon.fi-rr-target,
.knowledge-graph-icon.fi-rr-target::before {
  color: #4338ca;
}
.fi-rr-target::before { content: "\fd5f"; }
.fi-rr-square::before { content: "\fcd4"; }
.fi-rr-checkbox::before { content: "\f3c9"; }
