/* RTLY user guide. Static, dependency-free, light and dark aware, RTL aware.
   Colors match the extension's teal palette. No external fonts or requests. */

:root {
  color-scheme: light;
  --bg: #f4f2ec;
  --bg-tint: #e9f2f2;
  --surface: #ffffff;
  --surface-2: #eeebe3;
  --ink: #1a1a17;
  --ink-soft: #35342f;
  --muted: #5d594f;
  --line: #e4e0d6;
  --line-strong: #cbc6b8;
  --accent: #0e7c95;
  --accent-strong: #095f73;
  --accent-ink: #095f73;
  --accent-soft: #dcecef;
  --on-accent: #ffffff;
  --note-bg: #e6f1f3;
  --note-line: #9cc7d0;
  --warn-bg: #fff4de;
  --warn-line: #e3c077;
  --warn-ink: #6b4208;
  --known-bg: #f1eefb;
  --known-line: #c3b8ea;
  --known-ink: #3d2f80;
  --code-bg: #ebe8df;
  --code-ink: #1d2b2f;
  --shadow: 0 1px 2px rgba(30, 28, 20, .06), 0 8px 24px rgba(30, 28, 20, .08);
  --radius: 14px;
  --radius-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-fa: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Noto Sans Arabic", "Geeza Pro", system-ui, 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: #0d1012;
    --bg-tint: #10191c;
    --surface: #15191c;
    --surface-2: #1b2125;
    --ink: #edf0f2;
    --ink-soft: #cfd6db;
    --muted: #9aa5ad;
    --line: #252b30;
    --line-strong: #38414a;
    --accent: #34bfdd;
    --accent-strong: #7fd8ea;
    --accent-ink: #7fd8ea;
    --accent-soft: #123039;
    --on-accent: #04222a;
    --note-bg: #10272d;
    --note-line: #1f5663;
    --warn-bg: #2b2210;
    --warn-line: #7a5a1c;
    --warn-ink: #f0cf8a;
    --known-bg: #1f1b36;
    --known-line: #4c4290;
    --known-ink: #cfc4ff;
    --code-bg: #0b0f11;
    --code-ink: #cfe6ec;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1012;
  --bg-tint: #10191c;
  --surface: #15191c;
  --surface-2: #1b2125;
  --ink: #edf0f2;
  --ink-soft: #cfd6db;
  --muted: #9aa5ad;
  --line: #252b30;
  --line-strong: #38414a;
  --accent: #34bfdd;
  --accent-strong: #7fd8ea;
  --accent-ink: #7fd8ea;
  --accent-soft: #123039;
  --on-accent: #04222a;
  --note-bg: #10272d;
  --note-line: #1f5663;
  --warn-bg: #2b2210;
  --warn-line: #7a5a1c;
  --warn-ink: #f0cf8a;
  --known-bg: #1f1b36;
  --known-line: #4c4290;
  --known-ink: #cfc4ff;
  --code-bg: #0b0f11;
  --code-ink: #cfe6ec;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .45);
}

*, *::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; } * { animation: none !important; transition: none !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;
}
html[lang="fa"] body, html[lang="ar"] body { font-family: var(--font-fa); line-height: 1.9; }

img, svg { max-width: 100%; height: auto; }
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: -60px; 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) 90%, 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 img { width: 34px; height: 34px; display: block; }
.brand small { display: block; font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); line-height: 1.1; }
.brand span { display: block; line-height: 1.2; }
html[lang="fa"] .brand small { letter-spacing: 0; text-transform: none; font-size: .78rem; }
.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; }
@media (max-width: 720px) {
  .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; }
  .top-nav a { white-space: nowrap; flex: none; padding: 5px 11px; }
}
.search-box { position: relative; }
.search-box input {
  width: min(240px, 52vw); font: inherit; font-size: .92rem; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.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 span { display: block; font-size: .86rem; color: var(--muted); line-height: 1.4; }
.search-results .none { padding: 12px; color: var(--muted); font-size: .92rem; }
.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;
}
.icon-button:hover { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Home ---------- */
.hero { padding-block: clamp(36px, 7vw, 84px) 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: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); }
html[lang="fa"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: .9rem; }
.hero h1 { margin: 0 0 14px; font-size: clamp(2.05rem, 4.2vw, 3.1rem); line-height: 1.12; letter-spacing: -.025em; text-wrap: balance; }
html[lang="fa"] .hero h1 { letter-spacing: 0; line-height: 1.4; }
.lead { margin: 0 0 20px; font-size: clamp(1.08rem, 2vw, 1.24rem); color: var(--ink-soft); max-width: 60ch; line-height: 1.55; }
.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); }
:root[data-theme="dark"] .button.primary { background: var(--accent); border-color: var(--accent); }
.hero-note { margin: 0; font-size: .92rem; color: var(--muted); }
.hero-shot { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 34px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stats strong { display: block; font-size: 1.7rem; line-height: 1.1; color: var(--accent-ink); letter-spacing: -.02em; }
.stats span { font-size: .88rem; color: var(--muted); }

.section { padding-block: clamp(34px, 6vw, 60px); }
.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: 26px; }
@media (max-width: 820px) { .section-heading { grid-template-columns: 1fr; } }
.section-heading h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.1rem); line-height: 1.2; letter-spacing: -.02em; }
.section-heading p { margin: 0; color: var(--muted); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 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;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.card h3 { margin: 0; font-size: 1.1rem; line-height: 1.3; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card p { margin: 0; color: var(--muted); font-size: .96rem; line-height: 1.55; flex: 1; }
.card-link { margin-top: 8px; font-size: .9rem; font-weight: 650; color: var(--accent-ink); }
.tag { align-self: flex-start; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
html[lang="fa"] .tag { letter-spacing: 0; text-transform: none; font-size: .8rem; }
.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); }
.site-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.site-chips li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; font-size: .95rem; }

