/* The public site: the home page and the docs. One hand-written
   stylesheet, no build step and no JavaScript needed to read a page. Black on
   white, reversed in dark mode, set in one monospace face. `/assets/geist-mono-400.c58f6f34386a5c54.ttf` and
   `/assets/geist-mono-600.d58b5dd14edeae00.ttf` are replaced with the fonts' content-hashed URLs when the
   site is built (see `site/mod.rs`). */

@font-face {
  font-family: "Geist Mono";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/assets/geist-mono-400.c58f6f34386a5c54.ttf") format("truetype");
}
@font-face {
  font-family: "Geist Mono";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/assets/geist-mono-600.d58b5dd14edeae00.ttf") format("truetype");
}

:root {
  color-scheme: light dark;
  --paper: #fff;
  --paper-2: #f5f5f5;
  --ink: #0a0a0a;
  --soft: #4a4a4a;
  --line: #dadada;
  --line-strong: #b8b8b8;
  --mark: rgb(156 76 8 / 0.3);
  --hatch: repeating-linear-gradient(135deg, transparent 0 3px, rgb(0 0 0 / 0.05) 3px 4px);
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #000;
    --paper-2: #141414;
    --ink: #f5f5f5;
    --soft: #a0a0a0;
    --line: #404040;
    --line-strong: #5a5a5a;
    --mark: rgb(230 170 90 / 0.35);
    --hatch: repeating-linear-gradient(135deg, transparent 0 3px, rgb(255 255 255 / 0.07) 3px 4px);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }
code, pre, kbd { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; padding: 0.4rem 0.7rem; background: var(--paper); border: 1px solid var(--ink); }
/* The Oak mark beside the name. The image colours itself for light or dark. */
.mark { width: 1.25em; height: 1.25em; margin-right: 0.15em; vertical-align: -0.28em; }

/* ---- Home ------------------------------------------------------------- */

/* One centred column: a paragraph, the install command, three links, the
   tree, and the footer at the bottom of the window. The tree is a
   plain rectangular crop of the drawing (the oak and the ground under it). `home.js` lays a canvas over
   the image and moves the dots; the canvas reads the image's object-position,
   so change the crop here. */
.home {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.75;
}
/* The gaps are sized from the window's height, so on a short window they
   close up and the footer stays on the first screen. */
.home-copy { width: 100%; max-width: 42rem; padding: clamp(1.5rem, 6vh, 4rem) 1.5rem 0; }
/* The paragraph. Its opening question is the page's heading, set inline so
   the two sentences read as one block of ordinary text. */
.home-text { max-width: 30rem; margin: 0 auto; text-wrap: pretty; }
.home-text h1, .home-text p { display: inline; margin: 0; font: inherit; }
.home-install {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 22rem;
  margin: clamp(1.1rem, 4vh, 2.5rem) auto 0;
  padding: 0.5rem 0.5rem 0.5rem 0.85rem;
  border: 1px solid var(--line-strong);
  font-size: 0.8125rem;
  line-height: 1.6;
  text-align: left;
}
.home-cmd { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow-x: auto; }
.home-btn {
  flex: none;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}
.home-btn:hover { background: var(--ink); color: var(--paper); }
.home-copy .home-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 2rem; margin: clamp(1.1rem, 3.5vh, 2.25rem) 0 0; }
.home-links a { font-weight: 600; }
/* The tree takes whatever height the window has left, up to a limit, so the
   page fills one screen without scrolling where it can. At its natural shape
   (1.47 wide to 1 tall) the crop runs from just above the crown to the grass
   in front of it; when the window is too narrow for that width the box gets
   taller instead and shows more sky. */
.home-tree {
  position: relative;
  flex: 1 1 0;
  min-height: 11rem;
  max-height: 60vh;
  max-width: 100%;
  aspect-ratio: 147 / 100;
  margin: clamp(1.1rem, 4vh, 2.5rem) 0 clamp(0.5rem, 2vh, 1.5rem);
  overflow: hidden;
}
.home-tree img, .home-tree canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.home-tree img { object-fit: cover; object-position: 50% 86.5%; }
.home-tree canvas[hidden] { display: none; }
.home .foot { width: 100%; margin-top: auto; padding: clamp(0.75rem, 2.5vh, 2rem) 1.5rem clamp(1rem, 3vh, 2.25rem); border-top: 0; font-size: 0.75rem; }
@media (prefers-color-scheme: dark) {
  .home-tree img { filter: invert(1); }
}
/* On a phone the command has to shrink a little to fit beside its button. */
@media (max-width: 26rem) {
  .home-install { font-size: 0.75rem; }
}

