/* Docs layout. Nav, footer, type and colors come from assets/site.css; this file only lays out
   the docs column the way tos.html does: contents on the left, the article on the right, a hairline between. */

.docs-shell {
  max-width: var(--col);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "side bar" "side main";
}
.docs-bar { grid-area: bar; }
.docs-sidebar { grid-area: side; }
.docs-shell > main.docs-main { grid-area: main; }
.docs-shell > main.docs-main { max-width: none; margin: 0; min-width: 0; }

/* Contents */
.docs-sidebar { position: relative; border-right: 1px solid var(--line); }
.docs-sidebar > nav {
  position: sticky; top: var(--nav-h);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 36px var(--space-lg) var(--space-xl) 28px;
  scrollbar-width: thin;
}
.docs-nav-group + .docs-nav-group { margin-top: var(--space-lg); }
.docs-nav-group__title { margin-bottom: var(--space-2xs); font-size: var(--fs-meta); font-weight: 600; color: var(--meta); }
.docs-nav-list a {
  position: relative; display: block; padding: 5px 0;
  font-size: 14.5px; line-height: 1.45; color: var(--muted);
  transition: color 0.15s ease;
}
.docs-nav-list a:hover, .docs-nav-list a[aria-current] { color: var(--text); }
.docs-nav-list > li > a[aria-current="page"] { font-weight: 600; }
/* Section being read: a short stroke over the column line, like the terms contents */
.docs-nav-sub { margin: 2px 0 var(--space-xs); }
.docs-nav-sub a { padding: 4px 0 4px var(--space-sm); font-size: 13.5px; }
.docs-nav-sub .toc-sub a { padding-left: 24px; font-size: 13px; }
.docs-nav-sub a::before {
  content: ""; position: absolute; top: 5px; bottom: 5px;
  right: calc(-1 * var(--space-lg) - 1.5px); width: 2px;
  background: var(--accent); opacity: 0; transition: opacity 0.15s ease;
}
.docs-nav-sub a[aria-current="true"]::before { opacity: 1; }

/* Search row */
.docs-bar { display: flex; justify-content: flex-end; gap: var(--space-xs); padding: 24px 28px 0 clamp(32px, 4vw, 56px); }
.docs-search-trigger, .docs-bar__menu {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  min-height: 34px; padding: 6px 15px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper);
  font-size: 13px; color: var(--muted); cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}
.docs-search-trigger:hover, .docs-bar__menu:hover { border-color: var(--text); color: var(--text); }
.docs-bar__menu { display: none; }

/* Article */
.docs-article {
  padding: 28px 28px clamp(72px, 9vw, 120px) clamp(32px, 4vw, 56px);
  font-size: 15.5px; line-height: 1.85; color: var(--muted);
}
.docs-article > * { max-width: 68ch; }
.docs-article__head { padding-bottom: 32px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.docs-breadcrumb { display: flex; gap: var(--space-xs); margin-bottom: var(--space-md); font-size: var(--fs-meta); color: var(--meta); }
.docs-breadcrumb a:hover { color: var(--text); }
.docs-breadcrumb strong { font-weight: 400; }
.docs-article h1 { color: var(--text); font-size: clamp(32px, 3.6vw, 44px); line-height: 1.15; }
.docs-lead { margin-top: 14px; font-family: var(--font-serif); font-size: 16px; line-height: 1.6; color: var(--muted); }

.docs-article h2, .docs-article h3 { position: relative; color: var(--text); scroll-margin-top: calc(var(--nav-h) + 16px); }
.docs-article h2 { margin-top: 2.4em; margin-bottom: 0.6em; font-size: 22px; line-height: 1.35; }
.docs-article h3 { margin-top: 1.8em; margin-bottom: 0.4em; font-size: 16.5px; }
.docs-article__head + * { margin-top: 0; }
.docs-heading-anchor { margin-left: var(--space-xs); color: var(--meta); font-family: var(--font); font-weight: 400; opacity: 0; transition: opacity 0.15s ease; }
.docs-article h2:hover .docs-heading-anchor, .docs-article h3:hover .docs-heading-anchor, .docs-heading-anchor:focus-visible { opacity: 1; }

.docs-article p + p, .docs-article p + ul, .docs-article p + ol, .docs-article ul + p, .docs-article ol + p { margin-top: 1em; }
.docs-article ul, .docs-article ol { margin-top: 0.6em; }
.docs-article li + li { margin-top: 0.35em; }
.docs-article strong { color: var(--text); font-weight: 600; }
.docs-article a:not([class]) { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--link-line); }
.docs-article a:not([class]):hover { text-decoration-color: var(--text); text-decoration-thickness: 1.5px; }
.docs-article code, .docs-article kbd { font-family: var(--mono); font-size: 0.86em; color: var(--text); }
.docs-article code { padding: 1px 5px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; }
.docs-article kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; text-align: center; background: var(--paper); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; line-height: 1.6; }
.docs-article blockquote { margin: 1.4em 0; padding: 2px 0 2px var(--space-md); border-left: 2px solid var(--text); }

