/* ==========================================================================
   AZVYRA Documentation — design system
   Light / dark · RTL / LTR · zero dependencies
   ========================================================================== */

/* --------------------------------------------------------------- tokens */
:root {
  --bg: #f5f8f6;
  --bg-soft: #edf3f0;
  --surface: #ffffff;
  --surface-2: #f8fbf9;
  --surface-3: #f0f6f3;
  --ink: #0a1712;
  --ink-2: #2d4238;
  --muted: #62786d;
  --faint: #8fa398;
  --line: #e0eae5;
  --line-strong: #cddcd5;
  --accent: #0b9e6b;
  --accent-deep: #077a53;
  --accent-2: #84cc16;
  --accent-ink: #043f2b;
  --accent-soft: #e6f7ef;
  --accent-soft-2: #d6f2e5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --tip: #0284c7;
  --tip-soft: #f0f9ff;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --ring: rgba(11, 158, 107, .18);
  --shadow-xs: 0 1px 2px rgba(9, 34, 24, .05);
  --shadow-sm: 0 2px 8px -2px rgba(9, 34, 24, .08);
  --shadow-md: 0 18px 40px -24px rgba(9, 34, 24, .32);
  --shadow-lg: 0 40px 90px -40px rgba(9, 34, 24, .45);
  --topbar-h: 64px;
  --sidebar-w: 288px;
  --toc-w: 248px;
  --radius: 16px;
  --radius-sm: 10px;
  --font-ar: "IBM Plex Sans Arabic", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-en: "Inter", "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --shell-w: 1600px;

  /* language chooser (root page) */
  --chooser-bg: #050b08;
  --chooser-ink: #eaf4ef;
  --chooser-soft: #b7ccc0;
  --chooser-muted: #7f9c8d;
  --chooser-quiet: #6f8b7d;
  --chooser-faint: #5f7a6d;
  --chooser-accent: #64f93e;
  --chooser-accent-2: #a3e635;
  --chooser-accent-soft: #c9e8a8;
  --chooser-on-accent: #04130c;
  --chooser-line: rgba(255, 255, 255, .07);
  --chooser-line-strong: rgba(255, 255, 255, .1);
  --chooser-flag-bg: #0b1410;
  /* keep in sync with chooser.art in docs.config.mjs */
  --chooser-art-ratio: 760 / 950;
}

[data-theme="dark"] {
  --bg: #060b09;
  --bg-soft: #09110e;
  --surface: #0b1512;
  --surface-2: #0e1a16;
  --surface-3: #12211b;
  --ink: #eaf4ef;
  --ink-2: #bccfc5;
  --muted: #89a094;
  --faint: #647a6f;
  --line: #17271f;
  --line-strong: #22362c;
  --accent: #34d399;
  --accent-deep: #6ee7b7;
  --accent-2: #a3e635;
  --accent-ink: #c8f7e4;
  --accent-soft: #0c2a1f;
  --accent-soft-2: #103528;
  --danger: #f87171;
  --danger-soft: #2a1213;
  --warn: #fbbf24;
  --warn-soft: #2a1f0a;
  --tip: #38bdf8;
  --tip-soft: #08222e;
  --violet: #a78bfa;
  --violet-soft: #1c1730;
  --ring: rgba(52, 211, 153, .2);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 2px 10px -2px rgba(0, 0, 0, .5);
  --shadow-md: 0 20px 50px -28px rgba(0, 0, 0, .8);
  --shadow-lg: 0 50px 110px -50px rgba(0, 0, 0, .9);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-en);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

[lang="ar"] body, body[data-lang="ar"] { font-family: var(--font-ar); font-size: 16.5px; }

