:root {
  --text: #1c2024;
  --muted: #5b6470;
  --page: #ffffff;
  --panel: #f6f7f9;
  --line: #e2e5ea;
  --accent: #1d5fd0;
  --accent-soft: #eaf1fd;
  --important: #fdf3ee;
  --important-line: #e9b99f;
  --tip: #eef8f1;
  --tip-line: #a8d6b6;
  --code: #f1f3f6;
  --head-height: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e7eaee;
    --muted: #a3acb8;
    --page: #14171b;
    --panel: #1b1f25;
    --line: #2c323a;
    --accent: #8bb4ff;
    --accent-soft: #1d2a40;
    --important: #2e211b;
    --important-line: #7a4d35;
    --tip: #17281d;
    --tip-line: #2f5f3f;
    --code: #222831;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--head-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--page);
}

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

a:hover {
  text-decoration: underline;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 6px;
}

/* Header */

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--head-height);
  padding: 0 24px;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--page);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-weight: 400;
  color: var(--muted);
}

.search {
  position: relative;
  flex: 1;
  max-width: 520px;
  margin-left: auto;
}

.search input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-results {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  max-height: 70vh;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

.search-results a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text);
}

.search-results a:hover,
.search-results a:focus {
  background: var(--accent-soft);
  text-decoration: none;
}

.search-results strong {
  display: block;
  font-weight: 600;
}

.search-results span {
  display: block;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
}

.search-results .search-empty {
  padding: 10px;
  color: var(--muted);
}

/* Layout */

.shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--head-height);
  align-self: start;
  height: calc(100vh - var(--head-height));
  padding: 20px 14px 40px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  font-size: 14.5px;
}

/* The menu is always open on wide screens. On narrow ones a checkbox opens it,
   so it works without JavaScript and the links are in the page only once. */
.nav-check {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-label {
  display: none;
}

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

.sidebar li a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.sidebar li a:hover {
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
}

.sidebar li a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.sidebar .nav-top {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar .nav-top a {
  color: var(--text);
  font-weight: 600;
}

.sidebar details {
  margin-bottom: 4px;
}

.sidebar details > summary {
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.sidebar details > summary:hover {
  background: var(--panel);
}

.sidebar details > ul {
  margin: 2px 0 8px 10px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
}

main {
  min-width: 0;
  padding: 28px 40px 64px;
}

.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 780px) 220px;
  gap: 48px;
}

.article {
  min-width: 0;
}

/* Article */

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--muted);
}

.crumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--line);
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  margin: 0 0 18px;
  font-size: 2rem;
}

h2 {
  margin: 44px 0 12px;
  padding-top: 20px;
  font-size: 1.42rem;
  border-top: 1px solid var(--line);
}

h3 {
  margin: 30px 0 8px;
  font-size: 1.12rem;
}

h4 {
  margin: 22px 0 6px;
  font-size: 1rem;
}

.anchor {
  margin-left: 8px;
  font-weight: 400;
  color: var(--line);
  opacity: 0;
}

h2:hover .anchor,
h3:hover .anchor,
h4:hover .anchor,
.anchor:focus {
  opacity: 1;
  color: var(--muted);
}

p,
ul,
ol {
  margin: 0 0 16px;
}

.article ul,
.article ol {
  padding-left: 24px;
}

.article li {
  margin-bottom: 6px;
}

.article li > ul,
.article li > ol {
  margin-top: 6px;
}

h1 + p {
  font-size: 1.08rem;
}

code {
  padding: 0.12em 0.38em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: var(--code);
  border-radius: 5px;
  overflow-wrap: anywhere;
}

pre {
  margin: 0 0 18px;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--code);
  border-radius: 8px;
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: none;
  overflow-wrap: normal;
}

blockquote {
  margin: 0 0 18px;
  padding: 10px 16px;
  color: var(--text);
  background: var(--panel);
  border-left: 3px solid var(--line);
  border-radius: 0 8px 8px 0;
}

blockquote p:last-child,
.callout p:last-child {
  margin-bottom: 0;
}

.callout {
  margin: 0 0 18px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.callout-important {
  background: var(--important);
  border-color: var(--important-line);
}

.callout-tip {
  background: var(--tip);
  border-color: var(--tip-line);
}

.glance {
  margin: 0 0 24px;
  padding: 14px 18px 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.glance-title {
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
}

th,
td {
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--panel);
  font-weight: 600;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

.meta {
  margin-top: 44px;
  padding-top: 16px;
  font-size: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}

.pager a {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.pager a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.pager span {
  display: block;
  margin-bottom: 2px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.pager-next {
  text-align: right;
}

.article-list {
  padding: 0 !important;
  list-style: none;
}

.article-list li {
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.article-list a {
  font-size: 1.05rem;
  font-weight: 600;
}

.article-list p {
  margin: 4px 0 0;
  color: var(--muted);
}

/* On this page */

.toc {
  position: sticky;
  top: calc(var(--head-height) + 28px);
  align-self: start;
  max-height: calc(100vh - var(--head-height) - 56px);
  overflow-y: auto;
  font-size: 13.5px;
}

.toc-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc a {
  display: block;
  padding: 4px 0 4px 12px;
  color: var(--muted);
  line-height: 1.4;
}

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

.toc code {
  background: none;
  padding: 0;
}

.site-foot {
  padding: 22px 24px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

.site-foot p {
  margin: 0;
}

/* Smaller screens */

@media (max-width: 1180px) {
  .article-wrap {
    grid-template-columns: minmax(0, 780px);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 860px) {
  .site-head {
    gap: 12px;
    padding: 0 16px;
  }

  .brand-sub {
    display: none;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-full {
    display: none;
  }

  .nav-label {
    display: block;
    padding: 8px 12px;
    font-weight: 600;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
  }

  .nav-check:focus-visible + .nav-label {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .nav-check:checked ~ .nav-full {
    display: block;
    margin-top: 12px;
  }

  main {
    padding: 22px 16px 48px;
  }

  h1 {
    font-size: 1.65rem;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager-next {
    text-align: left;
  }
}

@media print {
  .site-head,
  .sidebar,
  .toc,
  .pager,
  .site-foot {
    display: none;
  }

  .shell,
  .article-wrap {
    display: block;
  }
}
