:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #202428;
  --muted: #59636e;
  --rule: #d8dee4;
  --accent: #005f8f;
  --accent-visited: #6f4aa8;
  --quote-bg: #f6f8fa;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  margin: 0 auto;
  max-width: 42rem;
  padding: 1.5rem 1rem 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.65;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:visited {
  color: var(--accent-visited);
}

a:hover,
a:focus {
  color: #004b72;
}

#menu {
  margin-bottom: 2.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.92rem;
}

#menu ul {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

#menu a {
  color: var(--muted);
  text-decoration: none;
}

#menu a::before {
  display: block;
  height: 0;
  overflow: hidden;
  content: attr(data-label);
  font-weight: 650;
  visibility: hidden;
}

#menu a:hover,
#menu a:focus {
  color: var(--text);
}

.nav_item {
  display: inline-block;
}

.nav_item.is-active a {
  color: var(--text);
  font-weight: 650;
}

.section > *:first-child {
  margin-top: 0;
}

p,
ul,
ol,
blockquote,
hr {
  margin-top: 0;
  margin-bottom: 1.15rem;
}

ul,
ol {
  padding-left: 1.35rem;
}

li + li {
  margin-top: 0.25rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 2.1rem 0 0.75rem;
  font-weight: 650;
}

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: 1.3rem;
  padding-top: 0.35rem;
}

h3 {
  font-size: 1.08rem;
}

.title {
  margin-bottom: 0.35rem;
}

.subtitle {
  margin-bottom: 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.toc {
  margin: 1.3rem 0 2rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.92rem;
}

.toc-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc-toggle::after {
  content: "+";
  font-size: 0.9rem;
  letter-spacing: 0;
}

.toc.is-expanded .toc-toggle::after {
  content: "-";
}

.toc-body {
  margin-top: 0.65rem;
}

.toc.is-collapsed .toc-body {
  display: none;
}

.toc ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.toc li {
  margin-top: 0;
}

.toc li + li {
  margin-top: 0.25rem;
}

.toc ol ol {
  margin: 0.2rem 0 0.45rem;
  padding-left: 1rem;
}

.toc ol ol a {
  color: var(--muted);
}

.toc a {
  color: var(--accent);
}

.toc a:hover,
.toc a:focus {
  color: #004b72;
}

@media (min-width: 76rem) {
  body {
    max-width: 68rem;
  }

  #menu,
  .section {
    max-width: 42rem;
    margin-right: auto;
    margin-left: auto;
  }

  .section {
    position: relative;
  }

  .toc {
    position: sticky;
    top: 1.5rem;
    float: left;
    width: 14.5rem;
    max-height: calc(100vh - 3rem);
    margin: 0 0 1.5rem -17rem;
    padding: 0.2rem 0 0.2rem 1rem;
    overflow: auto;
    border-top: 0;
    border-bottom: 0;
    border-left: 1px solid var(--rule);
    font-size: 0.78rem;
    line-height: 1.4;
  }

  .toc-toggle {
    cursor: default;
    pointer-events: none;
  }

  .toc-toggle::after {
    content: "";
  }

  .toc.is-collapsed .toc-body {
    display: block;
  }

  .toc-body {
    margin-top: 0.55rem;
  }

  .toc ol ol {
    padding-left: 0.75rem;
  }

  .toc li + li {
    margin-top: 0.3rem;
  }
}

.post-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

.post-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  background: #fbfcfd;
}

.post-card h2 {
  margin: 0 0 0.35rem;
  padding: 0;
  font-size: 1.12rem;
}

.post-card h2 a {
  color: var(--text);
}

.post-card h2 a:hover,
.post-card h2 a:focus {
  color: var(--accent);
  background: transparent;
}

.post-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

blockquote {
  margin-left: 0;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--rule);
  background: var(--quote-bg);
  color: #30363d;
}

blockquote > *:last-child {
  margin-bottom: 0;
}

hr {
  height: 1px;
  margin: 2rem 0;
  border: 0;
  background: var(--rule);
}

img {
  display: block;
  max-width: min(100%, 34rem);
  height: auto;
  margin: 1.5rem auto;
}

sup {
  line-height: 0;
}

.footnote-reference {
  position: relative;
  white-space: nowrap;
}

.footnote-reference a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15em;
  height: 1.15em;
  margin-left: 0.08em;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
}

.footnote-reference a:hover,
.footnote-reference a:focus,
.footnote-reference.is-open > a {
  background: #eef7fb;
  color: var(--accent);
  outline: none;
}

.footnote-popover {
  position: absolute;
  z-index: 10;
  bottom: 1.7em;
  left: 50%;
  width: max-content;
  max-width: min(20rem, calc(100vw - 2rem));
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgb(31 35 40 / 0.14);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateX(-50%) translateY(0.25rem);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.footnote-popover::before {
  position: absolute;
  right: 0;
  bottom: -0.7rem;
  left: 0;
  height: 0.7rem;
  content: "";
}

.footnote-popover p {
  margin-bottom: 0;
}

.footnote-reference:hover .footnote-popover,
.footnote-reference:focus-within .footnote-popover,
.footnote-reference.is-open .footnote-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.footnote-reference a,
.footnote-definition-label {
  color: var(--muted);
}

.footnotes,
.references {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}

.footnotes h2,
.references h2 {
  margin-top: 0;
  padding-top: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.footnote-definition {
  display: grid;
  grid-template-columns: 1.8rem 1fr;
  gap: 0.25rem;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footnote-definition-label {
  padding-top: 0.08rem;
  font-weight: 700;
}

.footnote-definition p {
  margin-bottom: 0.6rem;
}

.footnote-backlinks {
  grid-column: 2;
  margin-top: -0.2rem;
  font-size: 0.82rem;
}

.footnote-backlinks a + a {
  margin-left: 0.45rem;
}

.references ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.references li {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 620px) {
  html {
    font-size: 16px;
  }

  body {
    padding: 1rem 0.9rem 2.5rem;
  }

  #menu {
    margin-bottom: 1.6rem;
  }

  h1 {
    font-size: 1.55rem;
  }

  blockquote {
    padding: 0.75rem 0.85rem;
  }

  .footnote-popover {
    bottom: auto;
    left: 0;
    top: 1.6em;
    max-width: min(18rem, calc(100vw - 2rem));
    transform: translateY(0.25rem);
  }

  .footnote-reference:hover .footnote-popover,
  .footnote-reference:focus-within .footnote-popover,
  .footnote-reference.is-open .footnote-popover {
    transform: translateY(0);
  }

  .footnote-definition {
    grid-template-columns: 1.4rem 1fr;
  }
}
