/* The logo is a black line drawing, so it reads on the light header but would
   disappear on the dark one. The theme renders it as an <img>, which cannot
   inherit currentColor, so invert it for the slate scheme instead of shipping a
   second file — keying on the scheme attribute means it follows the theme
   toggle, not just the OS preference. Covers both placements: the header button
   and the drawer nav on small screens. */
[data-md-color-scheme="slate"] .md-logo img {
  filter: invert(1);
}

/* Prevent line wrapping for inline code blocks */
.md-typeset :not(pre) > code {
  white-space: nowrap;
}

/* Inside a table the nowrap above would pin the table's minimum width to its
   longest code span, pushing wide tables (the pushdown translation columns)
   past the center column into a horizontal scroll. Let code wrap there; the
   prose columns already do. */
.md-typeset table:not([class]) code {
  white-space: normal;
  overflow-wrap: break-word;
}

/* A flag broken across two lines is unreadable, so the columns that hold one
   keep the nowrap. The first column is safe in every table: its longest code
   span anywhere is --error.format.text.verbose, 27 characters. The second is
   only safe in the flag tables, whose header carries the :material-flag-outline:
   icon, so key on that; a wide reference table (the file-dump "Produced by"
   column, the pushdown translations) has no icon there and keeps wrapping. */
.md-typeset table:not([class]) td:first-child code,
.md-typeset table:not([class]):has(thead th .twemoji) td:nth-child(2) code {
  white-space: nowrap;
}

/* The flag tables label their first two columns "short" and "long" followed by
   the flag icon, and in a narrow column the icon drops to a second line on its
   own. Those cells are a word plus a glyph, so pinning them costs no width. */
.md-typeset table:not([class]) th:has(.twemoji) {
  white-space: nowrap;
}

/* The theme's cell padding (.9375em 1.25em) is generous for the dense flag
   and pushdown tables; tighten it so more of them fit without scrolling. */
.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  padding: 0.6em 0.8em;
}

/* The theme's th { min-width: 5rem } floors every column at 80px, so a
   many-column table (comparison.md: seven columns, three holding a single
   glyph) cannot fit the center column no matter its content. Let a column
   size to its content instead. */
.md-typeset table:not([class]) th {
  min-width: 2rem;
}

/* On a phone a multi-column table cannot compress below its longest tokens;
   scroll it inside the column instead of letting it jut past the margin. */
@media screen and (max-width: 44.9375em) {
  .md-typeset table:not([class]) {
    display: block;
    overflow-x: auto;
  }
}
