/* sphinxcontrib-mermaid defaults to a fixed 500px SVG height, which leaves a large
   empty block for small charts. Override to let SVG height fit its content. */

pre.mermaid > svg,
.mermaid-container > pre > svg {
  height: auto !important;
}

.mermaid-zoom-wrapper {
  position: relative;
  max-width: 100%;
}

.mermaid-zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.mermaid-zoom-controls button {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.mermaid-zoom-controls button:hover {
  background: #f8fafc;
}

.mermaid-zoom-container {
  max-width: 100%;
  max-height: 80vh;
  overflow: auto;
  cursor: grab;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px;
}

.mermaid-zoom-container.is-dragging {
  cursor: grabbing;
}

.mermaid-zoom-stage {
  transform-origin: 0 0;
  display: inline-block;
}
