/* Documentation pages: a sober, readable layout (the landing page keeps style.css). */
:root {
  color-scheme: light;
  --bg: #ffffff; --bg-soft: #f6f8fa; --bg-code: #f3f5f8; --line: #e3e8ee; --line-strong: #cfd7e0;
  --text: #1c2430; --muted: #5b6878; --faint: #8592a3; --accent: #0f7d6e; --accent-soft: #e4f4f1;
  --link: #0b6bcb; --warn-bg: #fff8e6; --mark: #fff3b0;
  --shadow: 0 8px 30px rgba(15, 30, 50, .10);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1117; --bg-soft: #131a23; --bg-code: #161e29; --line: #222c38; --line-strong: #2f3b4a;
    --text: #e6edf3; --muted: #9aa7b6; --faint: #6e7b8b; --accent: #5fd6c3; --accent-soft: #123430;
    --link: #6cb6ff; --warn-bg: #2b2412; --mark: #5a4b00;
    --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117; --bg-soft: #131a23; --bg-code: #161e29; --line: #222c38; --line-strong: #2f3b4a;
  --text: #e6edf3; --muted: #9aa7b6; --faint: #6e7b8b; --accent: #5fd6c3; --accent-soft: #123430;
  --link: #6cb6ff; --warn-bg: #2b2412; --mark: #5a4b00;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 17px; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand small { color: var(--faint); font-weight: 500; font-size: 13px; margin-left: 2px; }
.topbar .spacer { flex: 1; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); cursor: pointer;
  font-size: 16px;
}
.icon-button:hover { color: var(--text); border-color: var(--line-strong); }
#menu-toggle { display: none; }
.top-link { color: var(--muted); font-size: 14px; }

/* Search */
.search { position: relative; width: min(360px, 40vw); }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: 14px;
}
.search::before { content: "⌕"; position: absolute; left: 11px; top: 5px; color: var(--faint); font-size: 17px; }
.search kbd { position: absolute; right: 8px; top: 8px; }
.search-results {
  position: absolute; top: 42px; left: 0; width: min(560px, 92vw); max-height: 70vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px;
}
.search-results[hidden] { display: none; }
.search-results a { display: block; padding: 9px 12px; border-radius: 7px; color: var(--text); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--accent-soft); text-decoration: none; }
.search-results .where { display: block; font-size: 12px; color: var(--faint); }
.search-results .snippet { display: block; font-size: 13px; color: var(--muted); line-height: 1.5; }
.search-results mark { background: var(--mark); color: inherit; border-radius: 2px; }
.search-results .empty { padding: 12px; color: var(--muted); font-size: 14px; }

