:root {
  --bg: #fffff8;
  --sidebar-bg: #faf8f0;
  --fg: #111111;
  --muted: #58544c;
  --faint: #847e72;
  --rule: #d6d0c2;
  --accent: #244c73;
  --link-ul: #9c978a;
  --quote-bg: #f6f3e8;
  --code-bg: #f4f1e6;
  --surface: #ffffff;
  --shadow: rgba(17, 17, 17, 0.14);
  --backdrop: rgba(17, 17, 17, 0.36);
  --header-h: 56px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /* Warm Tufte syntax palette (light) */
  --hl-kw: #244c73;
  --hl-str: #2f6b4f;
  --hl-num: #944324;
  --hl-cm: #7d7668;
  --hl-fn: #5e3d78;
  --hl-ty: #7a4b1f;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412;
    --sidebar-bg: #1a1815;
    --fg: #e5e0d5;
    --muted: #9b9589;
    --faint: #6e695f;
    --rule: #2e2b25;
    --accent: #8ab4dc;
    --link-ul: #615c52;
    --quote-bg: #1d1b17;
    --code-bg: #1e1c18;
    --surface: #1b1916;
    --shadow: rgba(0, 0, 0, 0.45);
    --backdrop: rgba(0, 0, 0, 0.62);
    --hl-kw: #8ab4dc;
    --hl-str: #84c09d;
    --hl-num: #e28a6f;
    --hl-cm: #7c766b;
    --hl-fn: #c2a7e4;
    --hl-ty: #d9b25a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #151412;
  --sidebar-bg: #1a1815;
  --fg: #e5e0d5;
  --muted: #9b9589;
  --faint: #6e695f;
  --rule: #2e2b25;
  --accent: #8ab4dc;
  --link-ul: #615c52;
  --quote-bg: #1d1b17;
  --code-bg: #1e1c18;
  --surface: #1b1916;
  --shadow: rgba(0, 0, 0, 0.45);
  --backdrop: rgba(0, 0, 0, 0.62);
  --hl-kw: #8ab4dc;
  --hl-str: #84c09d;
  --hl-num: #e28a6f;
  --hl-cm: #7c766b;
  --hl-fn: #c2a7e4;
  --hl-ty: #d9b25a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body.docs-page {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "ETBook", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Liberation Serif", serif;
  font-size: 17px;
  line-height: 1.64;
  font-variant-numeric: oldstyle-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.docs-page:has(#docs-drawer-toggle:checked),
body.docs-search-open {
  overflow: hidden;
}

.drawer-toggle {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}

/* Sticky full-width top bar matching / and /compare/ */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.docs-header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 24px;
}

.docs-header nav.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 14.5px;
}

.nav-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

nav.top .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fg);
  text-decoration: none;
  border: none;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 16.5px;
  font-weight: 600;
}

nav.top .brand svg {
  width: 24px;
  height: 24px;
  display: block;
  flex-shrink: 0;
}

.nav-menu-btn {
  display: none;
  appearance: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--sidebar-bg);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.nav-menu-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  appearance: none;
  padding: 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--sidebar-bg);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.search-trigger:hover {
  border-color: var(--accent);
  color: var(--fg);
}

.search-trigger kbd {
  font-family: "Liberation Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 11px;
  padding: 0 5px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--faint);
}

nav.top .nav-right {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 18px;
}

nav.top .links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

nav.top .links a {
  color: var(--muted);
  text-decoration: none;
}

nav.top .links a:hover {
  color: var(--fg);
}

nav.top .links a.on {
  color: var(--fg);
}

.theme-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding-left: 14px;
  border-left: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--muted);
}

.theme-toggle button {
  appearance: none;
  background: none;
  border: none;
  padding: 2px 4px;
  margin: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle button:hover {
  color: var(--fg);
}

.theme-toggle button[aria-pressed="true"] {
  color: var(--fg);
  border-bottom: 1px solid var(--fg);
}

/* 3-column Warm Tufte docs shell */
.docs-shell {
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr) 216px;
  align-items: start;
  min-height: calc(100vh - var(--header-h));
}

