/* The docs (docs/, built by tools/build-docs.py): a sidebar, the article and
   an "On this page" list, under the site's nav drawn as a solid bar. */

.docs-page { background: #fff; }
.docs-page .nav { background: #000; padding-bottom: 0; }
.docs-page .nav-bg { display: none; }

/* The sidebar is a fixed column down the left, the whole height of the
   window; the article, "On this page" and the footer sit to its right. */
.docs-page { --side-w: 264px; }

.docs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 224px;
  max-width: calc(1180px + var(--side-w));
  padding: var(--nav-h) 0 0 var(--side-w);
  color: #1d1d1f;
}

.docs-page .footer { margin-left: var(--side-w); }

/* ---- sidebar ---- */
.docs-side {
  position: fixed;
  top: var(--nav-h);
  bottom: 0;
  left: 0;
  z-index: 5;
  width: var(--side-w);
  overflow-y: auto;
  padding: 28px 20px 48px 28px;
  border-right: 1px solid #e8e8ed;
  background: #fff;
}

.docs-search { position: relative; }

/* A white field with a magnifier, like the site's form fields, and the "/"
   shortcut shown at its end until the field is used. */
.docs-search input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  padding: 9px 34px 9px 36px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.6' cy='6.6' r='5.1' fill='none' stroke='%236e6e73' stroke-width='1.6'/%3E%3Cpath d='M10.4 10.4L14.6 14.6' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 12px center / 15px 15px;
  color: #1d1d1f;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.docs-search input::placeholder { color: #6e6e73; }
.docs-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.docs-search input:hover { border-color: #86868b; }

.docs-search input:focus {
  outline: none;
  border-color: #1d1d1f;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.docs-search-key {
  position: absolute;
  top: 50%;
  right: 10px;
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid #d2d2d7;
  border-radius: 5px;
  font-family: inherit;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  color: #6e6e73;
  transform: translateY(-50%);
  pointer-events: none;
}

.docs-search input:focus ~ .docs-search-key,
.docs-search input:not(:placeholder-shown) ~ .docs-search-key { display: none; }

.docs-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  z-index: 6;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  border: 1px solid #d2d2d7;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.docs-results a {
  display: block;
  padding: 8px 10px;
  border-radius: 9px;
  color: #1d1d1f;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.docs-results small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: #6e6e73; }
.docs-results .active a { background: #f5f5f7; }
.docs-results .none { padding: 8px 10px; font-size: 14px; color: #6e6e73; }

.side-group h2 {
  margin: 26px 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #1d1d1f;
}

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

.side-group a {
  display: block;
  margin: 0 -10px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: #424245;
  text-decoration: none;
}

.side-group a:hover { color: #1d1d1f; background: #f5f5f7; }
.side-group a[aria-current="page"] { color: #1d1d1f; font-weight: 600; background: #f5f5f7; }

/* ---- the article ---- */
.docs-main { min-width: 0; padding: 28px clamp(20px, 4vw, 64px) 72px; }

.docs-top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.docs-crumbs { font-size: 13px; color: #6e6e73; }
.docs-crumbs a { color: #6e6e73; text-decoration: none; }
.docs-crumbs a:hover { color: #1d1d1f; text-decoration: underline; }
.docs-crumbs .sep { margin: 0 7px; }

.docs-menu {
  display: none;
  -webkit-appearance: none;
  appearance: none;
  padding: 6px 14px;
  border: 1px solid #d2d2d7;
  border-radius: 999px;
  background: #fff;
  color: #1d1d1f;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.docs-article { max-width: 780px; font-size: 17px; line-height: 1.6; }

.docs-article h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.docs-article .lede { margin: 0 0 36px; font-size: 21px; line-height: 1.45; color: #6e6e73; }

.docs-article h2,
.docs-article h3,
.docs-article h4 { scroll-margin-top: calc(var(--nav-h) + 20px); }

.docs-article h2 {
  margin: 52px 0 14px;
  padding-top: 28px;
  border-top: 1px solid #e8e8ed;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.docs-article h3 { margin: 36px 0 10px; font-size: 21px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.docs-article h4 { margin: 28px 0 8px; font-size: 17px; font-weight: 600; }
.docs-article .anchor { color: inherit; text-decoration: none; }
.docs-article .anchor:hover::after { content: " #"; color: #86868b; font-weight: 400; }

.docs-article p { margin: 0 0 18px; }
.docs-article a:not(.anchor) { color: #0066cc; text-decoration: none; }
.docs-article a:not(.anchor):hover { text-decoration: underline; }
.docs-article ul,
.docs-article ol { margin: 0 0 18px; padding-left: 1.4em; }
.docs-article li { margin: 5px 0; }
.docs-article li > ul,
.docs-article li > ol { margin: 4px 0 0; }
.docs-article strong { font-weight: 600; }
.docs-article hr { margin: 40px 0; border: 0; border-top: 1px solid #e8e8ed; }

.docs-article code {
  padding: 0.12em 0.36em;
  border-radius: 5px;
  background: #f5f5f7;
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, monospace;
  font-size: 0.85em;
}

.docs-article kbd {
  padding: 0.1em 0.4em;
  border: 1px solid #d2d2d7;
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.85em;
}

/* code blocks, in Xcode's light colours */
.docs-article .code { position: relative; margin: 0 0 22px; border-radius: 12px; background: #f5f5f7; }
.docs-article .code pre { margin: 0; padding: 16px 20px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.docs-article .code code { padding: 0; border-radius: 0; background: none; font-size: inherit; }
.code-title { padding: 12px 20px 0; font-size: 12px; font-weight: 600; color: #6e6e73; }

.code .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  -webkit-appearance: none;
  appearance: none;
  padding: 4px 10px;
  border: 1px solid #d2d2d7;
  border-radius: 999px;
  background: #fff;
  color: #424245;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.code:hover .copy,
.code .copy:focus-visible,
.code .copy.done { opacity: 1; }

.tok-kw { color: #9b2393; }
.tok-str { color: #c41a16; }
.tok-com { color: #5d6c79; }
.tok-num { color: #1c00cf; }
.tok-fn { color: #326d74; }
.tok-opt { color: #0b4f79; }
.tok-key { color: #0b4f79; }

/* tables */
.docs-article .table { margin: 0 0 24px; overflow-x: auto; }
.docs-article table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }

.docs-article th {
  padding: 0 14px 8px 0;
  border-bottom: 1px solid #d2d2d7;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  color: #6e6e73;
}

.docs-article td { padding: 10px 14px 10px 0; border-bottom: 1px solid #e8e8ed; vertical-align: top; }
.docs-article td:first-child code { white-space: nowrap; }

/* callouts */
.callout { margin: 0 0 22px; padding: 14px 18px; border-radius: 12px; background: #f5f5f7; font-size: 15px; line-height: 1.55; }
.callout p { margin: 0; }
.callout-label { margin-right: 4px; }
.callout.note .callout-label { color: #0066cc; }
.callout.tip .callout-label { color: #248a3d; }
.callout.warning { background: #fff4e5; }
.callout.warning .callout-label { color: #b64400; }

.docs-article blockquote { margin: 0 0 22px; padding: 2px 0 2px 18px; border-left: 3px solid #d2d2d7; color: #424245; }

/* cards on the docs home */
.docs-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0 28px; }

.docs-cards a {
  display: block;
  padding: 20px 22px;
  border-radius: 14px;
  background: #f5f5f7;
  color: #1d1d1f !important;
  text-decoration: none !important;
  transition: background-color 0.15s;
}

.docs-cards a:hover { background: #ebebf0; }
.docs-cards strong { display: block; margin-bottom: 4px; font-size: 17px; }
.docs-cards span { display: block; font-size: 14px; line-height: 1.45; color: #6e6e73; }

/* previous / next */
.docs-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 780px; margin-top: 60px; }

.docs-pager a {
  display: block;
  padding: 16px 20px;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  color: #1d1d1f;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s;
}

.docs-pager a:hover { border-color: #1d1d1f; }
.docs-pager span { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 400; color: #6e6e73; }
.docs-pager .next { grid-column: 2; text-align: right; }

/* on this page */
.docs-toc {
  position: sticky;
  top: var(--nav-h);
  align-self: start;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  padding: 34px 28px 40px 4px;
}

.docs-toc h2 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: #1d1d1f; }
.docs-toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid #e8e8ed; }

.docs-toc a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 13px;
  border-left: 1px solid transparent;
  font-size: 13px;
  line-height: 1.4;
  color: #6e6e73;
  text-decoration: none;
}

.docs-toc .toc-3 a { padding-left: 25px; }
.docs-toc a:hover { color: #1d1d1f; }
.docs-toc a.active { border-left-color: #1d1d1f; color: #1d1d1f; }

@media (max-width: 1120px) {
  .docs-page { --side-w: 248px; }
  .docs { grid-template-columns: minmax(0, 1fr); }
  .docs-toc { display: none; }
}

@media (max-width: 780px) {
  .docs-page { --side-w: 0px; }

  .docs-side {
    right: 0;
    z-index: 9;
    display: none;
    width: auto;
    border-right: 0;
  }

  .docs-side.open { display: block; }

  /* Menu and breadcrumbs stay under the nav, above the open menu, so the
     button that opened it is there to close it. */
  .docs-main { padding-top: 0; }

  .docs-top {
    position: sticky;
    top: var(--nav-h);
    z-index: 10;
    margin: 0 calc(-1 * clamp(20px, 4vw, 64px)) 20px;
    padding: 12px clamp(20px, 4vw, 64px);
    border-bottom: 1px solid #e8e8ed;
    background: #fff;
  }

  .docs-side { top: calc(var(--nav-h) + 58px); }
  .docs-menu { display: inline-block; }
  .docs-search-key { display: none; }
  .docs-cards,
  .docs-pager { grid-template-columns: minmax(0, 1fr); }
  .docs-pager .next { grid-column: 1; }
  .docs-article .lede { font-size: 19px; }
}
