:root,
.light,
.rust {
  --bg: #f4f2ee;
  --fg: #1c1c1e;
  --sidebar-bg: #ebe8e2;
  --sidebar-fg: #1c1c1e;
  --sidebar-non-existant: #66645f;
  --sidebar-active: #8f321f;
  --sidebar-spacer: #d8d3ca;
  --scrollbar: #8b8881;
  --icons: #58657a;
  --icons-hover: #9a3825;
  --links: #4f5d72;
  --inline-code-color: #8f321f;
  --theme-popup-bg: #ffffff;
  --theme-popup-border: #c9c3b9;
  --theme-hover: #e3dfd8;
  --quote-bg: #ebe8e2;
  --quote-border: #58657a;
  --warning-border: #9a3825;
  --table-border-color: #c9c3b9;
  --table-header-bg: #e3dfd8;
  --table-alternate-bg: #efede8;
  --searchbar-border-color: #8a857d;
  --searchbar-bg: #ffffff;
  --searchbar-fg: #1c1c1e;
  --searchbar-shadow-color: #9a3825;
  --searchresults-header-fg: #66645f;
  --searchresults-border-color: #c9c3b9;
  --searchresults-li-bg: #ffffff;
  --search-mark-bg: #ead4cc;
  --copy-button-filter: invert(37%) sepia(12%) saturate(955%)
    hue-rotate(178deg) brightness(91%) contrast(87%);
  --copy-button-filter-hover: invert(29%) sepia(48%) saturate(1338%)
    hue-rotate(334deg) brightness(91%) contrast(91%);
  --footnote-highlight: #9a3825;
  --overlay-bg: rgba(28, 28, 30, 0.24);
  --blockquote-note-color: #58657a;
  --blockquote-tip-color: #397452;
  --blockquote-important-color: #744f83;
  --blockquote-warning-color: #8f5d18;
  --blockquote-caution-color: #9a3825;
  --sidebar-header-border-color: #9a3825;
  --color-scheme: light;

  --surface-muted: #ebe8e2;
  --surface-raised: #ffffff;
  --edge: #c9c3b9;
  --edge-strong: #9a948a;
  --accent-hover: #7d291a;
  --active-bg: #ded9d1;
  --code-bg: #e9e6e0;
  --code-fg: #1c1c1e;
  --focus-ring: #9a3825;
  --focus-halo: rgba(154, 56, 37, 0.18);
  --toolbar-bg: rgba(244, 242, 238, 0.86);
  --surface-shadow: 0 12px 32px rgba(55, 48, 39, 0.1);
  --content-max-width: 78rem;
}

.navy,
.ayu,
.coal {
  --bg: #171719;
  --fg: #f5f3ef;
  --sidebar-bg: #202023;
  --sidebar-fg: #f5f3ef;
  --sidebar-non-existant: #a39f98;
  --sidebar-active: #e18d78;
  --sidebar-spacer: #353539;
  --scrollbar: #77777f;
  --icons: #aeb9c9;
  --icons-hover: #e18d78;
  --links: #b8c5d7;
  --inline-code-color: #ef9d89;
  --theme-popup-bg: #252528;
  --theme-popup-border: #4a4a50;
  --theme-hover: #343438;
  --quote-bg: #222225;
  --quote-border: #98a5b8;
  --warning-border: #e18d78;
  --table-border-color: #4a4a50;
  --table-header-bg: #303034;
  --table-alternate-bg: #202023;
  --searchbar-border-color: #77777f;
  --searchbar-bg: #252528;
  --searchbar-fg: #f5f3ef;
  --searchbar-shadow-color: #e18d78;
  --searchresults-header-fg: #c6c1b9;
  --searchresults-border-color: #4a4a50;
  --searchresults-li-bg: #252528;
  --search-mark-bg: #623b32;
  --copy-button-filter: invert(76%) sepia(11%) saturate(421%)
    hue-rotate(178deg) brightness(93%) contrast(87%);
  --copy-button-filter-hover: invert(69%) sepia(28%) saturate(723%)
    hue-rotate(325deg) brightness(101%) contrast(83%);
  --footnote-highlight: #e18d78;
  --overlay-bg: rgba(0, 0, 0, 0.55);
  --blockquote-note-color: #aeb9c9;
  --blockquote-tip-color: #85bd98;
  --blockquote-important-color: #c2a1d0;
  --blockquote-warning-color: #ddb36e;
  --blockquote-caution-color: #e18d78;
  --sidebar-header-border-color: #e18d78;
  --color-scheme: dark;

  --surface-muted: #202023;
  --surface-raised: #29292d;
  --edge: #4a4a50;
  --edge-strong: #77777f;
  --accent-hover: #f0a28e;
  --active-bg: #343438;
  --code-bg: #1f1f22;
  --code-fg: #f5f3ef;
  --focus-ring: #e18d78;
  --focus-halo: rgba(225, 141, 120, 0.22);
  --toolbar-bg: rgba(23, 23, 25, 0.86);
  --surface-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
}

html {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

body {
  letter-spacing: normal;
}

code,
pre,
.chapter li.part-title {
  font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Monaco,
    Consolas, monospace;
  letter-spacing: normal;
}

.menu-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

#mdbook-menu-bar {
  background: var(--toolbar-bg);
  border-block-end-color: transparent;
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  backdrop-filter: blur(18px) saturate(135%);
}

#mdbook-menu-bar.bordered {
  border-block-end-color: var(--edge);
}

