/* Style sheet of the published documentation (/docs/). The pages are rendered
   from README.md and docs/*.md by tools/site/steps/30-docs.py. No remote fonts
   or images: the site is cross-origin isolated. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --panel: #f4f5f7;
  --text: #1b1f24;
  --muted: #59626d;
  --line: #dde1e6;
  --accent: #0b62c4;
  --code-bg: #f1f3f5;
  --mark: #fff3c4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111316;
    --panel: #181b20;
    --text: #e4e7ea;
    --muted: #9aa3ad;
    --line: #2b3038;
    --accent: #79b8ff;
    --code-bg: #1d2126;
    --mark: #4a3d0c;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -999rem; top: 0; background: var(--bg); padding: .5rem 1rem; z-index: 2; }
.skip:focus { left: 0; }

.top {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .7rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.top a { text-decoration: none; }
.top .site { font-weight: 700; color: var(--text); letter-spacing: .01em; }
.top .site::before { content: "\2190\00a0"; color: var(--muted); font-weight: 400; }
.top .here { color: var(--muted); }
.top a:hover { text-decoration: underline; }

.layout {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
  max-width: 68rem;
  margin: 0 auto;
}

.pages {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 1rem 2rem 1.25rem;
  font-size: .94rem;
}
.pages ul { list-style: none; margin: 0; padding: 0; }
.pages a {
  display: block;
  padding: .28rem .6rem;
  border-radius: .35rem;
  color: var(--text);
  text-decoration: none;
}
.pages a:hover { background: var(--panel); }
.pages a[aria-current="page"] { background: var(--panel); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
.pages .sections { margin: .15rem 0 .5rem .6rem; border-left: 1px solid var(--line); }
.pages .sections a { color: var(--muted); font-size: .88rem; padding: .16rem .6rem; border-radius: 0 .35rem .35rem 0; }
.pages .sections a:hover { color: var(--text); }

main {
  min-width: 0;
  max-width: 50rem;
  padding: 1.5rem 1.5rem 3rem 2rem;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 2em 0 .6em; }
h1 { font-size: 2rem; margin-top: .3em; letter-spacing: -.01em; }
h2 { font-size: 1.4rem; padding-top: .6em; border-top: 1px solid var(--line); }
h3 { font-size: 1.12rem; }
h4 { font-size: 1rem; }
.anchor { margin-left: .4em; color: var(--muted); text-decoration: none; font-weight: 400; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
h1 .anchor { display: none; }

p, ul, ol, pre, .table, blockquote { margin: 0 0 1em; }
ul, ol { padding-left: 1.5rem; }
li { margin: .2em 0; }
li > p { margin: .4em 0; }
li > pre, li > ul, li > ol { margin: .4em 0 .6em; }

code {
  font: .875em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  background: var(--code-bg);
  padding: .1em .3em;
  border-radius: .25rem;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: .4rem;
  padding: .75rem 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
pre code { background: none; padding: 0; font-size: .84rem; white-space: pre; }

.table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; font-size: .93rem; min-width: 100%; }
th, td { text-align: left; vertical-align: top; padding: .4rem .7rem; border-bottom: 1px solid var(--line); }
th { font-weight: 650; border-bottom-width: 2px; white-space: nowrap; }
td:first-child code { white-space: nowrap; }
td.right, th.right { text-align: right; }
td.center, th.center { text-align: center; }

blockquote {
  margin-left: 0;
  padding: .6rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  border-radius: 0 .4rem .4rem 0;
}
blockquote > :last-child { margin-bottom: 0; }

img { max-width: 100%; height: auto; border-radius: .4rem; }
/* A diagram keeps a readable size on a phone and scrolls sideways instead. */
.figure { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.figure img { display: block; min-width: 40rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

.around {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
}
.around a {
  flex: 0 1 48%;
  padding: .6rem .9rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  text-decoration: none;
  font-weight: 600;
}
.around a:hover { border-color: var(--accent); }
.around .next { margin-left: auto; text-align: right; }
.around small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }

footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }

/* Phones and narrow windows: the page list moves above the text and wraps. */
@media (max-width: 52rem) {
  .layout { display: block; }
  .pages {
    position: static;
    max-height: none;
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--line);
  }
  .pages > ul { display: flex; flex-wrap: wrap; gap: .1rem .15rem; }
  .pages a { padding: .3rem .55rem; }
  .pages a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .pages .sections { display: none; }
  main { padding: 1rem 1rem 2.5rem; }
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.25rem; }
  .around { flex-direction: column; }
  .around a { flex-basis: auto; }
  .around .next { margin-left: 0; }
}

@media print {
  .top, .pages, .around, .skip { display: none; }
  .layout { display: block; }
  main { max-width: none; padding: 0; }
}