/* ---------- Page intro and doc layout ---------- */
.page-intro { padding-block: 30px 6px; }
.breadcrumbs { margin: 0 0 8px; font-size: .88rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.page-intro h1 { margin: 0 0 10px; font-size: clamp(1.9rem, 4.2vw, 2.8rem); line-height: 1.15; letter-spacing: -.025em; }
html[lang="fa"] .page-intro h1 { letter-spacing: 0; line-height: 1.4; }
.page-intro .lead { margin-bottom: 8px; }
.meta-line { margin: 10px 0 0; font-size: .85rem; color: var(--muted); }

.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 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; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
html[lang="fa"] .sidebar p { letter-spacing: 0; text-transform: none; font-size: .85rem; }
.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: .72rem; font-weight: 700; letter-spacing: .12em; 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 a { display: block; padding: 4px 12px; color: var(--muted); text-decoration: none; margin-inline-start: -1px; border-inline-start: 2px solid transparent; }
.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; } }

/* ---------- Prose ---------- */
.prose { min-width: 0; max-width: 76ch; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 2.1em 0 .5em; font-size: clamp(1.4rem, 2.6vw, 1.7rem); line-height: 1.25; letter-spacing: -.018em; padding-top: .3em; position: relative; }
html[lang="fa"] .prose h2 { letter-spacing: 0; }
.prose h3 { margin: 1.7em 0 .4em; font-size: 1.15rem; line-height: 1.35; }
.prose h2 .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 h2 .anchor:focus-visible { opacity: 1; }
@media (max-width: 900px) { .prose h2 .anchor { display: none; } }
.prose p, .prose ul, .prose ol, .prose dl, .prose table, .prose pre, .prose figure, .prose .callout, .prose .table-wrap { margin-block: 0 1.05em; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.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); }

code, kbd, samp { font-family: var(--mono); font-size: .88em; direction: ltr; unicode-bidi: isolate; }
:not(pre) > code { background: var(--code-bg); color: var(--code-ink); padding: .12em .4em; border-radius: 5px; border: 1px solid var(--line); overflow-wrap: anywhere; }
kbd { background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: .08em .45em; white-space: nowrap; }
pre { background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; line-height: 1.5; direction: ltr; text-align: left; }
pre code { background: none; border: 0; padding: 0; font-size: .9rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.table-wrap:focus-visible { outline-offset: 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: start; vertical-align: top; padding: 9px 14px; border-bottom: 1px solid var(--line); }
thead th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Callouts, figures, steps ---------- */
.callout { border: 1px solid var(--note-line); background: var(--note-bg); border-radius: var(--radius-sm); padding: 12px 16px; }
.callout p { margin: .3em 0; }
.callout-title { display: block; font-weight: 700; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 2px; }
html[lang="fa"] .callout-title { letter-spacing: 0; text-transform: none; font-size: .9rem; }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.callout.known { background: var(--known-bg); border-color: var(--known-line); color: var(--known-ink); }
.callout.warn a, .callout.known a { color: inherit; }
.expect { border-inline-start: 4px solid var(--accent); background: var(--surface); border-radius: var(--radius-sm); padding: 8px 16px; border-block: 1px solid var(--line); border-inline-end: 1px solid var(--line); }
.expect p { margin: .3em 0; }

.shot { margin-inline: 0; }
.shot .frame { border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.shot img { display: block; width: 100%; height: auto; }
.shot.narrow { max-width: 360px; }
.shot.medium { max-width: 560px; }
.shot figcaption { margin-top: 8px; font-size: .88rem; color: var(--muted); }
.shot .for-dark { display: none; }
:root[data-theme="dark"] .shot .for-light { display: none; }
:root[data-theme="dark"] .shot .for-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shot .for-light { display: none; }
  :root:not([data-theme="light"]) .shot .for-dark { display: block; }
}
.shot .missing { padding: 28px 16px; text-align: center; color: var(--muted); font-size: .9rem; }

ol.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 12px; }
ol.steps > li { counter-increment: step; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 12px 56px; margin: 0; }
[dir="rtl"] ol.steps > li { padding: 12px 56px 12px 16px; }
ol.steps > li::before {
  content: counter(step); position: absolute; inset-inline-start: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-strong); color: var(--on-accent); font-weight: 700; display: grid; place-items: center; font-size: .9rem;
}
:root[data-theme="dark"] ol.steps > li::before { background: var(--accent); }
ol.steps h3 { margin: 0 0 2px; font-size: 1.05rem; }
ol.steps p { margin: .2em 0; }

.reading-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.reading-footer a { display: block; text-decoration: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 16px; background: var(--surface); color: var(--ink); font-weight: 600; }
.reading-footer a:hover { background: var(--accent-soft); }
.reading-footer small { display: block; color: var(--muted); font-weight: 500; font-size: .78rem; }
.reading-footer .next { text-align: end; margin-inline-start: auto; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: 22px; font-size: .92rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: center; }
.footer p { margin: 0; }
.footer a { margin-inline-end: 16px; color: var(--ink-soft); }
.footer a:last-child { margin-inline-end: 0; }

@media print {
  .site-header, .sidebar, .toc, .skip, .reading-footer, .footer { display: none; }
  .doc-layout { display: block; }
  body { background: #fff; color: #000; }
}
