:root {
  --bg: #07070C;
  --bg2: #0E0E17;
  --line: rgba(244, 244, 250, .1);
  --text: #F4F4FA;
  --muted: #A6A6BC;
  --violet: #7C5CFF;
  --cyan: #22D3EE;
  --lime: #C6F432;
  --head: "Unbounded", "Space Grotesk", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 130px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--body);
  overflow-x: hidden;
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(124, 92, 255, .16), transparent 60%),
    radial-gradient(700px 400px at -10% 10%, rgba(34, 211, 238, .08), transparent 60%);
  background-repeat: no-repeat;
}
html[dir="rtl"] body, html[lang="ar"] body { font-family: "IBM Plex Sans Arabic", var(--body); line-height: 1.9; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] .toc summary { font-family: "IBM Plex Sans Arabic", var(--head); font-weight: 700; letter-spacing: 0; }
a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--lime); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--lime); color: #000; padding: 8px 12px; border-radius: 8px; z-index: 20; }
.skip:focus { top: 8px; }

/* Top bar */
.bar { position: sticky; top: 0; z-index: 10; background: rgba(7, 7, 12, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1160px; margin: 0 auto; padding: 12px 16px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 17px/1 var(--head); }
.logo:hover { color: var(--text); }
.langs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.langs a { min-width: 38px; text-align: center; padding: 5px 9px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; }
.langs a[data-lang="ar"] { font-family: "IBM Plex Sans Arabic", var(--body); }
.langs a[aria-current="true"] { background: var(--text); color: var(--bg); }
.tabs { max-width: 1160px; margin: 0 auto; padding: 4px 16px 10px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.tabs a:hover { color: var(--text); border-color: rgba(124, 92, 255, .6); }
.tabs a[aria-current="page"] { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--violet), #5a3ff0); }

/* Layout */
.wrap { max-width: 1160px; margin: 0 auto; padding: 28px 16px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 960px) {
  .wrap { grid-template-columns: 280px minmax(0, 1fr); gap: 48px; padding-top: 44px; }
  .toc { position: sticky; top: 130px; align-self: start; max-height: calc(100vh - 150px); overflow: auto; }
}

/* TOC */
.toc details { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.toc summary { cursor: pointer; font: 600 12px/1.4 var(--head); text-transform: uppercase; letter-spacing: .08em; color: var(--lime); list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: " ▾"; color: var(--muted); }
.toc details[open] summary::after { content: " ▴"; }
.toc ol { margin: 10px 0 0; padding-inline-start: 22px; font-size: 14px; line-height: 1.5; }
.toc li { margin: 6px 0; color: var(--muted); }
.toc li::marker { color: var(--muted); font-size: 12px; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover, .toc a.on { color: var(--text); }
.toc a.on { box-shadow: inset 0 -1px 0 var(--cyan); }

/* Document */
.doc { min-width: 0; max-width: 760px; overflow-wrap: anywhere; }
.doc:focus { outline: none; }
.eyebrow { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); }
html[lang="ar"] .eyebrow { letter-spacing: 0; }
.doc h1 { margin: 0 0 14px; font: 700 clamp(26px, 6vw, 42px)/1.15 var(--head); letter-spacing: -.01em; background: linear-gradient(120deg, var(--text) 40%, #bfb3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.meta .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); display: inline-block; margin-inline-end: 6px; }
.print { margin-inline-start: auto; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font: 500 13px var(--body); cursor: pointer; }
html[lang="ar"] .print { font-family: "IBM Plex Sans Arabic", var(--body); }
.print:hover { border-color: var(--cyan); }
.doc section { padding: 6px 0 10px; }
.doc h2 { margin: 26px 0 10px; font: 600 clamp(17px, 3.8vw, 21px)/1.35 var(--head); color: var(--text); }
.doc h2 .n { color: var(--violet); margin-inline-end: 10px; font-size: .85em; }
.doc p { margin: 0 0 12px; color: #DADAE6; }
.doc ul { margin: 0 0 14px; padding-inline-start: 0; list-style: none; }
.doc li { position: relative; margin: 0 0 8px; padding-inline-start: 22px; color: #DADAE6; }
.doc li::before { content: ""; position: absolute; inset-inline-start: 4px; top: .72em; width: 7px; height: 7px; transform: rotate(45deg); background: linear-gradient(135deg, var(--violet), var(--cyan)); border-radius: 1px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc p.key { padding: 12px 14px; border-inline-start: 3px solid var(--lime); background: rgba(198, 244, 50, .06); border-radius: 0 10px 10px 0; color: var(--text); }
html[dir="rtl"] .doc p.key { border-radius: 10px 0 0 10px; }
.loading { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; }

.foot { border-top: 1px solid var(--line); padding: 22px 16px 34px; text-align: center; color: var(--muted); font-size: 13px; }
.foot p { margin: 0; overflow-wrap: anywhere; }

/* Print */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff !important; color: #000; font-size: 11pt; line-height: 1.5; }
  .bar, .toc, .print, .skip { display: none !important; }
  .wrap { display: block; padding: 0; max-width: none; }
  .doc { max-width: none; }
  .doc h1 { color: #000; background: none; -webkit-text-fill-color: #000; font-size: 20pt; }
  .doc h2 { color: #000; break-after: avoid; page-break-after: avoid; font-size: 13pt; }
  .doc h2 .n { color: #444; }
  .doc p, .doc li { color: #000; orphans: 3; widows: 3; }
  .doc p.key { background: none; border-color: #000; }
  .doc li::before { background: #000; }
  .meta { color: #333; border-color: #ccc; }
  .meta .dot { display: none; }
  .eyebrow { color: #333; }
  a { color: #000; text-decoration: none; }
  .foot { color: #333; border-color: #ccc; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
