/*!
 * مدد — الصفحات القانونية (terms.html — P08، privacy.html — P09)
 * فهرس جانبي ثابت (يصير قائمة قابلة للطي على الشاشات الصغيرة) + مستند مرقّم.
 * الترقيم بعدّادات CSS: القسم المخفي (مثل التجربة إذا مخفية) ما بينحسب، فالأرقام بتضل متسلسلة.
 */

/* ===== شريط الإصدار بالبانر ===== */
.lg-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin: var(--sp-5) 0 0; padding: 0; list-style: none; color: #DFE6F0; font-size: var(--fs-sm); font-weight: 600; }
.lg-meta li { display: inline-flex; align-items: center; gap: .4rem; }
.lg-draft { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .7rem; border-radius: var(--r-pill); border: 1px dashed rgba(255, 255, 255, .55); color: #FFFFFF; font-size: var(--fs-xs); }

/* ===== التخطيط ===== */
.lg__layout { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: clamp(2rem, 1rem + 3vw, 4rem); align-items: start; }
@media (max-width: 1024px) { .lg__layout { grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); } }

/* ===== الفهرس ===== */
.lg-toc { position: sticky; top: calc(var(--jb-header-h) + var(--sp-4)); display: grid; gap: var(--sp-3); max-height: calc(100vh - var(--jb-header-h) - var(--sp-6)); overflow: auto; overscroll-behavior: contain; }
@media (max-width: 1024px) { .lg-toc { position: static; max-height: none; overflow: visible; } }
.lg-toc__box { border-radius: var(--r-lg); border: 1px solid var(--jb-border); background: var(--jb-surface); }
.lg-toc__title { display: flex; align-items: center; gap: var(--sp-2); min-height: 48px; margin: 0; padding: var(--sp-3) var(--sp-4); font-size: 1rem; font-weight: 700; }
.lg-toc__title .bi, .lg-toc__toggle .bi:first-child { color: var(--jb-primary); }
.lg-toc__toggle { display: none; align-items: center; gap: var(--sp-2); width: 100%; min-height: 48px; padding: var(--sp-3) var(--sp-4); border: 0; border-radius: var(--r-lg); background: none; color: var(--jb-text); font-weight: 700; text-align: start; }
.lg-toc__toggle:focus-visible { outline: 3px solid var(--jb-primary); outline-offset: 2px; }
.lg-toc__chev { margin-inline-start: auto; color: var(--jb-text-muted); transition: transform var(--mo-fast) var(--mo-ease); }
.lg-toc__toggle[aria-expanded="true"] .lg-toc__chev { transform: rotate(180deg); }
@media (max-width: 1024px) {
  .lg-toc__title { display: none; }
  .lg-toc__toggle { display: flex; }
  .lg-toc__list[hidden] { display: none; }
}
.lg-toc__list { counter-reset: lgtoc; margin: 0; padding: 0 var(--sp-2) var(--sp-3); list-style: none; border-block-start: 1px solid var(--jb-border); padding-block-start: var(--sp-2); }
.lg-toc__list li { counter-increment: lgtoc; }
.lg-toc__list li[hidden] { display: none; }
.lg-toc__list a { display: flex; gap: .55rem; min-height: 36px; align-items: center; padding: .3rem var(--sp-3); border-radius: var(--r-md); color: var(--jb-text-muted); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; line-height: 1.5; }
.lg-toc__list a::before { content: counter(lgtoc) "."; flex: none; min-width: 1.4em; color: var(--jb-text-muted); font-variant-numeric: tabular-nums; }
.lg-toc__list a:hover { background: var(--jb-surface-2); color: var(--jb-text); }
.lg-toc__list a[aria-current="true"] { background: var(--jb-primary-subtle); color: var(--jb-primary); font-weight: 700; }
.lg-toc__list a[aria-current="true"]::before { color: inherit; }
.lg-print { display: inline-flex; justify-content: center; align-items: center; gap: .45rem; }
@media (max-width: 1024px) { .lg-print { display: none; } }

/* ===== المستند ===== */
.lg-doc { counter-reset: lgsec; min-width: 0; max-width: 780px; }
.lg-summary { margin-block-end: var(--sp-6); padding: var(--sp-5); border-radius: var(--r-lg); background: var(--jb-primary-subtle); border: 1px solid rgba(var(--jb-primary-rgb), .18); }
.lg-summary__title { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-4); font-size: 1.125rem; color: var(--jb-primary); }
.lg-sec { counter-increment: lgsec; padding-block: var(--sp-5); border-block-start: 1px solid var(--jb-border); scroll-margin-top: calc(var(--jb-header-h) + var(--sp-4)); }
.lg-sec[hidden] { display: none; }
.lg-sec:first-of-type { border-block-start: 0; padding-block-start: 0; }
.lg-sec__title { display: flex; align-items: baseline; gap: var(--sp-3); margin: 0 0 var(--sp-3); font-size: clamp(1.2rem, 1.1rem + .4vw, 1.4rem); }
.lg-sec__title::before { content: counter(lgsec); flex: none; display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 .3rem; border-radius: var(--r-md); background: var(--jb-primary-subtle); color: var(--jb-primary); font-size: .95rem; font-variant-numeric: tabular-nums; transform: translateY(-.1em); }
.lg-sec p { margin: 0 0 var(--sp-3); line-height: 1.9; }
.lg-sec p:last-child { margin-block-end: 0; }
.lg-sec a { font-weight: 600; text-underline-offset: 3px; }
.lg-list { display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-3); padding-inline-start: 1.4rem; line-height: 1.9; }
.lg-list:last-child { margin-block-end: 0; }
.lg-list li::marker { color: var(--jb-primary); }

/* ===== الطباعة ===== */
@media print {
  .jb-site-header, .jb-site-footer, .jb-support, .lg-toc, .jb-banner__bg, .jb-crumbs, .lg-draft, .jb-skip-link { display: none !important; }
  .jb-banner { min-height: 0; padding: 0 0 1rem; background: none !important; }
  .jb-banner::after { display: none; }
  .jb-banner__title, .jb-banner__lead, .lg-meta { color: #000 !important; }
  .lg__layout { display: block; }
  .lg-doc { max-width: none; }
  .lg-sec { break-inside: avoid-page; }
  .lg-summary { background: none; border-color: #999; }
}