/* --------------------------------------------------------------- preloader */
.preloader {
  display: none; position: fixed; inset: 0; z-index: 300;
  place-items: center; background: var(--bg); color: var(--ink);
}
html.js .preloader { display: grid; }
.preloader.is-done { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s ease, visibility .3s; }
.preloader-inner { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.preloader-mark { width: 96px; height: 96px; display: block; opacity: .95; filter: drop-shadow(0 12px 30px rgba(100, 249, 62, .22)); }
[data-theme="light"] .preloader-mark { opacity: 1; filter: brightness(.72) saturate(1.3); }
.preloader-track { width: 140px; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.preloader-track span { display: block; width: 38%; height: 100%; border-radius: 2px; background: var(--accent); animation: preloader-run 1.1s cubic-bezier(.45, .05, .55, .95) infinite; }
@keyframes preloader-run { 0% { transform: translateX(-130%); } 100% { transform: translateX(360%); } }

::selection { background: var(--accent-soft-2); color: var(--accent-ink); }

img, svg { max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; margin: 0; font-weight: 700; }
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3, [lang="ar"] h4 { letter-spacing: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 10px; inset-inline-start: 10px; z-index: 1000;
  background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: 8px; font-weight: 600;
  transform: translateY(-150%); transition: transform .18s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; vertical-align: -0.18em; }

/* --------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: .8;
}
.topbar-inner {
  height: var(--topbar-h);
  max-width: var(--shell-w); margin: 0 auto; padding: 0 18px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto;
}
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(100, 249, 62, .16)); }
[data-theme="light"] .brand-mark img { filter: brightness(.72) saturate(1.3); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: .95rem; font-weight: 700; letter-spacing: -.01em; }
.brand-text small { font-size: .7rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }

.top-nav { display: flex; align-items: center; gap: 2px; margin-inline-start: 14px; }
.top-nav a {
  padding: 7px 11px; border-radius: 8px; font-size: .86rem; font-weight: 500;
  color: var(--muted); transition: color .15s, background .15s;
}
.top-nav a:hover { color: var(--ink); background: var(--surface-3); }
.top-nav a.active { color: var(--accent-deep); background: var(--accent-soft); font-weight: 600; }

.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }

.search-trigger {
  display: flex; align-items: center; gap: 8px;
  min-width: 230px; height: 38px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; color: var(--muted); font-size: .84rem;
  cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-trigger:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.search-trigger .icon { width: 16px; height: 16px; }
.search-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kbd, .search-trigger kbd {
  margin-inline-start: auto; font-family: var(--mono); font-size: .64rem;
  color: var(--faint); background: var(--surface-2);
  border: 1px solid var(--line); border-bottom-width: 2px;
  padding: 2px 5px; border-radius: 5px; white-space: nowrap;
}

.lang-switch {
  display: flex; align-items: center; gap: 3px;
  height: 38px; padding: 0 9px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface);
  font-size: .78rem; font-weight: 600; color: var(--faint);
}
.lang-switch a { padding: 3px 4px; border-radius: 5px; color: var(--muted); }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a.active { color: var(--accent-deep); background: var(--accent-soft); }
.lang-switch span { opacity: .4; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  color: var(--ink-2); cursor: pointer; transition: background .15s, border-color .15s, transform .15s;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.96); }

.theme-btn .theme-moon { display: none; }
[data-theme="dark"] .theme-btn .theme-sun { display: none; }
[data-theme="dark"] .theme-btn .theme-moon { display: inline-flex; }

.menu-btn { display: none; }

.read-progress {
  position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: transparent;
}
.read-progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .1s linear;
}

/* --------------------------------------------------------------- shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: var(--shell-w); margin: 0 auto;
  align-items: start;
}

/* --------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  border-inline-end: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  z-index: 40;
}
.sidebar-scroll {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 14px 28px;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }

.side-home {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 9px;
  font-size: .87rem; font-weight: 600; color: var(--ink);
  border: 1px solid transparent;
}
.side-home:hover { background: var(--surface-3); }
.side-home.active { background: var(--accent-soft); color: var(--accent-deep); border-color: color-mix(in srgb, var(--accent) 18%, transparent); }
.side-icon { display: inline-grid; place-items: center; color: var(--muted); }
.side-icon .icon { width: 17px; height: 17px; }
.side-home.active .side-icon, .side-group[open] > summary .side-icon { color: var(--accent-deep); }
.side-count {
  margin-inline-start: auto; font-family: var(--mono); font-size: .66rem;
  background: var(--surface-3); color: var(--muted); padding: 1px 6px; border-radius: 999px;
}

.sidebar-label {
  margin: 20px 10px 8px; font-size: .64rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--faint);
}
[lang="ar"] .sidebar-label { letter-spacing: 0; }

.side-group { margin: 1px 0; }
.side-group summary {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  list-style: none; color: var(--ink-2); font-size: .82rem; font-weight: 600;
  user-select: none;
}
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary:hover { background: var(--surface-3); color: var(--ink); }
.side-group-title { flex: 1; }
.side-group-count {
  font-family: var(--mono); font-size: .62rem; color: var(--faint);
  background: var(--surface-3); padding: 1px 5px; border-radius: 5px;
}
.side-group summary .chev { width: 14px; height: 14px; color: var(--faint); transition: transform .2s var(--ease); }
.side-group[open] summary .chev { transform: rotate(180deg); }

.side-group ul { list-style: none; margin: 2px 0 8px; padding: 0 0 0 12px; }
[dir="rtl"] .side-group ul { padding: 0 12px 0 0; }
.side-group li a {
  position: relative;
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 9px; margin: 1px 0;
  border-radius: 7px; font-size: .795rem; line-height: 1.45;
  color: var(--muted);
  transition: color .13s, background .13s;
}
.side-group li a:hover { color: var(--ink); background: var(--surface-3); }
.side-group li a.active {
  color: var(--accent-deep); background: var(--accent-soft);
  font-weight: 600;
}
.side-group li a.active::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 50%;
  width: 3px; height: 18px; transform: translateY(-50%);
  background: var(--accent); border-radius: 3px;
}
.side-num {
  font-family: var(--mono); font-size: .6rem; color: var(--faint);
  min-width: 17px; opacity: .75;
}
.side-group li a.active .side-num { color: var(--accent); opacity: 1; }

.sidebar-footer { margin-top: 22px; padding: 14px 2px 0; border-top: 1px solid var(--line); }
.side-cta {
  display: flex; gap: 10px; align-items: center;
  padding: 11px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
}
.side-cta:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.side-cta > .icon { color: var(--accent-deep); width: 19px; height: 19px; }
.side-cta span { display: flex; flex-direction: column; line-height: 1.3; }
.side-cta strong { font-size: .78rem; }
.side-cta small { font-size: .68rem; color: var(--muted); }
.version-pill {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  margin-top: 12px; font-size: .66rem; color: var(--faint);
  font-family: var(--mono);
}
.version-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.sidebar-overlay {
  position: fixed; inset: 0; z-index: 39;
  background: rgba(3, 12, 8, .5); backdrop-filter: blur(3px);
}

/* --------------------------------------------------------------- main */
.main {
  min-width: 0; padding: 30px 46px 0;
  display: flex; flex-direction: column;
  min-height: calc(100vh - var(--topbar-h));
}
.article { max-width: 880px; width: 100%; margin: 0 auto; }

.breadcrumbs {
  max-width: 880px; width: 100%; margin: 0 auto 22px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  font-size: .74rem; color: var(--faint);
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent-deep); }
.breadcrumbs .icon { width: 12px; height: 12px; opacity: .5; }
[dir="rtl"] .breadcrumbs .icon { transform: scaleX(-1); }
.breadcrumbs span[aria-current] { color: var(--ink-2); font-weight: 500; }

/* --------------------------------------------------------------- page head */
.page-head { margin-bottom: 34px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .74rem; font-weight: 600; color: var(--accent-deep);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 5px 10px 5px 6px; border-radius: 999px;
  margin-bottom: 18px;
}
[dir="rtl"] .eyebrow { padding: 5px 6px 5px 10px; }
.eyebrow-icon {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--surface); color: var(--accent-deep);
}
.eyebrow-icon .icon { width: 13px; height: 13px; }
.eyebrow .sep { opacity: .4; }
.eyebrow .mono { font-family: var(--mono); font-size: .68rem; }

.page-head h1 {
  font-size: clamp(2rem, 1.4rem + 2.2vw, 2.9rem);
  font-weight: 700; letter-spacing: -.03em; line-height: 1.15;
  margin-bottom: 14px;
}
[lang="ar"] .page-head h1 { letter-spacing: 0; line-height: 1.35; }
.lead {
  font-size: 1.06rem; line-height: 1.8; color: var(--muted);
  max-width: 70ch;
}

.page-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: .76rem; color: var(--faint);
}
.meta-item { display: inline-flex; align-items: center; gap: 6px; }
.meta-item .icon { width: 14px; height: 14px; }
.meta-roles { flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: .68rem; font-weight: 500;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line);
}
.chip .icon { width: 11px; height: 11px; }
.chip-emerald { background: var(--accent-soft); color: var(--accent-deep); border-color: transparent; }
.chip-sky { background: var(--tip-soft); color: var(--tip); border-color: transparent; }
.chip-amber { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip-violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.chip-slate { background: var(--surface-3); color: var(--ink-2); }

/* --------------------------------------------------------------- prose */
.prose { font-size: 1rem; line-height: 1.9; color: var(--ink-2); }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 1.05em 0; }
.prose h2 {
  margin: 2.6em 0 .8em; padding-top: 1.4em;
  border-top: 1px solid var(--line);
  font-size: 1.55rem; color: var(--ink); letter-spacing: -.02em;
}
.prose h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 1.4em; }
.prose h3 { margin: 2em 0 .6em; font-size: 1.16rem; color: var(--ink); }
.prose h4 { margin: 1.6em 0 .5em; font-size: 1rem; color: var(--ink); }
[lang="ar"] .prose h2 { line-height: 1.5; }
[lang="ar"] .prose h3 { line-height: 1.55; }

.h-anchor {
  margin-inline-start: .35em; color: var(--faint); opacity: 0;
  font-weight: 400; text-decoration: none; transition: opacity .15s;
}
h2:hover .h-anchor, h3:hover .h-anchor, h4:hover .h-anchor, .h-anchor:focus { opacity: 1; color: var(--accent); }

