/* Custom tap/click tooltips for <abbr title="..."> elements, reusing MkDocs Material colors */

abbr[title] {
  position: relative;
  cursor: help;
}

/* Tooltip bubble, shown when data-abbr-open="true" */
abbr[title][data-abbr-open="true"]::after {
  content: attr(title);
  position: absolute;
  z-index: 20;
  left: 0;
  transform: none;
  bottom: calc(100% + 0.35rem);
  max-width: 95vw;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  background: #000;
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow-x: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

abbr[title][data-abbr-open="true"]::before {
  content: "";
  position: absolute;
  z-index: 21;
  left: 0.6rem;
  transform: none;
  bottom: 100%;
  border-width: 6px;
  border-style: solid;
  border-color: #000 transparent transparent transparent;
}

/* Match colors in dark scheme: light tooltip on dark background */
[data-md-color-scheme="slate"] abbr[title][data-abbr-open="true"]::after {
  background: #fff;
  color: #000;
}

[data-md-color-scheme="slate"] abbr[title][data-abbr-open="true"]::before {
  border-color: #fff transparent transparent transparent;
}

/* Ensure the tooltip stays within the viewport on very small screens */
@media (max-width: 480px) {
  abbr[title][data-abbr-open="true"]::after {
    left: 0;
    transform: none;
  }

  abbr[title][data-abbr-open="true"]::before {
    left: 1.2rem;
    transform: none;
  }
}

/* Mermaid light/dark SVG pair rendered by conversion script */
.uml-theme-image {
  display: block;
}

.uml-theme-image .uml-light,
.uml-theme-image .uml-dark {
  width: 100%;
  height: auto;
}

/* default (light) */
[data-md-color-scheme="default"] .uml-theme-image .uml-dark {
  display: none;
}

[data-md-color-scheme="default"] .uml-theme-image .uml-light {
  display: block;
}

/* slate (dark) */
[data-md-color-scheme="slate"] .uml-theme-image .uml-light {
  display: none;
}

[data-md-color-scheme="slate"] .uml-theme-image .uml-dark {
  display: block;
}

