/* monoblok docs: a standalone reading layout that shares the main site's palette. */
:root {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  --paper: #f5f4ed;
  --panel: #efefe5;
  --green: #244c36;
  --ink: #20372b;
  --muted: #55604f;
  --line: #d6d9cb;
  --lime: #d9ed94;
  --code-bg: #203b2c;
  --code-ink: #f1f2df;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; background: var(--paper); }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: #46732a; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #7b9e31;
  outline-offset: 3px;
}
.skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: fixed; top: 10px; left: 10px; z-index: 30; background: #fff; padding: 12px; }

/* Top bar */
.docs-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  min-height: 60px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.docs-brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; font-size: 21px; font-weight: 750; letter-spacing: -1px; }
.docs-brand span {
  font: 500 .75rem var(--mono);
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
  background: var(--green);
  color: var(--lime);
}
.docs-bar nav { display: flex; gap: 22px; font-size: .875rem; }
.docs-bar nav a { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }

/* Shell */
.docs-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  width: min(1240px, 100%);
  margin: 0 auto;
}
.docs-side {
  position: sticky;
  top: 60px;
  align-self: start;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 26px 18px 40px 28px;
  border-right: 1px solid var(--line);
  font-size: .875rem;
}
.docs-side summary { display: none; }
.docs-side h2 {
  margin: 22px 0 8px;
  padding: 0;
  border: 0;
  font: 500 .72rem var(--mono);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-side h2:first-of-type { margin-top: 0; }
.docs-side ul { list-style: none; margin: 0; padding: 0; }
.docs-side li a { display: block; padding: 6px 10px; border-radius: 4px; text-decoration: none; line-height: 1.35; }
.docs-side li a:hover { background: #e8ebdf; color: var(--ink); }
.docs-side li a[aria-current=page] { background: var(--green); color: var(--lime); }
.docs-side .toc { margin: 4px 0 8px 10px; padding-left: 8px; border-left: 1px solid var(--line); }
.docs-side .toc a { padding: 4px 8px; color: var(--muted); font-size: .8125rem; }

/* Article */
.docs-main { min-width: 0; padding: 44px 48px 60px; }
.docs-article { max-width: 800px; }
.docs-article > .kicker { margin: 0 0 10px; font: 500 .75rem var(--mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0 0 18px; font-size: 2.5rem; font-weight: 500; line-height: 1.12; letter-spacing: -1.5px; }
h2 { margin: 52px 0 14px; padding-top: 26px; border-top: 1px solid var(--line); font-size: 1.625rem; font-weight: 500; line-height: 1.2; letter-spacing: -.8px; }
h3 { margin: 34px 0 10px; font-size: 1.2rem; font-weight: 500; letter-spacing: -.3px; }
h4 { margin: 26px 0 8px; font-size: 1rem; font-weight: 700; }
h2 a.anchor, h3 a.anchor, h4 a.anchor { margin-left: 8px; color: #a8b29a; text-decoration: none; opacity: 0; }
h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, a.anchor:focus { opacity: 1; }
p, li { line-height: 1.7; color: #3b4a3d; }
p { margin: 0 0 16px; }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 680px; }
ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 6px; }
strong { color: var(--ink); }
code { font-family: var(--mono); font-size: .875em; }
p code, li code, td code, th code, h2 code, h3 code, h4 code { background: #e5e9dc; padding: 2px 5px; border-radius: 3px; overflow-wrap: anywhere; }
blockquote { margin: 0 0 18px; padding: 14px 18px; border-left: 3px solid #a8b982; background: var(--panel); border-radius: 0 5px 5px 0; }
blockquote p:last-child { margin-bottom: 0; }

/* Code */
figure.code { margin: 0 0 20px; border-radius: 6px; overflow: hidden; background: var(--code-bg); }
figure.code figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 6px 18px;
  min-height: 40px;
  font: .75rem var(--mono);
  color: #adc09d;
  border-bottom: 1px solid #36523f;
}
figure.code figcaption a { color: #c5d8aa; }
figure.code pre { margin: 0; padding: 18px; overflow-x: auto; color: var(--code-ink); font: .8125rem/1.75 var(--mono); tab-size: 2; scrollbar-color: #7e9270 var(--code-bg); }
figure.code pre code { font-size: inherit; }
figure.shot { margin: 0 0 22px; }
figure.shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
figure.shot figcaption { margin-top: 8px; color: var(--muted); font-size: .875rem; }
.copy { border: 1px solid #56705b; border-radius: 3px; background: transparent; color: #c5d8aa; font: .72rem var(--mono); padding: 5px 9px; cursor: pointer; }
.copy:hover { background: #2d4935; }
.tok-str { color: #dbeaa4; }
.tok-op { color: #a7d7b8; }
.tok-kw { color: #f0cd8a; }
.tok-num { color: #f0cd8a; }
.tok-com { color: #8fa58a; font-style: italic; }
.tok-key { color: #a7d7b8; }
.tok-bind { color: #e3b8d3; }
.sc-in { color: #b5c7b0; }
.sc-out { color: var(--lime); }

/* Tables */
.table-wrap { margin: 0 0 22px; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: #fbfbf4; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; line-height: 1.55; border-bottom: 1px solid var(--line); }
th { font-weight: 700; background: #e9eddd; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { min-width: 150px; }

/* Small pieces */
.tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 20px; font: 500 .7rem var(--mono); letter-spacing: .4px; text-transform: uppercase; vertical-align: middle; border: 1px solid #b9c5a6; color: var(--green); background: #e8edda; }
.tag-intermediate { background: #f3ecd2; border-color: #d9cc9b; color: #6b5413; }
.tag-advanced { background: var(--green); border-color: var(--green); color: var(--lime); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 0 0 24px; padding: 0; list-style: none; }
.cards li { margin: 0; }
.cards a { display: block; height: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: #fbfbf4; text-decoration: none; }
.cards a:hover { border-color: #8eaa61; color: inherit; }
.cards strong { display: block; margin-bottom: 6px; }
.cards span { color: var(--muted); font-size: .875rem; line-height: 1.55; display: block; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { flex: 1; max-width: 48%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: #fbfbf4; }
.pager a:hover { border-color: #8eaa61; }
.pager a.next { margin-left: auto; text-align: right; }
.pager small { display: block; margin-bottom: 4px; font: .72rem var(--mono); text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.docs-foot { margin-top: 36px; font-size: .8125rem; color: var(--muted); }

@media (max-width: 900px) {
  html { scroll-padding-top: 70px; }
  .docs-bar { padding: 0 16px; }
  .docs-bar nav { gap: 14px; overflow-x: auto; }
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-side { position: static; max-height: none; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .docs-side summary { display: block; padding: 14px 16px; font-weight: 600; cursor: pointer; }
  .docs-side .side-inner { padding: 4px 16px 20px; }
  .docs-main { padding: 28px 16px 48px; }
  h1 { font-size: 2rem; letter-spacing: -1px; }
  h2 { font-size: 1.4rem; margin-top: 40px; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
}
@media (max-width: 520px) {
  .docs-bar nav a.optional { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
