/* Baziness Developer Wiki — one stylesheet for both languages (logical properties handle RTL). */

:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f1f1f8;
  --border: #e3e3ee;
  --text: #1b1b2b;
  --muted: #5d5d78;
  --faint: #8a8aa3;
  --accent: #4f46e5;
  --accent-2: #6d5efc;
  --accent-soft: #ecebff;
  --accent-text: #4338ca;
  --gold: #f5b82e;
  --code-bg: #14142a;
  --code-head: #1d1d38;
  --code-text: #e6e6f5;
  --inline-code-bg: #ececf6;
  --inline-code-text: #3b2fbf;
  --note: #2563eb;
  --tip: #059669;
  --warn: #d97706;
  --important: #9333ea;
  --shadow: 0 1px 2px rgba(20, 20, 50, 0.06), 0 8px 24px rgba(20, 20, 50, 0.06);
  --radius: 12px;
  --topbar: 60px;
  --font: "Inter", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

code,
pre {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e1a;
    --surface: #15152a;
    --surface-2: #1c1c35;
    --border: #2a2a48;
    --text: #e8e8f6;
    --muted: #a6a6c4;
    --faint: #7a7a9a;
    --accent: #7c74ff;
    --accent-2: #9b8cff;
    --accent-soft: #23234a;
    --accent-text: #b4adff;
    --code-bg: #0a0a16;
    --code-head: #131326;
    --inline-code-bg: #24244a;
    --inline-code-text: #c4bfff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e1a;
  --surface: #15152a;
  --surface-2: #1c1c35;
  --border: #2a2a48;
  --text: #e8e8f6;
  --muted: #a6a6c4;
  --faint: #7a7a9a;
  --accent: #7c74ff;
  --accent-2: #9b8cff;
  --accent-soft: #23234a;
  --accent-text: #b4adff;
  --code-bg: #0a0a16;
  --code-head: #131326;
  --inline-code-bg: #24244a;
  --inline-code-text: #c4bfff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

html[lang="fa"] {
  --font: "Vazirmatn", "Inter", system-ui, Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}
html {
  scroll-padding-top: calc(var(--topbar) + 16px);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
}
a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  font-size: 1.02rem;
}
.brand:hover {
  text-decoration: none;
}
.logo {
  width: 30px;
  height: 30px;
  stroke: none;
}
.search {
  position: relative;
  flex: 1;
  max-width: 440px;
  margin-inline-start: auto;
  display: flex;
  align-items: center;
}
.search > svg {
  position: absolute;
  inset-inline-start: 12px;
  color: var(--faint);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 38px;
  padding-inline: 38px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  max-height: min(70vh, 460px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
}
.search-results a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  line-height: 1.45;
}
.search-results a:hover,
.search-results a.active {
  background: var(--accent-soft);
  text-decoration: none;
}
.search-results small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}
.search-results .empty {
  padding: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn,
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  min-width: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.lang-btn:hover,
.icon-btn:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.theme-toggle svg:last-child {
  display: none;
}
:root[data-theme="dark"] .theme-toggle svg:first-child {
  display: none;
}
:root[data-theme="dark"] .theme-toggle svg:last-child {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle svg:first-child {
    display: none;
  }
  :root:not([data-theme="light"]) .theme-toggle svg:last-child {
    display: block;
  }
}
.nav-toggle {
  display: none;
}

/* ---------------------------------------------------------------- layout */

.layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 230px;
  max-width: 1440px;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 24px 16px 40px;
  border-inline-end: 1px solid var(--border);
}
.nav-group + .nav-group {
  margin-top: 20px;
}
.nav-title {
  padding: 0 10px 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
html[lang="fa"] .nav-title {
  letter-spacing: 0;
  font-size: 0.8rem;
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}
.sidebar a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.sidebar a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.nav-downloads {
  margin-top: 28px !important;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.scrim {
  display: none;
}

.content {
  min-width: 0;
  padding: 40px 48px 80px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}
.toc {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 40px 16px 40px 8px;
  font-size: 0.85rem;
}
html[dir="rtl"] .toc {
  padding: 40px 8px 40px 16px;
}
.toc-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-inline-start: 1px solid var(--border);
}
.toc a {
  display: block;
  padding: 4px 12px;
  margin-inline-start: -1px;
  border-inline-start: 2px solid transparent;
  color: var(--muted);
  line-height: 1.45;
}
.toc li.d3 a {
  padding-inline-start: 24px;
  font-size: 0.8rem;
}
.toc a:hover {
  color: var(--text);
  text-decoration: none;
}
.toc a.active {
  color: var(--accent-text);
  border-inline-start-color: var(--accent);
  font-weight: 600;
}

/* ---------------------------------------------------------------- page head */

.page-head {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
html[lang="fa"] .eyebrow {
  letter-spacing: 0;
  text-transform: none;
}
.page-head h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
html[lang="fa"] .page-head h1 {
  letter-spacing: 0;
}
.lead {
  margin: 0;
  font-size: 1.1rem;
  color: var(--muted);
}
.downloads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--faint);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}
.chip svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.chip:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.cover-toc {
  margin: 18px 0 0;
  padding-inline-start: 22px;
  columns: 2;
  column-gap: 32px;
}
.all-section {
  padding-top: 32px;
}
.all-section + .all-section {
  border-top: 2px dashed var(--border);
  margin-top: 40px;
}