/* Tables */
.doc-table { max-width: none; margin-top: 1.2em; overflow-x: auto; }
.doc-table table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.65; }
.doc-table th, .doc-table td { padding: 10px 14px 10px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc-table th { font-size: var(--fs-meta); font-weight: 600; color: var(--meta); border-bottom-color: var(--line-strong); white-space: nowrap; }
.doc-table td:first-child { color: var(--text); }

/* Numbered steps */
.doc-steps { padding: 0; list-style: none; counter-reset: doc-steps; }
.docs-article .doc-steps > li { position: relative; margin: 0; padding: 22px 0 22px 44px; border-bottom: 1px solid var(--line); counter-increment: doc-steps; }
.doc-steps > li::before { content: counter(doc-steps); position: absolute; left: 0; top: 16px; font-family: var(--font-serif); font-size: 24px; color: var(--meta); }
.docs-article .doc-steps__title { margin: 0 0 0.4em; font-size: 17px; }

/* Page list on the docs home */
.doc-index { max-width: none; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.docs-article .doc-index > li { margin: 0; border-bottom: 1px solid var(--line); }
.doc-index > li:nth-child(odd) { border-right: 1px solid var(--line); }
.doc-index__link { display: block; height: 100%; padding: 20px 20px 20px 0; }
.doc-index > li:nth-child(even) .doc-index__link { padding-left: 20px; }
.doc-index__title { display: block; color: var(--text); font-family: var(--font-serif); font-size: 17px; }
.doc-index__desc { display: block; margin-top: 4px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.doc-index__link:hover .doc-index__title { text-decoration: underline; text-underline-offset: 4px; }

/* Prompt and code boxes */
.prompt-box, .code-block { margin-top: 1.2em; background: var(--paper-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.prompt-box__head, .code-block__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: 8px 14px; border-bottom: 1px solid var(--line); }
.prompt-box__label, .code-block__lang { font-size: var(--fs-meta); color: var(--meta); }
.prompt-box__body { padding: 14px; font-size: 14.5px; line-height: 1.7; color: var(--text); white-space: pre-wrap; }
.code-block pre { margin: 0; padding: 14px; overflow-x: auto; font-size: 13px; line-height: 1.65; }
.code-block pre code { padding: 0; background: none; border: 0; font-size: inherit; }
.copy-btn { padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); font-size: 12px; color: var(--muted); cursor: pointer; }
.copy-btn:hover, .copy-btn.is-copied { border-color: var(--text); color: var(--text); }

/* Previous and next */
.doc-pager { max-width: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); margin-top: 56px; padding-top: var(--space-lg); border-top: 1px solid var(--line); }
.doc-pager__link { display: block; }
.doc-pager__link--next { grid-column: 2; text-align: right; }
.doc-pager__dir { display: block; font-size: var(--fs-meta); color: var(--meta); }
.doc-pager__title { display: block; margin-top: 2px; color: var(--text); font-family: var(--font-serif); font-size: 17px; }
.doc-pager__link:hover .doc-pager__title { text-decoration: underline; text-underline-offset: 4px; }

/* Search */
.search-modal { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 20px 20px; background: rgba(255, 255, 255, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.search-modal__dialog { width: min(100%, 560px); max-height: 70vh; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--paper-shadow); overflow: hidden; }
.search-modal__bar { display: flex; align-items: center; gap: var(--space-sm); padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--meta); }
.search-modal__input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--text); }
.search-modal__input::-webkit-search-cancel-button { display: none; }
.search-modal__close { padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); font-size: 12px; color: var(--muted); cursor: pointer; }
.search-modal__results { overflow-y: auto; padding: 6px; }
.search-modal__empty { padding: 24px 12px; font-size: 14px; color: var(--meta); text-align: center; }
.search-result { display: block; padding: 10px 12px; border-radius: 6px; }
.search-result[aria-selected="true"], .search-result:hover { background: var(--paper-2); }
.search-result__top { display: flex; gap: var(--space-xs); font-size: 14px; color: var(--text); }
.search-result__cat { flex: none; color: var(--meta); }
.search-result__snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }

@media (max-width: 900px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "side" "main"; }
  .docs-sidebar { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .docs-sidebar.is-open { display: block; }
  .docs-sidebar > nav { position: static; max-height: none; padding: 16px var(--cell-pad) 24px; }
  .docs-nav-sub a::before { display: none; }
  .docs-bar { justify-content: space-between; padding: 16px var(--cell-pad) 0; }
  .docs-bar__menu { display: inline-flex; }
  .docs-article { padding: 20px var(--cell-pad) 72px; }
}
@media (max-width: 560px) {
  .doc-index { grid-template-columns: minmax(0, 1fr); }
  .doc-index > li:nth-child(odd) { border-right: 0; }
  .doc-index > li:nth-child(even) .doc-index__link { padding-left: 0; }
  .doc-pager { grid-template-columns: minmax(0, 1fr); }
  .doc-pager__link--next { grid-column: 1; }
}

/* Nightly download: the prerelease notice sits right beside the button */
.docs-article .nightly-download { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); margin-top: 1em; }
.docs-article .nightly-download p { margin: 0; }
.nightly-download__notice { font-size: var(--fs-small); color: var(--text); }
.nightly-download__status:empty { display: none; }
.nightly-download__status { flex-basis: 100%; font-size: var(--fs-small); color: var(--meta); }
