/* Corvid docs pages. Loaded after the landing page's style.css, which gives the colours, font, header and footer.
   This file is the source; tools/build-docs.mjs copies it to docs/docs.css. */

.docs { --header: 86px; --mono: ui-monospace, "Cascadia Code", Consolas, monospace; }
.nav a[aria-current] { color: #fff; box-shadow: 0 2px 0 var(--violet); }
html { scroll-padding-top: calc(var(--header) + 16px); }

.docs-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 220px;
  gap: 48px;
  align-items: start;
  max-width: 1440px;
  padding-top: 32px;
  padding-bottom: 72px;
}
.docs-side, .docs-toc { position: sticky; top: calc(var(--header) + 24px); }
.docs-side { z-index: 10; } /* sticky makes a stacking context: keep the search results above the page */
/* only the tree and the outline scroll, so the search results can spill over the page */
.tree, .docs-toc { max-height: calc(100vh - var(--header) - 40px); overflow-y: auto; overscroll-behavior: contain; }
.tree { max-height: calc(100vh - var(--header) - 110px); }

/* ---------- search ---------- */

.search { position: relative; margin-bottom: 20px; }
.search input {
  width: 100%;
  padding: 10px 38px 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; border-radius: 10px; }
.search input:not(:placeholder-shown) + kbd { display: none; }
.search kbd { position: absolute; right: 10px; top: 10px; color: var(--text-3); pointer-events: none; }
.hits {
  position: absolute;
  z-index: 30;
  left: 0;
  width: min(420px, calc(100vw - 32px));
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
}
.hits li a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.hits li a b { display: block; font-weight: 600; }
.hits li a small { display: block; color: var(--text-3); font-size: 13px; line-height: 1.45; }
.hits li a mark { background: rgba(143, 124, 255, .3); color: #fff; border-radius: 3px; }
.hits li[aria-selected="true"] a, .hits li a:hover { background: rgba(143, 124, 255, .16); }
.hits .empty { padding: 8px 10px; color: var(--text-3); font-size: 14px; }

/* ---------- nav tree ---------- */

.tree { font-size: 14.5px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree-home { display: block; padding: 5px 10px; margin-bottom: 10px; border-radius: 8px; color: var(--text-2); font-weight: 600; }
.tree-sec { margin-bottom: 14px; }
.tree-title { display: block; padding: 0 10px 4px; color: var(--text); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.tree-sec ul a { display: block; padding: 4px 10px; border-left: 2px solid var(--line); color: var(--text-2); }
.tree a:hover { color: #fff; }
.tree a[aria-current="page"] { color: #fff; border-left-color: var(--violet); background: rgba(143, 124, 255, .1); border-radius: 0 8px 8px 0; }
.tree-home[aria-current="page"] { background: rgba(143, 124, 255, .1); }
.tree-btn {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tree-btn .icon { transition: transform .2s; }
.tree-btn[aria-expanded="true"] .icon { transform: rotate(90deg); }

/* ---------- on this page ---------- */

.toc h2 { margin: 0 0 10px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--text); }
.toc ul { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.toc a { display: block; padding: 3px 0; color: var(--text-3); line-height: 1.4; }
.toc a:hover { color: #fff; }
.toc .toc-3 a { padding-left: 14px; }

/* ---------- the page ---------- */

.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; margin: 0 0 18px; padding: 0; font-size: 14px; color: var(--text-3); }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--text-3); }
.crumbs a { color: var(--text-2); }

.prose { max-width: 760px; color: #d9dbea; font-size: 16.5px; line-height: 1.7; overflow-wrap: anywhere; }
.prose h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 800; letter-spacing: -.03em; color: var(--text); margin-bottom: 18px; }
.prose h2 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin: 44px 0 12px; padding-top: 4px; color: var(--text); }
.prose h3 { font-size: 19px; font-weight: 700; margin: 30px 0 8px; color: var(--text); }
.prose h4, .prose h5, .prose h6 { font-size: 16.5px; margin: 24px 0 6px; color: var(--text); }
.prose :is(h2, h3, h4, h5, h6) { position: relative; }
.anchor { margin-left: 8px; color: var(--text-3); font-weight: 400; opacity: 0; transition: opacity .15s; }
.prose :is(h2, h3, h4, h5, h6):hover .anchor, .anchor:focus-visible { opacity: 1; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 24px; }
.prose li { margin: 4px 0; }
.prose li > p { margin: 0 0 6px; }
.prose li::marker { color: var(--violet-2); }
.prose strong { color: var(--text); font-weight: 700; }
.prose a { color: var(--violet-2); text-decoration: underline; text-decoration-color: rgba(177, 140, 255, .45); text-underline-offset: 3px; }
.prose a:hover { color: #d2c2ff; text-decoration-color: currentColor; }
.prose .ext::after { content: "↗"; margin-left: 2px; font-size: .8em; }
.source-ref { border-bottom: 1px dotted var(--text-3); }
.prose code { padding: 1px 6px; border-radius: 6px; background: rgba(143, 124, 255, .12); color: #e6e1ff; font-size: .9em; }
.prose hr { border: 0; border-top: 1px solid var(--line-2); margin: 32px 0; }
.prose img { margin: 18px 0; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
.prose blockquote { margin: 0 0 16px; padding: 4px 18px; border-left: 3px solid var(--line-2); color: var(--text-2); }

pre.code {
  margin: 0 0 18px;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #0a0e19;
  font-size: 14px;
  line-height: 1.6;
  tab-size: 2;
}
.prose pre.code code { padding: 0; background: none; color: #dfe3f3; font-size: inherit; overflow-wrap: normal; }
/* token colours, each 4.5:1 or better on the code background */
.tok-comment { color: #8c93ad; font-style: italic; }
.tok-string { color: #9be7a8; }
.tok-keyword { color: #c4a8ff; }
.tok-number { color: #ffc27a; }
.tok-var { color: #7fd8ff; }
.tok-command { color: #ffffff; font-weight: 600; }

.table-wrap { margin: 0 0 20px; overflow-x: auto; border: 1px solid var(--line-2); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: normal; }
.prose th { background: var(--panel-2); color: var(--text); font-weight: 700; }
.prose tr:last-child td { border-bottom: 0; }
.prose td { min-width: 9ch; }
.prose .al-center { text-align: center; }
.prose .al-right { text-align: right; }

.callout { margin: 0 0 18px; padding: 12px 16px 2px; border: 1px solid var(--line-2); border-left: 4px solid var(--c); border-radius: 10px; background: color-mix(in srgb, var(--c) 9%, var(--bg)); }
.callout-label { margin: 0 0 2px !important; color: var(--c); font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
/* the label sits on its own line, so the sentence after "WARNING:" starts with a capital */
.callout-label + p::first-letter { text-transform: uppercase; }
.callout.note { --c: #7fb2ff; }
.callout.caution { --c: #f5b13d; }
.callout.warning { --c: #ff7b7b; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 760px; margin-top: 56px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--line-2); border-radius: 12px; color: var(--text); font-weight: 600; }
.pager a:hover { border-color: var(--violet); }
.pager span { display: block; color: var(--text-3); font-size: 13px; font-weight: 500; }
.pager-next { text-align: right; grid-column: 2; }

.notfound { padding-top: 90px; padding-bottom: 120px; }
.notfound h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; margin-bottom: 12px; }
.notfound p { color: var(--text-2); }
.notfound .pill { margin: 12px 12px 0 0; }

/* ---------- smaller screens ---------- */

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 230px minmax(0, 1fr); gap: 40px; }
  .docs-toc { display: none; }
}
@media (max-width: 860px) {
  .docs { --header: 68px; }
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .docs-side { position: static; }
  .tree { max-height: none; overflow: visible; }
  .js .tree-btn { display: flex; }
  .js .tree { display: none; margin-top: 10px; padding: 12px 6px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); }
  .js .tree.open { display: block; }
  .search { margin-bottom: 12px; }
  .search kbd { display: none; }
}
@media (max-width: 640px) {
  .prose { font-size: 16px; }
  .prose h2 { font-size: 21px; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .tree-btn .icon, .anchor { transition: none; }
}
