/* Textrinum core: images in the text (figure.tx-figure) and tables. Loaded before the
   design's CSS, so a design can restyle every rule with the same selectors. */
.tx-figure { margin: 1.5rem auto; }
.tx-figure img { display: block; width: 100%; height: auto; }
.tx-figure figcaption { margin-top: .45rem; font-size: .9em; opacity: .8; }
.tx-figure--small { max-width: 33%; }
.tx-figure--medium { max-width: 66%; }
.tx-figure--full { max-width: none; }
.tx-figure--left { float: left; margin: .3rem 1.5rem 1rem 0; }
.tx-figure--right { float: right; margin: .3rem 0 1rem 1.5rem; }
/* Beside the text, "medium" takes half the width, so the text keeps room. */
.tx-figure--left.tx-figure--medium, .tx-figure--right.tx-figure--medium { max-width: 50%; }
@media (max-width: 40rem) {
  .tx-figure--small, .tx-figure--medium { max-width: 100%; }
  .tx-figure--left, .tx-figure--right { float: none; margin: 1.5rem 0; }
}
/* Whatever holds a floating image also holds its end, so the image does not hang out. */
:has(> .tx-figure--left, > .tx-figure--right)::after { content: ""; display: block; clear: both; }

/* Tables in the text: plain defaults without specificity (:where), so any rule of the design wins. */
:where(table) { border-collapse: collapse; margin: 1.5rem 0; max-width: 100%; }
:where(th, td) { padding: .45rem .75rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
:where(th) { font-weight: 600; }
:where(tr:first-child > th) { border-bottom-width: 2px; }
:where(th, td) > :where(p, ul, ol):first-child { margin-top: 0; }
:where(th, td) > :where(p, ul, ol):last-child { margin-bottom: 0; }
