/* The cheat sheet: its sections flowed into as many columns as the page holds.
   Columns rather than a grid, so a short section does not leave a hole beside a long
   one, and so printing breaks between sections instead of pushing them all to page 2. */

.cheat {
  column-width: 15rem;
  column-gap: 1.5rem;
}

.cheat > div {
  break-inside: avoid;
}

/* The back is the same layout under its own heading; in print it starts a new sheet. */
.cheat.back {
  margin-top: 2em;
}

.md-typeset .cheat.back h2 {
  margin-top: 0;
}

.cheat h3 {
  margin-top: 0.4em;
}

/* The theme styles `table:not([class])`, so matching it is what it takes to win. */
.md-typeset .cheat table:not([class]) {
  display: table;
  width: 100%;
  font-size: 0.68rem;
  margin: 0.4em 0;
}

.md-typeset .cheat table:not([class]) td {
  padding: 0.25em 0.6em;
  vertical-align: top;
}

.md-typeset .cheat table:not([class]) td:first-child {
  white-space: nowrap;
}

/* The tables have no column titles; an empty header row is a blank bar. */
.md-typeset .cheat thead {
  display: none;
}

@media print {
  @page {
    margin: 1cm;
  }

  .md-header,
  .md-tabs,
  .md-sidebar,
  .md-footer,
  .md-content__button {
    display: none;
  }

  .cheat {
    column-count: 3;
    column-width: auto;
  }

  /* The theme's full-height page layout spills a blank second sheet. */
  .md-container,
  .md-main,
  .md-main__inner {
    display: block;
    min-height: 0;
    height: auto;
    margin: 0;
  }

  .cheat.back {
    break-before: page;
    margin-top: 0;
  }

  .md-typeset .cheat.back h2 {
    font-size: 14pt;
    margin-bottom: 0.2em;
  }

  /* One side of the sheet each, front and back. */
  .md-typeset {
    font-size: 8pt;
  }

  .md-typeset h1 {
    margin-bottom: 0.3em;
  }

  .md-typeset .cheat h3 {
    font-size: 10pt;
    margin: 0.3em 0 0.2em;
  }

  .md-typeset .cheat table:not([class]) {
    font-size: 7pt;
  }

  .md-typeset .cheat table:not([class]) td {
    padding: 0.15em 0.4em;
  }
}
