:root {
  --brand: #0F4C81;
  --brand-dark: #0B3A63;
  --accent: #F2A900;
  --text: #1a1f26;
  --muted: #5b6673;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e3e8ef;
  --focus: #F2A900;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #e8edf3; --muted: #a9b4c0; --bg: #0e141b; --card: #151d26; --line: #263240; --brand: #6aa8de;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.7;
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", Tahoma, Arial, sans-serif; font-size: 16px;
}
a { color: var(--brand); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
/* Visually hidden until focused. (Off-screen offsets like left:-9999px create a huge scroll area in RTL pages.) */
.skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { width: auto; height: auto; clip-path: none; inset-inline-start: 16px; top: 16px; background: var(--card); padding: 8px 12px; z-index: 10; }

header.site {
  background: linear-gradient(135deg, #145C9A, var(--brand-dark)); color: #fff;
}
header.site .bar { max-width: 960px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header.site .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
header.site .brand img { width: 36px; height: 36px; border-radius: 9px; }
header.site nav { display: flex; gap: 4px 14px; flex-wrap: wrap; margin-inline-start: auto; align-items: center; }
header.site nav a { color: #fff; text-decoration: none; opacity: .9; font-size: .95rem; padding: 4px 0; }
header.site nav a[aria-current="page"] { opacity: 1; border-bottom: 2px solid var(--accent); }
.lang-switch { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .9rem; cursor: pointer; }

main { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
article.doc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; }
article.doc + article.doc { margin-top: 24px; }
h1 { color: var(--brand); font-size: 1.7rem; line-height: 1.3; margin: 0 0 6px; }
h2 { font-size: 1.2rem; margin: 28px 0 8px; padding-top: 8px; border-top: 1px solid var(--line); }
h3 { font-size: 1.02rem; margin: 18px 0 6px; }
.meta { color: var(--muted); font-size: .92rem; margin: 0 0 18px; }
.lead { font-size: 1.05rem; }
ul, ol { padding-inline-start: 22px; }
li { margin: 4px 0; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; margin: 10px 0; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: start; vertical-align: top; }
th { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.note { border-inline-start: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 10px 14px; border-radius: 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.cards a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-decoration: none; color: var(--text); }
.cards a strong { color: var(--brand); display: block; margin-bottom: 4px; }
.steps li { margin: 8px 0; }
code, .code { font-family: ui-monospace, Consolas, monospace; background: color-mix(in srgb, var(--brand) 8%, transparent); padding: 1px 6px; border-radius: 4px; }
footer.site { max-width: 960px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: .9rem; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }

/* Language: both versions are in the HTML (readable without JavaScript and by crawlers); JS shows one at a time. */
html.js [data-lang] { display: none; }
html.js[data-active-lang="en"] [data-lang="en"],
html.js[data-active-lang="ar"] [data-lang="ar"] { display: block; }
html.js[data-active-lang="en"] nav [data-lang="en"],
html.js[data-active-lang="ar"] nav [data-lang="ar"] { display: inline; }
[dir="rtl"] { text-align: right; }

@media (max-width: 560px) {
  article.doc { padding: 20px 16px; }
  h1 { font-size: 1.4rem; }
  header.site nav { margin-inline-start: 0; width: 100%; }
}
@media print {
  header.site, footer.site, .lang-switch { display: none; }
  html.js [data-lang] { display: block !important; }
  article.doc { border: 0; }
}