/* Left chapter sidebar */
aside.toc-left {
  position: sticky;
  top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--rule);
  padding: 22px 16px 28px 20px;
  font-size: 14px;
  line-height: 1.44;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.drawer-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.drawer-title {
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 2px;
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.drawer-close:hover {
  color: var(--fg);
  border-color: var(--fg);
}

.sec-tree,
.ch-list,
.sub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-sec {
  margin-bottom: 16px;
}

.nav-sec:last-child {
  margin-bottom: 0;
}

.sec-label,
.sec-link {
  display: block;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  margin: 0 0 5px;
  padding: 2px 6px 2px 8px;
  margin-left: -8px;
  border-left: 2px solid transparent;
  text-decoration: none;
}

.sec-link {
  color: var(--muted);
}

.sec-link:hover {
  color: var(--fg);
}

.sec-link.ai {
  font-style: italic;
}

.sec-link.active {
  color: var(--fg);
  border-left-color: var(--accent);
}

.ch-item {
  margin: 2px 0;
}

.ch-item > a {
  display: block;
  padding: 3px 6px 3px 8px;
  margin-left: -10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms ease, border-color 120ms ease;
}

.ch-item > a:hover {
  color: var(--fg);
}

.ch-item > a.ai {
  font-style: italic;
}

.ch-item > a.active {
  color: var(--fg);
  font-weight: 600;
  border-left-color: var(--accent);
}

.ch-item > .wip {
  display: block;
  padding: 3px 6px 3px 8px;
  margin-left: -10px;
  color: var(--faint);
  font-size: 13px;
  opacity: 0.78;
}

.ch-item > .sub-label {
  display: block;
  margin: 9px 0 3px;
  font-variant: small-caps;
  letter-spacing: 0.07em;
  font-size: 11.5px;
  color: var(--faint);
}

.sub-list {
  padding-left: 12px;
  border-left: 1px solid var(--rule);
  margin: 3px 0 6px 2px;
}

.sub-list .ch-item > a {
  margin-left: -13px;
  padding-left: 11px;
  font-size: 13.5px;
}

.sub-list .ch-item > .wip {
  margin-left: -13px;
  padding-left: 11px;
  font-size: 12.5px;
}

.ai-key {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  line-height: 1.45;
  color: var(--faint);
  font-style: italic;
}

.docs-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: var(--backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

#docs-drawer-toggle:checked ~ .docs-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Center reading column */
.doc-col {
  min-width: 0;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 44px 56px;
}

.doc-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.doc-crumb {
  font-size: 12.5px;
  color: var(--faint);
  font-variant: small-caps;
  letter-spacing: 0.07em;
}

.doc-edit {
  font-size: 12.5px;
  color: var(--faint);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}

.doc-edit:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Mobile inline "On this page" disclosure (hidden on wide desktop) */
.mobile-toc {
  display: none;
  margin: 0 0 22px;
  padding: 9px 14px;
  background: var(--sidebar-bg);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-size: 13.5px;
}

.mobile-toc summary {
  cursor: pointer;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-toc summary::-webkit-details-marker {
  display: none;
}

.mobile-toc summary::after {
  content: "+";
  font-size: 15px;
  color: var(--faint);
}

.mobile-toc[open] summary::after {
  content: "−";
}

.mobile-toc #TableOfContents ul {
  list-style: none;
  margin: 10px 0 2px;
  padding: 0 0 0 10px;
  border-left: 1px solid var(--rule);
}

.mobile-toc #TableOfContents li {
  margin: 4px 0;
}

.mobile-toc #TableOfContents a {
  color: var(--muted);
  text-decoration: none;
  border: 0;
}

.mobile-toc #TableOfContents a:hover {
  color: var(--accent);
}

/* Warm Tufte article typography */
.doc-body h1 {
  font-size: 34px;
  font-weight: 400;
  line-height: 1.16;
  margin: 0 0 18px;
}

.doc-body h2 {
  font-size: 16px;
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  margin: 42px 0 14px;
  padding-top: 12px;
  border-top: 1px solid var(--fg);
}

.doc-body h3 {
  font-size: 21px;
  font-weight: 400;
  font-style: italic;
  line-height: 1.3;
  margin: 30px 0 8px;
}

.doc-body h4 {
  font-size: 16.5px;
  font-weight: 600;
  margin: 22px 0 6px;
}

.doc-body h2 a.anchor,
.doc-body h3 a.anchor,
.doc-body h4 a.anchor {
  opacity: 0;
  border: 0;
  text-decoration: none;
  color: var(--faint);
  font-style: normal;
  font-weight: 400;
  font-variant: normal;
  letter-spacing: 0;
  margin-left: 7px;
  transition: opacity 120ms ease;
}

.doc-body h2:hover a.anchor,
.doc-body h3:hover a.anchor,
.doc-body h4:hover a.anchor,
.doc-body a.anchor:focus {
  opacity: 1;
}

.doc-body p {
  margin: 0 0 15px;
}

.doc-body ul,
.doc-body ol {
  margin: 8px 0 18px;
  padding-left: 24px;
}

.doc-body li {
  margin-bottom: 6px;
}

