:root {
  color-scheme: dark;
  --bg: #14151b;
  --panel: #20212a;
  --text: #f6f3e9;
  --muted: #c1bdaf;
  --gold: #ffca50;
  --edge: #494853;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    1rem/1.65 system-ui,
    sans-serif;
}
header {
  background: #191a21;
  border-bottom: 1px solid var(--edge);
}
main,
.bar,
footer {
  width: min(100% - 2.5rem, 66rem);
  margin: auto;
}
.bar,
footer,
.section-title,
.card small,
.crumb {
  display: flex;
  align-items: center;
}
.bar {
  justify-content: space-between;
  min-height: 4.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: 900 1.4rem var(--mono);
  color: var(--text);
}
.brand span {
  margin-left: -0.35rem;
  color: var(--gold);
}
a {
  color: var(--gold);
  text-underline-offset: 0.2em;
}
.brand,
.bar a,
.card {
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
.bar nav {
  display: flex;
  gap: 0.4rem;
}
.bar nav a {
  font: 700 0.94rem var(--mono);
  padding: 0.65rem;
  color: var(--muted);
  border-bottom: 3px solid transparent;
}
.bar nav a[aria-current] {
  color: var(--gold);
  border-color: var(--gold);
}
main {
  padding: clamp(2rem, 5vw, 4rem) 0;
  min-height: 74vh;
}
.hero {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 5vw, 4rem);
  border: 2px solid #63606a;
  background: #252632;
  box-shadow: 5px 5px #0a0a10;
}
.hero:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0.5rem;
  background: repeating-linear-gradient(
    135deg,
    var(--gold) 0 10px,
    #d58034 10px 20px
  );
}
.scene {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url('storm.svg') right bottom/auto 100% no-repeat;
}
.intro {
  width: fit-content;
}
.intro small {
  text-transform: none;
}
.intro p {
  font-size: 1.1rem;
  color: var(--text);
  margin: 1rem 0 1.4rem;
}
.intro .job-title {
  /* Align the visible M, not its font's left side bearing, with the label. */
  text-indent: -0.05em;
  margin-block: 0 1rem;
  color: color-mix(in srgb, var(--text) 60%, var(--muted));
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
}
.intro .affiliations {
  max-width: 36ch;
}
footer div {
  display: flex;
  gap: 1rem;
}
.affiliations a,
footer a,
.crumb {
  font: 600 0.9rem/1.6 var(--mono);
}
small,
#count {
  font: 700 0.74rem/1.5 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