/* ---------------------------------------------------------------- prose */

.prose {
  overflow-wrap: break-word;
}
.prose h2,
.prose h3,
.prose h4,
.prose h5 {
  position: relative;
  line-height: 1.35;
  scroll-margin-top: calc(var(--topbar) + 16px);
}
.prose h2 {
  margin: 2.4em 0 0.7em;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}
.prose h3 {
  margin: 1.9em 0 0.5em;
  font-size: 1.18rem;
}
.prose h4 {
  margin: 1.6em 0 0.4em;
  font-size: 1.05rem;
}
.prose > :first-child {
  margin-top: 0;
}
.anchor {
  position: absolute;
  inset-inline-start: -1.1em;
  color: var(--faint);
  opacity: 0;
  font-weight: 400;
  text-decoration: none !important;
}
.prose :is(h2, h3, h4, h5):hover .anchor {
  opacity: 1;
}
.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1em;
}
.prose li + li {
  margin-top: 0.3em;
}
.prose li > ul,
.prose li > ol {
  margin-top: 0.3em;
  margin-bottom: 0;
}
.prose strong {
  font-weight: 700;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.4em 0;
}
.prose :not(pre) > code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  font-family: var(--mono);
  font-size: 0.86em;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: normal;
  overflow-wrap: break-word;
}
.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.4em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.55;
}
.prose th,
.prose td {
  padding: 10px 14px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.prose th {
  background: var(--surface-2);
  font-weight: 700;
  white-space: nowrap;
}
.prose tr:last-child td {
  border-bottom: 0;
}
.prose blockquote {
  margin: 0 0 1.2em;
  padding: 12px 16px;
  border-inline-start: 4px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}
.callout {
  --c: var(--note);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border)) !important;
  border-inline-start: 4px solid var(--c) !important;
  background: color-mix(in srgb, var(--c) 7%, var(--surface)) !important;
  color: var(--text) !important;
}
.callout-tip {
  --c: var(--tip);
}
.callout-warning {
  --c: var(--warn);
}
.callout-important {
  --c: var(--important);
}
.callout-title {
  margin: 0 0 4px !important;
  font-weight: 700;
  color: var(--c);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------- code */

.code-block,
.code-tabs {
  margin: 0 0 1.4em;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid color-mix(in srgb, var(--code-bg) 70%, var(--border));
  direction: ltr;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 8px 0 14px;
  background: var(--code-head);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.code-lang {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #9d9dc0;
}
.tab-list {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  margin-inline-start: -8px;
  scrollbar-width: none;
}
.tab-list button {
  position: relative;
  height: 40px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #9d9dc0;
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.tab-list button:hover {
  color: #fff;
}
.tab-list button[aria-selected="true"] {
  color: #fff;
}
.tab-list button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-2);
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: transparent;
  color: #b9b9d8;
  font: 500 0.75rem var(--font);
  cursor: pointer;
  flex: none;
}
.copy-btn svg {
  width: 14px;
  height: 14px;
}
.copy-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.copy-btn.ok {
  color: #6ee7b7;
  border-color: #6ee7b7;
}
.prose pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.65;
  tab-size: 2;
  text-align: left;
}
.prose pre code {
  font-family: inherit;
  background: none;
  padding: 0;
}
.print-label {
  display: none;
}
.tab-panel[hidden] {
  display: none;
}

