.b4math-theme,
.b4math-theme :where(.site-header, main, .site-footer),
.b4math-theme :where(.site-header, main, .site-footer) *,
.b4math-theme :where(.site-header, main, .site-footer) *::before,
.b4math-theme :where(.site-header, main, .site-footer) *::after {
  box-sizing: border-box;
}

html {
  background: var(--b4-color-canvas);
  scroll-behavior: smooth;
}

.b4math-theme {
  min-width: 20rem;
  margin: 0;
  overflow-x: clip;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--b4-color-canvas);
  background-size: 4.5rem 4.5rem;
  color: var(--b4-color-text);
  font-family: var(--b4-font-sans);
  font-size: 1rem;
  line-height: var(--b4-leading-body);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.b4math-theme.is-menu-open {
  overflow: hidden;
}

.b4math-theme :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) {
  margin-top: 0;
}

.b4math-theme :where(h1, h2, h3, h4, strong, b) {
  overflow-wrap: anywhere;
}

.b4math-theme :where(p, li, dd) {
  text-wrap: pretty;
}

.b4math-theme :where(a) {
  color: inherit;
  text-decoration: none;
}

.b4math-theme :where(img, svg) {
  display: block;
  max-width: 100%;
}

.b4math-theme :where(button, input, textarea, select) {
  margin: 0;
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

.b4math-theme :where(button, a, input, textarea, select, summary) {
  -webkit-tap-highlight-color: transparent;
}

.b4math-theme :where(button) {
  border: 0;
}

.b4math-theme :where(:focus-visible) {
  outline: 3px solid var(--b4-color-focus);
  outline-offset: 3px;
}

.b4math-theme [hidden] {
  display: none;
}

.b4math-theme :where([aria-disabled="true"], :disabled) {
  cursor: not-allowed;
  opacity: 0.52;
}

.b4-shell,
.b4-v50-shell {
  width: min(var(--b4-shell), calc(100% - 4rem));
  margin-inline: auto;
}

.b4-reading-width {
  max-width: var(--b4-reading);
}

.b4-skip-link {
  position: fixed;
  z-index: 10000;
  top: -5rem;
  left: var(--b4-space-4);
  min-height: 2.75rem;
  padding: var(--b4-space-3) var(--b4-space-4);
  border-radius: var(--b4-radius-2);
  background: var(--b4-color-paper);
  color: var(--b4-color-paper-ink);
  font-weight: 700;
}

.b4-skip-link:focus {
  top: var(--b4-space-3);
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 47.99rem) {
  .b4-shell,
  .b4-v50-shell {
    width: min(100% - 1.5rem, var(--b4-shell));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .b4math-theme :where(.site-header, main, .site-footer) *,
  .b4math-theme :where(.site-header, main, .site-footer) *::before,
  .b4math-theme :where(.site-header, main, .site-footer) *::after {
    scroll-behavior: auto;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
  }
}
