/* RTLY-Kit documentation. Static, dependency-free, light/dark aware, RTL/LTR via logical properties. */

:root {
  color-scheme: light;
  --bg: #f4f9f8;
  --bg-tint: #e6f4f1;
  --surface: #ffffff;
  --surface-2: #eff6f4;
  --ink: #12201d;
  --ink-soft: #2a3d38;
  --muted: #4f625c;
  --line: #d3e1dd;
  --line-strong: #adc3bd;
  --accent: #0f766e;
  --accent-strong: #134e4a;
  --accent-ink: #0b5f58;
  --accent-soft: #dcf3ef;
  --on-accent: #ffffff;
  --mint: #99f6e4;
  --note-bg: #e6f4f2;
  --note-line: #8fc9c0;
  --warn-bg: #fff4de;
  --warn-line: #e0b866;
  --warn-ink: #6b4208;
  --known-bg: #f3effd;
  --known-line: #b9a9ea;
  --known-ink: #3f2f86;
  --code-bg: #eef4f2;
  --code-ink: #12332d;
  --tok-c: #55665f;
  --tok-s: #166534;
  --tok-v: #1d4ed8;
  --tok-k: #86198f;
  --tok-n: #94430a;
  --shadow: 0 1px 2px rgba(16, 35, 30, .05), 0 8px 24px rgba(16, 35, 30, .06);
  --radius: 14px;
  --radius-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1412;
    --bg-tint: #0f201d;
    --surface: #131d1b;
    --surface-2: #1a2623;
    --ink: #e8f1ee;
    --ink-soft: #cddbd6;
    --muted: #a0b4ad;
    --line: #26352f;
    --line-strong: #3a514b;
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;
    --accent-ink: #99f6e4;
    --accent-soft: #123530;
    --on-accent: #042f2a;
    --note-bg: #10291f;
    --note-line: #1f5a4d;
    --warn-bg: #2b2210;
    --warn-line: #7a5a1c;
    --warn-ink: #f0cf8a;
    --known-bg: #1f1b36;
    --known-line: #4c4290;
    --known-ink: #cfc4ff;
    --code-bg: #091110;
    --code-ink: #cfe8e1;
    --tok-c: #8fa79f;
    --tok-s: #86efac;
    --tok-v: #93c5fd;
    --tok-k: #f0abfc;
    --tok-n: #fcd34d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1412;
  --bg-tint: #0f201d;
  --surface: #131d1b;
  --surface-2: #1a2623;
  --ink: #e8f1ee;
  --ink-soft: #cddbd6;
  --muted: #a0b4ad;
  --line: #26352f;
  --line-strong: #3a514b;
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --accent-ink: #99f6e4;
  --accent-soft: #123530;
  --on-accent: #042f2a;
  --note-bg: #10291f;
  --note-line: #1f5a4d;
  --warn-bg: #2b2210;
  --warn-line: #7a5a1c;
  --warn-ink: #f0cf8a;
  --known-bg: #1f1b36;
  --known-line: #4c4290;
  --known-ink: #cfc4ff;
  --code-bg: #091110;
  --code-ink: #cfe8e1;
  --tok-c: #8fa79f;
  --tok-s: #86efac;
  --tok-v: #93c5fd;
  --tok-k: #f0abfc;
  --tok-n: #fcd34d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
}