/* highlight.js tokens (one dark palette — code panels are always dark) */
.hljs-comment,
.hljs-quote {
  color: #7f84a8;
  font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag {
  color: #c792ea;
}
.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-template-tag {
  color: #a5e075;
}
.hljs-number,
.hljs-symbol,
.hljs-bullet {
  color: #f9ae58;
}
.hljs-title,
.hljs-title.function_,
.hljs-section {
  color: #82aaff;
}
.hljs-title.class_,
.hljs-type,
.hljs-built_in {
  color: #ffcb6b;
}
.hljs-attr,
.hljs-attribute,
.hljs-property,
.hljs-variable,
.hljs-template-variable {
  color: #89ddff;
}
.hljs-params {
  color: #e6e6f5;
}
.hljs-meta,
.hljs-meta .hljs-keyword {
  color: #ff9cac;
}
.hljs-deletion {
  color: #ff5370;
}
.hljs-tag,
.hljs-name {
  color: #f07178;
}

/* ---------------------------------------------------------------- mermaid */

.mermaid-wrap {
  margin: 0 0 1.4em;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
  direction: ltr;
}
.mermaid-wrap pre.mermaid {
  margin: 0;
  padding: 0;
  background: none;
  color: var(--muted);
  text-align: center;
  font-family: var(--font);
}
.mermaid-wrap svg {
  width: auto;
  height: auto;
  max-width: 100%;
  stroke: none;
  fill: initial;
}

/* ---------------------------------------------------------------- pager */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 56px;
}
.pager a {
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}
.pager a:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.pager small {
  color: var(--faint);
  font-weight: 500;
}
.pager .next {
  text-align: end;
  grid-column: 2;
}

/* ---------------------------------------------------------------- buttons, demo */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  font: 600 0.95rem var(--font);
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-2);
  text-decoration: none;
}
.demo-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 0 0 1.4em;
  padding: 16px 18px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.demo-card p {
  margin: 0 !important;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1 1 240px;
}

/* the demo sheet — same structure and CSS as the one the docs recommend */
.overlay.baziness-webview {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: rgba(8, 6, 4, 0.5);
}
.overlay.baziness-webview.hidden {
  display: none;
}
.baziness-sheet {
  position: relative;
  width: min(560px, 100%);
  height: 92%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 22px 22px 0 0;
  overflow: hidden;
  box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.42);
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}
.baziness-grabber-zone {
  flex: 0 0 auto;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  background: #fff;
}
.baziness-grabber {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}
.baziness-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

/* ---------------------------------------------------------------- landing */

