/* Editorial diagrams (diagram.engine) — Insights design tokens
 *
 * Hierarchy: HTML title (~18px) > circle labels > outer context.
 * SVG does not upscale past natural viewBox (see max-width on .machbar-diagram).
 */

.machbar-diagram-figure {
  margin: 1.5rem auto 0;
  padding: 0;
  width: 100%;
  max-width: min(100%, 52rem); /* same band as Insights prose / Mermaid figure */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  border: 0;
  background: none;
  box-shadow: none;
}

.machbar-diagram-figure__title {
  margin: 0;
  width: 100%;
  font-family: Inter-Lokal, system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  color: #1a1a1a;
  text-align: center;
}

.machbar-diagram {
  display: block;
  width: 100%;
  max-width: 100%; /* tightened further via inline max-width = viewBox width */
  height: auto;
  margin-inline: auto;
  overflow: hidden;
}

.machbar-diagram__region {
  /* Venn only: transparency needed for overlaps */
  fill: var(--machbar-sl-light, #c7d530);
  fill-opacity: 0.55;
  stroke: none;
}

/* Quieter than figcaption title — graphic labels, not headlines */
.machbar-diagram__label {
  fill: #1a1a1a;
  font-family: Inter-Lokal, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

.machbar-diagram__label-sub {
  font-size: 12px;
  font-weight: 400;
  fill: #444;
}

.machbar-diagram__center {
  fill: var(--machbar-sl-ink, #407f72);
  font-family: Inter-Lokal, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

.machbar-diagram__outer {
  fill: #666;
  font-family: Inter-Lokal, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 400;
  pointer-events: none;
}

/* Non-overlap shapes: solid lime like Mermaid nodes */
.machbar-diagram__node {
  fill: var(--machbar-sl-light, #c7d530);
  fill-opacity: 1;
  stroke: none;
}

.machbar-diagram__node--ghost {
  fill-opacity: 1;
}

.machbar-diagram__bar {
  fill: var(--machbar-sl-light, #c7d530);
  fill-opacity: 1;
  stroke: none;
}

.machbar-diagram__edge {
  stroke: var(--machbar-sl-ink, #407f72);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.machbar-diagram__arrowhead {
  fill: var(--machbar-sl-ink, #407f72);
}

.machbar-diagram__ring {
  stroke: #c5c5c5;
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.machbar-diagram__axis {
  stroke: #bbb;
  stroke-width: 1;
}

.machbar-diagram--mobile {
  display: none;
}

@media (max-width: 767px) {
  .machbar-diagram--desktop {
    display: none;
  }
  .machbar-diagram--mobile {
    display: block;
  }
}

.machbar-diagram-outer-mobile {
  display: none;
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  width: 100%;
  max-width: 22rem;
  font-family: Inter-Lokal, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #666;
}

.machbar-diagram-outer-mobile li {
  margin: 0.2rem 0;
}

.machbar-diagram-outer-mobile__slot {
  display: inline-block;
  min-width: 3.5rem;
  margin-right: 0.35rem;
  font-weight: 600;
  color: #333;
  text-transform: capitalize;
}

.machbar-diagram-caption {
  margin: 0;
  width: 100%;
  font-family: Inter-Lokal, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: #666;
  text-align: center;
}

.machbar-diagram-source {
  margin: 0;
  width: 100%;
  font-family: Inter-Lokal, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: #888;
  text-align: center;
}

.machbar-diagram-fallback {
  margin: 0;
  padding: 0.75rem 0;
  width: 100%;
  max-width: 36rem;
  font-family: Inter-Lokal, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: #333;
}

.machbar-diagram-fallback__title {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.machbar-diagram-fallback__err {
  margin: 0.5rem 0 0;
  font-size: 13px;
  color: #888;
}

.machbar-sl-page .machbar-diagram-figure {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-pageparagraph .machbar-diagram-figure {
  margin-top: 1.35rem;
  margin-bottom: 1.35rem;
}

@media (max-width: 767px) {
  .machbar-diagram-figure {
    gap: 0.35rem;
  }

  .machbar-diagram-outer-mobile {
    display: none;
  }

  .machbar-diagram__label {
    font-size: 12px;
  }

  .machbar-diagram__label-sub {
    font-size: 11px;
  }

  .machbar-diagram__center {
    font-size: 12px;
  }

  .machbar-diagram__outer {
    font-size: 11px;
  }
}