/* Layout */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; max-width: 1440px; margin: 0 auto; }
.sidebar {
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto; padding: 24px 16px 40px 20px;
  border-right: 1px solid var(--line);
}
.sidebar h3 { margin: 18px 0 6px; padding: 0 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.sidebar h3:first-child { margin-top: 0; }
.sidebar a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.sidebar a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar .home { margin-bottom: 14px; color: var(--muted); }

.content { min-width: 0; padding: 36px 56px 80px; }
.breadcrumbs { font-size: 13px; color: var(--faint); margin-bottom: 8px; }
.breadcrumbs a { color: var(--faint); }

.toc { position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto; padding: 36px 20px 40px 8px; font-size: 13px; }
.toc h4 { margin: 0 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.toc a { display: block; padding: 3px 0 3px 10px; color: var(--muted); border-left: 2px solid var(--line); line-height: 1.45; }
.toc a.sub { padding-left: 22px; font-size: 12.5px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* Article typography */
.doc { max-width: 820px; }
.doc h1 { font-size: 34px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 18px; }
.doc h2 { font-size: 24px; line-height: 1.3; margin: 48px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); letter-spacing: -.01em; }
.doc h3 { font-size: 18px; margin: 30px 0 8px; }
.doc h4 { font-size: 16px; margin: 24px 0 6px; }
.doc h2 a.anchor, .doc h3 a.anchor { margin-left: 8px; color: var(--faint); opacity: 0; font-weight: 400; }
.doc h2:hover a.anchor, .doc h3:hover a.anchor { opacity: 1; }
.doc p, .doc li { color: var(--text); }
.doc ul, .doc ol { padding-left: 24px; }
.doc li { margin: 4px 0; }
.doc strong { font-weight: 650; }
.doc code { font: 13.5px/1.5 ui-monospace, SFMono-Regular, "DejaVu Sans Mono", Consolas, monospace; background: var(--bg-code); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
.doc pre { position: relative; background: var(--bg-code); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow: auto; margin: 18px 0; }
.doc pre code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.65; }
.doc pre .copy {
  position: absolute; top: 8px; right: 8px; padding: 3px 9px; font-size: 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted); opacity: 0; transition: opacity .15s;
}
.doc pre:hover .copy, .doc pre .copy:focus { opacity: 1; }
.doc table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.doc th { background: var(--bg-soft); font-weight: 600; }
.doc blockquote { margin: 18px 0; padding: 10px 16px; border-left: 4px solid var(--accent); background: var(--bg-soft); border-radius: 0 8px 8px 0; color: var(--muted); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.doc img { max-width: 100%; height: auto; }

/* Collapsible screenshots */
details.shot { margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); }
details.shot summary { cursor: pointer; padding: 10px 14px; font-size: 14px; color: var(--muted); list-style: none; }
details.shot summary::-webkit-details-marker { display: none; }
details.shot summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--accent); transition: transform .2s; }
details.shot[open] summary::before { transform: rotate(90deg); }
details.shot summary span { font-weight: 600; color: var(--text); margin-right: 4px; }
details.shot .shot-body { padding: 0 14px 14px; animation: reveal .25s ease-out; }
details.shot img { border-radius: 6px; border: 1px solid var(--line); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Previous / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 820px; margin-top: 56px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; color: var(--faint); font-size: 12px; }
.pager .next { text-align: right; grid-column: 2; }
.page-meta { max-width: 820px; margin-top: 28px; font-size: 13px; color: var(--faint); display: flex; gap: 18px; flex-wrap: wrap; }
.page-meta a { color: var(--faint); }

kbd { font: 11px ui-monospace, monospace; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--bg); }

