/* 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 ---------------------------------------------------- */

/* The same top line the app has: the mark, then a few links, in
   the page's column. No bar and no rule under it. */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 2rem;
  max-width: 58rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 4.5vh, 3rem) 1.5rem;
  font-size: 0.8125rem;
}
.top a { text-decoration: none; }
/* Just the mark, at the app's size (`.g-mark`: 1.25rem, centred on the line). */
.top-brand { display: inline-flex; align-self: center; line-height: 1; }
.top-brand .mark { display: block; width: 1.25rem; height: 1.25rem; margin: 0; vertical-align: 0; }
.top-nav { display: flex; gap: 1.5rem; color: var(--soft); }
.top-nav a:hover { color: var(--ink); text-decoration: underline; }
.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;
  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 ------------------------------------------------------------- */

/* One column of small text, as in the app: the search box, the page's name
   and what it covers, every page behind "All pages", the sections of this
   one, then the page. No sidebar, no rules, no fills; a command keeps the
   outline it has on the home page. */
.docs { max-width: 58rem; margin: 0 auto; padding: 0 1.5rem 4rem; font-size: 0.8125rem; line-height: 1.7; }
.docs-title { margin: 0; font-size: inherit; font-weight: 600; }
.docs-lede { max-width: 44rem; margin: 0; color: var(--soft); }
.docs-actions { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 0.5rem 0 0; color: var(--soft); }
.docs-btn { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.docs-btn:hover { color: var(--ink); }

.docs-contents { margin-top: 2rem; }
.docs-contents summary { width: fit-content; cursor: pointer; list-style: none; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; }
.docs-contents summary::-webkit-details-marker { display: none; }
.docs-contents summary:hover, .docs-contents[open] summary { color: var(--ink); }
.docs-contents nav { columns: 13rem; column-gap: 2rem; margin-top: 1rem; }
.docs-nav-set { break-inside: avoid; padding-bottom: 1.25rem; }
.docs-nav-group { margin: 0; font-weight: 600; }
.docs-nav-list { list-style: none; margin: 0; padding: 0; }
.docs-nav-link { color: var(--soft); text-decoration: none; }
.docs-nav-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.docs-nav-active, .docs-nav-active:hover { color: var(--ink); font-weight: 600; }

.docs-toc { display: flex; flex-wrap: wrap; gap: 0.1rem 1.5rem; margin-top: 1.25rem; }
.docs-toc-link { color: var(--soft); text-decoration: none; }
.docs-toc-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.docs-toc-active { color: var(--ink); }

.docs-prose { max-width: 44rem; margin-top: 2.5rem; overflow-wrap: anywhere; text-wrap: pretty; }
.docs-prose > :first-child { margin-top: 0; }
.docs-prose h2, .docs-prose h3, .docs-prose h4 { position: relative; font-size: inherit; font-weight: 600; scroll-margin-top: 1.5rem; }
.docs-prose h2 { margin: 3rem 0 0.75rem; }
.docs-prose h3 { margin: 2rem 0 0.5rem; color: var(--soft); }
.docs-prose h4 { margin: 1.5rem 0 0.5rem; color: var(--soft); font-weight: 400; }
.docs-anchor { margin-left: 0.45rem; color: var(--line-strong); text-decoration: none; font-weight: 400; opacity: 0; }
.docs-prose h2:hover .docs-anchor, .docs-prose h3:hover .docs-anchor, .docs-anchor:focus { opacity: 1; }
.docs-prose p { margin: 0 0 0.9rem; }
.docs-prose ul, .docs-prose ol { padding-left: 1.4rem; margin: 0 0 0.9rem; }
.docs-prose li { margin: 0.2rem 0; }
.docs-prose li > p { margin: 0.2rem 0; }
.docs-prose pre { max-width: 100%; margin: 1.1rem 0; padding: 0.6rem 0.9rem; overflow-x: auto; border: 1px solid var(--line-strong); line-height: 1.6; }
.docs-prose pre code { overflow-wrap: normal; }
.docs-prose blockquote { margin: 1.1rem 0; padding-left: 1.4rem; color: var(--soft); }
.docs-prose blockquote p { margin: 0.2rem 0; }
.docs-prose hr { border: 0; margin: 2rem 0; }
.docs-prose img { max-width: 100%; height: auto; }
.docs-table { max-width: 100%; overflow-x: auto; margin: 1.1rem 0; }
.docs-table table { border-collapse: collapse; margin: 0; }
.docs-table th, .docs-table td { padding: 0.12rem 1.75rem 0.12rem 0; text-align: left; vertical-align: top; overflow-wrap: break-word; }
.docs-table th { font-weight: 400; color: var(--soft); }
.docs-table td code, .docs-table th code { white-space: nowrap; }

.docs-pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; max-width: 44rem; margin-top: 4rem; }
.docs-pager a { text-underline-offset: 3px; }
.docs-pager a span { margin-right: 0.6rem; color: var(--soft); }
.docs-pager-next { margin-left: auto; text-align: right; }
.docs-footnote { max-width: 44rem; margin-top: 2rem; color: var(--soft); }

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

.ds { position: relative; max-width: 30rem; margin-bottom: 2rem; }
.ds-input { display: flex; align-items: center; gap: 8px; padding: 0.3rem 0.6rem; border: 1px solid var(--line-strong); color: var(--soft); cursor: text; }
.ds-input:focus-within { border-color: var(--ink); }
.ds-input svg { display: none; }
.ds-input input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; box-shadow: none; background: transparent; color: var(--ink); font: inherit; }
.ds-input input::-webkit-search-cancel-button { display: none; }
.ds-kbd { flex-shrink: 0; 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; padding: 0.4rem 0; border: 1px solid var(--ink); background: var(--paper); }
.ds-pop[hidden] { display: none; }
.ds-status { flex-shrink: 0; margin: 0; padding: 0.2rem 0.8rem; color: var(--soft); }
.ds-list { overflow-y: auto; min-height: 0; }
.ds-row { display: block; padding: 0.35rem 0.8rem; text-decoration: none; }
.ds-row.is-sel .ds-title { text-decoration: underline; text-underline-offset: 3px; }
.ds-where { display: block; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-title { display: block; font-weight: 600; }
.ds-snip { display: block; line-height: 1.5; color: var(--soft); overflow-wrap: anywhere; }
.ds-row mark { background: var(--mark); color: inherit; font-weight: 600; }

@media print {
  .top, .foot, .docs-contents, .docs-toc, .ds, .docs-actions, .docs-pager { display: none; }
  .docs, .docs-prose { max-width: none; padding: 0; }
}
