*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Hide the scrollbar but keep native scrolling (wheel, touch, keys). */
html {
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100svh;
}

h1,
p,
dl,
dd,
figure {
  margin: 0;
}

a {
  color: inherit;
}

:root {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.3 0 0 0 -.52'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Paper grain over the whole page. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background-image: var(--grain);
  opacity: var(--grain-opacity, 0.12);
  mix-blend-mode: var(--grain-blend, multiply);
}

canvas.dither {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0;
  transition: opacity 0.4s ease;
}

canvas.dither.is-ready {
  opacity: 1;
}

/* Theme toggle — a single pixel-art icon, coloured by the page. */
.theme {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -10px -9px -10px 0;
  color: inherit;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.theme:hover,
.theme:focus-visible {
  opacity: 1;
}

.theme svg {
  display: block;
  width: 18px;
  height: 18px;
  shape-rendering: crispEdges;
  fill: currentColor;
}

/* Highlighter marks, swept in one after another once the page has loaded. */
.hl {
  position: relative;
  z-index: 0;
  display: inline-block;
  margin: 0 0.18em;
  padding: 0 0.3em;
  color: #fff;
  background: none;
}

.hl::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0.06em 0 0;
  background: rgb(36, 84, 196);
  opacity: var(--hl-opacity, 0.55);
  transform-origin: left center;
  animation: mark 0.6s cubic-bezier(0.65, 0, 0.35, 1) both;
  animation-delay: var(--delay, 1s);
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.hl:nth-of-type(2) {
  --delay: 1.2s;
}

.hl:nth-of-type(3) {
  --delay: 1.4s;
}

@keyframes mark {
  from { transform: scaleX(0); }
}

@media (hover: hover) {
  .hl:hover::before {
    opacity: 1;
    background-color: rgb(46, 104, 232);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
