/* コードブロックのコピーボタンと同じ位置と色にする。 */
.md-typeset .mermaid-frame {
  position: relative;
  margin: 1em 0;
}

.md-typeset .mermaid-frame > .mermaid {
  margin: 0;
  overflow: auto;
  max-height: min(80vh, 48rem);
}

.md-typeset .mermaid-zoom-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 0;
  border-radius: 0.1rem;
  background: color-mix(in srgb, var(--md-default-bg-color) 82%, transparent);
  color: var(--md-default-fg-color--lightest);
  cursor: zoom-in;
}

.md-typeset .mermaid-frame:hover .mermaid-zoom-btn,
.md-typeset .mermaid-zoom-btn:focus-visible {
  color: var(--md-default-fg-color--light);
}

.md-typeset .mermaid-zoom-btn:hover {
  color: var(--md-accent-fg-color);
}

.md-typeset .mermaid-zoom-btn svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

html.mermaid-lightbox-open {
  overflow: hidden;
}

.mermaid-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: color-mix(in srgb, var(--md-default-bg-color) 94%, transparent);
}

.mermaid-lightbox__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  padding: 0;
  border: 0;
  border-radius: 0.1rem;
  background: transparent;
  color: var(--md-default-fg-color--light);
  cursor: pointer;
}

.mermaid-lightbox__close:hover {
  color: var(--md-accent-fg-color);
}

.mermaid-lightbox__close svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.mermaid-lightbox__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
}

.mermaid-lightbox__stage.is-dragging {
  cursor: grabbing;
}

.mermaid-lightbox__stage .mermaid {
  display: inline-block;
}