.prose a:not(.h-anchor) {
  color: var(--accent-deep); font-weight: 500;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px; text-decoration-thickness: 1.5px;
  transition: text-decoration-color .15s, color .15s;
}
.prose a:not(.h-anchor):hover { text-decoration-color: var(--accent); color: var(--accent); }
.prose a.ext::after {
  content: "↗"; font-size: .72em; margin-inline-start: 3px; opacity: .6;
}
.prose strong { color: var(--ink); font-weight: 650; }
.prose em { font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose ul, .prose ol { margin: 1.1em 0; padding-inline-start: 1.4em; }
.prose li { margin: .45em 0; }
.prose li::marker { color: var(--accent); }
.prose ul { list-style: none; padding-inline-start: 1.25em; }
.prose ul > li { position: relative; }
.prose ul > li::before {
  content: ""; position: absolute; inset-inline-start: -1.05em; top: .72em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  opacity: .55;
}
.prose ul.checklist > li::before, .prose ul > li.task-item::before { display: none; }
.prose ol { list-style: decimal; }
.prose ol > li::marker { font-family: var(--mono); font-size: .82em; color: var(--muted); }

.prose blockquote {
  margin: 1.6em 0; padding: 14px 18px;
  border-inline-start: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 10px 10px 0;
  color: var(--muted); font-size: .95em;
}
[dir="rtl"] .prose blockquote { border-radius: 10px 0 0 10px; }

.prose code {
  font-family: var(--mono); font-size: .85em;
  background: var(--surface-3); color: var(--accent-deep);
  padding: .14em .38em; border-radius: 5px;
  border: 1px solid var(--line);
  word-break: break-word;
}
.prose pre code { border: 0; background: none; padding: 0; color: inherit; }

.prose img {
  border-radius: 12px; border: 1px solid var(--line);
  margin: 1.4em 0; box-shadow: var(--shadow-sm);
}

/* tables */
.table-wrap {
  margin: 1.5em 0; border: 1px solid var(--line); border-radius: 12px;
  overflow: auto; background: var(--surface);
  box-shadow: var(--shadow-xs);
  scrollbar-width: thin;
}
.prose table { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 460px; }
.prose thead th {
  background: var(--surface-2); color: var(--ink);
  font-weight: 600; font-size: .78rem; letter-spacing: .01em;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.prose tbody td {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  color: var(--ink-2); vertical-align: top; line-height: 1.7;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.prose tbody tr:hover { background: var(--accent-soft); }
.prose td strong { color: var(--ink); }

/* code blocks */
.code-block {
  margin: 1.6em 0; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: #0b1512;
}
.code-block figcaption {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: #0f1d18;
  border-bottom: 1px solid #1a2c24;
  font-family: var(--mono); font-size: .68rem; color: #7f9c8d;
  text-transform: uppercase; letter-spacing: .08em;
}
.copy-btn {
  border: 1px solid #24382f; background: #14241d; color: #a8c1b4;
  font-size: .66rem; font-family: var(--mono); padding: 3px 8px;
  border-radius: 5px; cursor: pointer; transition: background .15s;
}
.copy-btn:hover { background: #1c332a; color: #d8efe4; }
.code-block pre {
  margin: 0; padding: 16px; overflow-x: auto;
  font-family: var(--mono); font-size: .8rem; line-height: 1.7; color: #cfe6db;
}

/* callouts */
.callout {
  display: flex; gap: 12px; margin: 1.6em 0; padding: 14px 16px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: .92rem; line-height: 1.8;
}
.callout-icon {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 8px; margin-top: 1px;
}
.callout-icon .icon { width: 16px; height: 16px; }
.callout-body p { margin: .25em 0; }
.callout-body p:first-child { margin-top: 0; }
.callout-body p:last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; color: var(--ink); }
.callout-note { border-color: color-mix(in srgb, var(--tip) 22%, var(--line)); background: var(--tip-soft); }
.callout-note .callout-icon { background: color-mix(in srgb, var(--tip) 12%, transparent); color: var(--tip); }
.callout-tip { border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); background: var(--accent-soft); }
.callout-tip .callout-icon { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent-deep); }
.callout-warning { border-color: color-mix(in srgb, var(--warn) 28%, var(--line)); background: var(--warn-soft); }
.callout-warning .callout-icon { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.callout-danger { border-color: color-mix(in srgb, var(--danger) 26%, var(--line)); background: var(--danger-soft); }
.callout-danger .callout-icon { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.callout-success { border-color: color-mix(in srgb, var(--accent) 26%, var(--line)); background: var(--accent-soft); }
.callout-success .callout-icon { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent-deep); }

/* task lists */
.task-item { list-style: none; display: flex; gap: 9px; align-items: flex-start; }
.task-box {
  flex: 0 0 auto; width: 17px; height: 17px; margin-top: 5px;
  border: 1.5px solid var(--line-strong); border-radius: 5px;
  background: var(--surface); position: relative;
}
.task-box.checked { background: var(--accent); border-color: var(--accent); }
.task-box.checked::after {
  content: ""; position: absolute; inset-inline-start: 5px; top: 2px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.prose ul.checklist { padding-inline-start: 0; }

/* flow diagrams */
.flow {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(134px, 1fr)); gap: 10px;
  margin: 1.8em 0; padding: 18px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
}
.flow-step {
  min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 13px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.flow-index {
  font-family: var(--mono); font-size: .58rem; color: var(--accent);
  font-weight: 500; letter-spacing: .06em;
}
.flow-text { font-size: .82rem; font-weight: 500; color: var(--ink); line-height: 1.5; }
.flow-arrow { display: none; }
.flow:where(:has(> .flow-step:nth-child(6):last-child)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.flow-states .flow-step:nth-child(4n+1) { border-top: 2px solid var(--accent); }
.flow-states .flow-step:nth-child(4n+2) { border-top: 2px solid var(--tip); }
.flow-states .flow-step:nth-child(4n+3) { border-top: 2px solid var(--warn); }
.flow-states .flow-step:nth-child(4n+4) { border-top: 2px solid var(--danger); }

.flow-step-action { padding: 0; overflow: hidden; transition: transform .16s var(--ease), border-color .16s, box-shadow .16s; }
.flow-step-action:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); box-shadow: var(--shadow-sm); }
.flow-step-action:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.flow-step-btn {
  position: relative; width: 100%; height: 100%; min-height: 100%;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 13px; text-align: start;
  border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.flow-step-btn:focus-visible { outline: 0; }
.flow-plus {
  position: absolute; top: 9px; inset-inline-end: 10px;
  display: grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep);
  font-size: .78rem; font-weight: 700; line-height: 1;
  opacity: 0; transform: scale(.8); transition: opacity .15s, transform .15s;
}
.flow-step-action:hover .flow-plus, .flow-step-btn:focus-visible .flow-plus { opacity: 1; transform: scale(1); }
.flow-detail[hidden] { display: none; }

/* mini cards */
.mini-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin: 1.6em 0;
}
.mini-card {
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2);
}
.mini-card h4 { margin: 0 0 4px; font-size: .9rem; color: var(--ink); }
.mini-card p { margin: 0; font-size: .84rem; color: var(--muted); line-height: 1.7; }

/* --------------------------------------------------------------- toc */
.toc { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 30px 22px; scrollbar-width: none; }
.toc::-webkit-scrollbar { display: none; }
.toc-title {
  display: flex; align-items: center; gap: 7px;
  font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 12px;
}
[lang="ar"] .toc-title { letter-spacing: 0; }
.toc-title .icon { width: 14px; height: 14px; }
.toc ol { list-style: none; border-inline-start: 1px solid var(--line); padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 5px 12px; font-size: .775rem; line-height: 1.5;
  color: var(--muted); border-inline-start: 2px solid transparent;
  margin-inline-start: -1px; transition: color .15s, border-color .15s;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent-deep); border-inline-start-color: var(--accent); font-weight: 600; }
.toc-l3 a { padding-inline-start: 22px; font-size: .73rem; }

.toc-help {
  display: flex; gap: 9px; margin-top: 22px; padding: 13px;
  border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line);
}
.toc-help-icon { color: var(--accent-deep); line-height: 1; }
.toc-help-icon .icon { width: 17px; height: 17px; }
.toc-help strong { display: block; font-size: .76rem; margin-bottom: 2px; }
.toc-help p { font-size: .7rem; color: var(--muted); line-height: 1.6; }
.toc-help a {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; font-size: .7rem; font-weight: 600; color: var(--accent-deep);
}
.toc-help a .icon { width: 11px; height: 11px; }