body.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    var(--bg);
}
.land-head {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 8px;
}
.land-head .logo {
  width: 44px;
  height: 44px;
}
.land-head h1 {
  margin: 0;
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  line-height: 1.4;
}
.land-head .sep {
  color: var(--faint);
}
.land-head .theme-toggle {
  margin-inline-start: auto;
}
.land-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 20px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
  flex: 1;
}
.land-card {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.land-card[lang="fa"] {
  font-family: "Vazirmatn", sans-serif;
}
.land-card[lang="en"] {
  font-family: "Inter", sans-serif;
}
.land-lang {
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 700;
}
.land-card h2 {
  margin: 12px 0 6px;
  font-size: 1.5rem;
}
.land-card p {
  margin: 0 0 14px;
  color: var(--muted);
}
.land-card ul {
  margin: 0 0 22px;
  padding-inline-start: 20px;
  line-height: 1.9;
}
.land-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}
.land-example {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
  box-shadow: var(--shadow);
}
.land-example-text {
  flex: 1 1 320px;
}
.land-example-text b {
  font-size: 1.15rem;
}
.land-example-text p {
  margin: 4px 0 0;
  color: var(--muted);
}
.land-example .btn svg {
  color: #fff;
}
.land-foot {
  padding: 20px;
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .nav-toggle {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: var(--topbar);
    inset-inline-start: 0;
    z-index: 60;
    width: min(300px, 86vw);
    background: var(--surface);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }
  html[dir="rtl"] .sidebar {
    transform: translateX(105%);
  }
  body.nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease;
  }
  body.nav-open .scrim {
    display: block;
    position: fixed;
    inset: var(--topbar) 0 0 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.35);
  }
  .content {
    padding: 28px 16px 64px;
  }
  .land-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .topbar {
    gap: 8px;
    padding: 0 12px;
  }
  .brand span {
    display: none;
  }
  .lang-btn span {
    display: none;
  }
  .search {
    max-width: none;
  }
  .cover-toc {
    columns: 1;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager .next {
    grid-column: 1;
  }
  .prose pre {
    font-size: 0.8rem;
  }
}

/* ---------------------------------------------------------------- print / PDF */

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --code-bg: #f6f6fb;
    --code-head: #ececf6;
    --code-text: #1b1b2b;
  }
  body {
    font-size: 11pt;
    line-height: 1.6;
    background: #fff;
  }
  .topbar,
  .sidebar,
  .toc,
  .scrim,
  .no-print,
  .copy-btn,
  .tab-list,
  .anchor {
    display: none !important;
  }
  .layout {
    display: block;
  }
  .content {
    max-width: none;
    padding: 0;
  }
  .code-block,
  .code-tabs {
    border: 1px solid #dcdce8;
  }
  .code-tabs .code-head {
    display: none;
  }
  .tab-panel,
  .tab-panel[hidden] {
    display: block !important;
  }
  .tab-panel + .tab-panel {
    border-top: 1px solid #dcdce8;
  }
  .print-label {
    display: block;
    padding: 6px 14px;
    background: #ececf6;
    font: 600 8.5pt var(--mono);
    color: #4b4b6b;
  }
  .code-head {
    min-height: 0;
    padding: 6px 14px;
  }
  .code-lang {
    color: #4b4b6b;
  }
  .prose pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 8.3pt;
    line-height: 1.5;
    overflow: visible;
  }
  .hljs-comment,
  .hljs-quote {
    color: #6a6f8f;
  }
  .hljs-keyword,
  .hljs-selector-tag,
  .hljs-literal,
  .hljs-doctag {
    color: #7c2fb8;
  }
  .hljs-string,
  .hljs-regexp,
  .hljs-addition {
    color: #2f7d16;
  }
  .hljs-number {
    color: #b45309;
  }
  .hljs-title,
  .hljs-title.function_ {
    color: #1d4ed8;
  }
  .hljs-title.class_,
  .hljs-type,
  .hljs-built_in {
    color: #a16207;
  }
  .hljs-attr,
  .hljs-attribute,
  .hljs-property,
  .hljs-variable {
    color: #0e7490;
  }
  .hljs-params {
    color: #1b1b2b;
  }
  .prose h2,
  .prose h3,
  .prose h4 {
    break-after: avoid;
  }
  .table-wrap,
  .callout,
  .mermaid-wrap {
    break-inside: avoid;
  }
  .all-section {
    break-before: page;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .cover {
    border: 0;
  }
  a {
    color: var(--accent-text);
  }
}
