/* Affordance on zoomable Mermaid diagrams */
.mermaid-zoomable {
  cursor: zoom-in;
  position: relative;
}

.mermaid-zoom-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  color: var(--bs-secondary-color, #6c757d);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 2;
}

.mermaid-zoomable:hover .mermaid-zoom-hint,
.mermaid-zoomable:focus-visible .mermaid-zoom-hint {
  opacity: 1;
}

.mermaid-zoomable:focus-visible {
  outline: 2px solid var(--bs-primary, #447099);
  outline-offset: 2px;
}

/* Full-screen overlay */
.mermaid-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  background: rgba(0, 0, 0, 0.8);
  overflow: hidden;
  touch-action: none;
}

.mermaid-zoom-overlay.is-open {
  display: block;
}

/* svg-pan-zoom drives panning/zooming directly on the SVG inside the stage */
.mermaid-zoom-stage {
  position: absolute;
  inset: 24px;
  background: var(--bs-body-bg, #fff);
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.mermaid-zoom-stage svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.mermaid-zoom-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #212529;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
}

.mermaid-zoom-close:hover {
  background: #fff;
}

.mermaid-zoom-help {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 0.8rem;
  pointer-events: none;
}
