/* RAKAN docs section (site/docs.html, docs-ar.html, docs/*.html, docs/ar/*.html). Loaded after styles / flow / rtl / home.
   Mobile first: one column + slide-in menu; ≥ 900 px sidebar; ≥ 1180 px "on this page" column. Colours = the site tokens in styles.css. */
.d-body { --d-side: 268px; --d-toc: 210px; --d-bar: 48px; --d-r: 14px; background: radial-gradient(1200px 500px at 10% -10%, rgba(10, 132, 255, .08), transparent 60%), var(--bg); }
.d-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar under the header (mobile menu button + where you are) */
.d-bar { position: sticky; top: var(--d-top, 61px); z-index: 8; background: rgba(1, 10, 21, .9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.d-bar .wrap { display: flex; align-items: center; gap: 12px; min-height: var(--d-bar); }
.d-menu { display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); color: var(--white); font: 600 .82rem/1 var(--display); cursor: pointer; }
.d-menu svg { width: 18px; height: 18px; fill: var(--cyan); }
.d-menu:hover { border-color: var(--cyan); }
.d-bar-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mute); font-size: .84rem; }
.d-bar-t b { color: var(--white); font-weight: 600; }

.d-shell { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }

/* sidebar = off-canvas drawer on phones */
.d-side { position: fixed; inset: 0 auto 0 0; z-index: 70; width: min(86vw, 320px); transform: translateX(-102%); transition: transform .28s var(--ease); background: #030f1e; border-inline-end: 1px solid var(--line-2); box-shadow: 20px 0 60px -20px rgba(0, 0, 0, .8); overflow-y: auto; overscroll-behavior: contain; visibility: hidden; }
html[dir="rtl"] .d-side { inset: 0 0 0 auto; transform: translateX(102%); box-shadow: -20px 0 60px -20px rgba(0, 0, 0, .8); }
.d-side.is-open { transform: none; visibility: visible; }
.d-scrim { position: fixed; inset: 0; z-index: 65; background: rgba(0, 4, 10, .6); }
.d-side-in { padding: 18px 16px 90px; }
.d-side-home { display: block; margin-bottom: 14px; color: var(--white); font: 700 1rem/1.2 var(--display); text-decoration: none; }
.d-side-home::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-inline-end: 10px; border-radius: 2px; background: var(--grad); box-shadow: 0 0 10px var(--cyan); vertical-align: middle; }

.d-grp { margin-top: 18px; }
.d-grp-h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--cyan); font: 600 .7rem/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
html[dir="rtl"] .d-grp-h { font-family: var(--ar); font-size: .8rem; text-transform: none; }
.d-grp-h svg { width: 15px; height: 15px; fill: currentColor; opacity: .85; }
.d-grp ul { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--line); }
.d-grp a { display: block; padding: 7px 12px; margin-inline-start: -1px; border-inline-start: 2px solid transparent; color: var(--text); text-decoration: none; font-size: .92rem; line-height: 1.35; border-radius: 0 8px 8px 0; }
html[dir="rtl"] .d-grp a { border-radius: 8px 0 0 8px; }
.d-grp a:hover { color: var(--white); background: rgba(34, 195, 255, .05); }
.d-grp a[aria-current="page"] { color: var(--white); border-inline-start-color: var(--cyan); background: linear-gradient(90deg, rgba(34, 195, 255, .14), rgba(34, 195, 255, .02)); font-weight: 600; }
html[dir="rtl"] .d-grp a[aria-current="page"] { background: linear-gradient(270deg, rgba(34, 195, 255, .14), rgba(34, 195, 255, .02)); }

