:root {
  --bg: #ffffff;
  --ink: #4e1010;
  --link: #4e1010;
  --rule: #ead8d8;
  --dot: rgb(240, 240, 240);
  --lattice: 34px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Source Serif 4", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  z-index: 0;
  left: 50%;
  top: 50%;
  width: 180vmax;
  height: 180vmax;
  transform: translate(-50%, -50%) rotate(11deg);
  pointer-events: none;
  background-image:
    radial-gradient(circle, var(--dot) 3.8px, transparent 4.05px),
    radial-gradient(circle, var(--dot) 3.8px, transparent 4.05px);
  background-size: var(--lattice) calc(var(--lattice) * 1.7320508);
  background-position: 0 0, calc(var(--lattice) / 2) calc(var(--lattice) * 0.8660254);
}

::selection {
  background: #f0d4d4;
  color: var(--ink);
}

main {
  position: relative;
  z-index: 1;
  max-width: 98.8rem;
  margin: 0 auto;
  padding: 3.25rem 1.5rem 5rem;
}

h1 {
  margin: 0 0 2.4rem;
  font-weight: 560;
  font-size: 2.25rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

p {
  margin: 0 0 1.15rem;
}

ul {
  margin: 0.35rem 0 1.15rem;
  padding-left: 1.3rem;
}

li {
  margin: 0.15rem 0;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 1.5px;
}

.katex,
.katex-display {
  color: var(--ink);
}

.katex-display {
  margin: 1.35rem 0 1.45rem;
  overflow-x: auto;
  overflow-y: hidden;
}

a.paper {
  color: #b73108;
  font-weight: 700;
  border-bottom-color: #1a4fbf;
}

.stage {
  max-width: 42rem;
  margin: 1.6rem auto 0;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: #fff;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
}

.controls input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--ink);
}

button.text {
  font: inherit;
  font-size: 1.15rem;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--link);
  padding: 0 0 0.08em;
  cursor: pointer;
}

.readout {
  margin: 0.75rem 0 0;
  font-variant-numeric: tabular-nums;
}

footer {
  margin-top: 3.4rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.5;
}

footer p {
  margin: 0 0 0.9rem;
}

footer a {
  color: var(--link);
}

@media (max-width: 40rem) {
  main {
    padding-top: 2.25rem;
  }

  h1 {
    font-size: 1.9rem;
  }
}
