/**
  * Documentation pages at /docs
  */

.docs-page {
  --docs-nav-top: 96px;
  --docs-text-color: #1f2937;
  --docs-muted-color: #6b7280;
  --docs-hover-bg-color: #26262608;
  --docs-active-bg-color: #59b20014;
  --docs-code-bg-color: #f3f4f6;
  background-color: #fbfdff;
  color: var(--docs-text-color);
}

/* footer.html sets #body-content's top margin under the fixed navbar. */
.docs-layout {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
}

/** Sidebar */

.docs-sidebar {
  position: sticky;
  top: var(--docs-nav-top);
  flex: none;
  width: 17rem;
  max-height: calc(100vh - var(--docs-nav-top));
  overflow-y: auto;
  padding: 1rem 0.5rem 3rem 0;
  font-size: 0.875rem;
}

.docs-search-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 1.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: white;
  color: var(--docs-muted-color);
  box-shadow: 0 1px 2px #0000000d;
  transition: border-color 0.2s;
}

.docs-search-button:hover {
  border-color: #d1d5db;
}

.docs-search-button svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.docs-search-button span {
  flex: 1;
  text-align: left;
}

.docs-page kbd {
  padding: 0 0.375rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--docs-muted-color);
}

.docs-nav-category {
  margin-bottom: 1.25rem;
}

.docs-nav-category h5 {
  margin: 0 0 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--docs-text-color);
}

.docs-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3125rem 0.75rem;
  border-radius: 6px;
  color: #4b5563;
  line-height: 1.35;
}

.docs-nav a:hover {
  background-color: var(--docs-hover-bg-color);
  color: var(--docs-text-color);
}

.docs-nav li.active > a {
  background-color: var(--docs-active-bg-color);
  color: var(--docs-text-color);
  font-weight: 600;
}

.docs-nav-chevron {
  width: 0.875rem;
  height: 0.875rem;
  flex: none;
  color: #9ca3af;
  transition: transform 0.15s;
}

.docs-nav li.open > a .docs-nav-chevron {
  transform: rotate(90deg);
}

.docs-nav-children {
  margin: 0.125rem 0 0.125rem 0.75rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-color);
}

/* The current page's sections. */
.docs-nav-sections {
  margin: 0.25rem 0 0.375rem 0.75rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-color);
  font-size: 0.8125rem;
}

.docs-nav-sections a {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  color: var(--docs-muted-color);
}

.docs-nav-sections li.level-3 a {
  padding-left: 1.5rem;
}

.docs-nav-sections a.current {
  color: var(--green-color);
  font-weight: 500;
}

/** Article */

.docs-article {
  flex: 1;
  min-width: 0;
  max-width: 48rem;
  padding: 1.5rem 0 4rem;
}

.docs-menu-button {
  display: none;
}

.docs-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--green-color);
}

.docs-breadcrumb > * + *::before {
  content: "/";
  margin-right: 0.5rem;
  color: #d1d5db;
}

.docs-breadcrumb a:hover {
  text-decoration: underline;
}

.docs-title {
  margin: 0.375rem 0 1.5rem;
  font-size: 2.25rem;
  line-height: 1.2;
  font-weight: 700;
  color: #111827;
}

/** Page content, rendered from Markdown */

.docs-content {
  font-size: 1rem;
  line-height: 1.75;
}

.docs-content > * + * {
  margin-top: 1rem;
}

.docs-content h2,
.docs-content h3 {
  scroll-margin-top: calc(var(--docs-nav-top) + 1rem);
  color: #111827;
  font-weight: 600;
}

.docs-content h2 {
  margin-top: 2.5rem;
  font-size: 1.5rem;
  line-height: 1.3;
}

.docs-content h3 {
  margin-top: 2rem;
  font-size: 1.1875rem;
}

.docs-content h4 {
  margin-top: 1.5rem;
  font-weight: 600;
}

.docs-content a {
  color: var(--link-text-color);
}

.docs-content a:hover {
  text-decoration: underline;
}

.docs-content strong {
  font-weight: 600;
  color: #111827;
}

.docs-content ul,
.docs-content ol {
  padding-left: 1.5rem;
}

.docs-content ul {
  list-style: disc;
}

.docs-content ol {
  list-style: decimal;
}

.docs-content ul ul {
  list-style: circle;
}

.docs-content li + li,
.docs-content li > ul,
.docs-content li > ol {
  margin-top: 0.375rem;
}

.docs-content li > p + p {
  margin-top: 0.5rem;
}

.docs-content code {
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  background-color: var(--docs-code-bg-color);
  font-size: 0.875em;
  white-space: nowrap;
}

.docs-content pre {
  overflow-x: auto;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background-color: #1f2328;
  color: #e6edf3;
  font-size: 0.875rem;
  line-height: 1.6;
}

.docs-content pre code {
  padding: 0;
  background: none;
  font-size: inherit;
  white-space: pre;
}

.docs-content figure {
  margin: 1.5rem 0;
  text-align: center;
}

.docs-content figure img,
.docs-content figure video {
  display: inline-block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.docs-content figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--docs-muted-color);
}

.docs-content img {
  display: inline;
  max-width: 100%;
}

.docs-content table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.docs-content th,
.docs-content td {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-color);
  text-align: left;
  vertical-align: top;
}

