/* ==========================================================================
   راهنمای جیبک: theme + layout (RTL, single light theme)
   Blocks: 1 tokens · 2 base · 3 header · 4 search · 5 layout/sidebar/tree
           6 main/breadcrumbs/pager · 7 page TOC · 8 document content
           9 landing + chapter pages · 10 lightbox · 11 responsive · 12 print
   ========================================================================== */

/* ---- 1. Tokens ---------------------------------------------------------- */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-VF.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --paper: #f6f4ec;
  --surface: #fff;
  --surface-soft: #f3f6f4;
  --ink: #17211f;
  --ink-soft: #52615e;
  --ink-mute: #6b7b76;
  --line: rgba(23, 33, 31, .13);
  --line-strong: rgba(23, 33, 31, .22);
  --green: #078b78;
  --green-deep: #056a5c;
  --green-soft: #dff0e9;
  --green-ink: #034f45;
  --orange: #f39a62;
  --orange-soft: #f9e6d7;
  --orange-ink: #7a3f12;
  --focus: 0 0 0 3px rgba(7, 139, 120, .35);
  --r-sm: 13px;
  --r-md: 16px;
  --r-lg: 24px;
  --shadow-sm: 0 12px 35px rgba(33, 49, 44, .07);
  --shadow-lg: 0 28px 80px rgba(33, 49, 44, .14);
  --hdr-h: 64px;
  --side-w: 19rem;
  --toc-w: 15rem;
  --gutter: 16px;
}

@counter-style fa-digits { system: numeric; symbols: '۰' '۱' '۲' '۳' '۴' '۵' '۶' '۷' '۸' '۹'; }

