/* ReaFruit manual — one small stylesheet for both pages. No fonts, no icons,
   no framework: the page is complete without this file and without JS. */
:root {
  --bg: #ffffff; --fg: #1c2328; --muted: #5d6b75; --line: #d9dfe4;
  --accent: #4f8a12; --amber: #c48a0c; --code-bg: #f3f5f7; --nav-bg: #f7f8f9;
  --current: #e9f3dc; --callout: #f5c84e; --callout-ink: #1b242b; --box: #f5c84e;
  --nav-w: 250px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b242b; --fg: #d9dfe4; --muted: #9aa5ae; --line: #34444e;
    --accent: #8dc63f; --amber: #f5c84e; --code-bg: #232b31; --nav-bg: #1f282f;
    --current: #2a3a28;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 56px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); }
a:hover { text-decoration: underline; }
code, kbd, pre { font: 0.92em/1.4 ui-monospace, Consolas, "SF Mono", Menlo, monospace; }
code { background: var(--code-bg); padding: 1px 4px; border-radius: 3px; }
pre { background: var(--code-bg); padding: 10px 12px; border-radius: 4px; overflow-x: auto; }
pre code { background: none; padding: 0; }
kbd {
  display: inline-block; padding: 0 5px; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; background: var(--code-bg);
  font-size: 0.85em; line-height: 1.5; white-space: nowrap;
}

/* top bar */
.top {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 14px;
  padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.top .brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.top .pages a { margin-right: 10px; }
.top .pages a[aria-current] { color: var(--fg); font-weight: 600; text-decoration: none; }
.top .ver { color: var(--muted); font-size: 0.85em; }
.top .spacer { flex: 1; }
.top input {
  width: 180px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg); color: var(--fg); font: inherit; font-size: 0.9em;
}
.top button {
  display: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--nav-bg); color: var(--fg); font: inherit; cursor: pointer;
}

/* layout: sidebar + content */
.page { display: flex; align-items: flex-start; }
nav#toc {
  position: sticky; top: 45px; width: var(--nav-w); flex: none; max-height: calc(100vh - 45px);
  overflow-y: auto; overscroll-behavior: contain; padding: 12px 8px 40px 16px; background: var(--nav-bg);
  border-right: 1px solid var(--line); font-size: 0.9em;
}
nav#toc ul { list-style: none; margin: 0; padding: 0; }
nav#toc > ul > li { margin: 10px 0 2px; }
nav#toc .group { font-size: 0.78em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
nav#toc ul ul li { margin: 0; }
nav#toc ul ul ul { margin-left: 12px; border-left: 1px solid var(--line); }
nav#toc a {
  display: block; padding: 2px 8px; color: var(--fg); text-decoration: none; border-radius: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
nav#toc a:hover { background: var(--current); }
nav#toc a.current { background: var(--current); color: var(--accent); font-weight: 600; }
nav#toc li.hidden { display: none; }
main { flex: 1; min-width: 0; max-width: 1200px; padding: 8px 40px 80px; }
/* tables and figures use the whole column; running text stays readable */
main > p, main > ul, main > ol, main > .note, main > .tip { max-width: 90ch; }

/* headings with hover anchors */
h1 { font-size: 1.9em; margin: 20px 0 6px; }
h2 { font-size: 1.45em; margin: 48px 0 10px; padding-top: 6px; border-top: 1px solid var(--line); }
h3 { font-size: 1.12em; margin: 30px 0 6px; }
h4 { font-size: 1em; margin: 20px 0 4px; }
h2 a.anchor, h3 a.anchor, h4 a.anchor { margin-left: 6px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor { opacity: 1; }
.lead { color: var(--muted); font-size: 1.05em; }
p, ul, ol, table { margin: 8px 0 12px; }
li { margin: 2px 0; }

/* tables */
table { border-collapse: collapse; width: 100%; font-size: 0.93em; }
th, td { text-align: left; vertical-align: top; padding: 5px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.9em; }
td:first-child { white-space: nowrap; }
table.wrap td:first-child { white-space: normal; }

/* callouts */
.note, .tip { margin: 12px 0; padding: 8px 12px; border-left: 3px solid var(--amber); background: var(--code-bg); border-radius: 0 4px 4px 0; }
.tip { border-left-color: var(--accent); }
.note b:first-child, .tip b:first-child { margin-right: 4px; }
.path { white-space: nowrap; }

/* annotated screenshots */
figure.shot { margin: 16px 0 20px; }
figure.shot .wrap { position: relative; display: block; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
figure.shot svg rect { fill: none; stroke: var(--box); stroke-width: 2.5; rx: 3; }
figure.shot svg circle { fill: var(--callout); stroke: var(--callout-ink); stroke-width: 1; }
figure.shot svg text { fill: var(--callout-ink); font: 700 15px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; }
figure.shot figcaption { font-size: 0.9em; color: var(--muted); margin-top: 6px; }
figure.shot figcaption ol { margin: 4px 0 0; padding-left: 22px; columns: 2; column-gap: 24px; }
figure.shot figcaption ol li { break-inside: avoid; }
figure.shot figcaption ol li::marker { color: var(--amber); font-weight: 700; }

/* narrow screens */
@media (max-width: 900px) {
  .top button { display: inline-block; }
  .top input { width: 120px; }
  .page { display: block; }
  nav#toc { display: none; position: static; width: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  nav#toc.open { display: block; }
  main { padding: 8px 16px 60px; max-width: none; }
  figure.shot figcaption ol { columns: 1; }
}
@media print {
  .top, nav#toc { display: none; }
  main { max-width: none; }
  h2 a.anchor, h3 a.anchor { display: none; }
}
figure.shot svg.small circle { stroke-width: .8; }
figure.shot svg.small text { font-size: 11px; }

/* native scrollbars and form controls follow the page's scheme (Chrome
   otherwise draws light ones over a dark page), tinted with the palette */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) { :root { color-scheme: dark; } }
html { scrollbar-color: var(--line) var(--bg); }
nav#toc { scrollbar-color: var(--line) var(--nav-bg); scrollbar-width: thin; }