/* --------------------------------------------------------------- page actions */
.page-actions {
  max-width: 880px; width: 100%; margin: 38px auto 0;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.feedback { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .8rem; }
.feedback-q { color: var(--muted); font-weight: 500; }
.feedback button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .75rem; color: var(--ink-2); transition: all .15s;
}
.feedback button:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.feedback button .icon { width: 12px; height: 12px; }
.feedback-thanks { color: var(--accent-deep); font-size: .76rem; font-weight: 500; }
.action-btns { display: flex; gap: 8px; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: transparent;
  font-size: .75rem; color: var(--muted); transition: all .15s;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface); }
.ghost-btn .icon { width: 13px; height: 13px; }

/* related */
.related { max-width: 880px; width: 100%; margin: 36px auto 0; }
.related h2 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; font-weight: 700; }
[lang="ar"] .related h2 { letter-spacing: 0; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.related-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.related-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.related-icon { color: var(--accent-deep); margin-top: 2px; }
.related-icon .icon { width: 17px; height: 17px; }
.related-card > span:nth-child(2) { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.related-card strong { font-size: .82rem; color: var(--ink); }
.related-card small { font-size: .7rem; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-card .go { margin-inline-start: auto; color: var(--faint); align-self: center; }
.related-card .go .icon { width: 14px; height: 14px; }
[dir="rtl"] .related-card .go .icon { transform: scaleX(-1); }

/* pager */
.pager { max-width: 880px; width: 100%; margin: 26px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager-link {
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s, transform .15s;
}
.pager-link:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.pager-link.next { text-align: end; align-items: flex-end; }
.pager-link span { display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; color: var(--faint); font-weight: 600; letter-spacing: .04em; }
.pager-link span .icon { width: 12px; height: 12px; }
[dir="rtl"] .pager-link span .icon { transform: scaleX(-1); }
.pager-link.prev span .icon { transform: rotate(180deg); }
[dir="rtl"] .pager-link.prev span .icon { transform: rotate(180deg) scaleX(-1); }
.pager-link strong { font-size: .86rem; color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------------- export band */
.export-band { padding-bottom: 0; }
.export-card {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 22px 24px; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(120deg, var(--accent-soft), var(--surface) 62%);
}
.export-icon {
  display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  color: var(--accent-deep); box-shadow: var(--shadow-xs);
}
.export-icon .icon { width: 20px; height: 20px; }
.export-copy { flex: 1 1 260px; min-width: 0; }
.export-copy h3 { font-size: .98rem; margin: 0 0 3px; letter-spacing: -.01em; }
.export-copy p { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.65; }
.export-links { display: flex; gap: 8px; flex-wrap: wrap; }
.export-links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-size: .74rem; font-weight: 600;
  transition: border-color .15s, color .15s, background .15s;
}
.export-links a:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--surface-2); }
.export-links .icon { width: 14px; height: 14px; opacity: .8; }

/* --------------------------------------------------------------- footer */
.site-footer {
  max-width: 880px; width: 100%; margin: 60px auto 0;
  padding: 38px 0 30px; border-top: 1px solid var(--line);
  font-size: .82rem;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px; }
.footer-brand .brand { margin-bottom: 12px; }
.footer-brand > p { color: var(--muted); font-size: .78rem; line-height: 1.8; max-width: 34ch; }
.footer-company { margin-top: 8px !important; font-size: .72rem !important; color: var(--muted) !important; }
.footer-company strong { color: var(--accent-deep); font-weight: 600; }
.footer-note { margin-top: 10px !important; font-size: .7rem !important; color: var(--faint) !important; }
.site-footer h3 { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: 12px; }
[lang="ar"] .site-footer h3 { letter-spacing: 0; }
.site-footer ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.site-footer ul a { color: var(--muted); font-size: .78rem; transition: color .15s; }
.site-footer ul a:hover { color: var(--accent-deep); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: .7rem; color: var(--faint); font-family: var(--mono);
}

/* --------------------------------------------------------------- hub / home */
.hub { padding-top: 0; }
.hub .hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.08fr .92fr; gap: 40px;
  padding: 64px 0 54px;
}
.hero-bg { position: absolute; inset: -80px -60px auto; height: 520px; z-index: 0; pointer-events: none; }
.hero-bg .orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.orb-a { width: 380px; height: 380px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, transparent), transparent 70%); top: -40px; inset-inline-start: 10%; }
.orb-b { width: 320px; height: 320px; background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 38%, transparent), transparent 70%); top: 80px; inset-inline-end: 0; }
.grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, #000, transparent 72%);
  opacity: .35;
}
.hero-copy { position: relative; z-index: 1; padding-top: 10px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .72rem; font-weight: 600; color: var(--accent-deep);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 20px;
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--ring); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--ring); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.hero h1 {
  font-size: clamp(2.4rem, 1.5rem + 3.2vw, 4rem);
  line-height: 1.12; letter-spacing: -.04em; font-weight: 700;
  margin-bottom: 18px; max-width: 16ch;
}
[lang="ar"] .hero h1 { letter-spacing: 0; line-height: 1.35; max-width: 20ch; }
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-lead { font-size: 1.04rem; line-height: 1.85; color: var(--muted); max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.primary-btn, .secondary-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 11px;
  font-size: .86rem; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s, background .15s, border-color .15s;
}
.primary-btn {
  border: 0; background: var(--ink); color: var(--bg);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .5);
}
[data-theme="dark"] .primary-btn { background: var(--accent); color: #04130c; }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -16px rgba(0, 0, 0, .55); }
.primary-btn .icon { width: 16px; height: 16px; }
.primary-btn kbd { font-family: var(--mono); font-size: .62rem; background: color-mix(in srgb, var(--bg) 18%, transparent); padding: 2px 5px; border-radius: 4px; opacity: .7; }
.secondary-btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.secondary-btn:hover { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-2px); }
.secondary-btn .icon { width: 15px; height: 15px; }
[dir="rtl"] .primary-btn .icon, [dir="rtl"] .secondary-btn .icon, [dir="rtl"] .text-link .icon, [dir="rtl"] .role-cta .icon { transform: scaleX(-1); }

.hero-stats { display: flex; gap: 30px; margin: 34px 0 0; padding-top: 22px; border-top: 1px solid var(--line); }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats dt { font-size: 1.4rem; font-weight: 700; color: var(--ink); font-family: var(--mono); letter-spacing: -.03em; }
.hero-stats dd { margin: 0; font-size: .7rem; color: var(--muted); font-weight: 500; }