/* ---- 2. Base ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hdr-h) + 20px); scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  /* ss01 maps Latin digits to Persian forms in Vazirmatn, so figures render Persian wherever they are typed */
  font-feature-settings: 'kern', 'liga', 'calt', 'ss01';
  text-rendering: optimizeLegibility;
}
body.drawer-open, body.lb-open { overflow: hidden; }
a { color: var(--green-deep); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { color: var(--green-ink); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; box-shadow: var(--focus); border-radius: 6px; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--green-deep); color: #fff; padding: 8px 14px; border-radius: 10px; }
.skip:focus { top: 10px; }
[hidden] { display: none !important; }
.progress { position: fixed; top: 0; inset-inline: 0; height: 3px; background: var(--green); transform-origin: right center; transform: scaleX(0); z-index: 60; pointer-events: none; }
.chev, .arrow { flex: none; }
[dir=rtl] .chev { transform: scaleX(-1); }
[dir=rtl] .arrow { transform: scaleX(-1); }

.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 12px; color: var(--ink); }
.icon-btn:hover { background: var(--surface-soft); }
.btn-primary { background: var(--green); color: #fff !important; border-radius: 999px; padding: 8px 18px; text-decoration: none; font-weight: 700; }
.btn-primary:hover { background: var(--green-deep); }

/* ---- 3. Header ---------------------------------------------------------- */
.hdr { position: sticky; top: 0; z-index: 50; background: rgba(246, 244, 236, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.hdr-in { display: flex; align-items: center; gap: 12px; height: var(--hdr-h); padding-inline: var(--gutter); max-width: 100rem; margin-inline: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.logo { color: var(--green); display: inline-flex; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.hdr-links { display: flex; align-items: center; gap: 18px; flex: none; margin-inline-start: auto; font-size: .94rem; }
.hdr-links a:not(.btn-primary) { color: var(--ink-soft); text-decoration: none; }
.hdr-links a:not(.btn-primary):hover { color: var(--green-deep); text-decoration: underline; }
.menu-btn, .search-btn { display: none; }
.hdr .search-wrap { flex: 0 1 34rem; margin-inline: auto; }

/* ---- 4. Search ---------------------------------------------------------- */
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%; height: 44px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px;
  padding-inline: 44px 44px; font-size: .96rem; appearance: none; -webkit-appearance: none;
}
.search-wrap input::placeholder { color: var(--ink-mute); }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-wrap input:focus { outline: none; border-color: var(--green); box-shadow: var(--focus); }
.s-ico { position: absolute; inset-inline-start: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); pointer-events: none; }
.s-key { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: .78rem; padding: 0 8px; line-height: 22px; }
.search-wrap.has-text .s-key, .search-wrap:focus-within .s-key { display: none; }
.search-panel {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: min(42rem, calc(100vw - 2 * var(--gutter))); max-height: min(70vh, 34rem); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 8px; z-index: 70;
}
.s-head { padding: 6px 12px; font-size: .8rem; color: var(--ink-mute); font-weight: 600; }
.s-empty { padding: 14px 12px 16px; color: var(--ink-soft); }
.s-result { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.s-result.focus, .s-result:hover { background: var(--green-soft); }
.s-result .crumb { font-size: .78rem; color: var(--ink-mute); }
.s-result .ttl { font-weight: 700; color: var(--green-ink); }
.s-result .snip { font-size: .88rem; color: var(--ink-soft); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
mark { background: var(--orange-soft); color: inherit; border-radius: 4px; padding: 0 2px; box-shadow: 0 0 0 1px rgba(243, 154, 98, .45); }

/* ---- 5. Layout, sidebar, tree ------------------------------------------ */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w); max-width: 100rem; margin-inline: auto; align-items: start; }
.sidebar {
  position: sticky; top: var(--hdr-h); height: calc(100vh - var(--hdr-h)); display: flex; flex-direction: column;
  border-inline-end: 1px solid var(--line); background: var(--paper); min-width: 0;
}
.side-tools { padding: 16px 16px 8px; display: grid; gap: 10px; }
.filter input { width: 100%; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding-inline: 12px; font-size: .9rem; appearance: none; -webkit-appearance: none; }
.filter input:focus { outline: none; border-color: var(--green); box-shadow: var(--focus); }
.side-btns { display: flex; gap: 14px; font-size: .82rem; }
.side-btns button { border: 0; background: none; color: var(--green-deep); padding: 4px 0; min-height: 28px; }
.side-btns button:hover { text-decoration: underline; }
.tree-wrap { flex: 1; overflow-y: auto; padding: 4px 10px 24px 8px; overscroll-behavior: contain; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-inline-start: 16px; border-inline-start: 1px solid var(--line); padding-inline-start: 6px; display: none; }
.tree li.open > ul { display: block; }
.tree li.hidden { display: none; }
.tree .node { display: flex; align-items: flex-start; border-radius: 12px; }
.tree .node:hover { background: rgba(7, 139, 120, .07); }
.tree .tw { width: 30px; min-height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-mute); flex: none; padding: 0; }
.tree .tw.leaf { cursor: default; }
.tree .tw .chev { transition: transform .15s; }
.tree li.open > .node > .tw .chev { transform: rotate(90deg); }
.tree .node a { flex: 1; padding: 8px 4px 8px 8px; color: var(--ink-soft); text-decoration: none; font-size: .92rem; line-height: 1.55; min-height: 40px; }
.tree .root > .node a { font-weight: 800; color: var(--ink); font-size: .96rem; }
.tree .node.current { background: var(--green-soft); }
.tree .node.current a { color: var(--green-ink); font-weight: 700; }
.side-foot { display: none; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.side-foot a { flex: 1; text-align: center; padding: 10px; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--ink); font-size: .9rem; min-height: 44px; display: grid; place-items: center; }
.side-foot a:last-child { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.backdrop { position: fixed; inset: 0; background: rgba(23, 33, 31, .42); z-index: 54; }

/* ---- 6. Main, breadcrumbs, pager --------------------------------------- */
.main { min-width: 0; padding: 22px 40px 64px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: 46rem; margin: 0 auto 18px; font-size: .84rem; color: var(--ink-mute); }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--green-deep); text-decoration: underline; }
.crumbs .chev { width: 13px; height: 13px; opacity: .7; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.doc { max-width: 46rem; margin: 0 auto; }
.doc:focus, .doc:focus-visible { outline: none; box-shadow: none; }
.main.is-home .doc { max-width: 62rem; }
.pager { max-width: 46rem; margin: 48px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.main.is-home .pager { display: none; }
.pg { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label ico" "title ico"; align-items: center; column-gap: 12px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-decoration: none; color: var(--ink); min-width: 0; }
.pg:hover { border-color: var(--green); box-shadow: var(--shadow-sm); }
.pg-label { grid-area: label; font-size: .78rem; color: var(--ink-mute); }
.pg-title { grid-area: title; font-weight: 700; color: var(--green-ink); line-height: 1.5; }
.pg .arrow { grid-area: ico; color: var(--green); }
.pg.prev { grid-column: 1; grid-template-areas: "ico label" "ico title"; grid-template-columns: auto 1fr; }
.pg.prev .arrow { transform: scaleX(1); }
.pg.next { grid-column: 2; }
.pg.next:only-child { grid-column: 2; }

/* ---- 7. Page TOC -------------------------------------------------------- */
.toc { position: sticky; top: var(--hdr-h); max-height: calc(100vh - var(--hdr-h)); overflow-y: auto; padding: 40px 8px 24px 24px; }
.toc-title { margin: 0 0 10px; font-size: .78rem; font-weight: 700; color: var(--ink-mute); letter-spacing: .02em; }
.toc ul { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--line); }
.toc a { display: block; padding: 4px 14px; margin-inline-start: -1px; border-inline-start: 2px solid transparent; font-size: .85rem; line-height: 1.6; color: var(--ink-soft); text-decoration: none; }
.toc li.l3 a { padding-inline-start: 28px; font-size: .82rem; }
.toc a:hover { color: var(--green-deep); }
.toc a.active { color: var(--green-ink); font-weight: 700; border-inline-start-color: var(--green); }

/* ---- 8. Document content ----------------------------------------------- */
.doc-head { margin-bottom: 26px; }
.page-title { margin: 0; font-size: 2rem; line-height: 1.4; font-weight: 800; letter-spacing: -.01em; }
.lead { margin: 12px 0 0; font-size: 1.1rem; color: var(--ink-soft); line-height: 1.85; }
.chapter-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--green-soft); color: var(--green-deep); margin-bottom: 14px; }
.chapter-ico svg { width: 26px; height: 26px; }
.doc-body > :first-child { margin-top: 0; }
.doc-body p { margin: 0 0 1em; }
.doc-body h2, .doc-body h3 { position: relative; line-height: 1.5; font-weight: 800; }
.doc-body h2 { font-size: 1.45rem; margin: 2.2em 0 .6em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.doc-body h2:first-child { border-top: 0; padding-top: 0; }
.doc-body h3 { font-size: 1.15rem; margin: 1.8em 0 .5em; color: var(--green-ink); }
.doc-body .anchor { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-inline-start: 6px; vertical-align: middle; color: var(--ink-mute); opacity: 0; border-radius: 8px; transition: opacity .15s; }
.doc-body h2:hover .anchor, .doc-body h3:hover .anchor, .doc-body .anchor:focus-visible { opacity: 1; }
.doc-body .anchor:hover { background: var(--green-soft); color: var(--green-deep); }
.doc-body ul, .doc-body ol:not(.steps) { padding-inline-start: 1.5em; margin: 0 0 1.1em; }
.doc-body li { margin-bottom: .35em; }
.doc-body li::marker { color: var(--green); }
.doc-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.doc-body strong, .doc-body b { font-weight: 700; }

/* kbd = a UI label (button/menu text), not keyboard input */
kbd { font-family: inherit; font-size: .92em; font-weight: 600; background: var(--green-soft); color: var(--green-ink); border-radius: 8px; padding: 1px 9px; white-space: nowrap; border: 0; display: inline-block; line-height: 1.6; }

/* steps: numbered green circles */
ol.steps { list-style: none; counter-reset: step; margin: 1.2em 0 1.4em; padding: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-inline-start: 50px; margin: 0 0 1.1em; min-height: 36px; }
ol.steps > li::before {
  content: counter(step, fa-digits); position: absolute; inset-inline-start: 0; top: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .95rem; line-height: 1;
}
ol.steps > li:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 17px; top: 42px; bottom: -14px; width: 2px; background: var(--green-soft); }
ol.steps > li > b:first-child { display: block; font-weight: 800; color: var(--ink); margin-bottom: 2px; }

/* phone screenshots in a thin device frame */
figure { margin: 1.6em 0; }
figure.shot { width: 280px; max-width: 100%; margin-inline: auto; }
figure.shot img { display: block; width: 100%; border-radius: 28px; border: 6px solid #1d2826; background: #fff; box-shadow: var(--shadow-sm); cursor: zoom-in; }
figure figcaption { margin-top: 10px; font-size: .86rem; color: var(--ink-soft); text-align: center; line-height: 1.7; }
.shots { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; margin: 1.6em 0; }
.shots figure.shot { margin: 0; width: min(280px, 100%); flex: 0 1 280px; }
figure.diagram { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; }
figure.diagram img { display: block; width: 100%; cursor: zoom-in; }
@media (max-width: 767.98px) {
  figure.diagram { overflow-x: auto; padding: 12px; }
  figure.diagram img { width: 640px; max-width: none; }
  figure.diagram figcaption::after { content: ' (برای بزرگ‌نمایی لمس کنید)'; color: var(--ink-mute); }
}
figure.missing { position: relative; }
figure.missing::before { content: 'تصویر به‌زودی اضافه می‌شود'; display: grid; place-items: center; min-height: 160px; border: 1px dashed var(--line-strong); border-radius: 22px; color: var(--ink-mute); font-size: .85rem; background: var(--surface); padding: 12px; text-align: center; }
figure.shot.missing::before { aspect-ratio: 390 / 600; min-height: 0; }

/* callouts */
.callout { margin: 1.4em 0; padding: 14px 18px 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); border-inline-start-width: 4px; background: var(--surface); }
.callout > :last-child { margin-bottom: 0; }
.callout > b:first-child, .callout > strong:first-child { display: block; margin-bottom: 2px; font-weight: 800; }
.callout.tip { background: var(--green-soft); border-color: rgba(7, 139, 120, .25); border-inline-start-color: var(--green); color: var(--green-ink); }
.callout.note { background: var(--surface-soft); border-inline-start-color: var(--ink-mute); }
.callout.warn { background: var(--orange-soft); border-color: rgba(243, 154, 98, .45); border-inline-start-color: var(--orange); color: var(--orange-ink); }

/* facts: "at a glance" */
dl.facts { display: grid; grid-template-columns: max-content 1fr; margin: 1.4em 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
dl.facts dt, dl.facts dd { margin: 0; padding: 11px 18px; border-top: 1px solid var(--line); }
dl.facts dt:first-of-type, dl.facts dt:first-of-type + dd { border-top: 0; }
dl.facts dt { color: var(--ink-mute); font-size: .88rem; font-weight: 600; background: var(--surface-soft); padding-inline-end: 28px; }
dl.facts dd { font-weight: 600; }

/* tables */
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.props { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 30rem; }
table.props th, table.props td { padding: 11px 16px; text-align: start; vertical-align: top; border-top: 1px solid var(--line); }
table.props thead th { background: var(--surface-soft); border-top: 0; font-weight: 700; color: var(--ink-soft); font-size: .86rem; white-space: nowrap; }
table.props tbody tr:first-child td { border-top: 0; }
table.props td:first-child { font-weight: 600; }
table:not(.props) { border-collapse: collapse; }

/* ---- 9. Landing + chapter pages ---------------------------------------- */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 44px 40px 40px; margin-bottom: 40px; }
.eyebrow { margin: 0 0 12px; color: var(--green-deep); font-weight: 700; font-size: .9rem; }
.hero .page-title { font-size: 2.5rem; line-height: 1.45; max-width: 36rem; }
.hero .page-title span { color: var(--green); }
.hero-lead { margin: 14px 0 26px; color: var(--ink-soft); font-size: 1.08rem; max-width: 38rem; }
.hero-search { max-width: 34rem; }
.hero-search input { height: 54px; font-size: 1rem; background: var(--paper); }
.hero-search .s-ico { inset-inline-start: 18px; }
.hero-search input { padding-inline-start: 50px; }
.hero-search .search-panel { left: auto; right: 0; transform: none; width: min(40rem, calc(100vw - 2 * var(--gutter))); }
[dir=rtl] .hero-search .search-panel { right: 0; }
.block-title { font-size: 1.3rem; font-weight: 800; margin: 0 0 16px; }
.home-block { margin-bottom: 44px; }
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.role-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.role-card:hover { border-color: var(--green); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.rc-ico { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: var(--green-soft); color: var(--green-deep); margin-bottom: 4px; }
.rc-ico svg { width: 26px; height: 26px; }
.rc-title { font-weight: 800; font-size: 1.08rem; line-height: 1.5; }
.rc-lead { color: var(--ink-soft); font-size: .9rem; line-height: 1.8; flex: 1; }
.rc-meta { display: flex; align-items: center; gap: 6px; color: var(--green-deep); font-size: .86rem; font-weight: 700; margin-top: 6px; }
.paths { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.path { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; }
.path h3 { margin: 0 0 10px; font-size: 1.02rem; font-weight: 800; }
.path ol { list-style: none; counter-reset: p; margin: 0; padding: 0; }
.path li { counter-increment: p; display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: .92rem; }
.path li::before { content: counter(p, fa-digits); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); display: grid; place-items: center; font-size: .78rem; font-weight: 700; }
.path li a { text-decoration: none; color: var(--ink); }
.path li a:hover { color: var(--green-deep); text-decoration: underline; }
.path li.soon { color: var(--ink-mute); }
.path li.soon em { font-style: normal; font-size: .72rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.sec-list { display: grid; gap: 10px; }
.sec-card { position: relative; display: grid; gap: 2px; padding: 16px 20px; padding-inline-end: 56px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--ink); }
.sec-card:hover { border-color: var(--green); box-shadow: var(--shadow-sm); }
.sc-title { font-weight: 800; color: var(--green-ink); line-height: 1.6; }
.sc-lead { color: var(--ink-soft); font-size: .9rem; line-height: 1.8; }
.sc-meta { font-size: .8rem; color: var(--ink-mute); }
.sc-go { position: absolute; inset-inline-end: 18px; top: 50%; transform: translateY(-50%); color: var(--green); display: grid; }
.back-home { margin-top: 24px; }

/* ---- 10. Lightbox ------------------------------------------------------- */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(15, 22, 20, .86); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 16px 24px; gap: 12px; }
.lightbox img { max-width: min(100%, 60rem); max-height: calc(100vh - 140px); border-radius: 18px; box-shadow: var(--shadow-lg); background: #fff; object-fit: contain; }
.lightbox.wide { overflow: auto; justify-content: flex-start; }
.lightbox.wide img { width: 900px; max-width: none; max-height: none; margin: auto; flex: none; }
.lb-cap { margin: 0; color: #e9efed; font-size: .9rem; text-align: center; max-width: 40rem; }
.lb-cap:empty { display: none; }
.lb-close { position: absolute; top: 10px; inset-inline-end: 10px; color: #fff; background: rgba(255, 255, 255, .12); }
.lb-close:hover { background: rgba(255, 255, 255, .22); }

/* ---- 11. Responsive ----------------------------------------------------- */
@media (max-width: 1279.98px) {
  .layout { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 1023.98px) {
  .layout { display: block; }
  .main { padding: 18px 28px 56px; }
  .menu-btn { display: inline-grid; margin-inline-start: -8px; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; inset-inline-start: auto; right: 0; width: min(21rem, 88vw); height: 100dvh; z-index: 55;
    background: var(--paper); box-shadow: var(--shadow-lg); transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s;
    border-inline-end: 0;
  }
  body.drawer-open .sidebar { transform: none; visibility: visible; transition: transform .22s ease; }
  .side-tools { padding-top: 20px; }
  .side-foot { display: flex; }
  .role-grid, .paths { grid-template-columns: repeat(2, 1fr); }
  .hdr .search-wrap { flex-basis: 24rem; }
}
@media (max-width: 820px) {
  .hdr-links a:not(.btn-primary) { display: none; }
  .hdr .search-wrap { flex-basis: 16rem; }
}
@media (max-width: 767.98px) {
  :root { --hdr-h: 56px; }
  .hdr-in { gap: 6px; }
  .hdr .search-wrap { display: none; }
  .hdr.search-open .search-wrap { display: block; position: absolute; top: var(--hdr-h); inset-inline: var(--gutter); flex: none; padding-bottom: 10px; }
  .hdr.search-open { padding-bottom: 54px; }
  .hdr.search-open .search-panel { top: calc(100% - 2px); }
  .search-btn { display: inline-grid; margin-inline-start: auto; }
  .hdr-links { margin-inline-start: 0; }
  .hdr-links .btn-primary { display: none; }
  .brand-name { font-size: 1.02rem; }
  .main { padding: 14px var(--gutter) 48px; }
  .page-title { font-size: 1.6rem; }
  .lead { font-size: 1.02rem; }
  .hero { padding: 26px 20px 24px; border-radius: 20px; margin-bottom: 30px; }
  .hero .page-title { font-size: 1.7rem; }
  .role-grid, .paths { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pg.next, .pg.prev { grid-column: 1; }
  .doc-body h2 { font-size: 1.3rem; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dt { padding-bottom: 2px; }
  dl.facts dd { border-top: 0; padding-top: 2px; }
}

/* ---- 12. Motion + print ------------------------------------------------- */
@media (max-width: 767.98px) {
  table.props { min-width: 21rem; }
  table.props th, table.props td { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  body { background: #fff; font-size: 12pt; }
  .hdr, .sidebar, .toc, .pager, .crumbs, .progress, .backdrop, .lightbox, .anchor, .skip { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  .doc { max-width: none; }
  figure, .callout, table, ol.steps > li { break-inside: avoid; }
  figure.shot img { box-shadow: none; }
  a { color: inherit; text-decoration: none; }
  .doc-body a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: .8em; color: #555; }
}
