/* Figures and diagram captions */
figure {
  margin: 2rem 0;
  text-align: center;
}

figure svg {
  max-width: 100%;
  height: auto;
}

/* On narrow screens, shrinking a detailed diagram to fit makes its labels
   unreadable. Scroll it at a legible size instead. */
@media (max-width: 700px) {
  figure {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  figure svg {
    min-width: 620px;
    max-width: none;
  }
}

/* Printing: diagrams must fit the page, and scroll containers must not clip. */
@media print {
  figure,
  .content table {
    overflow: visible !important;
    width: auto !important;
    display: table;
    break-inside: avoid;
  }

  figure svg {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  figure {
    display: block;
  }
}

figcaption {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  line-height: 1.5;
  opacity: 0.72;
  font-style: italic;
  text-align: center;
}

/* "Where this connects" footers */
h2#where-this-connects {
  font-size: 1.1rem;
  opacity: 0.85;
}

h2#where-this-connects + ul {
  font-size: 0.925rem;
}

/* Wide reference tables should scroll rather than overflow the page */
.content table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  width: max-content;
  margin: 1.2rem 0;
}

/* Keep long code samples from forcing horizontal page scroll */
.content pre > code {
  overflow-x: auto;
}