/* hero visual */
.hero-visual { position: relative; z-index: 1; min-height: 430px; display: flex; align-items: center; justify-content: center; }
.dash-card {
  width: min(100%, 370px); padding: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(10px);
  transform: rotate(-1.2deg);
  position: relative; z-index: 2;
}
[dir="rtl"] .dash-card { transform: rotate(1.2deg); }
.dash-top { display: flex; align-items: center; gap: 10px; }
.dash-avatar {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.dash-avatar .icon { width: 19px; height: 19px; }
.dash-top div { display: flex; flex-direction: column; line-height: 1.25; }
.dash-top strong { font-size: .82rem; }
.dash-top small { font-size: .68rem; color: var(--muted); }
.dash-badge {
  margin-inline-start: auto; font-size: .62rem; font-weight: 600;
  color: var(--accent-deep); background: var(--accent-soft);
  padding: 3px 8px; border-radius: 999px;
}
.dash-ring { position: relative; width: 132px; height: 132px; margin: 18px auto 8px; }
.dash-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.dash-ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: url(#g); stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 301.6; stroke-dashoffset: 84.4; animation: ring 1.4s var(--ease) both; }
@keyframes ring { from { stroke-dashoffset: 301.6; } }
.dash-ring > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.dash-ring strong { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; }
.dash-ring small { font-size: .62rem; color: var(--muted); }
.dash-list { list-style: none; display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.dash-list li { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; font-size: .72rem; color: var(--muted); }
.dash-list b { font-family: var(--mono); font-size: .68rem; color: var(--ink); font-weight: 500; }
.dash-list i { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--line); position: relative; overflow: hidden; }
.dash-list i::after { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: var(--w, 50%); border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.float-card {
  position: absolute; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-md); font-size: .7rem;
  animation: float 6s ease-in-out infinite;
}
.float-card > .icon { width: 16px; height: 16px; color: var(--accent-deep); }
.float-card div { display: flex; flex-direction: column; line-height: 1.25; }
.float-card strong { font-size: .72rem; color: var(--ink); }
.float-card small { font-size: .62rem; color: var(--muted); }
.fc-1 { top: 3%; inset-inline-start: 0; animation-delay: 0s; }
.fc-2 { bottom: 15%; inset-inline-end: 0; animation-delay: -2s; }
.fc-3 { bottom: 1%; inset-inline-start: 6%; color: var(--accent-deep); font-weight: 700; animation-delay: -4s; }
.fc-3 .icon { color: var(--accent); }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

/* sections */
.section { padding: 46px 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 26px; max-width: 70ch; }
.section-head.split { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; max-width: none; }
.section-label {
  display: inline-block; font-size: .66rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep);
  margin-bottom: 8px;
}
[lang="ar"] .section-label { letter-spacing: 0; }
.section-head h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); letter-spacing: -.025em; margin-bottom: 6px; }
[lang="ar"] .section-head h2 { letter-spacing: 0; }
.section-head p { color: var(--muted); font-size: .9rem; line-height: 1.75; }
.text-link { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--accent-deep); white-space: nowrap; }
.text-link:hover { color: var(--accent); }
.text-link .icon { width: 14px; height: 14px; }

/* role cards */
.role-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.role-card {
  --rc: var(--accent);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 16px 16px; min-height: 200px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.role-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--rc) 45%, var(--line)); box-shadow: var(--shadow-md); }
.role-glow { position: absolute; top: -40px; inset-inline-end: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--rc); opacity: .09; filter: blur(22px); }
.role-emerald { --rc: #10b981; } .role-sky { --rc: #0ea5e9; } .role-amber { --rc: #f59e0b; } .role-violet { --rc: #8b5cf6; } .role-slate { --rc: #64748b; }
.role-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.role-icon {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 10px; color: var(--rc);
  background: color-mix(in srgb, var(--rc) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc) 16%, transparent);
}
.role-icon .icon { width: 18px; height: 18px; }
.role-count { font-family: var(--mono); font-size: .66rem; color: var(--rc); font-weight: 600; }
.role-count small { font-weight: 400; color: var(--faint); font-family: var(--font-en); }
[lang="ar"] .role-count small { font-family: var(--font-ar); }
.role-card > strong { font-size: .88rem; line-height: 1.35; color: var(--ink); }
.role-card > p { font-size: .74rem; line-height: 1.65; color: var(--muted); flex: 1; }
.role-cta {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .68rem; font-weight: 600; color: var(--rc);
  padding-top: 9px; border-top: 1px solid var(--line);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.role-cta .icon { width: 11px; height: 11px; flex: 0 0 auto; }

/* trainee loop */
.loop-section { position: relative; }
.loop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.loop-step {
  position: relative; display: flex; flex-direction: column; gap: 5px;
  padding: 18px 18px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.loop-step:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.loop-num { position: absolute; top: 16px; inset-inline-end: 16px; font-family: var(--mono); font-size: .64rem; color: var(--faint); }
.loop-icon { color: var(--accent-deep); margin-bottom: 4px; }
.loop-icon .icon { width: 22px; height: 22px; }
.loop-step strong { font-size: .9rem; color: var(--ink); }
.loop-step p { font-size: .76rem; line-height: 1.7; color: var(--muted); }
.loop-link { position: absolute; bottom: 14px; inset-inline-end: 16px; color: var(--faint); opacity: 0; transition: opacity .15s, transform .15s; }
.loop-step:hover .loop-link { opacity: 1; transform: translateX(3px); }
[dir="rtl"] .loop-step:hover .loop-link { transform: translateX(-3px); }
.loop-link .icon { width: 14px; height: 14px; }

/* category grid */
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cat-card {
  padding: 20px; border: 1px solid var(--line); border-radius: 15px;
  background: var(--surface); transition: border-color .18s, box-shadow .18s;
}
.cat-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.cat-head { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 14px; }
.cat-icon {
  display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 9px; color: var(--accent-deep); background: var(--accent-soft);
}
.cat-icon .icon { width: 17px; height: 17px; }
.cat-head h3 { font-size: .95rem; margin-bottom: 2px; }
.cat-head p { font-size: .73rem; color: var(--muted); line-height: 1.6; }
.cat-count { margin-inline-start: auto; font-family: var(--mono); font-size: .64rem; color: var(--faint); background: var(--surface-3); padding: 2px 7px; border-radius: 6px; }
.cat-pages { list-style: none; display: flex; flex-direction: column; }
.cat-pages a {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 7px; border-radius: 6px; font-size: .77rem; color: var(--ink-2);
  transition: background .13s, color .13s;
}
.cat-pages a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.cat-pages a span:first-child { font-family: var(--mono); font-size: .58rem; color: var(--faint); min-width: 16px; }
.cat-pages a .icon { margin-inline-start: auto; width: 12px; height: 12px; color: var(--faint); }
[dir="rtl"] .cat-pages a .icon { transform: scaleX(-1); }

/* welcome from the coach */
.welcome-section { padding-top: 34px; }
.welcome-card {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 232px 1fr; gap: 36px; align-items: center;
  padding: 32px; border: 1px solid var(--line); border-radius: 22px;
  background:
    radial-gradient(140% 120% at 100% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 55%),
    linear-gradient(150deg, var(--surface-2), var(--surface) 60%);
}
.welcome-glow {
  position: absolute; width: 340px; height: 340px; top: -190px; inset-inline-end: -90px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 35%, transparent), transparent 66%);
  filter: blur(50px); opacity: .45;
}
.welcome-portrait {
  position: relative; width: 100%; aspect-ratio: 4 / 4.7;
  display: grid; place-items: center; overflow: hidden;
  border-radius: 18px; border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  background:
    radial-gradient(circle at 32% 22%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 58%),
    linear-gradient(165deg, var(--surface), var(--accent-soft));
  box-shadow: var(--shadow-sm);
}
.portrait-orbit { position: absolute; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.orbit-1 { width: 62%; aspect-ratio: 1; }
.orbit-2 { width: 84%; aspect-ratio: 1; border-style: dashed; opacity: .55; }
.portrait-monogram {
  position: relative; z-index: 2; font-family: var(--font-ar);
  font-size: clamp(3.6rem, 5vw, 5.2rem); font-weight: 700; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-fill-color: transparent;
}
.portrait-mark {
  position: absolute; bottom: 13px; inset-inline-end: 13px; z-index: 2;
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; background: var(--surface); border: 1px solid var(--line);
  color: var(--accent-deep);
}
.portrait-mark .icon { width: 16px; height: 16px; }
.welcome-copy { position: relative; z-index: 1; }
.welcome-copy h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.95rem); letter-spacing: -.025em; margin: 2px 0 14px; }
[lang="ar"] .welcome-copy h2 { letter-spacing: 0; }
.welcome-quote { position: relative; margin: 0; padding-inline-start: 24px; }
.quote-mark {
  position: absolute; inset-inline-start: 0; top: -14px;
  font-family: Georgia, "Times New Roman", serif; font-size: 3.4rem; line-height: 1;
  color: var(--accent); opacity: .3; pointer-events: none;
}
.welcome-quote p { font-size: 1rem; line-height: 2; color: var(--ink-2); }
[lang="en"] .welcome-quote p { line-height: 1.85; }
.welcome-note { margin-top: 12px !important; font-size: .9rem !important; font-weight: 600; color: var(--ink) !important; }
.welcome-sign {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
}
.signature-block { display: flex; flex-direction: column; gap: 2px; }
.signature { font-size: 1.02rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.signature-rule { width: 64px; height: 2px; border-radius: 2px; margin: 6px 0; background: linear-gradient(90deg, var(--accent), transparent); }
.signature-role { font-size: .76rem; color: var(--muted); }
.signature-company { font-size: .68rem; color: var(--faint); margin-top: 1px; }
.welcome-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600; color: var(--accent-deep);
  padding: 8px 12px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.welcome-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.welcome-link .icon { width: 13px; height: 13px; }
[dir="rtl"] .welcome-link .icon { transform: scaleX(-1); }

/* updates */
.updates-section { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; align-items: start; }
.updates-card, .scope-card { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.updates-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.updates-head h2 { font-size: 1.25rem; }
.updates-list { list-style: none; }
.updates-list li { border-top: 1px solid var(--line); }
.updates-list li:first-child { border-top: 0; }
.updates-list a { display: flex; align-items: baseline; gap: 12px; padding: 11px 0; font-size: .8rem; color: var(--ink-2); }
.updates-list a:hover { color: var(--accent-deep); }
.updates-list time { font-family: var(--mono); font-size: .62rem; color: var(--faint); white-space: nowrap; flex: 0 0 auto; }
.updates-list span { flex: 1; line-height: 1.6; }
.updates-list .icon { width: 13px; height: 13px; color: var(--faint); flex: 0 0 auto; }
[dir="rtl"] .updates-list .icon { transform: scaleX(-1); }
.scope-card { background: linear-gradient(160deg, var(--accent-soft), var(--surface) 65%); position: relative; overflow: hidden; }
.scope-icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  background: var(--surface); color: var(--accent-deep); border: 1px solid var(--line);
  margin-bottom: 12px;
}
.scope-icon .icon { width: 20px; height: 20px; }
.scope-card h3 { font-size: 1.05rem; margin-bottom: 5px; }
.scope-card p { font-size: .8rem; color: var(--muted); line-height: 1.7; margin-bottom: 14px; }
.scope-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: .68rem; color: var(--muted); }
.scope-meta span { display: inline-flex; align-items: center; gap: 4px; }
.scope-meta .icon { width: 12px; height: 12px; color: var(--accent-deep); }