/* Persian and Arabic: system Arabic-script stack, looser leading, no letter-spacing (it breaks letter joining). */
:root:lang(fa) {
  --font: Vazirmatn, "Vazir", Tahoma, "Segoe UI", "Noto Naskh Arabic", "Noto Sans Arabic", ui-sans-serif, system-ui, sans-serif;
}
:root:lang(ar) {
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", "Geeza Pro", "Droid Arabic Kufi", ui-sans-serif, system-ui, sans-serif;
}
:lang(fa) body { line-height: 1.95; }
:lang(ar) body { line-height: 1.9; }
:is(:lang(fa), :lang(ar)) *, :is(:lang(fa), :lang(ar)) *::before, :is(:lang(fa), :lang(ar)) *::after { letter-spacing: 0 !important; }
:is(:lang(fa), :lang(ar)) .eyebrow, :is(:lang(fa), :lang(ar)) .tag, :is(:lang(fa), :lang(ar)) .sidebar p, :is(:lang(fa), :lang(ar)) .toc p, :is(:lang(fa), :lang(ar)) .callout > strong:first-child { text-transform: none; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; }
a { color: var(--accent-ink); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.shell { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .shell { padding-inline: 28px; } }

.skip { position: absolute; inset-inline-start: 12px; top: -80px; z-index: 100; background: var(--accent-strong); color: var(--on-accent); padding: 10px 14px; border-radius: var(--radius-sm); }
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand img { width: 34px; height: 34px; display: block; }
.brand small { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); line-height: 1.2; }
.brand span { display: block; line-height: 1.25; }
.brand .name { unicode-bidi: isolate; }
.top-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-inline-start: auto; align-items: center; min-width: 0; }
.top-nav a { color: var(--ink-soft); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: .95rem; font-weight: 500; }
.top-nav a:hover { background: var(--accent-soft); color: var(--accent-ink); }
.top-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.header-tools { display: flex; gap: 8px; align-items: center; position: relative; }
.search-box { position: relative; }
.search-box input {
  width: min(240px, 52vw); font: inherit; font-size: .92rem; padding: 7px 12px; padding-inline-start: 34px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.search-box::before { content: ""; position: absolute; inset-inline-start: 12px; top: 50%; width: 11px; height: 11px; border: 2px solid var(--muted); border-radius: 50%; transform: translateY(-62%); pointer-events: none; }
.search-box::after { content: ""; position: absolute; inset-inline-start: 22px; top: 50%; width: 6px; height: 2px; background: var(--muted); transform: translateY(5px) rotate(45deg); pointer-events: none; }
[dir="rtl"] .search-box::after { transform: translateY(5px) rotate(-45deg); }
@media (max-width: 760px) {
  .header-tools { margin-inline-start: auto; }
  .top-nav { order: 3; width: 100%; margin-inline-start: 0; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .top-nav a { white-space: nowrap; flex: none; padding: 5px 11px; }
  .search-box input { width: min(180px, 40vw); }
}
.search-results {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); width: min(460px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 60;
}
.search-results a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.search-results a:hover, .search-results a:focus-visible, .search-results a.is-active { background: var(--accent-soft); }
.search-results strong { display: block; font-size: .98rem; }
.search-results em { display: block; font-style: normal; font-size: .82rem; color: var(--accent-ink); }
.search-results span { display: block; font-size: .86rem; color: var(--muted); line-height: 1.5; }
.search-results .none { padding: 12px; margin: 0; color: var(--muted); font-size: .92rem; }
.icon-button, a.icon-button {
  font: inherit; cursor: pointer; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 6px 12px; font-size: .88rem; font-weight: 550; text-decoration: none; white-space: nowrap; display: inline-block;
}
.icon-button:hover, a.icon-button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.lang-switch { display: inline-flex; gap: 4px; align-items: center; }
.lang-switch .icon-button { padding: 5px 10px; }
.lang-switch .icon-button.is-current { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; cursor: default; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(36px, 7vw, 88px) 36px; background: radial-gradient(900px 380px at 85% -10%, var(--accent-soft), transparent 70%), linear-gradient(180deg, var(--bg-tint), var(--bg)); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; gap: 36px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.eyebrow { margin: 0 0 10px; font-size: .85rem; font-weight: 700; letter-spacing: .04em; color: var(--accent-ink); unicode-bidi: isolate; }
.hero h1 { margin: 0 0 6px; font-size: clamp(2.3rem, 5vw, 3.6rem); line-height: 1.1; letter-spacing: -.025em; text-wrap: balance; }
.hero .subtitle { margin: 0 0 14px; font-size: clamp(1.2rem, 2.4vw, 1.6rem); font-weight: 600; color: var(--ink-soft); }
.lead { margin: 0 0 20px; font-size: clamp(1.05rem, 2vw, 1.22rem); color: var(--ink-soft); max-width: 62ch; line-height: 1.6; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-block: 22px 12px; }
.button {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 650; padding: 11px 18px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.button.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.button.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.hero-note { margin: 0; font-size: .92rem; color: var(--muted); }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.hero-card h2 { margin: 0 0 8px; font-size: 1rem; letter-spacing: 0; }
.hero-card pre { margin: 0 0 14px; }
.hero-card pre:last-child { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.stats li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stats strong { display: block; font-size: 1.8rem; line-height: 1.2; color: var(--accent-ink); letter-spacing: -.02em; }
.stats span { font-size: .9rem; color: var(--muted); }
.stats-note { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }

/* ---------- Sections and cards ---------- */
.section { padding-block: clamp(32px, 5vw, 56px); }
.section + .section { border-top: 1px solid var(--line); }
.section-heading { display: grid; gap: 8px 40px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; margin-bottom: 22px; }
@media (max-width: 820px) { .section-heading { grid-template-columns: 1fr; } }
.section-heading h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.25; letter-spacing: -.02em; }
.section-heading p { margin: 0; color: var(--muted); }
.can-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.can-list li { position: relative; padding: 14px 16px; padding-inline-start: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.can-list li::before { content: ""; position: absolute; inset-inline-start: 16px; top: 1.15em; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.can-list a { font-weight: 600; }
.notice { padding: 16px 20px; border-radius: var(--radius); border: 1px solid var(--warn-line); border-inline-start-width: 5px; background: var(--warn-bg); color: var(--ink); }
.notice h2 { margin: 0 0 6px; font-size: 1.15rem; color: var(--warn-ink); }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
.notice a { color: var(--warn-ink); font-weight: 650; }
.group-block + .group-block { margin-top: 34px; }
.group-block h3 { margin: 0 0 4px; font-size: 1.3rem; line-height: 1.3; }
.group-block > p { margin: 0 0 14px; color: var(--muted); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 16px; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover, .card:focus-within { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.card h3, .card h4 { margin: 0; font-size: 1.1rem; line-height: 1.4; letter-spacing: -.01em; }
.card h3 a, .card h4 a { color: var(--ink); text-decoration: none; }
.card h3 a::after, .card h4 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:focus-visible::after, .card h4 a:focus-visible::after { outline: 3px solid var(--accent); outline-offset: 2px; }
.card h3 a:focus-visible, .card h4 a:focus-visible { outline: 0; }
.card p { margin: 0; color: var(--muted); font-size: .96rem; line-height: 1.6; flex: 1; }
.card-link { margin-top: 8px; font-size: .9rem; font-weight: 650; color: var(--accent-ink); }
.filter { margin-bottom: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.filter label { font-weight: 650; }
.filter input { font: inherit; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); min-width: min(100%, 300px); }
.filter-status { margin: 0 0 14px; font-size: .9rem; color: var(--muted); }
.empty { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Page intro + doc layout ---------- */
.page-intro { padding-block: 30px 6px; }
.breadcrumbs { margin: 0 0 8px; font-size: .88rem; color: var(--muted); }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 0; }
.breadcrumbs li + li::before { content: "/"; margin-inline: .5em; color: var(--line-strong); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent-ink); }
.page-intro h1 { margin: 0 0 10px; font-size: clamp(1.9rem, 4.2vw, 2.8rem); line-height: 1.2; letter-spacing: -.025em; text-wrap: balance; }
.page-intro .lead { margin-bottom: 8px; }

.doc-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; padding-block: 18px 64px; align-items: start; }
@media (min-width: 1160px) { .doc-layout.has-toc { grid-template-columns: 250px minmax(0, 1fr) 210px; } }
@media (max-width: 900px) { .doc-layout { grid-template-columns: 1fr; gap: 14px; } }

.sidebar { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding-inline-end: 6px; font-size: .94rem; }
.sidebar details { border: 0; }
.sidebar summary { cursor: pointer; font-weight: 650; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
@media (min-width: 901px) { .sidebar summary { display: none; } }
@media (max-width: 900px) { .sidebar { position: static; max-height: none; overflow: visible; } .sidebar details > nav { margin-top: 8px; } }
.sidebar nav { display: grid; gap: 2px; }
.sidebar p { margin: 16px 0 4px; padding-inline: 12px; font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sidebar nav > p:first-child { margin-top: 2px; }
.sidebar a { display: block; padding: 6px 12px; border-radius: var(--radius-sm); color: var(--ink-soft); text-decoration: none; }
.sidebar a:hover { background: var(--accent-soft); color: var(--accent-ink); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .sidebar a[aria-current="page"] { box-shadow: inset -3px 0 0 var(--accent); }

.toc { position: sticky; top: 84px; font-size: .88rem; max-height: calc(100vh - 100px); overflow: auto; }
.toc p { margin: 0 0 8px; font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; border-inline-start: 1px solid var(--line); }
.toc ol ol { border: 0; padding-inline-start: 12px; margin-top: 2px; }
.toc a { display: block; padding: 4px 12px; color: var(--muted); text-decoration: none; margin-inline-start: -1px; border-inline-start: 2px solid transparent; }
.toc ol ol a { padding-block: 2px; font-size: .94em; }
.toc a:hover { color: var(--accent-ink); }
.toc a.is-current { color: var(--accent-ink); border-inline-start-color: var(--accent); font-weight: 600; }
@media (max-width: 1159px) { .toc { display: none; } }
.toc-inline { margin-bottom: 1.4em; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: .94rem; }
.toc-inline summary { cursor: pointer; padding: 9px 14px; font-weight: 650; }
.toc-inline ol { margin: 0; padding: 0 14px 10px; padding-inline-start: 2.2em; }
.toc-inline ol ol { padding-inline-start: 1.4em; padding-block: 0; }
@media (min-width: 1160px) { .toc-inline { display: none; } }

/* ---------- Prose ---------- */
.prose { min-width: 0; max-width: 78ch; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 2.1em 0 .5em; font-size: clamp(1.4rem, 2.6vw, 1.75rem); line-height: 1.3; letter-spacing: -.018em; padding-top: .3em; position: relative; }
.prose h3 { margin: 1.7em 0 .4em; font-size: 1.15rem; line-height: 1.4; letter-spacing: -.01em; position: relative; }
.prose .anchor { position: absolute; inset-inline-start: -1.1em; color: var(--line-strong); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity .15s; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus-visible { opacity: 1; }
.prose .anchor:hover { color: var(--accent-ink); }
@media (max-width: 900px) { .prose .anchor { display: none; } }
.prose p, .prose ul, .prose ol, .prose dl, .prose table, .prose pre, .prose blockquote, .prose .callout, .prose .table-wrap { margin-block: 0 1.05em; }
.prose ul, .prose ol { padding-inline-start: 1.5em; }
.prose li { margin-block: .28em; }
.prose li > p { margin-block: .3em; }
.prose strong { font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2em; }
.prose dt { font-weight: 650; margin-top: .8em; }
.prose dd { margin: .15em 0 0; padding-inline-start: 1em; border-inline-start: 2px solid var(--line); color: var(--ink-soft); }
.prose blockquote { padding: .4em 1.1em; border-inline-start: 4px solid var(--line-strong); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-soft); }
[dir="rtl"] .prose blockquote { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }

code, kbd, samp { font-family: var(--mono); font-size: .88em; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
:not(pre) > code { direction: ltr; unicode-bidi: isolate; background: var(--code-bg); color: var(--code-ink); padding: .12em .4em; border-radius: 5px; border: 1px solid var(--line); overflow-wrap: anywhere; }
pre { direction: ltr; text-align: left; unicode-bidi: isolate; background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; overflow: auto; line-height: 1.55; font-size: .9rem; tab-size: 4; }
pre code { font-size: inherit; background: none; border: 0; padding: 0; white-space: pre; }
.tok-c { color: var(--tok-c); font-style: italic; }
.tok-s { color: var(--tok-s); }
.tok-v { color: var(--tok-v); }
.tok-k { color: var(--tok-k); font-weight: 600; }
.tok-n { color: var(--tok-n); }
kbd {
  display: inline-block; padding: .08em .5em; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); color: var(--ink); font-size: .84em; line-height: 1.5; white-space: nowrap; direction: ltr; unicode-bidi: isolate;
}
.code-tools { display: flex; justify-content: flex-end; margin: -.7em 0 1.05em; }
[dir="rtl"] .code-tools { justify-content: flex-start; }
.copy-button { font: inherit; font-size: .8rem; cursor: pointer; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; }
.copy-button:hover { color: var(--accent-ink); border-color: var(--accent); }
.hero-card .code-tools { margin-block: -.7em 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); -webkit-overflow-scrolling: touch; }
.table-wrap table { margin: 0 !important; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { text-align: start; padding: 9px 14px; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-weight: 650; font-size: .88rem; color: var(--ink-soft); }
tbody tr:last-child td { border-bottom: 0; }
td code, th code { white-space: nowrap; }
caption { text-align: start; font-size: .86rem; color: var(--muted); padding: 8px 14px; caption-side: bottom; }

.callout { padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid var(--note-line); background: var(--note-bg); border-inline-start-width: 4px; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout > strong:first-child { color: var(--accent-ink); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.callout.warn > strong:first-child { color: var(--warn-ink); }
.callout.known { background: var(--known-bg); border-color: var(--known-line); }
.callout.known > strong:first-child { color: var(--known-ink); }

/* ---------- Reading footer, footer ---------- */
.reading-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 3em; padding-top: 1.4em; border-top: 1px solid var(--line); }
.reading-footer a { display: block; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); text-decoration: none; background: var(--surface); min-width: 0; flex: 1 1 220px; color: var(--ink); }
.reading-footer a:hover { border-color: var(--accent); background: var(--accent-soft); }
.reading-footer small { display: block; color: var(--muted); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.reading-footer .next { text-align: end; }
.reading-footer .prev small::before { content: "\2190\00a0"; }
.reading-footer .next small::after { content: "\00a0\2192"; }
[dir="rtl"] .reading-footer .prev small::before { content: "\2192\00a0"; }
[dir="rtl"] .reading-footer .next small::after { content: "\00a0\2190"; }
.footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 20px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-block: 22px; font-size: .9rem; color: var(--muted); }
.footer-inner p { margin: 0; }
.footer-inner div { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- Language chooser (docs/index.html) ---------- */
.chooser { min-height: 100vh; display: grid; align-content: center; padding-block: 40px; }
.chooser h1 { margin: 12px 0 4px; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.02em; }
.chooser .lead { margin-bottom: 26px; }
.chooser .lead[lang="fa"], .chooser .lead[lang="ar"] { direction: rtl; }
.lang-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); max-width: 720px; }
.lang-cards .card.is-suggested { border-color: var(--accent); box-shadow: var(--shadow); }
.lang-cards .card h2 { margin: 0; font-size: 1.5rem; }
.lang-cards .card h2 a { color: var(--ink); text-decoration: none; }
.lang-cards .card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.lang-cards .card .tag { align-self: flex-start; font-size: .75rem; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 10px; border-radius: 999px; }
.chooser .brand-row { display: flex; align-items: center; gap: 12px; }
.chooser .brand-row img { width: 52px; height: 52px; }

noscript .callout { margin-block: 12px; }

@media print {
  .site-header, .sidebar, .toc, .toc-inline, .code-tools, .reading-footer, .search-box, .skip, .actions, .filter { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; line-height: 1.5; }
  .hero { background: none; border: 0; padding-block: 0 12px; }
  .doc-layout, .hero-grid { display: block; }
  .shell { max-width: none; padding-inline: 0; }
  a { color: inherit; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #333; overflow-wrap: anywhere; }
  pre { white-space: pre-wrap; overflow: visible; border-color: #999; background: #f4f4f4; color: #000; break-inside: avoid; }
  .tok-c, .tok-s, .tok-v, .tok-k, .tok-n { color: #000; }
  .callout, .card, .notice, table { break-inside: avoid; }
  .footer { border: 0; background: none; }
}