/* Responsive */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  #menu-toggle { display: inline-flex; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0; width: 280px; height: auto; z-index: 15; background: var(--bg);
    transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility .2s;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow); }
  .content { padding: 24px 18px 60px; }
  .search { width: auto; flex: 1; min-width: 0; }
  .topbar .spacer { display: none; }
  .topbar .brand small { display: none; }
  .search kbd, .top-link { display: none; }
  .doc h1 { font-size: 28px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Yocto-docs mode: Bitloom's documentation dressed the way Sphinx and the Read the Docs theme look,
   for developers who feel at home there. A tribute, switched on with the ¶ button; same content. */
html[data-classic] { color-scheme: light; --bg: #fcfcfc; --bg-soft: #f3f6f6; --bg-code: #f8f8f8; --line: #e1e4e5; --line-strong: #c9c9c9;
  --text: #404040; --muted: #6e6e6e; --faint: #999; --link: #2980b9; --accent: #2980b9; --accent-soft: #e7f2fa; --mark: #f1c40f55; }
html[data-classic] body { background: #edf0f2; font-family: Lato, "proxima-nova", "Helvetica Neue", Arial, sans-serif; color: #404040; }
html[data-classic] .topbar { background: #2980b9; border: 0; box-shadow: none; color: #fff; }
html[data-classic] .topbar .brand, html[data-classic] .topbar .top-link { color: #fff; }
html[data-classic] .topbar .icon-button { color: #fff; background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .35); }
html[data-classic] .topbar .brand small { color: #e1f0fa; }
html[data-classic] .search input { background: #fff; border: 1px solid #2472a4; border-radius: 50px; color: #404040; }
html[data-classic] .layout { background: #fcfcfc; max-width: none; }
html[data-classic] .sidebar { background: #343131; border: 0; padding-top: 12px; }
html[data-classic] .sidebar h3 { color: #55a5d9; font-size: 85%; letter-spacing: .02em; text-transform: uppercase; }
html[data-classic] .sidebar a, html[data-classic] .sidebar .home { color: #d9d9d9; border-radius: 0; }
html[data-classic] .sidebar a:hover { background: #4e4a4a; color: #d9d9d9; }
html[data-classic] .sidebar a[aria-current="page"] { background: #fcfcfc; color: #404040; font-weight: 700; border: 0; box-shadow: none; }
html[data-classic] .content { max-width: 800px; background: #fcfcfc; }
html[data-classic] .toc { display: none; }
html[data-classic] .doc h1, html[data-classic] .doc h2, html[data-classic] .doc h3, html[data-classic] .doc h4 { font-family: "Roboto Slab", "ff-tisa-web-pro", Georgia, serif; font-weight: 700; color: #404040; letter-spacing: 0; border: 0; }
html[data-classic] .doc h1 { font-size: 175%; } html[data-classic] .doc h2 { font-size: 150%; } html[data-classic] .doc h3 { font-size: 125%; }
html[data-classic] .doc a { color: #2980b9; } html[data-classic] .doc a:visited { color: #9b59b6; }
html[data-classic] .doc a.anchor { font-size: 0; } html[data-classic] .doc a.anchor::after { content: "¶"; font-size: 1rem; color: #2980b9; }
html[data-classic] .doc code { color: #e74c3c; background: #fff; border: 1px solid #e1e4e5; border-radius: 0; padding: 2px 5px; font-size: 75%; }
html[data-classic] .doc pre { background: #f8f8f8; border: 1px solid #e1e4e5; border-radius: 0; box-shadow: none; }
html[data-classic] .doc pre code { color: #404040; background: none; border: 0; padding: 0; font-size: 12px; }
html[data-classic] .doc table { border: 1px solid #e1e4e5; border-radius: 0; } html[data-classic] .doc th { background: #fff; border-bottom: 2px solid #e1e4e5; }
html[data-classic] .doc tr:nth-child(2n-1) td { background: #f3f6f6; } html[data-classic] .doc td, html[data-classic] .doc th { border-color: #e1e4e5; }
html[data-classic] .doc blockquote { background: #e7f2fa; border: 0; border-radius: 0; padding: 0 12px 12px; color: #404040; }
html[data-classic] .doc blockquote::before { content: "Note"; display: block; margin: 0 -12px 12px; padding: 6px 12px; background: #6ab0de; color: #fff; font-weight: 700; }
html[data-classic] .doc img, html[data-classic] .doc .shot { border-radius: 0; }
html[data-classic] .breadcrumbs { font-size: 13px; color: #404040; } html[data-classic] .breadcrumbs::before { content: "Docs » "; }
html[data-classic] .pager a { background: #f3f6f6; border: 1px solid rgba(0, 0, 0, .1); border-radius: 2px; box-shadow: inset 0 1px 2px -1px hsla(0, 0%, 100%, .5), inset 0 -2px 0 0 rgba(0, 0, 0, .1); color: #404040; }
html[data-classic] .pager .prev small::before { content: "« "; } html[data-classic] .pager .next small::after { content: " »"; }
html[data-classic] .page-meta { border-top: 1px solid #e1e4e5; color: #6e6e6e; }
.classic-note, .classic-footer, .classic-version { display: none; }
html[data-classic] .classic-note { display: block; background: #e7f2fa; margin: 0 0 24px; font-size: 14px; }
html[data-classic] .classic-note b { display: block; background: #6ab0de; color: #fff; padding: 6px 12px; }
html[data-classic] .classic-note p { margin: 0; padding: 10px 12px; }
html[data-classic] .classic-footer { display: block; margin: 28px 0 8px; padding-top: 14px; border-top: 1px solid #e1e4e5; font-size: 13px; color: #6e6e6e; }
html[data-classic] .classic-version { display: block; position: fixed; left: 0; bottom: 0; width: 260px; z-index: 6; background: #272525; color: #fcfcfc; font: 13px Lato, Arial, sans-serif; border-top: 1px solid #000; }
.classic-version button { all: unset; box-sizing: border-box; width: 100%; padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; }
.classic-version button span { color: #27ae60; }
.classic-version p { margin: 0; padding: 6px 12px 10px; color: #d9d9d9; }
html[data-classic] .topbar .classic-toggle { background: #fff; color: #2980b9; border-color: #fff; }
.classic-toggle { font: 700 17px Georgia, serif; }
@media (min-width: 1101px) { html[data-classic] .layout { grid-template-columns: 260px minmax(0, 1fr); } }
@media (max-width: 1100px) { html[data-classic] .classic-version { width: 240px; } }
@media (max-width: 900px) { html[data-classic] .classic-version { display: none; } }
