/* Phone and tablet. The article grid keeps a text column whose minimum is 0,
   so the flexible side tracks take the width and the words wrap a few at a
   time. Below 860px the article is one column. Wide figures, code and tables
   scroll inside themselves. */

@media (max-width: 860px) {
  .masthead-inner {
    padding: 1.5rem 1.15rem 1.25rem;
  }
  .masthead-inner h1,
  .doc > h1 {
    font-size: clamp(1.65rem, 7.5vw, 2.35rem);
  }
  .doc {
    display: block;
    max-width: 40rem;
    margin: 0 auto;
    padding: 1.15rem 1.15rem 3.5rem;
  }
  .doc > *,
  .doc > .wide,
  .doc > h2,
  .doc > h3 {
    max-width: 100%;
  }
  .doc > h2 { margin-top: 2.1rem; }
  .stats {
    grid-template-columns: repeat(auto-fit, minmax(8.25rem, 1fr));
  }
  .byline,
  .dek,
  .doc p,
  .doc li {
    overflow-wrap: break-word;
  }
  pre,
  .table-wrap,
  .doc table,
  .diagram {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
  img,
  video,
  canvas {
    max-width: 100%;
    height: auto;
  }
  figure svg {
    max-width: 100%;
    min-width: 0;
    height: auto;
  }
  /* A diagram keeps its drawing size and scrolls, instead of widening the page. */
  .diagram svg {
    min-width: 36rem;
    max-width: none;
    width: 36rem;
  }
  footer,
  .footer-inner {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .doc { padding-left: 1rem; padding-right: 1rem; }
  .masthead-inner { padding-left: 1rem; padding-right: 1rem; }
}
