@font-face { font-family: Almarai; src: url(fonts/Almarai-Regular.ttf); font-weight: 400; }
@font-face { font-family: Almarai; src: url(fonts/Almarai-Bold.ttf); font-weight: 700; }
@font-face { font-family: ReemKufi; src: url(fonts/ReemKufi-wght.ttf); font-weight: 400 700; }
/* ألوان لوحة رَقيم وخطها: Segoe UI على Windows، وAlmarai المشحون بدله على الهاتف. العناوين الرئيسية بـAlmarai،
   واسم «رَقيم» وحده بخط الشعار Reem Kufi. */
:root { --bg:#F4F5F9; --ink:#1B2236; --muted:#6E768A; --navy:#141C2E; --gold:#E0A458; --gold-ink:#9A6420; --gold-bg:#FFF7EC;
        --sand:#CDD2DE; --line:#E7E9F0; --soft:#F0F1F5; --card:#FFFFFF; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Segoe UI", Tahoma, Almarai, sans-serif; font-size: 16px; line-height: 1.8; }
a { color: inherit; text-decoration: none; }
h1, h2, .h { font-family: Almarai, "Segoe UI", sans-serif; font-weight: 700; }

/* الشريط العلوي */
header.site { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); height: 68px;
              display: flex; align-items: center; gap: 30px; padding: 0 48px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-family: ReemKufi, Almarai, sans-serif; font-size: 30px; color: var(--navy); line-height: 1; }
.brand span { border: 1.5px solid var(--gold); color: var(--gold-ink); border-radius: 4px; padding: 0 8px; font-size: 14px; }
header nav { display: flex; gap: 24px; color: var(--muted); font-size: 15px; }
header nav a:hover, header nav a.on { color: var(--ink); }
header nav a.on { font-weight: 700; }
.sp { flex: 1; }
.btn { background: var(--navy); color: #fff; border-radius: 8px; padding: 9px 18px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.menu { display: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; }
.mini { position: relative; width: 300px; }
.mini input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 14px; background: var(--bg); }

/* البحث: النتائج تحت المربع */
.results { position: absolute; inset-inline: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px;
           box-shadow: 0 12px 30px rgba(20,28,46,.18); text-align: start; overflow: hidden; display: none; z-index: 40; color: var(--ink); }