.doc-body li > ul,
.doc-body li > ol {
  margin: 6px 0 6px;
}

.doc-body a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--link-ul);
  transition: color 120ms ease, border-color 120ms ease;
}

.doc-body a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.doc-body blockquote {
  margin: 18px 0 20px;
  padding: 12px 16px;
  border-left: 2px solid var(--rule);
  background: var(--quote-bg);
  color: var(--muted);
  font-size: 15.5px;
}

.doc-body blockquote p:last-child {
  margin-bottom: 0;
}

.doc-body blockquote strong {
  color: var(--fg);
  font-weight: 600;
}

.doc-body hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 28px 0;
}

/* Inline & block code */
.doc-body code {
  font-family: "Liberation Mono", "DejaVu Sans Mono", ui-monospace, monospace;
  font-size: 13.5px;
  background: var(--code-bg);
  padding: 1px 4px;
  border-radius: 2px;
}

.doc-body .highlight,
.doc-body pre {
  position: relative;
  margin: 16px 0 20px;
}

.doc-body pre {
  background: var(--code-bg) !important;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.54;
  -webkit-overflow-scrolling: touch;
}

.doc-body .highlight pre {
  margin: 0;
}

.doc-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

.code-copy {
  position: absolute;
  top: 7px;
  right: 8px;
  appearance: none;
  background: var(--bg);
  color: var(--faint);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 2px 7px;
  font-family: "Liberation Mono", ui-monospace, monospace;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease;
}

.doc-body .highlight:hover .code-copy,
.doc-body pre:hover .code-copy,
.code-copy:focus,
.code-copy.copied {
  opacity: 1;
}

.code-copy:hover,
.code-copy.copied {
  color: var(--accent);
  border-color: var(--accent);
}

/* Warm Tufte Chroma token colors */
.chroma .k, .chroma .kc, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr { color: var(--hl-kw); font-weight: 600; }
.chroma .kt { color: var(--hl-ty); }
.chroma .s, .chroma .s1, .chroma .s2, .chroma .sb, .chroma .sc, .chroma .sd, .chroma .se, .chroma .sh, .chroma .si, .chroma .sx, .chroma .sr { color: var(--hl-str); }
.chroma .m, .chroma .mb, .chroma .mf, .chroma .mh, .chroma .mi, .chroma .il, .chroma .mo { color: var(--hl-num); }
.chroma .c, .chroma .ch, .chroma .cm, .chroma .c1, .chroma .cs, .chroma .cp, .chroma .cpf { color: var(--hl-cm); font-style: italic; }
.chroma .nf, .chroma .fm, .chroma .nb { color: var(--hl-fn); }
.chroma .nc, .chroma .nd, .chroma .ne { color: var(--hl-ty); }

/* Book-style tables + horizontal scroll wrapper for mobile */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0 22px;
  -webkit-overflow-scrolling: touch;
}

.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 22px;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.table-wrap table {
  margin: 0;
}

.doc-body th,
.doc-body td {
  text-align: left;
  padding: 7px 14px 7px 0;
  vertical-align: top;
}

.doc-body th:last-child,
.doc-body td:last-child {
  padding-right: 0;
}

.doc-body thead th {
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  border-top: 1px solid var(--fg);
  border-bottom: 1px solid var(--rule);
}

.doc-body h2 + table thead th,
.doc-body h2 + .table-wrap thead th {
  border-top-color: var(--rule);
}

.doc-body tbody tr {
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 50%, transparent);
}

.doc-body tbody tr:last-child {
  border-bottom: 1px solid var(--fg);
}

/* Pre-rendered KaTeX */
.katex-display-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
  margin: 14px 0 18px;
  -webkit-overflow-scrolling: touch;
}

.katex-display-wrap .katex-display {
  margin: 0;
}

.katex {
  font-size: 1.04em;
  color: var(--fg);
}

/* Images & SVGs */
.doc-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 20px auto;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .doc-body img[src$=".svg"] {
    filter: invert(0.9) hue-rotate(180deg);
  }
}

:root[data-theme="dark"] .doc-body img[src$=".svg"] {
  filter: invert(0.9) hue-rotate(180deg);
}

/* Previous / Next footer pager */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 42px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.pager-right {
  text-align: right;
}

.pager-link {
  display: inline-block;
  text-decoration: none;
  color: var(--fg);
  border-bottom: none;
  padding: 4px 0;
}

.pager-link small {
  display: block;
  font-size: 11.5px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 2px;
}

.pager-link span {
  font-size: 15.5px;
  border-bottom: 1px solid var(--link-ul);
  transition: color 120ms ease, border-color 120ms ease;
}