/* ---- Shared chrome ---------------------------------------------------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}
.top a { text-decoration: none; }
.top-brand { font-weight: 600; }
.top-nav { display: flex; gap: 1.75rem; font-size: 0.8125rem; color: var(--soft); }
.top-nav a:hover, .top-nav [aria-current] { color: var(--ink); }
/* The footer of every page: two groups of links, centred. */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 2.5rem;
  padding: 2rem 1.5rem 2.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--soft);
}
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.25rem; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }

.plain { max-width: 30rem; margin: 0 auto; padding: 7rem 1.5rem; font-size: 0.875rem; line-height: 1.75; text-align: center; }
.plain h1 { margin: 0 0 1.25rem; font-size: 1rem; }

/* ---- Docs ------------------------------------------------------------- */

.docs-shell { display: flex; align-items: flex-start; }
.docs-sidebar { display: none; width: 15.5rem; flex: none; align-self: stretch; border-right: 1px solid var(--line); }
.docs-sidebar-inner { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: 2.5rem 1rem 3rem; }
.docs-nav-group { margin: 1.75rem 0 0.4rem; padding: 0 0.75rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); }
.docs-nav-group:first-child { margin-top: 0; }
.docs-nav-list { list-style: none; margin: 0; padding: 0; }
.docs-nav-link { display: block; padding: 0.3rem 0.75rem; font-size: 0.8125rem; color: var(--soft); text-decoration: none; border-left: 2px solid transparent; }
.docs-nav-link:hover { color: var(--ink); background-color: var(--paper-2); background-image: var(--hatch); }
.docs-nav-active, .docs-nav-active:hover { color: var(--ink); background-color: var(--paper-2); background-image: var(--hatch); border-left-color: var(--ink); font-weight: 600; }
.docs-main { flex: 1; min-width: 0; max-width: 46rem; padding: 2.5rem 1.5rem 5rem; }
.docs-rail { display: none; width: 14rem; flex: none; align-self: stretch; }
.docs-rail-inner { position: sticky; top: 0; padding: 3.75rem 1.5rem 2rem 0.5rem; max-height: 100vh; overflow-y: auto; }
.docs-rail-heading { margin: 0 0 0.6rem; padding-left: 0.75rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); }
.docs-toc-link { display: block; padding: 0.25rem 0 0.25rem 0.75rem; border-left: 2px solid transparent; font-size: 0.78rem; color: var(--soft); text-decoration: none; }
.docs-toc-link:hover { color: var(--ink); }
.docs-toc-active { color: var(--ink); border-left-color: var(--ink); }
@media (min-width: 40rem) { .docs-main { padding: 3rem 2.5rem 5rem; } }
@media (min-width: 64rem) { .docs-sidebar { display: block; } .docs-mobile-nav { display: none; } .docs-main { padding: 3.75rem 4.5rem 7rem; } }
@media (min-width: 80rem) { .docs-rail { display: block; } }

.docs-mobile-nav { margin-bottom: 1.5rem; border: 1px solid var(--line); }
.docs-mobile-nav summary { cursor: pointer; padding: 0.6rem 0.9rem; font-size: 0.8125rem; font-weight: 600; list-style: none; }
.docs-mobile-nav summary::-webkit-details-marker { display: none; }
.docs-mobile-nav-body { padding: 0.75rem 0.5rem; border-top: 1px solid var(--line); }

.docs-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.docs-title { margin: 0; font-size: 1.625rem; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.docs-title-actions { display: flex; gap: 0.4rem; flex: none; padding-top: 0.35rem; }
.docs-btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.65rem; font: inherit; font-size: 0.75rem; color: var(--soft); background: var(--paper); border: 1px solid var(--line); text-decoration: none; cursor: pointer; }
.docs-btn:hover { color: var(--ink); border-color: var(--ink); background-color: var(--paper-2); background-image: var(--hatch); }
.docs-lede { margin: 1rem 0 3rem; font-size: 0.9375rem; line-height: 1.7; color: var(--soft); }
@media (max-width: 39.99rem) { .docs-title { font-size: 1.375rem; } .docs-title-row { flex-direction: column; } }