h1,
h2,
h3 {
  font-family: var(--mono);
  letter-spacing: -0.06em;
  line-height: 1.15;
}
h1 {
  font-size: clamp(2.55rem, 6vw, 4.6rem);
  margin: 0.35em 0;
}
@font-face {
  font-family: 'Hero Mono';
  src: url('fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
.hero h1 {
  font-family: 'Hero Mono', var(--mono);
  /* The k has an 80/1000 em bearing; the label's ink is ~1px inside the column. */
  text-indent: calc(1px - 0.08em);
  font-size: clamp(3.4rem, 8vw, 6.2rem);
  margin: 0.12em 0;
}
.intro h1 span,
footer span {
  color: var(--gold);
}
h2 {
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}
.section-title {
  gap: 1.25rem;
  margin-top: 2rem;
}
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.3rem;
}
.card {
  border: 1px solid var(--edge);
  border-top: 4px solid var(--gold);
  padding: 1.5rem;
  background: var(--panel);
  box-shadow: 4px 4px #090a0e;
  color: var(--text);
}
.card:hover {
  background: #2a2931;
  text-decoration: none;
  border-color: var(--gold);
}
.card small {
  justify-content: space-between;
}
.card h3 {
  font-size: 2rem;
  margin: 0.5rem 0;
}
.card p {
  color: var(--muted);
  margin: 0.4rem 0 1.4rem;
}
.card strong {
  color: var(--gold);
  font: 700 0.85rem var(--mono);
}
footer {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-top: 1px solid var(--edge);
  padding: 1.75rem 0;
  font-family: var(--mono);
}
.filter {
  display: block;
  font: 600 0.9rem var(--mono);
  margin: 2rem 0 1rem;
}
.filter input {
  display: block;
  margin-top: 0.55rem;
  background: var(--panel);
  color: var(--text);
  padding: 0.8rem 1rem;
  width: min(100%, 34rem);
  border: 1px solid var(--edge);
  font: inherit;
}
.archive-tree,
.archive-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.archive-tree > li {
  margin: 0.8rem 0;
  border: 1px solid var(--edge);
  border-left: 3px solid var(--gold);
  background: var(--panel);
}
.archive-tree details {
  padding: 0;
  border: none;
  background: transparent;
}
.archive-tree summary,
.tree-page {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  overflow-wrap: anywhere;
}
.archive-tree summary {
  list-style: none;
  cursor: pointer;
  font-weight: 650;
}
.archive-tree summary::-webkit-details-marker {
  display: none;
}
.archive-tree summary::before {
  content: '+';
  color: var(--gold);
  font: 700 1rem var(--mono);
}
.archive-tree details[open] > summary::before {
  content: '−';
}
.archive-tree > li > details > summary {
  font: 700 1.4rem var(--mono);
  padding: 1rem;
}
.archive-tree summary small {
  margin-left: auto;
  white-space: nowrap;
  color: var(--muted);
}
.archive-tree ul {
  margin: 0 clamp(0.3rem, 1vw, 1rem) 0.6rem clamp(0.65rem, 2vw, 1.7rem);
  border-left: 1px solid var(--edge);
}
.archive-tree summary:hover,
.tree-page:hover {
  background: #2c2c35;
}
.archive-tree summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}
.archive-tree .event-result {
  margin: 0 0.8rem 0.7rem clamp(0.65rem, 2vw, 1.7rem);
  padding: 0.4rem 0.75rem;
  border-left: 2px solid var(--gold);
  color: var(--muted);
  font-size: 0.94rem;
}
.tree-page {
  text-decoration: none;
}
.tree-page::before {
  content: '';
  width: 0.65rem;
  flex: none;
  border-top: 1px solid var(--edge);
  align-self: center;
}
.tree-page span {
  font-size: 0.8rem;
}
.crumb {
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.crumb a {
  color: var(--muted);
}
article {
  max-width: 52rem;
  margin: auto;
  overflow-wrap: anywhere;
}
/* One centered column for breadcrumbs, title, prose and code, with or
   without an outline. The surrounding gutters are not part of its width. */
main.article-page {
  --reading-width: clamp(52rem, 64vw, 58rem);
  width: min(100% - 2.5rem, var(--reading-width));
}
.article-page article {
  max-width: none;
  font-size: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem);
}
.article-page article pre {
  font-size: 0.9em;
}
.article-page article p {
  max-width: 80ch;
}
article h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  padding-bottom: 0.45em;
  border-bottom: 2px solid var(--gold);
}
.article-page article :is(h2, h3, h4) {
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
  scroll-margin-top: 1rem;
}
.article-page article h2 {
  margin-block: clamp(2.75rem, 6vw, 4rem) 0.75rem;
  border-top: 1px solid var(--edge);
  padding-top: 0.75em;
  font-size: clamp(1.65rem, 3vw, 2rem);
}
.article-page article h3 {
  margin-block: 2rem 0.55rem;
  font-size: 1.35em;
}
.article-page article h4 {
  margin-block: 1.5rem 0.4rem;
  font-size: 1.08em;
}
/* Let the heading set the gap to its content, not the paragraph's default margin. */
.article-page article :is(h2, h3, h4) + :is(p, ul, ol, pre, blockquote) {
  margin-block-start: 0;
}
/* Adjacent pages belong to the reading column, not the TOC rail. */
.sibling-nav {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--edge);
}
.sibling-nav > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.sibling-nav a {
  display: grid;
  align-content: start;
  gap: 0.3rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.sibling-direction {
  color: var(--gold);
  font: 600 0.85rem/1.5 var(--mono);
}
.sibling-nav a[rel='next'] {
  grid-column: 2;
  text-align: end;
}
.sibling-nav a:is(:hover, :focus-visible) {
  border-color: var(--gold);
}
.sibling-nav a:is(:hover, :focus-visible) strong {
  text-decoration: underline;
}
@media (max-width: 36rem) {
  .sibling-nav > div {
    grid-template-columns: minmax(0, 1fr);
  }
  .sibling-nav a[rel='next'] {
    grid-column: 1;
    text-align: start;
  }
}
.article-toc {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--gold);
}
.article-toc summary {
  cursor: pointer;
  color: var(--gold);
  font: 700 0.95rem/1.5 var(--mono);
}
.article-toc nav {
  max-height: 40vh;
  overflow-y: auto;
  margin-top: 0.65rem;
}
.article-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.article-toc ul ul {
  margin-left: 0.45rem;
  padding-left: 0.7rem;
  border-left: 1px solid var(--edge);
}
.article-toc a {
  display: block;
  padding: 0.25rem 0.3rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.article-toc a[aria-current='location'] {
  color: var(--gold);
}
.article-toc a:hover,
.article-toc a:focus-visible {
  color: var(--gold);
  text-decoration: underline;
}
.article-toc a:focus-visible {
  outline-offset: -2px;
}
@media screen and (min-width: 80rem) {
  .reading-layout {
    /* Track one is the full article. Track two extends into the right
       gutter, leaving a gap and at least 1.25rem at the viewport edge. */
    --toc-gap: 1.5rem;
    display: grid;
    grid-template-columns: 100% min(
        15rem,
        calc(50vw - 50% - var(--toc-gap) - 1.25rem)
      );
    grid-template-areas: 'body toc';
    column-gap: var(--toc-gap);
  }
  .article-body {
    grid-area: body;
  }
  .article-toc {
    grid-area: toc;
    align-self: start;
    position: sticky;
    top: 1rem;
  }
  .article-toc nav {
    max-height: calc(100vh - 7rem);
  }
}
@media print {
  .sibling-nav,
  .article-toc {
    display: none;
  }
  .reading-layout {
    display: block;
  }
}
article .katex-display {
  overflow-x: auto;
  padding: 0.4em 0;
}
article .katex-display > .katex {
  width: max-content;
  min-width: 100%;
}
article img {
  max-width: 100%;
  height: auto;
}
figure {
  margin: 1.4rem 0;
}
figcaption {
  color: var(--muted);
}
pre,
table {
  display: block;
  overflow: auto;
}
pre,
blockquote,
details {
  background: var(--panel);
  padding: 1rem;
  border: 1px solid var(--edge);
}
pre {
  font: 0.88rem/1.6 var(--mono);
  tab-size: 4;
}
code {
  font-family: var(--mono);
  color: #ffe1a0;
}
article pre {
  background: #1a1b26;
  color: #c0caf5;
  border-color: #414868;
  border-left: 3px solid #7aa2f7;
}
article pre > code {
  color: inherit;
}
article pre[data-language]::before {
  content: attr(data-language);
  display: block;
  margin-bottom: 0.65rem;
  color: #7dcfff;
  font: 700 0.72rem/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* Raise the contrast of Tokyo Night's muted tokens on the dark panel. */
article pre .hljs-comment,
article pre .hljs-meta {
  color: #919bc1;
}
blockquote {
  margin-inline: 0;
  border-left: 4px solid var(--gold);
}
table {
  border-collapse: collapse;
}
th,
td {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--edge);
  text-align: left;
}
th {
  background: var(--panel);
}
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: #111;
  padding: 0.7rem;
  z-index: 10;
}
[hidden] {
  display: none !important;
}
@media (max-width: 750px) {
  .scene {
    opacity: 0.3;
  }
  .intro {
    text-shadow: 0 1px 2px #111;
  }
}
@media (max-width: 560px) {
  .cards {
    grid-template-columns: 1fr;
  }
  .bar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.8rem 0;
  }
  .bar nav {
    gap: 0;
  }
  .bar nav a {
    font-size: 0.83rem;
    padding: 0.4rem;
  }
  .brand {
    font-size: 1.15rem;
  }
  .section-title {
    display: block;
    margin-bottom: 1rem;
  }
  .section-title h2 {
    margin: 0.25rem 0;
  }
  .card {
    padding: 1rem;
  }
  .scene {
    background-position: 75% bottom;
  }
}
