/* Enlarged drawing sheet: keep the original geometry and confine its scroll. */
.diagram-open {
  display: block;
  max-width: 100%;
  margin-top: .75rem;
  padding: .625rem .75rem;
  border: 1px solid #4e4e4d;
  background: #fdfdfc;
  color: #181818;
  font: 11px/1.5 "IBM Plex Mono", monospace;
  letter-spacing: .12em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}
.diagram-open:hover, .diagram-close:hover { background: #e3e3e2; }
.diagram-open:focus-visible, .diagram-close:focus-visible, .diagram-scroll:focus-visible {
  outline: 2px solid #181818;
  outline-offset: 3px;
}
.diagram-scroll:focus-visible { outline-offset: -3px; }
.diagram-text {
  margin-top: .75rem;
  border-top: 1px dashed #b2b2b1;
}
.diagram-text summary {
  padding: .625rem 0;
  color: #181818;
  font: 11px/1.5 "IBM Plex Mono", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}
.diagram-text summary:focus-visible {
  outline: 2px solid #181818;
  outline-offset: 3px;
}
.diagram-text p {
  margin: 0;
  padding-bottom: .75rem;
  color: #515150;
  font: 14px/1.6 "Inter", sans-serif;
  text-align: justify;
  hyphens: auto;
}
.diagram-viewer {
  box-sizing: border-box;
  width: min(72rem, calc(100% - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid #4e4e4d;
  background: #fdfdfc;
  color: #181818;
  overflow: auto;
  overscroll-behavior: contain;
}
.diagram-viewer::backdrop { background: rgb(24 24 24 / .72); }
.diagram-viewer-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid #b2b2b1;
  background: #fdfdfc;
}
.diagram-viewer-title {
  min-width: 0;
  margin: 0;
  font: 700 1.125rem/1.4 "Space Grotesk", sans-serif;
  text-align: left;
}
.diagram-close {
  flex-shrink: 0;
  min-height: 44px;
  padding: .5rem .75rem;
  border: 1px solid #4e4e4d;
  background: #fdfdfc;
  color: #181818;
  font: 11px/1.5 "IBM Plex Mono", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}
.diagram-instruction, .diagram-description {
  margin: 0;
  padding: .75rem 1rem;
  font: 14px/1.6 "Inter", sans-serif;
  color: #515150;
  text-align: left;
}
.diagram-description {
  text-align: justify;
  hyphens: auto;
}
.diagram-scroll {
  max-width: 100%;
  max-height: 60dvh;
  padding: 1rem;
  overflow: auto;
  overscroll-behavior: contain;
  border-block: 1px solid #b2b2b1;
  touch-action: pan-x pan-y pinch-zoom;
}
.diagram-scroll svg {
  display: block;
  max-width: none;
  height: auto;
  color: #181818;
}
@media print {
  .diagram-open, .diagram-viewer { display: none; }
}
