/* A small control on each Mermaid diagram opens the source in a native dialog
   at page width, so the diagram can be read without leaving the page. */
.mermaid-zoom-wrapper {
  position: relative;
}

.mermaid-zoom-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.35rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color--light);
  cursor: pointer;
  opacity: 0.6;
  transition:
    opacity 125ms,
    color 125ms,
    border-color 125ms;
}

.mermaid-zoom-button:hover,
.mermaid-zoom-button:focus-visible {
  opacity: 1;
  color: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
}

.mermaid-zoom-button svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mermaid-zoom-dialog {
  width: min(96vw, 100rem);
  max-width: 96vw;
  height: 90vh;
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.5rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 35%);
}

.mermaid-zoom-dialog::backdrop {
  background: rgb(0 0 0 / 60%);
  backdrop-filter: blur(2px);
}

.mermaid-zoom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 2.75rem;
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  font-size: 0.8rem;
  font-weight: 600;
}

.mermaid-zoom-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.35rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color--light);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.mermaid-zoom-close:hover,
.mermaid-zoom-close:focus-visible {
  color: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
}

.mermaid-zoom-body {
  height: calc(100% - 2.75rem);
  padding: 1rem;
  overflow: auto;
  background: var(--md-default-bg-color);
  display: flex;
  align-items: center;
  align-items: safe center;
  justify-content: center;
  justify-content: safe center;
}

/* The diagram is sized in javascript so it fills the dialog without distortion
   and keeps its own width on a narrow screen, where the dialog is no larger
   than the card the diagram came from. */
.mermaid-zoom-body svg {
  display: block;
  flex: none;
  max-width: none;
  max-height: none;
}

@media (max-width: 44rem) {
  .mermaid-zoom-body {
    justify-content: flex-start;
  }
}

@media print {
  .mermaid-zoom-button {
    display: none;
  }
}