/* toast */
.toast {
  position: fixed; bottom: 26px; inset-inline-start: 50%;
  transform: translate(-50%, 20px);
  z-index: 300; padding: 10px 18px; border-radius: 10px;
  background: var(--ink); color: var(--bg);
  font-size: .8rem; font-weight: 500;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
}
[data-theme="dark"] .toast { background: var(--accent); color: #04130c; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.copy-btn.done { background: #1f6f4f; color: #eafff5; }

/* --------------------------------------------------------------- search */
.search-modal { position: fixed; inset: 0; z-index: 200; display: flex; justify-content: center; align-items: flex-start; padding: 8vh 16px 16px; }
.search-modal[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; background: rgba(3, 12, 8, .55); backdrop-filter: blur(6px); }
.search-panel {
  position: relative; width: min(680px, 100%); max-height: 76vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop .18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
.search-field { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-field > .icon { width: 19px; height: 19px; color: var(--faint); }
.search-field input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 1rem; color: var(--ink); font-family: inherit;
}
.search-field input::placeholder { color: var(--faint); }
.search-results { overflow-y: auto; padding: 8px; flex: 1; }
.search-group-label { padding: 10px 10px 4px; font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.search-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent;
}
.search-item:hover, .search-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 18%, transparent); }
.search-item-top { display: flex; align-items: center; gap: 7px; }
.search-item-top strong { font-size: .84rem; color: var(--ink); }
.search-item-top .crumb { font-size: .64rem; color: var(--faint); margin-inline-start: auto; white-space: nowrap; }
.search-item p { font-size: .74rem; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-item mark { background: color-mix(in srgb, var(--accent-2) 40%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-empty { padding: 40px 20px; text-align: center; color: var(--faint); font-size: .84rem; }
.search-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: .66rem; color: var(--faint); flex-wrap: wrap; }
.search-foot kbd { font-family: var(--mono); font-size: .6rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; padding: 0 4px; border-radius: 3px; background: var(--surface); }

/* --------------------------------------------------------------- detail modal */
.detail-modal { position: fixed; inset: 0; z-index: 190; display: grid; place-items: center; padding: 20px; }
.detail-modal[hidden] { display: none; }
.detail-backdrop { position: absolute; inset: 0; background: rgba(3, 12, 8, .55); backdrop-filter: blur(5px); }
.detail-card {
  position: relative; width: min(580px, 100%); max-height: min(80vh, 660px); overflow: auto;
  padding: 30px 30px 20px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: detail-in .22s var(--ease);
}
.detail-close {
  position: absolute; top: 14px; inset-inline-end: 14px;
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.detail-close:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-3); }
.detail-close .icon { width: 15px; height: 15px; }
.detail-kicker { font-family: var(--mono); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.detail-card h2 { font-size: clamp(1.35rem, 1.1rem + .8vw, 1.7rem); margin: 6px 0 12px; letter-spacing: -.02em; }
[lang="ar"] .detail-card h2 { letter-spacing: 0; }
.detail-body { color: var(--ink-2); font-size: .94rem; line-height: 1.9; }
.detail-body p + p { margin-top: .75em; }
.detail-body ul, .detail-body ol { margin: .6em 0; padding-inline-start: 1.25em; }
.detail-body ul { list-style: disc; }
.detail-body ol { list-style: decimal; }
.detail-body li { margin: .25em 0; }
.detail-body a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
.detail-body strong { color: var(--ink); }
.detail-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .64rem; color: var(--faint); }
.detail-ok { padding: 7px 14px; border-radius: 8px; border: 0; background: var(--ink); color: var(--bg); font-size: .74rem; font-weight: 600; cursor: pointer; }
[data-theme="dark"] .detail-ok { background: var(--accent); color: #04130c; }
@keyframes detail-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }

/* --------------------------------------------------------------- 404 */
.notfound { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 30px; }
.notfound h1 { font-size: clamp(5rem, 14vw, 9rem); font-family: var(--mono); letter-spacing: -.08em; background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.notfound p { color: var(--muted); max-width: 46ch; line-height: 1.8; }
.notfound .brand { margin-bottom: 20px; }
.notfound .hero-actions { justify-content: center; }

/* --------------------------------------------------------------- chooser */
.chooser-body {
  min-height: 100svh; display: flex; flex-direction: column;
  background: var(--chooser-bg); color: var(--chooser-ink); overflow-x: hidden; position: relative;
}
.chooser {
  position: relative; z-index: 1; width: 100%; max-width: var(--shell-w);
  margin: 0 auto; padding: clamp(16px, 2.4vh, 28px) clamp(18px, 4vw, 64px) 0;
  display: flex; flex-direction: column; flex: 1;
}
.chooser-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.chooser-top, .chooser-stage { position: relative; z-index: 1; }
.chooser-bg .orb-a { width: 560px; height: 560px; top: -190px; inset-inline-start: 2%; opacity: .4; }
.chooser-bg .orb-b { width: 460px; height: 460px; bottom: -190px; inset-inline-end: -40px; opacity: .3; }
.chooser-grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 34%, #000, transparent 70%);
}

.chooser-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-bottom: 18px; border-bottom: 1px solid var(--chooser-line);
}
.chooser-brand { display: inline-flex; align-items: center; gap: 10px; }
.chooser-brand-logo { width: 34px; height: 34px; display: block; filter: drop-shadow(0 6px 16px rgba(100,249,62,.18)); }
.chooser-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.chooser-brand-text strong { font-family: var(--font-en); font-size: .9rem; letter-spacing: .16em; color: #fff; }
.chooser-brand-text small { font-size: .64rem; letter-spacing: .05em; color: #7f9c8d; }
.chooser-version {
  font-family: var(--mono); font-size: .58rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--chooser-muted); padding: 5px 9px; border: 1px solid var(--chooser-line-strong); border-radius: 6px;
}

.chooser-stage {
  flex: 1; display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 30vw, 520px);
  grid-template-areas:
    "copy visual"
    "pick visual"
    "sign visual";
  column-gap: clamp(28px, 4vw, 72px);
  align-items: center;
  align-content: center;
  padding: clamp(24px, 3.6vh, 40px) 0 22px;
}
.chooser-copy { grid-area: copy; min-width: 0; }
.chooser-pick { grid-area: pick; min-width: 0; max-width: 680px; }
.chooser-signature { grid-area: sign; }
.chooser-visual { grid-area: visual; }