/* search (shown only when docs.js runs) */
.d-search { position: relative; display: none; }
.d-js .d-search { display: block; }
.d-search input { width: 100%; min-height: 42px; padding: 0 40px 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); color: var(--white); font: 400 .92rem/1 var(--body); }
html[dir="rtl"] .d-search input { padding: 0 12px 0 40px; }
.d-search input::placeholder { color: var(--mute); }
.d-search input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 195, 255, .18); }
.d-search kbd { position: absolute; top: 10px; inset-inline-end: 10px; min-width: 22px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--mute); font: 500 .74rem/1.3 var(--mono); text-align: center; }
.d-res { list-style: none; margin: 6px 0 0; padding: 6px; border-radius: 12px; border: 1px solid var(--line-2); background: #061629; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9); max-height: 60vh; overflow-y: auto; }
.d-res li { margin: 0; }
.d-res a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.d-res a b { display: block; color: var(--white); font-weight: 600; font-size: .9rem; }
.d-res a small { display: block; color: var(--mute); font-size: .76rem; line-height: 1.4; }
.d-res a:hover, .d-res a.is-on { background: rgba(34, 195, 255, .1); }
.d-res mark { background: rgba(34, 195, 255, .25); color: var(--white); border-radius: 3px; }
.d-res .d-none { padding: 10px; color: var(--mute); font-size: .86rem; }

/* main column */
.d-main { min-width: 0; padding: 22px 16px 40px; outline: none; }
.d-bc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--mute); font: 500 .76rem/1.4 var(--mono); margin-bottom: 14px; }
html[dir="rtl"] .d-bc { font-family: var(--ar); font-size: .84rem; }
.d-bc a { color: var(--cyan); text-decoration: none; }
.d-art { max-width: 760px; }
.d-art h1 { font-size: clamp(1.8rem, 6vw, 2.5rem); margin: 0 0 12px; }
.d-art h2 { position: relative; font-size: 1.3rem; margin: 38px 0 12px; padding-top: 6px; scroll-margin-top: calc(var(--hdr) + var(--d-bar) + 16px); }
.d-art h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.d-anchor { display: none; position: absolute; inset-inline-start: -1.1em; top: 6px; color: var(--cyan); opacity: 0; text-decoration: none; font-weight: 500; transition: opacity .2s; }
.d-art h2:hover .d-anchor, .d-anchor:focus-visible { opacity: .8; }
.d-art p, .d-art li { color: var(--text); }
.d-art p { margin: 0 0 14px; }
.d-art ul, .d-art ol { margin: 0 0 16px; padding-inline-start: 1.25em; }
.d-art li { margin: 6px 0; }
.d-art li::marker { color: var(--cyan); }
.d-lead { font-size: 1.08rem; color: var(--white) !important; opacity: .92; margin-bottom: 20px !important; }
.d-art code { font: 500 .86em/1.4 var(--mono); padding: 2px 6px; border-radius: 6px; background: rgba(34, 195, 255, .09); color: #bfefff; border: 1px solid rgba(34, 195, 255, .16); white-space: nowrap; unicode-bidi: isolate; }
.d-art a { overflow-wrap: anywhere; }

/* numbered steps */
.d-steps { counter-reset: s; list-style: none; padding: 0 !important; }
.d-steps > li { counter-increment: s; position: relative; padding: 2px 0 10px; padding-inline-start: 44px; margin: 0 0 6px; }
.d-steps > li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 0; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(10, 132, 255, .16); border: 1px solid rgba(34, 195, 255, .4); color: var(--white); font: 700 .9rem/1 var(--display); }

