html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body { text-rendering: optimizeLegibility; }

mjx-container { color: inherit; }
mjx-container[display="true"] {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  margin: 0 !important;
}
/* Inline math must stay in the sentence (mjx-container and its SVG). */
mjx-container:not([display="true"]) {
  display: inline;
  vertical-align: -0.15em;
  margin: 0 0.05em;
  max-width: none;
}
mjx-container:not([display="true"]) svg {
  display: inline;
  vertical-align: inherit;
  max-width: none;
}

@media (prefers-reduced-motion: no-preference) {
  section {
    animation: rise .7s ease-out both;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
  }
  @keyframes rise {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}

a:focus-visible,
button:focus-visible,
details > summary:focus-visible {
  outline: 2px solid #f5b642;
  outline-offset: 3px;
  border-radius: 4px;
}

pre code,
pre {
  white-space: pre;
}

/* ASCII diagrams: constrain to parent width and scroll when wider */
.ascii-diagram {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ascii-diagram pre {
  margin: 0;
  width: max-content;
}

details > summary {
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }

::selection {
  background: #fcd34d;
  color: #0c1220;
}