.chooser-presents { font-family: var(--mono); font-size: .6rem; letter-spacing: .17em; text-transform: uppercase; color: var(--chooser-quiet); margin: 0 0 12px; }
.chooser-presents span { color: var(--chooser-accent-2); }

.chooser-wordmark {
  font-family: var(--font-en); font-size: clamp(2.9rem, 4.6vw + .9rem, 5.6rem); font-weight: 800;
  letter-spacing: .14em; line-height: .95; margin: 0 0 14px; text-indent: .14em;
  /* shrink to the word: a block-wide background would make the sweep travel across
     empty space, which is why the glint was rarely on the letters. */
  width: fit-content; max-width: 100%;
  /* brand gradient under a lime/white specular band that never stops sweeping the glyphs.
     The band is tinted, not pure white: half the word is already white, so a white-only
     highlight would be invisible there. */
  background-image:
    linear-gradient(105deg,
      transparent 30%,
      rgba(206, 255, 128, .85) 43%,
      rgba(255, 255, 255, .96) 50%,
      rgba(206, 255, 128, .85) 57%,
      transparent 70%),
    linear-gradient(112deg, #fff 6%, #e7ffb8 42%, var(--chooser-accent) 96%);
  background-size: 220% 100%, 100% 100%;
  background-position: 135% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  /* alternate: the glint runs start -> end, then end -> start, forever */
  animation: wordmark-sheen 3.2s cubic-bezier(.45, .05, .55, .95) infinite alternate;
  will-change: background-position;
}
@keyframes wordmark-sheen {
  0% { background-position: 135% 0, 0 0; }
  100% { background-position: -35% 0, 0 0; }
}
.chooser-tagline { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; margin: 0; font-size: .88rem; line-height: 1.7; color: var(--chooser-soft); }
.chooser-tag-ar { color: var(--chooser-quiet); font-size: .82rem; }

.chooser-select {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 14px; font-family: var(--mono); font-size: .6rem;
  letter-spacing: .16em; text-transform: uppercase; color: var(--chooser-muted);
}
.chooser-select::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,.14), transparent);
}
.chooser-select span { font-family: var(--font-ar); font-size: .78rem; letter-spacing: 0; text-transform: none; color: var(--chooser-accent-2); }

.chooser-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chooser-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  min-height: 138px; padding: 18px; border-radius: 16px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(100,249,62,.09), transparent 60%),
    rgba(255,255,255,.028);
  border: 1px solid rgba(255,255,255,.09);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.chooser-card:hover {
  border-color: rgba(100,249,62,.46); transform: translateY(-3px);
  box-shadow: 0 24px 45px -30px rgba(100,249,62,.7), inset 0 0 0 1px rgba(100,249,62,.1);
}
.chooser-card:focus-visible { outline: 2px solid #64f93e; outline-offset: 3px; }
.chooser-flag {
  display: block; width: 42px; height: 28px; flex: 0 0 auto;
  border-radius: 4px; overflow: hidden;  background: var(--chooser-flag-bg);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 8px 18px -12px rgba(0,0,0,.95);
  transition: transform .2s;
}
.chooser-card:hover .chooser-flag { transform: scale(1.06); }
.chooser-flag img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chooser-text { display: flex; flex-direction: column; gap: 3px; line-height: 1.4; }
.chooser-text strong { font-size: 1.16rem; color: #fff; letter-spacing: .01em; }
.chooser-text small { font-size: .72rem; color: #8aa196; }
.chooser-arrow {
  position: absolute; top: 16px; inset-inline-end: 16px;
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 999px; border: 1px solid rgba(100,249,62,.25);
  background: rgba(100,249,62,.07); color: var(--chooser-accent-2);
  transition: background .18s, color .18s, border-color .18s;
}
.chooser-arrow .icon { width: 14px; height: 14px; }
.chooser-card:hover .chooser-arrow { background: var(--chooser-accent); border-color: var(--chooser-accent); color: var(--chooser-on-accent); }
[dir="rtl"] .chooser-arrow .icon { transform: scaleX(-1); }

/* The mockup artwork is transparent, so the figure must not paint a box behind it. */
.chooser-visual {
  align-self: center; margin: 0; width: 100%;
  aspect-ratio: var(--chooser-art-ratio); max-height: min(74svh, 760px);
}
.chooser-visual img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .55));
}