.docs-content th {
  background-color: #f9fafb;
  font-weight: 600;
}

.docs-content blockquote {
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--border-color);
  color: #4b5563;
}

.docs-content hr {
  border-color: var(--border-color);
}

/* GitHub style callouts: > [!NOTE] */
.docs-content .callout {
  padding: 0.875rem 1.125rem;
  border: 1px solid;
  border-left-width: 4px;
  border-radius: 8px;
  color: var(--docs-text-color);
}

.docs-content .callout::before {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.docs-content .callout > * + * {
  margin-top: 0.5rem;
}

.docs-content .callout-note {
  border-color: #3b89f733;
  border-left-color: var(--blue-color);
  background-color: #3b89f70d;
}

.docs-content .callout-note::before {
  content: "Note";
  color: var(--blue-color);
}

.docs-content .callout-tip {
  border-color: #59b20033;
  border-left-color: var(--green-color);
  background-color: #59b2000d;
}

.docs-content .callout-tip::before {
  content: "Tip";
  color: #3f8000;
}

.docs-content .callout-important {
  border-color: #8b5cf633;
  border-left-color: #8b5cf6;
  background-color: #8b5cf60d;
}

.docs-content .callout-important::before {
  content: "Important";
  color: #7c3aed;
}

.docs-content .callout-warning,
.docs-content .callout-caution {
  border-color: #faa73e4d;
  border-left-color: var(--orange-color);
  background-color: #faa73e12;
}

.docs-content .callout-warning::before {
  content: "Warning";
  color: #b86e0b;
}

.docs-content .callout-caution {
  border-color: #d9534f33;
  border-left-color: var(--danger-color);
  background-color: #d9534f0d;
}

.docs-content .callout-caution::before {
  content: "Caution";
  color: var(--danger-color);
}

/* Footnotes hold the Windows and Linux differences. */
.docs-content .footnotes {
  margin-top: 3rem;
  font-size: 0.875rem;
  color: var(--docs-muted-color);
}

.docs-content .footnotes hr {
  margin-bottom: 1rem;
}

.docs-content .footnotes li + li {
  margin-top: 0.25rem;
}

.docs-content .footnote-ref {
  margin-left: 0.125rem;
  font-size: 0.75em;
  text-decoration: none;
}

.docs-content .footnote-backref {
  text-decoration: none;
}

.docs-content [id^="fn:"],
.docs-content [id^="fnref:"] {
  scroll-margin-top: calc(var(--docs-nav-top) + 1rem);
}

.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
}

.docs-pager a {
  display: flex;
  flex-direction: column;
  padding: 0.875rem 1.125rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: white;
  font-weight: 600;
  transition: border-color 0.2s;
}

.docs-pager a:hover {
  border-color: var(--green-color);
}

.docs-pager a span {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--docs-muted-color);
}

.docs-pager-next {
  grid-column: 2;
  text-align: right;
}

/** Search dialog */

.docs-search[hidden] {
  display: none;
}

.docs-search {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 1rem 1rem;
}

.docs-search-backdrop {
  position: absolute;
  inset: 0;
  background-color: #11182766;
}

.docs-search-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 40rem;
  max-height: 70vh;
  border-radius: 12px;
  background-color: white;
  box-shadow: 0 20px 50px #0000004d;
  overflow: hidden;
}

.docs-search-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.docs-search-field svg {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  color: var(--docs-muted-color);
}

.docs-search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  font-size: 1.0625rem;
  background: transparent;
}

.docs-search-field input::-webkit-search-cancel-button {
  display: none;
}

.docs-search-field kbd {
  cursor: pointer;
}

.docs-search-results {
  overflow-y: auto;
}

.docs-search-results:empty {
  display: none;
}

.docs-search-results a {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.docs-search-results li[aria-selected="true"] a {
  background-color: var(--docs-active-bg-color);
}

.docs-search-result-section {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green-color);
}

.docs-search-result-title {
  font-weight: 600;
  color: #111827;
}

.docs-search-result-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.875rem;
  color: #4b5563;
}

.docs-search-results mark {
  background-color: #59b20033;
  color: inherit;
  border-radius: 2px;
}

.docs-search-status {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--docs-muted-color);
}

.docs-search-status:empty {
  display: none;
}

/** Error page */

.docs-error {
  padding-top: 4rem;
  padding-bottom: 6rem;
}

.docs-error-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.docs-error-actions a {
  color: var(--link-text-color);
}

/** Narrow screens: the sidebar slides in from the left */

@media (max-width: 960px) {
  .docs-layout {
    display: block;
  }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    width: min(20rem, 85vw);
    max-height: none;
    padding: 1.25rem 1rem 3rem;
    background-color: white;
    box-shadow: 0 0 40px #00000033;
    transform: translateX(-105%);
    transition: transform 0.2s;
  }

  .docs-page.docs-menu-open .docs-sidebar {
    transform: none;
  }

  .docs-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    font-size: 0.875rem;
    font-weight: 500;
  }

  .docs-menu-button svg {
    width: 1rem;
    height: 1rem;
  }

  .docs-title {
    font-size: 1.875rem;
  }

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

  .docs-pager-next {
    grid-column: 1;
  }
}