#mdbook-menu-bar .fa-svg,
#mdbook-menu-bar .icon-button,
.nav-chapters {
  transition-duration: 140ms;
}

#mdbook-menu-bar .icon-button:active,
#mdbook-menu-bar a:active .fa-svg,
.mobile-nav-chapters:active {
  transform: scale(0.94);
}

.sidebar {
  border-inline-end: 1px solid var(--edge);
}

.sidebar .sidebar-scrollbox {
  padding: 1.6rem 1.2rem 2.4rem;
}

.chapter li.part-title {
  margin-block: 1.6rem 0.6rem;
  color: var(--sidebar-non-existant);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.chapter li a {
  display: inline-block;
  margin-inline-start: -0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.6rem;
}

.chapter li a.active,
.chapter a.current-header {
  background: var(--active-bg);
  color: var(--sidebar-active);
  font-weight: 650;
}

.on-this-page {
  border-inline-start-color: var(--sidebar-header-border-color);
}

.content h1,
.content h2,
.content h3 {
  font-weight: 700;
}

.content h1 {
  margin-block: 1.15em 0.55em;
  font-size: clamp(3.4rem, 5vw, 4.8rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.content h2 {
  margin-block: 2.2em 0.65em;
  font-size: 2.8rem;
  line-height: 1.18;
  letter-spacing: -0.022em;
}

.content h3 {
  margin-block: 2em 0.55em;
  font-size: 2.2rem;
  line-height: 1.28;
  letter-spacing: -0.012em;
}

.content p,
.content li {
  line-height: 1.68;
}

.content a:not(.header) {
  text-decoration: underline;
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.2em;
}

.content a:not(.header):hover {
  color: var(--accent-hover);
  text-decoration-thickness: 0.1em;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.hljs {
  background: var(--code-bg);
  color: var(--code-fg);
}

pre {
  margin-block: 2rem;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 1.2rem;
  background: var(--code-bg);
}

pre > code.hljs {
  overflow-x: auto;
  padding: 1.6rem 1.8rem;
  line-height: 1.62;
}

:not(pre) > .hljs {
  border: 1px solid var(--edge);
  border-radius: 0.5rem;
  background: var(--code-bg);
}

pre > .buttons {
  visibility: visible;
  opacity: 0.62;
}

pre:hover > .buttons,
pre:focus-within > .buttons {
  opacity: 1;
}

pre > .buttons button {
  border-color: var(--edge-strong);
  border-radius: 0.7rem;
  background: var(--surface-raised);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.table-wrapper {
  margin-block: 2rem;
  overflow: hidden;
  overflow-x: auto;
  border: 1px solid var(--edge);
  border-radius: 1.2rem;
}

.table-wrapper table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  text-align: start;
}

.table-wrapper table th,
.table-wrapper table td {
  padding: 1rem 1.2rem;
  border: 0;
  border-block-start: 1px solid var(--table-border-color);
  text-align: start;
  vertical-align: top;
}

.table-wrapper table thead th {
  border-block-start: 0;
  background: var(--table-header-bg);
  font-weight: 700;
}

.table-wrapper table thead tr {
  border: 0;
}

.table-wrapper table tbody tr:nth-child(2n) {
  background: var(--table-alternate-bg);
}

blockquote,
.api-reference-status {
  margin-block: 2.4rem;
  padding: 1.4rem 1.6rem;
  border: 1px solid var(--edge);
  border-inline-start: 3px solid var(--quote-border);
  border-radius: 1.2rem;
  background: var(--quote-bg);
}

blockquote > :first-child,
.api-reference-status > :first-child {
  margin-block-start: 0;
}

blockquote > :last-child,
.api-reference-status > :last-child {
  margin-block-end: 0;
}

#mdbook-searchbar {
  padding: 1.1rem 1.4rem;
  border-radius: 1rem;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

#mdbook-searchbar:focus,
#mdbook-searchbar.active {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

#mdbook-searchbar:focus-visible {
  outline: none;
}

.theme-popup {
  overflow: hidden;
  border-color: var(--edge);
  border-radius: 1rem;
  background: var(--surface-raised);
  box-shadow: var(--surface-shadow);
}

.theme-popup .theme {
  padding-block: 0.5rem;
}

#mdbook-help-popup {
  border-color: var(--edge);
  border-radius: 1.2rem;
  background: var(--surface-raised);
  box-shadow: var(--surface-shadow);
}

.mobile-nav-chapters {
  border: 1px solid var(--edge);
  border-radius: 1rem;
  background: var(--surface-muted);
}

.api-reference-status {
  border-inline-start-color: var(--quote-border);
}

#manifold-api-reference:not(:empty) {
  margin-block-start: 2rem;
  min-height: 40rem;
}

@media only screen and (max-width: 620px) {
  :root {
    --page-padding: 1.6rem;
  }

  .menu-title {
    font-size: 1.4rem;
  }

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

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

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

  pre > code.hljs {
    padding: 1.4rem;
  }

  .table-wrapper table th,
  .table-wrapper table td {
    padding: 0.9rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  #mdbook-menu-bar {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root,
  .light,
  .rust,
  .navy,
  .ayu,
  .coal {
    --edge: var(--edge-strong);
    --table-border-color: var(--edge-strong);
    --searchbar-border-color: var(--edge-strong);
    --toolbar-bg: var(--bg);
  }

  :focus-visible {
    outline-width: 3px;
  }

  .content a:not(.header) {
    text-decoration-thickness: 0.12em;
  }
}
