@layer base {
  :where(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6) {
    font-weight: 800;
    hyphens: auto;
    letter-spacing: -0.02ch;
    line-height: 1.1;
    margin-block: 0;
    overflow-wrap: break-word;
    text-wrap: balance;
  }

  :where(h1, h2, h3, h4, h5, h6) {
    display: block;
  }

  :is(h1, h2, h3, h4, h5, h6) {
    margin-block: 0.65em;
  }

  :is(h1, .h1) {
    font-size: 2em;
  }

  :is(h2, .h2) {
    font-size: 1.5em;
  }

  :is(h3, .h3) {
    font-size: 1.17em;
  }

  :is(h4, .h4) {
    font-size: 1em;
  }

  :is(h5, .h5) {
    font-size: 0.83em;
  }

  :is(h6, .h6) {
    font-size: 0.67em;
  }

  :is(p, ul, ol, dl, blockquote, pre, figure, table, hr) {
    margin-block: 0.65lh;
    overflow-wrap: break-word;
    text-wrap: pretty;
  }

  hr {
    border-color: var(--color-gray-dark);
    border-style: var(--border-style, solid) none none;
    margin: 2lh auto;
  }

  b,
  strong {
    font-weight: 700;
  }

  :is(pre, code, .pre, .code) {
    background-color: var(--color-gray-light);
    border: 1px solid var(--color-gray);
    border-radius: 0.3em;
    font-family: var(--font-mono);
    font-size: 0.85em;
  }

  pre {
    overflow-x: auto;
    text-wrap: nowrap;
  }

  code {
    padding: 0.1em 0.3em;
  }

  :is(pre, .pre) {
    border-radius: 0.5em;
    padding: 0.5lh 2ch;

    :is(code, .code) {
      background-color: transparent;
      border: 0;
      font-size: 1em;
      padding: 0;
    }
  }

  p {
    hyphens: auto;
    letter-spacing: -0.005ch;
  }

  :is(blockquote, .quote) {
    font-style: italic;
    margin: 0 3ch;

    p {
      hyphens: none;
    }
  }

  table {
    border: 1px solid var(--color-gray-dark);
    border-collapse: collapse;
    margin: 1lh 0;
  }

  th {
    font-weight: 700;
  }

  :where(th, td) {
    border: 1px solid var(--color-gray-dark);
    padding: 0.2lh 1ch;
    text-align: start;
  }

  :where(th) {
    border-block-end-width: 3px;
  }

  del {
    background-color: oklch(var(--lch-red) / 0.1);
    color: var(--color-red);
  }

  ins {
    background-color: oklch(var(--lch-green) / 0.1);
    color: var(--color-green);
  }

  /* No horizontal padding: search marks routinely cover word fragments, and
     padding splits the word ("Registrierun g"). Rich text bodies repeat this
     rule in lexxy.css, above the gem's transparency reset. */
  mark {
    background-color: var(--color-orange);
    color: var(--color-ink);
    border-radius: 4px;
  }

  /* Shared warning sentence: amber, one size below body text, with a leading
     exclamation icon (see ApplicationHelper#warning_hint). */
  .warning-hint {
    display: flex;
    align-items: baseline;
    gap: 0.5ch;
    color: var(--color-yellow-dark);
    font-size: var(--font-size-s);
  }

  /* Links are blue by design — everywhere except buttons, and they keep that
     colour on hover (underline + cursor are the affordance). The :where() keeps
     this at `a` specificity (0,0,1) so component classes (.txt-ink, .txt-subtle,
     …) still override it; it only filters .btn out of the default link colour.
     Lives here, not in base.css, because the website imports text.css too. */
  a:where(:not(.btn)) {
    color: var(--color-blue);
  }
}
