/* Keep diagrams readable */
.mermaid {
  max-width: 100%;
  overflow-x: auto;
}

/* Horizontal quick navigation (page-level) */
.quicknav {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 6px 2px 14px;
  margin: 0 0 18px;
  -webkit-overflow-scrolling: touch;
}

.quicknav__link {
  white-space: nowrap;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(128, 128, 128, 0.28);
  background: rgba(128, 128, 128, 0.06);
}

.quicknav__link:hover {
  background: rgba(128, 128, 128, 0.12);
}

img.glightbox {
  cursor: zoom-in;
}

body.local-lightbox-open {
  overflow: hidden;
}

#local-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.local-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.local-lightbox__content {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.local-lightbox__img {
  max-width: min(1200px, 92vw);
  max-height: 86vh;
  width: auto;
  height: auto;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.local-lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
}

/* Mermaid diagram modals */
.diagram-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(128, 128, 128, 0.28);
  background: rgba(128, 128, 128, 0.06);
}

.diagram-open:hover {
  background: rgba(128, 128, 128, 0.12);
}

dialog.diagram-modal {
  width: min(1100px, 94vw);
  max-height: 86vh;
  border: 1px solid rgba(128, 128, 128, 0.28);
  border-radius: 14px;
  padding: 0;
}

dialog.diagram-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.diagram-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.22);
}

.diagram-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.diagram-modal__close {
  border: 1px solid rgba(128, 128, 128, 0.28);
  background: rgba(128, 128, 128, 0.06);
  padding: 8px 10px;
  border-radius: 10px;
}

.diagram-modal__body {
  padding: 14px;
  overflow: auto;
}

.diagram-modal__body .mermaid {
  overflow: visible;
}