.results.on { display: block; }
.results a { display: block; padding: 10px 16px; border-bottom: 1px solid var(--soft); }
.results a:hover, .results a.sel { background: var(--gold-bg); }
.results b { display: block; font-size: 15px; }
.results small { color: var(--muted); font-size: 13px; line-height: 1.6; display: block; }
.results .none { padding: 12px 16px; color: var(--muted); font-size: 14px; }
mark { background: #F6E7D2; color: inherit; border-radius: 2px; }

/* الرئيسية */
.hero { background: var(--navy); color: #fff; text-align: center; padding: 56px 16px 64px; }
.hero h1 { margin: 0; font-size: 42px; line-height: 1.4; }
.hero p { margin: 6px 0 26px; color: var(--sand); font-size: 16px; }
.search { position: relative; width: min(720px, 100%); margin: 0 auto; }
.search input { width: 100%; height: 58px; border: 0; border-radius: 12px; padding: 0 52px 0 20px; font: inherit; font-size: 16px;
                box-shadow: 0 8px 24px rgba(0,0,0,.25); }
[dir=ltr] .search input { padding: 0 20px 0 52px; }
.search svg { position: absolute; top: 18px; inset-inline-start: 18px; width: 22px; height: 22px; color: var(--navy); pointer-events: none; }
.tags { margin-top: 16px; color: var(--sand); font-size: 13px; }
.tags button { background: rgba(255,255,255,.1); border: 0; border-radius: 14px; padding: 3px 12px; margin: 0 3px 6px; color: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.wrap { width: min(1180px, 100% - 32px); margin: 0 auto; padding: 40px 0 10px; }
h2.sec { font-size: 26px; margin: 0 0 18px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.cat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; gap: 16px; align-items: flex-start; transition: border-color .15s, box-shadow .15s; }
a.cat:hover { border-color: var(--gold); box-shadow: 0 6px 18px rgba(20,28,46,.06); }
.ic { width: 52px; height: 52px; border-radius: 12px; background: var(--gold-bg); color: var(--gold-ink); display: flex; align-items: center; justify-content: center; flex: none; }
.ic svg { width: 28px; height: 28px; }
.cat b { font-size: 17px; }
.cat p { margin: 2px 0 6px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.cat small { color: var(--gold-ink); font-weight: 700; }
.list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px 26px; }
.list a { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--soft); }
.list a:hover span { color: var(--gold-ink); }
.list i { color: var(--muted); font-style: normal; white-space: nowrap; font-size: 14px; }
.list .soon { padding: 14px 0; border-bottom: 1px solid var(--soft); color: var(--muted); }
.downloads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.cta { margin: 34px 0 30px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px 30px; display: flex; align-items: center; gap: 20px; }
.cta h3 { margin: 0; font-family: Almarai, sans-serif; font-size: 21px; }
.cta p { margin: 0; color: var(--muted); }
footer.site { background: var(--navy); color: var(--sand); padding: 22px 48px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13px; }

/* المقال: قائمة القسم، ثم المقال، ثم محتوياته */
.art { display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px; gap: 32px; width: min(1280px, 100% - 32px); margin: 0 auto; padding: 30px 0 40px; }
.side { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14px; align-self: start; position: sticky; top: 88px;
        max-height: calc(100vh - 110px); overflow-y: auto; }
.side h4 { margin: 6px 8px 6px; font-size: 13px; color: var(--muted); }
.side a { display: block; padding: 7px 10px; border-radius: 8px; line-height: 1.6; }
.side a:hover { background: var(--bg); }
.side a.on { background: var(--gold-bg); color: var(--gold-ink); font-weight: 700; }
.side .grp { margin-top: 8px; border-top: 1px solid var(--soft); padding-top: 6px; }
.side .soon { display: block; padding: 6px 10px; color: var(--muted); font-size: 13px; }
article.doc { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px 36px 34px; min-width: 0; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
article.doc .crumb a { color: var(--muted); text-decoration: none; }
article.doc .crumb a:hover { color: var(--gold-ink); }
article.doc h1 { font-size: 32px; line-height: 1.45; margin: 0; }
.meta { color: var(--muted); font-size: 13px; margin: 6px 0 14px; }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 8px; }
article.doc h2 { font-size: 23px; line-height: 1.5; margin: 30px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--soft); }
article.doc h3 { font-size: 17px; margin: 20px 0 4px; }
.num { color: var(--gold-ink); margin-inline-end: 10px; font-size: .85em; }
article.doc p, article.doc li { margin: 0 0 12px; }
article.doc ul { padding-inline-start: 22px; }
article.doc a { color: var(--gold-ink); text-decoration: underline; text-underline-offset: 3px; }
.toc { font-size: 13px; align-self: start; position: sticky; top: 88px; }
.toc h4 { margin: 0 0 8px; color: var(--muted); }
.toc a { display: block; padding: 5px 12px; border-inline-start: 2px solid var(--line); line-height: 1.6; }
.toc a.l3 { padding-inline-start: 24px; font-size: 12.5px; }
.toc a.active { border-color: var(--gold); color: var(--gold-ink); font-weight: 700; }
figure { margin: 18px 0 22px; }
figure img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; background: var(--card); }
figure .crop { position: relative; display: block; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
figure .crop img { position: absolute; max-width: none; border: 0; border-radius: 0; }
figure > a { display: block; }
figure.phone > a { max-width: 360px; margin-inline: auto; }
figure.phone figcaption { text-align: center; }
figcaption { color: var(--muted); font-size: 14px; line-height: 1.7; margin-top: 6px; }
.note { background: var(--gold-bg); border-inline-start: 4px solid var(--gold); border-radius: 8px; padding: 10px 16px; margin: 16px 0; font-size: 15px; }
.code { font-family: Consolas, "Courier New", monospace; font-size: 14px; background: var(--soft); border-radius: 4px; padding: 0 5px; unicode-bidi: isolate; direction: ltr; }
.table { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: start; padding: 8px 12px; border: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg); }
.next { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; border-top: 1px solid var(--soft); padding-top: 16px; font-size: 14px; }
.next a { color: var(--ink) !important; text-decoration: none !important; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; max-width: 48%; }
.next a small { display: block; color: var(--muted); }
.scrim { display: none; }

@media (max-width: 1100px) {
  .art { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  header.site { padding: 0 16px; gap: 12px; height: 58px; }
  header nav, .mini, header .btn { display: none; }
  .menu { display: block; }
  .brand b { font-size: 25px; }
  html { scroll-padding-top: 70px; }
  .hero { padding: 30px 16px 36px; }
  .hero h1 { font-size: 28px; }
  .search input { height: 50px; font-size: 15px; }
  .search svg { top: 14px; }
  .grid, .downloads, .list { grid-template-columns: 1fr; }
  .list { padding: 4px 18px; }
  .wrap { padding: 24px 0 6px; }
  h2.sec { font-size: 22px; }
  .cta { flex-wrap: wrap; padding: 20px; }
  footer.site { padding: 18px 16px; }
  .art { display: block; padding: 16px 0 30px; }
  article.doc { padding: 20px 18px 24px; border-radius: 12px; }
  article.doc h1 { font-size: 25px; }
  article.doc h2 { font-size: 20px; }
  .side { position: fixed; z-index: 30; top: 0; bottom: 0; inset-inline-start: 0; width: min(86vw, 320px); max-height: none; border-radius: 0;
          transform: translateX(100%); transition: transform .2s ease; }
  [dir=ltr] .side { transform: translateX(-100%); }
  body.open .side { transform: none; }
  body.open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(20,28,46,.45); }
}