.docs-prose { font-size: 0.875rem; line-height: 1.85; overflow-wrap: anywhere; min-width: 0; }
.docs-prose > :first-child { margin-top: 0; }
.docs-prose h2 { position: relative; font-size: 1.125rem; line-height: 1.4; font-weight: 600; margin: 4rem 0 1.25rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); scroll-margin-top: 1.5rem; }
.docs-prose h3 { position: relative; font-size: 0.9375rem; font-weight: 600; margin: 2.75rem 0 0.75rem; scroll-margin-top: 1.5rem; }
.docs-prose h4 { font-size: 0.875rem; font-weight: 600; margin: 2rem 0 0.5rem; }
.docs-anchor { margin-left: 0.45rem; color: var(--line-strong); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity 0.12s; }
.docs-prose h2:hover .docs-anchor, .docs-prose h3:hover .docs-anchor, .docs-anchor:focus { opacity: 1; }
.docs-prose p { margin: 1.15em 0; }
.docs-prose ul, .docs-prose ol { padding-left: 1.5em; margin: 1em 0; }
.docs-prose li { margin: 0.5em 0; }
.docs-prose li > p { margin: 0.25em 0; }
.docs-prose code { background: var(--paper-2); padding: 0.15em 0.35em; font-size: 0.9em; }
.docs-prose pre { background: var(--paper-2); border: 1px solid var(--line); padding: 1rem 1.25rem; overflow-x: auto; margin: 1.5em 0; font-size: 0.8125rem; line-height: 1.7; }
.docs-prose pre code { background: transparent; padding: 0; font-size: inherit; overflow-wrap: normal; }
.docs-prose blockquote { border-left: 3px solid var(--ink); background-color: var(--paper-2); background-image: var(--hatch); color: var(--soft); padding: 0.6rem 1rem; margin: 1.25rem 0; }
.docs-prose blockquote p { margin: 0.25em 0; }
.docs-prose hr { border: none; border-top: 1px solid var(--line); margin: 1.5em 0; }
.docs-prose img { max-width: 100%; height: auto; }
.docs-table { max-width: 100%; overflow-x: auto; margin: 1.75rem 0; }
.docs-table table { border-collapse: collapse; width: 100%; margin: 0; font-size: 0.8125rem; line-height: 1.65; }
.docs-table th, .docs-table td { border: 1px solid var(--line); padding: 0.5em 0.75em; text-align: left; overflow-wrap: break-word; }
.docs-table th { background: var(--paper-2); font-weight: 600; }
.docs-table td code, .docs-table th code { white-space: nowrap; }

.docs-pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 5rem; padding-top: 1.75rem; font-size: 0.875rem; border-top: 1px solid var(--line); }
.docs-pager a { display: flex; flex-direction: column; gap: 0.15rem; max-width: 48%; font-weight: 600; }
.docs-pager a span { font-size: 0.6875rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.05em; color: var(--soft); }
.docs-pager-next { margin-left: auto; text-align: right; }
.docs-footnote { margin-top: 2.5rem; font-size: 0.78rem; color: var(--soft); }

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

.ds { position: relative; margin-bottom: 2.75rem; }
.ds-input { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border: 1px solid var(--line); background: var(--paper); color: var(--soft); cursor: text; }
.ds-input:focus-within { border-color: var(--ink); }
.ds-input svg { width: 15px; height: 15px; flex-shrink: 0; }
.ds-input input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; box-shadow: none; background: transparent; color: var(--ink); font: inherit; font-size: 0.875rem; }
.ds-input input::-webkit-search-cancel-button { display: none; }
.ds-kbd { flex-shrink: 0; padding: 1px 5px; border: 1px solid var(--line); font-size: 11px; color: var(--soft); }
.ds-kbd:empty, .ds-input:focus-within .ds-kbd { display: none; }
@media (hover: none) { .ds-kbd { display: none; } }
.ds-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; max-height: min(70vh, 560px); display: flex; flex-direction: column; border: 1px solid var(--ink); background: var(--paper); box-shadow: 0 12px 32px rgb(0 0 0 / 0.14); }
.ds-pop[hidden] { display: none; }
.ds-status { flex-shrink: 0; margin: 0; padding: 6px 10px; font-size: 11px; color: var(--soft); }
.ds-list { overflow-y: auto; min-height: 0; }
.ds-row { display: block; padding: 8px 10px; border-top: 1px solid var(--line); border-left: 2px solid transparent; text-decoration: none; }
.ds-row.is-sel { background-color: var(--paper-2); background-image: var(--hatch); border-left-color: var(--ink); }
.ds-where { display: block; font-size: 12px; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-title { display: block; font-size: 0.875rem; font-weight: 600; }
.ds-snip { display: block; margin-top: 2px; font-size: 0.78rem; line-height: 1.45; color: var(--soft); overflow-wrap: anywhere; }
.ds-row mark { background: var(--mark); color: inherit; font-weight: 600; }

@media print {
  .top, .foot, .docs-sidebar, .docs-rail, .docs-mobile-nav, .ds, .docs-title-actions, .docs-pager { display: none; }
  .docs-main { max-width: none; padding: 0; }
}