.chooser-signature { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--chooser-line); }
.chooser-name {
  margin: 0; font-family: 'Amiri', var(--font-ar); font-weight: 700;
  font-size: clamp(1.85rem, 3.4vw, 2.5rem); line-height: 1.35;
  color: #f2fbf6;
  width: fit-content; max-width: 100%;
  /* the same band and the same back-and-forth sweep as the wordmark */
  background-image:
    linear-gradient(105deg,
      transparent 30%,
      rgba(206, 255, 128, .85) 43%,
      rgba(255, 255, 255, .96) 50%,
      rgba(206, 255, 128, .85) 57%,
      transparent 70%),
    linear-gradient(100deg, #fff 8%, #f0ffd0 52%, #b6ef6a 100%);
  background-size: 220% 100%, 100% 100%;
  background-position: 135% 0, 0 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: wordmark-sheen 3.2s cubic-bezier(.45, .05, .55, .95) infinite alternate;
  will-change: background-position;
}

.chooser-footer {
  position: relative; z-index: 1; width: 100%; margin: 0;
  padding: 16px 0 18px; border-top: 1px solid var(--chooser-line);
  color: var(--chooser-quiet); font-size: .64rem;
}
.chooser-foot-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px 18px; flex-wrap: wrap; width: 100%;
  font-family: var(--mono); font-size: .58rem; color: #5f7a6d;
}
.chooser-foot-brand { display: flex; align-items: center; gap: 8px; color: var(--chooser-muted); }
.chooser-foot-brand img { width: 20px; height: 20px; display: block; }
.chooser-foot-credit {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .58rem; letter-spacing: .1em;
  text-transform: uppercase; color: #5f7a6d;
}
.byteon {
  font-family: var(--font-en); font-size: .62rem; font-weight: 600; letter-spacing: .14em;
  color: var(--chooser-accent-soft);
}

/* --------------------------------------------------------------- responsive */
@media (max-width: 1400px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .main { padding-inline: 40px; }
}

@media (max-width: 1180px) {
  .role-grid { grid-template-columns: repeat(3, 1fr); }
  .top-nav { display: none; }
  .search-trigger { min-width: 190px; }
  .hero { gap: 26px; }
  .hero-visual { transform: scale(.94); }
}

@media (max-width: 1024px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; inset-inline-start: 0; z-index: 90;
    width: min(320px, 86vw); height: 100vh; padding-top: var(--topbar-h);
    transform: translateX(-105%); transition: transform .25s var(--ease);
    background: var(--surface); border-inline-end: 1px solid var(--line-strong);
    box-shadow: var(--shadow-lg);
  }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }
  .menu-btn { display: inline-grid; }
  .topbar-inner { gap: 10px; }
  .main { padding: 26px 26px 0; }
  .toc { display: none; }
  .hub .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-visual { min-height: 380px; margin-top: 14px; }
  .fc-1 { inset-inline-start: 2%; } .fc-2 { inset-inline-end: 2%; }
  .updates-section { grid-template-columns: 1fr; }
  .welcome-card { grid-template-columns: 180px 1fr; gap: 24px; padding: 24px; }
}

@media (max-width: 760px) {
  .welcome-card { grid-template-columns: 1fr; padding: 22px; gap: 20px; }
  .welcome-portrait { max-width: 148px; aspect-ratio: 1; margin-inline: auto; }
  .welcome-sign { align-items: flex-start; }
}

@media (max-width: 760px) {
  .search-trigger { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .search-trigger .search-label, .search-trigger kbd { display: none; }
  .brand-text small { display: none; }
  .lang-switch { display: none; }
  .hero { padding: 34px 0 40px; }
  .hero h1 { font-size: clamp(2rem, 1.4rem + 3vw, 2.6rem); }
  .hero-stats { gap: 18px; flex-wrap: wrap; }
  .role-grid { grid-template-columns: repeat(2, 1fr); }
  .role-card { min-height: 0; padding: 15px; }
  .role-card > p { display: none; }
  .role-cta { font-size: .64rem; }
  .loop-grid { grid-template-columns: 1fr 1fr; }
  .cat-grid { grid-template-columns: 1fr; }
  .section { padding: 34px 0; }
  .section-head.split { flex-direction: column; align-items: flex-start; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
  .footer-brand { grid-column: 1 / -1; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .action-btns { justify-content: flex-start; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { text-align: start; align-items: flex-start; }
  .main { padding-inline: 18px; }
  .prose { font-size: .96rem; }
  .prose table { font-size: .8rem; }
  .page-head h1 { font-size: 1.9rem; }
  .lead { font-size: .96rem; }
  .flow { padding: 12px; }
  .dash-card { transform: none !important; }
  .float-card { display: none; }
  .hero-visual { min-height: 0; }
}

@media (max-width: 900px) {
  .chooser { max-width: 780px; padding: 18px clamp(16px, 4vw, 26px) 0; }
  .chooser-stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "pick" "visual" "sign";
    row-gap: 24px; padding: 26px 0 24px; text-align: center;
  }
  .chooser-select { justify-content: center; }
  .chooser-select::after { display: none; }
  .chooser-wordmark { font-size: clamp(2.8rem, 11vw, 3.6rem); }
  .chooser-tagline { align-items: center; }
  .chooser-visual { max-width: 340px; max-height: none; margin: 0 auto; }
  .chooser-pick { max-width: none; margin-inline: auto; width: 100%; }
  .chooser-signature { margin-top: 0; }
}

/* Short laptop screens: keep the whole chooser inside one viewport. */
@media (min-width: 901px) and (max-height: 800px) {
  .chooser { padding-top: 14px; }
  .chooser-stage { padding: 16px 0 14px; }
  .chooser-wordmark { font-size: clamp(2.5rem, 3.6vw + .7rem, 4rem); margin-bottom: 10px; }
  .chooser-select { margin: 16px 0 10px; }
  .chooser-signature { margin-top: 16px; padding-top: 14px; }
  .chooser-visual { max-height: 60svh; }
}

@media (max-width: 600px) {
  .chooser-options { grid-template-columns: 1fr; }
  .chooser-card { min-height: 0; padding: 15px 16px; gap: 12px; }
  .chooser-arrow { top: 15px; inset-inline-end: 15px; }
  .chooser-foot-credit > span { display: none; }
}

@media (max-width: 480px) {
  .topbar-inner { padding: 0 12px; }
  .brand-text strong { font-size: .85rem; }
  .eyebrow { font-size: .66rem; }
  .meta-roles { width: 100%; }
  .role-grid { grid-template-columns: 1fr; }
  .loop-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; }
  .export-card { padding: 16px; gap: 14px; }
  .export-links { width: 100%; }
  .export-links a { flex: 1 1 auto; justify-content: center; }
  .preloader-mark { width: 72px; height: 72px; }
  .preloader-track { width: 116px; }
  .chooser { padding: 14px 16px 0; }
  .chooser-top { padding-bottom: 14px; }
  .chooser-wordmark { font-size: clamp(2.6rem, 13vw, 3.2rem); }
  .chooser-name { font-size: 1.75rem; }
  .chooser-foot-row { justify-content: center; text-align: center; }
}

/* --------------------------------------------------------------- motion + print */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  /* The brand wordmark's sheen is a small, non-translating glint and is kept, at a
     gentler pace, so the landing wordmark keeps its identity for every visitor. */
  .chooser-wordmark, .chooser-name { animation-duration: 5s !important; animation-iteration-count: infinite !important; }
}

@page { margin: 18mm 14mm; }
@media print {
  .topbar, .sidebar, .toc, .page-actions, .pager, .related, .site-footer, .search-modal, .sidebar-overlay, .skip-link { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .article, .breadcrumbs { max-width: none; }
  body { background: #fff; color: #111; font-size: 11pt; }
  .prose { color: #222; }
  .page-head h1 { font-size: 24pt; }
  .prose h2 { page-break-after: avoid; border-top: 0; padding-top: 0; }
  .prose table, .callout, .flow, .code-block { page-break-inside: avoid; }
  a { text-decoration: none; color: #111; }
  .page-head .eyebrow { border: 1px solid #ccc; background: none; color: #333; }
  .page-head .lead { color: #444; }
  .prose a:not(.h-anchor) { color: #0b6b4b; }
}
