:root {
  --bg: #fbfaf7;
  --text: #1f2422;
  --muted: #5f6b67;
  --accent: #24453f;
  --accent-text: #ffffff;
  --rule: #e2ded6;
  --header-cell: #efece5;
  --shade: #d9dfdb;
  --highlight: #c8553d;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --content-width: 42rem;
  --table-max-width: 72rem;
  --gutter: 1rem;
  --title-height: 2rem;
  --tab-height: 3rem;
  --toc-button-size: 3.25rem;
  --jump-gap: -1.6rem;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.55 var(--font);
}

.site-header {
  position: sticky;
  top: calc(-1 * var(--title-height));
  z-index: 10;
  background: var(--accent);
  color: var(--accent-text);
  padding-top: env(safe-area-inset-top);
}

.site-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gutter);
  height: var(--title-height);
  padding: 0.5rem var(--gutter) 0;
}

.site-title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 calc(var(--gutter) / 2);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  height: var(--tab-height);
  padding: 0 calc(var(--gutter) / 2 + 0.25rem);
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  opacity: 0.8;
  border-bottom: 3px solid transparent;
}

.tab[aria-current="page"] {
  opacity: 1;
  border-bottom-color: var(--accent-text);
}

.tab.unseen::after {
  content: "";
  position: absolute;
  top: 0.6rem;
  right: 0.2rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--highlight);
}

.content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1rem var(--gutter);
  outline: none;
}

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  line-height: 1.25;
  margin: 2em 0 0.5em;
}

.content h1 {
  font-size: 1.6rem;
}

.content h2 {
  font-size: 1.35rem;
}

.content h3 {
  font-size: 1.15rem;
}

.content h4,
.content h5,
.content h6 {
  font-size: 1rem;
}

.content p,
.content ul,
.content ol {
  margin: 0 0 0.75em;
}

.content ul,
.content ol {
  padding-left: 1.4em;
}

.content li > ul,
.content li > ol {
  margin: 0.25em 0 0;
}

.content a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

.content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.5em 0;
}

.content .subtitle {
  color: var(--muted);
  font-size: 1.1rem;
}

.content .load-error,
.content .loading {
  color: var(--muted);
}

.table-wrap {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  min-width: 100%;
  max-width: min(100vw - 2 * var(--gutter), var(--table-max-width));
  isolation: isolate;
  overflow: auto;
  max-height: calc(100vh - var(--title-height) - var(--tab-height) - 2rem);
  max-height: calc(100svh - var(--title-height) - var(--tab-height) - 2rem - env(safe-area-inset-top));
  margin: 0 0 1em;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.content table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
}

.content th,
.content td {
  min-width: 9rem;
  padding: 0.4em 0.6em;
  vertical-align: top;
  text-align: left;
  background: var(--bg);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.content th:first-child,
.content td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 5.5rem;
}

.content .shaded {
  background: var(--shade);
}

.content thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--header-cell);
}

.content thead th:first-child {
  z-index: 3;
}

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

.content > :last-child {
  margin-bottom: 0;
}

.content th > :last-child,
.content td > :last-child {
  margin-bottom: 0;
}

.updated {
  flex: none;
  font-size: 0.8125rem;
  opacity: 0.8;
}

.status {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter) calc(1.5rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.875rem;
}

.status:empty {
  display: none;
}

.notice {
  position: fixed;
  z-index: 20;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  background: var(--highlight);
  color: var(--accent-text);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
}

.notice[hidden] {
  display: none;
}

.notice button {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  min-height: 3rem;
  cursor: pointer;
}

.notice-go {
  flex: 1;
  text-align: left;
  padding: 0 var(--gutter);
  font-weight: 600;
}

.notice-close {
  padding: 0 var(--gutter);
  font-size: 1.5rem;
}

.content [id] {
  scroll-margin-top: calc(var(--tab-height) + var(--jump-gap));
}

.has-toc .content [id] {
  scroll-margin-top: calc(var(--tab-height) + 0.75rem + var(--toc-button-size) + var(--jump-gap));
}

.has-toc .content > section > :first-child {
  position: sticky;
  top: calc(var(--tab-height) + env(safe-area-inset-top));
  z-index: 1;
  margin-inline: calc(-1 * var(--gutter));
  margin-bottom: 0;
  padding: 0.5rem calc(var(--gutter) + var(--toc-button-size) + 0.5rem) calc(0.5rem + 0.5em) var(--gutter);
  background: var(--bg);
  scroll-margin-top: calc(var(--tab-height) + env(safe-area-inset-top));
}

.toc {
  position: sticky;
  top: calc(var(--tab-height) + env(safe-area-inset-top));
  z-index: 5;
  height: 0;
  font-size: 0.9375rem;
}

.toc summary {
  position: absolute;
  top: 0.75rem;
  right: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--toc-button-size);
  height: var(--toc-button-size);
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
  list-style: none;
  cursor: pointer;
}

.toc summary::-webkit-details-marker {
  display: none;
}

.toc-list {
  position: absolute;
  top: calc(0.75rem + var(--toc-button-size) + 0.5rem);
  right: var(--gutter);
  width: min(18rem, 100vw - 2 * var(--gutter));
  max-height: 60vh;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
}

.toc-list a {
  display: block;
  padding: 0.625rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.toc-list a[aria-current="location"] {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

@media (min-width: 70rem) {
  .toc {
    position: fixed;
    top: calc(var(--title-height) + var(--tab-height) + 1rem);
    left: var(--gutter);
    z-index: auto;
    height: auto;
    width: calc((100vw - var(--content-width)) / 2 - 2 * var(--gutter));
    max-height: calc(100vh - var(--title-height) - var(--tab-height) - 2rem);
    overflow-y: auto;
  }

  .toc summary {
    display: none;
  }

  .toc-list {
    position: static;
    width: auto;
    max-height: none;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .toc-list a {
    padding: 0.375rem 0.75rem;
  }

  .has-toc .content [id],
  .has-toc .content > section > :first-child {
    scroll-margin-top: calc(var(--tab-height) + var(--jump-gap));
  }

  .has-toc .content > section > :first-child {
    position: static;
    margin-inline: 0;
    margin-bottom: 0.5em;
    padding: 0;
  }

  .has-toc .table-wrap {
    left: 0;
    transform: none;
    max-width: 100%;
  }
}