/* command block + copy button */
.d-cmd { position: relative; margin: 0 0 18px; }
.d-cmd pre { margin: 0; padding: 14px 16px; padding-inline-end: 84px; border-radius: 12px; border: 1px solid var(--line-2); background: #020a14; overflow-x: auto; direction: ltr; text-align: left; }
html[dir="rtl"] .d-cmd pre { padding-inline-end: 16px; padding-right: 84px; }
.d-cmd code { all: unset; font: 500 .9rem/1.7 var(--mono); color: #d8f3ff; white-space: pre; }
.d-copy { position: absolute; top: 9px; right: 9px; min-height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); color: var(--text); font: 600 .74rem/1 var(--display); cursor: pointer; }
.d-copy:hover { border-color: var(--cyan); color: var(--white); }
.d-copy.is-done { border-color: var(--lower); color: var(--lower); }

/* callouts */
.d-call { display: flex; gap: 12px; margin: 0 0 18px; padding: 14px 16px; border-radius: var(--d-r); border: 1px solid var(--line-2); background: rgba(255, 255, 255, .025); }
.d-call > div { min-width: 0; }
.d-call p:last-child, .d-call ul:last-child { margin-bottom: 0; }
.d-call ul { padding-inline-start: 1.1em; margin-top: 4px; }
.d-call-ic { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font: 700 .8rem/1 var(--display); color: #001018; background: var(--cyan); margin-top: 1px; }
.d-call-t { display: block; margin-bottom: 4px; font: 600 .78rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); }
html[dir="rtl"] .d-call-t { font-family: var(--ar); font-size: .9rem; text-transform: none; }
.d-call-tip { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .05); } .d-call-tip .d-call-ic { background: var(--lower); } .d-call-tip .d-call-t { color: var(--lower); }
.d-call-warn { border-color: rgba(255, 181, 71, .4); background: rgba(255, 181, 71, .05); } .d-call-warn .d-call-ic { background: var(--caution); } .d-call-warn .d-call-t { color: var(--caution); }
.d-call-risk { border-color: rgba(255, 90, 106, .4); background: rgba(255, 90, 106, .05); } .d-call-risk .d-call-ic { background: var(--high); color: #1a0004; } .d-call-risk .d-call-t { color: var(--high); }

/* figures */
.d-fig { margin: 4px 0 22px; }
.d-fig > img { display: block; width: 100%; height: auto; border-radius: var(--d-r); border: 1px solid var(--line-2); background: #04111f; }
.d-fig figcaption { margin-top: 8px; color: var(--mute); font-size: .84rem; line-height: 1.5; }
.d-ex { display: inline-block; margin-inline-end: 8px; padding: 1px 8px; border-radius: 999px; border: 1px solid rgba(169, 182, 255, .45); color: var(--unknown); font: 600 .68rem/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; vertical-align: 1px; }
html[dir="rtl"] .d-ex { font-family: var(--ar); font-size: .74rem; text-transform: none; }

/* a Telegram-like reply (text replies drawn from the bot's own formatter) */
.d-chat { max-width: 560px; padding: 12px; border-radius: 18px; background: linear-gradient(180deg, #0b1b2e, #08131f); border: 1px solid var(--line-2); }
.d-chat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.d-chat-head img { width: 28px; height: 28px; border-radius: 50%; }
.d-chat-head b { display: block; color: var(--white); font: 700 .78rem/1.2 var(--display); letter-spacing: .06em; }
.d-chat-head small { color: var(--mute); font-size: .72rem; }
.d-msg { padding: 12px 14px; border-radius: 4px 14px 14px 14px; background: #13263b; color: #e6eef8; font: 400 .88rem/1.55 var(--body); white-space: pre-wrap; overflow-wrap: anywhere; }
html[dir="rtl"] .d-msg { border-radius: 14px 4px 14px 14px; }
.d-msg pre { margin: 4px 0 8px; padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, .3); overflow-x: auto; font: 500 .74rem/1.5 var(--mono); white-space: pre; direction: ltr; text-align: left; }
.d-msg code { font: 500 .82rem/1.4 var(--mono); color: #bfefff; white-space: pre; }
.d-msg i { color: var(--mute); }

/* tables */
.d-tablewrap { margin: 0 0 20px; border: 1px solid var(--line-2); border-radius: var(--d-r); overflow-x: auto; background: rgba(255, 255, 255, .015); }
.d-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.d-table th, .d-table td { padding: 10px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
.d-table thead th { color: var(--cyan); font: 600 .7rem/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; background: rgba(34, 195, 255, .04); }
html[dir="rtl"] .d-table thead th { font-family: var(--ar); font-size: .82rem; text-transform: none; }
.d-table tbody th { color: var(--white); font-weight: 600; }
.d-table tbody tr:last-child > * { border-bottom: 0; }
.d-cmp { min-width: 560px; }
.d-cmp td { text-align: center; } .d-cmp thead th:not(:first-child) { text-align: center; }

/* verdict tiles */
.d-verdicts { display: grid; gap: 10px; margin: 0 0 20px; grid-template-columns: minmax(0, 1fr); }
.d-v { padding: 14px; border-radius: var(--d-r); border: 1px solid var(--line-2); background: rgba(255, 255, 255, .02); border-top: 3px solid var(--c); }
.d-v b { display: block; color: var(--c); font: 700 1rem/1.3 var(--display); }
.d-v span { color: var(--mute); font: 500 .76rem/1.4 var(--mono); }
.d-v p { margin: 6px 0 0 !important; font-size: .9rem; }
.d-v-high { --c: var(--high); } .d-v-caution { --c: var(--caution); } .d-v-lower { --c: var(--lower); } .d-v-unk { --c: var(--unknown); }

/* quick-link cards */
.d-cards { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin: 0 0 20px; }
.d-card { display: block; padding: 14px 16px; border-radius: var(--d-r); border: 1px solid var(--line-2); background: linear-gradient(160deg, rgba(10, 132, 255, .07), rgba(255, 255, 255, .01)); text-decoration: none; transition: border-color .2s, transform .2s; }
.d-card:hover, .d-card:focus-visible { border-color: var(--cyan); transform: translateY(-2px); }
.d-card b { display: block; color: var(--white); font: 600 1rem/1.3 var(--display); }
.d-card b::after { content: " →"; color: var(--cyan); }
html[dir="rtl"] .d-card b::after { content: " ←"; }
.d-card span { display: block; margin-top: 4px; color: var(--mute); font-size: .86rem; line-height: 1.45; }

/* FAQ */
.d-faq { margin: 0 0 10px; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(255, 255, 255, .02); }
.d-faq summary { cursor: pointer; padding: 13px 16px; color: var(--white); font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.d-faq summary::-webkit-details-marker { display: none; }
.d-faq summary::after { content: "+"; color: var(--cyan); font: 600 1.1rem/1 var(--mono); }
.d-faq[open] summary::after { content: "−"; }
.d-faq > div { padding: 0 16px 6px; }

/* previous / next */
.d-pn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; max-width: 760px; margin-top: 40px; }
.d-pn a { display: block; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); text-decoration: none; min-width: 0; }
.d-pn a:hover, .d-pn a:focus-visible { border-color: var(--cyan); }
.d-pn span { display: block; color: var(--mute); font: 500 .72rem/1.4 var(--mono); letter-spacing: .06em; }
html[dir="rtl"] .d-pn span { font-family: var(--ar); font-size: .8rem; }
.d-pn b { display: block; color: var(--white); font: 600 .95rem/1.3 var(--display); overflow-wrap: anywhere; }
.d-pn-prev b::before { content: "← "; color: var(--cyan); } .d-pn-next { text-align: end; } .d-pn-next b::after { content: " →"; color: var(--cyan); }
html[dir="rtl"] .d-pn-prev b::before { content: "→ "; } html[dir="rtl"] .d-pn-next b::after { content: " ←"; }
.d-fine { max-width: 760px; margin: 26px 0 0; color: var(--mute); font-size: .8rem; }

.d-toc { display: none; }

@media (min-width: 600px) {
  .d-verdicts, .d-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-main { padding: 28px 28px 50px; }
}
@media (min-width: 900px) {
  .d-bar { display: none; }
  .d-shell { grid-template-columns: var(--d-side) minmax(0, 1fr); }
  .d-side { position: sticky; top: var(--d-top, 61px); inset: auto; z-index: 1; width: auto; height: calc(100vh - var(--d-top, 61px)); transform: none; visibility: visible; box-shadow: none; background: transparent; border-inline-end: 1px solid var(--line); }
  html[dir="rtl"] .d-side { inset: auto; transform: none; box-shadow: none; }
  .d-scrim { display: none !important; }
  .d-main { padding: 34px 40px 60px; }
  .d-art h2 { scroll-margin-top: calc(var(--hdr) + 20px); }
  .d-anchor { display: inline; }
}
@media (min-width: 1180px) {
  .d-shell { grid-template-columns: var(--d-side) minmax(0, 1fr) var(--d-toc); }
  .d-toc { display: block; position: sticky; top: var(--d-top, 61px); align-self: start; max-height: calc(100vh - var(--d-top, 61px)); overflow-y: auto; padding: 36px 16px 20px 4px; }
  html[dir="rtl"] .d-toc { padding: 36px 4px 20px 16px; }
  .d-toc-h { margin: 0 0 8px; color: var(--mute); font: 600 .7rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
  html[dir="rtl"] .d-toc-h { font-family: var(--ar); font-size: .82rem; text-transform: none; }
  .d-toc ul { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--line); }
  .d-toc a { display: block; padding: 5px 12px; margin-inline-start: -1px; border-inline-start: 2px solid transparent; color: var(--mute); text-decoration: none; font-size: .84rem; line-height: 1.4; }
  .d-toc a:hover { color: var(--white); }
  .d-toc a.is-on { color: var(--white); border-inline-start-color: var(--cyan); }
}
@media (prefers-reduced-motion: reduce) { .d-side, .d-card { transition: none; } }
.d-search input:focus ~ kbd, .d-search input:not(:placeholder-shown) ~ kbd { display: none; }