.pager-link:hover span {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.doc-col footer {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}

.doc-col footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--link-ul);
}

.doc-col footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Right "On this page" rail */
aside.toc-right {
  position: sticky;
  top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 34px 20px 28px 8px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--faint);
}

.toc-right .on-page {
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 11.5px;
  margin-bottom: 8px;
  color: var(--faint);
}

.toc-right #TableOfContents > ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--rule);
}

.toc-right #TableOfContents ul ul {
  list-style: none;
  margin: 3px 0 4px;
  padding: 0 0 0 10px;
}

.toc-right #TableOfContents li {
  margin: 5px 0;
}

.toc-right #TableOfContents a {
  display: block;
  padding-left: 11px;
  color: var(--faint);
  text-decoration: none;
  border-left: 1.5px solid transparent;
  margin-left: -1px;
  transition: color 120ms ease, border-color 120ms ease;
}

.toc-right #TableOfContents a:hover {
  color: var(--fg);
}

.toc-right #TableOfContents a.cur {
  color: var(--fg);
  border-left-color: var(--accent);
}

/* Search modal */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--backdrop);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 16px 16px;
}

.search-modal[hidden] {
  display: none;
}

.search-dialog {
  width: 100%;
  max-width: 580px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 16px 40px var(--shadow);
  overflow: hidden;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
}

.search-ic {
  color: var(--faint);
  flex-shrink: 0;
}

#docs-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.search-esc {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.search-esc kbd,
.search-foot kbd {
  font-family: "Liberation Mono", ui-monospace, monospace;
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--faint);
  background: var(--sidebar-bg);
}

.search-results {
  max-height: 54vh;
  overflow-y: auto;
  padding: 6px;
}

.search-empty {
  padding: 20px 14px;
  font-size: 14px;
  color: var(--faint);
  font-style: italic;
}

.search-hit {
  display: block;
  padding: 9px 12px;
  border-radius: 2px;
  text-decoration: none;
  color: var(--fg);
  border-left: 2px solid transparent;
}

.search-hit:hover,
.search-hit.sel {
  background: var(--sidebar-bg);
  border-left-color: var(--accent);
}

.search-hit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.search-hit-title {
  font-weight: 600;
  font-size: 15px;
}

.search-hit-crumb {
  font-size: 11.5px;
  color: var(--faint);
  font-variant: small-caps;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.search-hit-snip {
  margin-top: 3px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
}

.search-hit mark {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--fg);
  padding: 0 2px;
  border-radius: 2px;
}

.search-foot {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--rule);
  background: var(--sidebar-bg);
  font-size: 12px;
  color: var(--faint);
}

/* Responsive breakpoints */
@media (max-width: 1180px) {
  .docs-shell {
    grid-template-columns: 248px minmax(0, 1fr);
  }
  aside.toc-right {
    display: none;
  }
  .mobile-toc {
    display: block;
  }
  .doc-col {
    padding: 28px 34px 48px;
  }
}

@media (max-width: 900px) {
  .docs-header-inner {
    padding: 10px 16px;
  }
  .nav-menu-btn {
    display: inline-flex;
  }
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  aside.toc-left {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    max-height: none;
    width: min(84vw, 312px);
    z-index: 80;
    padding: 16px 18px 28px 22px;
    box-shadow: 6px 0 28px var(--shadow);
    transform: translateX(-104%);
    transition: transform 280ms var(--ease-out);
  }
  #docs-drawer-toggle:checked ~ .docs-shell aside.toc-left {
    transform: translateX(0);
  }
  .doc-body > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .drawer-head {
    display: flex;
  }
  .doc-col {
    padding: 22px 20px 44px;
  }
  .doc-body h1 {
    font-size: 28px;
  }
  .code-copy {
    opacity: 0.85;
  }
}

@media (max-width: 600px) {
  body.docs-page {
    font-size: 16px;
  }
  .search-trigger .search-label,
  .search-trigger kbd {
    display: none;
  }
  .search-trigger {
    padding: 5px 7px;
  }
  .nav-menu-btn .menu-label {
    display: none;
  }
  nav.top .nav-right {
    gap: 10px 14px;
    width: 100%;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
    font-size: 13.5px;
  }
  .theme-toggle {
    padding-left: 0;
    border-left: none;
    font-size: 12px;
  }
  .doc-body h1 {
    font-size: 25px;
  }
  .doc-body h3 {
    font-size: 19px;
  }
  .doc-body table {
    font-size: 14px;
  }
  .pager {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .pager-right {
    text-align: left;
  }
  .search-modal {
    padding: 16px 10px;
  }
  .search-foot {
    display: none;
  }
}
