/* ==========================================================================
   blog.css — المدونة v2 (posts.php + single-post.php)
   قائمة: مقال مميز + رقائق الأقسام + بحث + شبكة بطاقات + شريط جانبي (الأكثر إعجاباً / الأقسام / CTA)
   مقال: شريط تقدم القراءة + غلاف + نص منسّق + مشاركة/إعجاب + معرض بتكبير + سابق/تالي + مقالات ذات صلة
   يعتمد على متغيرات header.php: --accent --text-primary --text-secondary --text-muted (+ Cairo)
   ========================================================================== */
.bg {
    --bg-r: 20px; --bg-r-sm: 12px;
    --bg-surface: rgba(15, 19, 26, 0.62);
    --bg-surface-2: rgba(255, 255, 255, 0.035);
    --bg-surface-3: rgba(255, 255, 255, 0.07);
    --bg-border: rgba(255, 255, 255, 0.08);
    --bg-border-strong: rgba(255, 255, 255, 0.14);
    --bg-accent: var(--accent, #ffcc00);
    --bg-accent-soft: rgba(255, 204, 0, 0.10);
    --bg-accent-line: rgba(255, 204, 0, 0.38);
    --bg-red: #ef4444; --bg-green: #10b981; --bg-wa: #25D366; --bg-tg: #2AABEE; --bg-fb: #1877F2;
    --bg-text: var(--text-primary, #f8fafc); --bg-text-2: var(--text-secondary, #cbd5e1); --bg-muted: var(--text-muted, #7c8798);
    --bg-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    --bg-header-h: var(--bg-header-d, 80px);
    font-family: 'Cairo', sans-serif; color: var(--bg-text); direction: rtl;
    max-width: 1320px; margin: 0 auto; padding: 18px 20px 80px;
}
.bg *, .bg *::before, .bg *::after { box-sizing: border-box; }
.bg a { text-decoration: none; }
.bg button, .bg input { font-family: inherit; }
.bg [hidden] { display: none !important; }
body.bg-lock { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }

/* ---------- عناصر مشتركة ---------- */
.bg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: var(--bg-r-sm); border: 1px solid transparent; font-size: 13px; font-weight: 800; cursor: pointer; white-space: nowrap; transition: transform .18s, box-shadow .18s, background .18s, border-color .18s, color .18s, filter .18s; background: var(--bg-surface-3); color: var(--bg-text-2); }
.bg-btn:hover { transform: translateY(-1px); }
.bg-btn--primary, .bg a.bg-btn--primary { background: linear-gradient(135deg, var(--bg-accent), #e6b800); color: #111 !important; box-shadow: 0 6px 16px rgba(255, 204, 0, 0.22); }
.bg-btn--primary:hover { filter: brightness(1.06); }
.bg-btn--ghost, .bg a.bg-btn--ghost { background: var(--bg-surface-2); border-color: var(--bg-border-strong); color: var(--bg-text-2); }
.bg-btn--ghost:hover, .bg a.bg-btn--ghost:hover { border-color: var(--bg-accent-line); color: var(--bg-accent); background: var(--bg-accent-soft); }
.bg-btn--sm { height: 36px; padding: 0 12px; font-size: 12px; }
.bg-btn--block { width: 100%; }
.bg-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; background: rgba(8, 11, 17, 0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--bg-accent-line); color: var(--bg-accent); font-size: 12px; font-weight: 800; white-space: nowrap; }
.bg-chip i { font-size: 10px; }
.bg-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--bg-muted); font-weight: 600; }
.bg-meta span { display: inline-flex; align-items: center; gap: 5px; }
.bg-meta i { font-size: 11px; color: var(--bg-accent); }
.bg-meta__like i { color: #f87171; }
.bg-meta--lg { font-size: 13.5px; gap: 16px; }
.bg-meta--lg b { color: #fff; }
.bg-crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--bg-muted); min-width: 0; }
.bg-crumbs a { color: var(--bg-text-2); transition: color .2s; }
.bg-crumbs a:hover { color: var(--bg-accent); }
.bg-crumbs i { font-size: 10px; opacity: .6; }
.bg-crumbs [aria-current] { color: #fff; font-weight: 700; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-section__title { margin: 0 0 14px; font-size: 20px; font-weight: 900; display: flex; align-items: center; gap: 10px; }
.bg-section__title i { color: var(--bg-accent); font-size: 17px; }
.bg-empty { text-align: center; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bg-empty__icon { width: 76px; height: 76px; border-radius: 50%; background: var(--bg-accent-soft); border: 1px solid var(--bg-accent-line); color: var(--bg-accent); display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 8px; }
.bg-empty h2 { margin: 0; font-size: 20px; font-weight: 900; }
.bg-empty p { margin: 0 0 12px; color: var(--bg-muted); font-size: 14px; }

/* ---------- الهيرو (القائمة) ---------- */
.bg-hero { display: flex; flex-direction: column; gap: 14px; }
.bg-hero__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.bg-hero__text h1 { margin: 0 0 6px; font-size: 28px; font-weight: 900; display: flex; align-items: center; gap: 12px; }
.bg-hero__text h1 i { color: var(--bg-accent); font-size: 22px; }
.bg-hero__text p { margin: 0; color: var(--bg-muted); font-size: 14px; max-width: 640px; }
.bg-search { position: relative; max-width: 720px; }
.bg-search__input { width: 100%; height: 52px; border-radius: 999px; border: 1px solid var(--bg-border-strong); background: var(--bg-surface); color: #fff; font-size: 16px !important; font-weight: 600; padding: 0 50px 0 110px; outline: none; -webkit-appearance: none; appearance: none; transition: border-color .2s, box-shadow .2s; }
.bg-search__input::placeholder { color: var(--bg-muted); font-weight: 500; }
.bg-search__input:focus { border-color: var(--bg-accent-line); box-shadow: 0 0 0 4px var(--bg-accent-soft); }
.bg-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.bg-search__icon { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 20px; color: var(--bg-muted); font-size: 15px; pointer-events: none; }
.bg-search:focus-within .bg-search__icon { color: var(--bg-accent); }
.bg-search__clear { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 92px; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-surface-3); color: var(--bg-text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.bg-search__clear:hover { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.bg-search__go { position: absolute; top: 6px; bottom: 6px; inset-inline-end: 6px; padding: 0 20px; border-radius: 999px; border: none; background: linear-gradient(135deg, var(--bg-accent), #e6b800); color: #111; font-size: 13px; font-weight: 900; cursor: pointer; }

/* رقائق الأقسام */
.bg-cats { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; margin-top: 14px; }
.bg-cats::-webkit-scrollbar { display: none; }
.bg-cat { flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--bg-border-strong); background: var(--bg-surface-2); color: var(--bg-text-2); font-size: 13px; font-weight: 700; white-space: nowrap; transition: background .18s, color .18s, border-color .18s; }
.bg-cat i { font-size: 12px; opacity: .8; }
.bg-cat span { font-size: 11px; font-weight: 800; background: rgba(255, 255, 255, 0.08); border-radius: 999px; padding: 1px 8px; }
.bg-cat:hover { border-color: var(--bg-accent-line); color: var(--bg-accent); background: var(--bg-accent-soft); }
.bg-cat.is-active { background: var(--bg-accent); border-color: var(--bg-accent); color: #111; box-shadow: 0 6px 16px rgba(255, 204, 0, 0.25); }
.bg-cat.is-active span { background: rgba(0, 0, 0, 0.16); }

/* المقال المميز */
.bg-feat { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); margin-top: 18px; background: var(--bg-surface); border: 1px solid var(--bg-accent-line); border-radius: var(--bg-r); overflow: hidden; color: inherit; transition: transform .25s, box-shadow .25s; }
.bg-feat:hover { transform: translateY(-3px); box-shadow: var(--bg-shadow); }
.bg-feat__media { position: relative; min-height: 360px; overflow: hidden; background: radial-gradient(110% 80% at 50% 0%, rgba(255, 204, 0, 0.09), transparent 60%), linear-gradient(180deg, rgba(22, 27, 36, 0.9), rgba(12, 16, 23, 0.95)); }
.bg-feat__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.bg-feat:hover .bg-feat__media img { transform: scale(1.04); }
.bg-feat__badge { position: absolute; top: 14px; inset-inline-start: 14px; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: linear-gradient(135deg, var(--bg-accent), #e6b800); color: #111; font-size: 12px; font-weight: 900; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.bg-feat__body { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 30px 32px; }
.bg-feat__title { margin: 0; font-size: 26px; font-weight: 900; line-height: 1.4; color: #fff; }
.bg-feat__excerpt { margin: 0; color: var(--bg-text-2); font-size: 14.5px; line-height: 1.85; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bg-feat__cta { align-self: flex-start; margin-top: 4px; }

/* التخطيط: المحتوى + الشريط الجانبي */
.bg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; margin-top: 22px; }
.bg-main { min-width: 0; }
.bg-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 0 4px 12px; }
.bg-toolbar__info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--bg-muted); }
.bg-toolbar__info b { color: var(--bg-accent); font-weight: 900; font-size: 15px; }
.bg-toolbar__page { color: var(--bg-muted); }
.bg-achip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--bg-accent-soft); border: 1px solid var(--bg-accent-line); color: var(--bg-accent); font-size: 12px; font-weight: 700; }
.bg-achip i { font-size: 10px; }
.bg-achip:hover { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.bg-toolbar__reset { font-size: 12.5px; font-weight: 700; color: var(--bg-muted); display: inline-flex; align-items: center; gap: 6px; }
.bg-toolbar__reset:hover { color: var(--bg-accent); }

/* شبكة البطاقات */
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.bg-card { display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--bg-border); border-radius: var(--bg-r); overflow: hidden; transition: transform .25s cubic-bezier(.2, .8, .2, 1), border-color .25s, box-shadow .25s; }
.bg-card:hover { transform: translateY(-4px); border-color: var(--bg-border-strong); box-shadow: var(--bg-shadow); }
.bg-card__media { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: linear-gradient(180deg, rgba(22, 27, 36, 0.9), rgba(12, 16, 23, 0.95)); }
.bg-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.bg-card:hover .bg-card__media img { transform: scale(1.06); }
.bg-card__noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; color: rgba(255, 255, 255, 0.12); }
.bg-card__cat { position: absolute; top: 10px; inset-inline-start: 10px; }
.bg-card__body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.bg-card__title { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bg-card__title a { color: #fff; transition: color .2s; }
.bg-card__title a:hover { color: var(--bg-accent); }
.bg-card__excerpt { margin: 0; font-size: 13px; color: var(--bg-muted); line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bg-card__foot { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--bg-border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bg-card__more { color: var(--bg-accent); font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.bg-card__more i { font-size: 11px; transition: transform .2s; }
.bg-card:hover .bg-card__more i { transform: translateX(-4px); }
.bg-card__edit { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--bg-muted); background: var(--bg-surface-2); border: 1px solid var(--bg-border); font-size: 12px; }
.bg-card__edit:hover { color: var(--bg-accent); border-color: var(--bg-accent-line); }
.bg-card--compact .bg-card__media { aspect-ratio: 16 / 9; }
.bg-card--compact .bg-card__title { font-size: 15px; }

/* الترقيم */
.bg-pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 22px; }
.bg-page { min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--bg-border-strong); background: var(--bg-surface-2); color: var(--bg-text-2); font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; transition: background .18s, color .18s, border-color .18s; }
.bg-page:hover { border-color: var(--bg-accent-line); color: var(--bg-accent); }
.bg-page.is-active { background: var(--bg-accent); border-color: var(--bg-accent); color: #111; }
.bg-page.is-disabled { opacity: .35; pointer-events: none; }
.bg-page--gap { border: none; background: transparent; color: var(--bg-muted); }

/* الشريط الجانبي */
.bg-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--bg-header-h) + 16px); }
.bg-widget { background: var(--bg-surface); border: 1px solid var(--bg-border); border-radius: var(--bg-r); padding: 16px; }
.bg-widget__title { margin: 0 0 12px; font-size: 15px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.bg-widget__title i { color: var(--bg-accent); font-size: 13px; }
.bg-poplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bg-pop { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; color: inherit; transition: background .18s; }
.bg-pop:hover { background: var(--bg-surface-3); }
.bg-pop__n { width: 22px; height: 22px; border-radius: 7px; background: var(--bg-accent); color: #111; font-size: 11px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bg-pop img, .bg-pop__noimg { width: 52px; height: 42px; border-radius: 9px; object-fit: cover; flex-shrink: 0; background: var(--bg-surface-3); }
.bg-pop__noimg { display: inline-flex; align-items: center; justify-content: center; color: var(--bg-muted); }
.bg-pop__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bg-pop__text b { font-size: 13px; font-weight: 800; color: #fff; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bg-pop__text small { font-size: 11px; color: var(--bg-muted); }
.bg-pop__text small i { color: #f87171; font-size: 10px; }
.bg-catlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bg-catlist a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 10px; color: var(--bg-text-2); font-size: 13px; font-weight: 700; border: 1px solid transparent; transition: background .18s, color .18s, border-color .18s; }
.bg-catlist a:hover { background: var(--bg-surface-3); color: #fff; }
.bg-catlist a.is-active { background: var(--bg-accent-soft); border-color: var(--bg-accent-line); color: var(--bg-accent); }
.bg-catlist b { font-size: 11px; font-weight: 800; color: var(--bg-muted); background: rgba(255, 255, 255, 0.07); border-radius: 999px; padding: 1px 8px; }
.bg-widget--cta { text-align: center; background: linear-gradient(135deg, rgba(255, 204, 0, 0.14), rgba(15, 19, 26, 0.7) 60%); border-color: var(--bg-accent-line); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bg-widget--cta > i { font-size: 26px; color: var(--bg-accent); margin-bottom: 4px; }
.bg-widget--cta h3 { margin: 0; font-size: 17px; font-weight: 900; }
.bg-widget--cta p { margin: 0 0 6px; font-size: 13px; color: var(--bg-text-2); line-height: 1.7; }

/* ==========================================================================
   صفحة المقال
   ========================================================================== */
.bg--article { max-width: 1180px; }
.bg-progress { position: fixed; top: var(--bg-header-h); left: 0; right: 0; height: 3px; z-index: 1500; background: transparent; pointer-events: none; }
.bg-progress span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #e6b800, var(--bg-accent)); transform-origin: right center; transform: scaleX(0); transition: transform .1s linear; box-shadow: 0 0 10px rgba(255, 204, 0, 0.5); }
.bg-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.bg-post__head { max-width: 860px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.bg-post__head .bg-chip { background: var(--bg-accent-soft); }
.bg-post__title { margin: 0; font-size: clamp(24px, 3vw, 38px); font-weight: 900; line-height: 1.4; color: #fff; }
.bg-post__cover { position: relative; margin: 0 0 24px; border-radius: var(--bg-r); overflow: hidden; border: 1px solid var(--bg-border); background: var(--bg-surface); box-shadow: var(--bg-shadow); }
.bg-post__cover img { width: 100%; max-height: 520px; object-fit: cover; display: block; cursor: zoom-in; }
.bg-zoom { position: absolute; bottom: 14px; inset-inline-start: 14px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(8, 11, 17, 0.72); backdrop-filter: blur(8px); color: #fff; cursor: zoom-in; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.bg-post__layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
.bg-post__main { min-width: 0; }
.bg-post__side { position: sticky; top: calc(var(--bg-header-h) + 16px); display: flex; flex-direction: column; gap: 14px; }
.bg-sidecard { background: var(--bg-surface); border: 1px solid var(--bg-border); border-radius: var(--bg-r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bg-sidecard--accent { border-color: var(--bg-accent-line); background: linear-gradient(135deg, rgba(255, 204, 0, 0.12), rgba(15, 19, 26, 0.7) 60%); }
.bg-sidecard__title { font-size: 14px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.bg-sidecard__title i { color: var(--bg-accent); font-size: 12px; }
.bg-sidecard__text { margin: 0; font-size: 12.5px; color: var(--bg-text-2); line-height: 1.7; }

/* نص المقال */
.bg-prose { font-size: 17px; line-height: 2; color: var(--bg-text-2); max-width: 780px; }
.bg-prose p { margin: 0 0 18px; }
.bg-prose h2, .bg-prose h3, .bg-prose h4 { color: #fff; font-weight: 900; line-height: 1.5; margin: 28px 0 12px; }
.bg-prose h2 { font-size: 24px; } .bg-prose h3 { font-size: 20px; padding-inline-start: 12px; border-inline-start: 3px solid var(--bg-accent); } .bg-prose h4 { font-size: 17px; }
.bg-prose ul, .bg-prose ol { margin: 0 0 18px; padding-inline-start: 26px; }
.bg-prose li { margin-bottom: 6px; }
.bg-prose ul li::marker { color: var(--bg-accent); }
.bg-prose a { color: var(--bg-accent); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.bg-prose img { max-width: 100%; height: auto; border-radius: 14px; margin: 8px 0 18px; display: block; }
.bg-prose blockquote { margin: 0 0 18px; padding: 14px 18px; border-inline-start: 4px solid var(--bg-accent); background: var(--bg-accent-soft); border-radius: 0 12px 12px 0; color: #fff; }
.bg-prose table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14px; }
.bg-prose td, .bg-prose th { border: 1px solid var(--bg-border-strong); padding: 8px 10px; }
.bg-prose th { background: var(--bg-surface-3); color: #fff; }
.bg-prose iframe { max-width: 100%; border-radius: 14px; border: 0; }
.bg-prose hr { border: 0; border-top: 1px dashed var(--bg-border-strong); margin: 22px 0; }
.bg-prose strong, .bg-prose b { color: #fff; }
.bg-prose__empty { color: var(--bg-muted); }

/* أزرار المنتجات المذكورة */
.bg-cta { margin: 26px 0; padding: 18px 20px; border-radius: var(--bg-r); background: linear-gradient(135deg, rgba(255, 204, 0, 0.12), rgba(15, 19, 26, 0.7) 60%); border: 1px solid var(--bg-accent-line); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.bg-cta__text { display: flex; flex-direction: column; gap: 2px; }
.bg-cta__text b { font-size: 15px; color: #fff; }
.bg-cta__text i { color: var(--bg-accent); margin-inline-end: 6px; }
.bg-cta__text span { font-size: 12.5px; color: var(--bg-text-2); }
.bg-cta__btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* المعرض */
.bg-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 26px; }
.bg-gallery__item { margin: 0; background: var(--bg-surface); border: 1px solid var(--bg-border); border-radius: 16px; overflow: hidden; }
.bg-gallery__btn { position: relative; display: block; width: 100%; padding: 0; border: 0; background: rgba(0, 0, 0, 0.25); cursor: zoom-in; aspect-ratio: 4 / 3; }
.bg-gallery__btn img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.bg-gallery__btn:hover img { transform: scale(1.05); }
.bg-gallery__zoom { position: absolute; bottom: 10px; inset-inline-start: 10px; width: 34px; height: 34px; border-radius: 50%; background: rgba(8, 11, 17, 0.72); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; opacity: 0; transition: opacity .2s; }
.bg-gallery__btn:hover .bg-gallery__zoom { opacity: 1; }
.bg-gallery__item figcaption { padding: 10px 12px; font-size: 12.5px; color: var(--bg-text-2); border-top: 1px solid var(--bg-border); }

/* المشاركة والإعجاب */
.bg-share { margin-top: 10px; padding: 16px 18px; border-radius: var(--bg-r); background: var(--bg-surface); border: 1px solid var(--bg-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bg-share__label { font-size: 13.5px; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; }
.bg-share__label i { color: var(--bg-accent); }
.bg-share__btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bg-share__btns--col { flex-direction: column; align-items: stretch; }
.bg-share__btns--col .bg-sbtn { width: 100%; justify-content: flex-start; padding: 0 14px; }
.bg-sbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--bg-border-strong); background: var(--bg-surface-2); color: var(--bg-text-2); font-size: 13px; font-weight: 700; cursor: pointer; transition: background .18s, color .18s, border-color .18s, transform .18s; }
.bg-sbtn:hover { transform: translateY(-1px); color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.bg-sbtn i { font-size: 16px; }
.bg-sbtn--wa { color: var(--bg-wa); border-color: rgba(37, 211, 102, 0.35); } .bg-sbtn--wa:hover { background: rgba(37, 211, 102, 0.15); color: var(--bg-wa); }
.bg-sbtn--tg { color: var(--bg-tg); border-color: rgba(42, 171, 238, 0.35); } .bg-sbtn--tg:hover { background: rgba(42, 171, 238, 0.15); color: var(--bg-tg); }
.bg-sbtn--fb { color: #60a5fa; border-color: rgba(24, 119, 242, 0.4); } .bg-sbtn--fb:hover { background: rgba(24, 119, 242, 0.15); color: #60a5fa; }
.bg-like { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.1); color: #fca5a5; font-size: 13px; font-weight: 800; cursor: pointer; transition: background .18s, transform .18s; }
.bg-like i { font-size: 15px; transition: transform .2s; }
.bg-like:hover { background: rgba(239, 68, 68, 0.2); transform: translateY(-1px); }
.bg-like:hover i { transform: scale(1.15); }
.bg-like b { background: rgba(0, 0, 0, 0.25); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.bg-like.is-liked { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; border-color: transparent; cursor: default; }
.bg-like.is-liked i { animation: bgPop .4s ease; }
.bg-like.is-busy { opacity: .7; pointer-events: none; }
.bg-like--block { width: 100%; height: 44px; }
@keyframes bgPop { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* السابق/التالي */
.bg-postnav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px; }
.bg-postnav__item { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 16px; background: var(--bg-surface); border: 1px solid var(--bg-border); color: inherit; transition: border-color .2s, transform .2s; min-width: 0; }
.bg-postnav__item:hover { border-color: var(--bg-accent-line); transform: translateY(-2px); }
.bg-postnav__item small { font-size: 12px; color: var(--bg-muted); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.bg-postnav__item small i { color: var(--bg-accent); }
.bg-postnav__item b { font-size: 14px; color: #fff; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bg-postnav__item--prev { text-align: end; align-items: flex-end; }
.bg-postnav__item.is-empty { visibility: hidden; }

/* مقالات ذات صلة */
.bg-related { margin-top: 34px; }
.bg-related__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bg-related__all { color: var(--bg-accent); font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.bg-grid--related { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* تكبير الصور */
.bg-lightbox { position: fixed; inset: 0; z-index: 99999; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; background: rgba(5, 7, 11, 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; transition: opacity .22s; touch-action: none; overscroll-behavior: contain; }
.bg-lightbox.is-open { opacity: 1; }
.bg-lightbox img { max-width: min(94vw, 1100px); max-height: 82vh; border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); object-fit: contain; }
.bg-lightbox__caption { color: var(--bg-text-2); font-size: 14px; text-align: center; max-width: 800px; }
.bg-lightbox__close { position: absolute; top: 18px; inset-inline-start: 22px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 20px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

/* التوست */
.bg-toast { position: fixed; bottom: 96px; left: 50%; transform: translate(-50%, 12px); z-index: 99998; padding: 11px 18px; border-radius: 12px; background: rgba(15, 19, 26, 0.96); border: 1px solid rgba(16, 185, 129, 0.5); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); opacity: 0; visibility: hidden; transition: opacity .25s, transform .25s, visibility .25s; max-width: calc(100vw - 32px); }
.bg-toast i { color: var(--bg-green); margin-inline-end: 4px; }
.bg-toast.is-show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.bg-toast.is-error { border-color: rgba(239, 68, 68, 0.5); }
.bg-toast.is-error i { color: var(--bg-red); }

/* ==========================================================================
   الاستجابة
   ========================================================================== */
@media (max-width: 991px) {
    .bg-layout { grid-template-columns: 1fr; }
    .bg-side { position: static; display: grid; grid-template-columns: 1fr 1fr; }
    .bg-widget--cta { grid-column: 1 / -1; }
    .bg-post__layout { grid-template-columns: 1fr; }
    .bg-post__side { position: static; display: grid; grid-template-columns: 1fr 1fr; }
    .bg-post__side .bg-sidecard:first-child, .bg-post__side .bg-sidecard--accent { display: none; } /* المشاركة وأزرار المنتجات موجودة داخل المقال */
    .bg-post__side { grid-template-columns: 1fr; }
    .bg-feat { grid-template-columns: 1fr; }
    .bg-feat__media { min-height: 0; aspect-ratio: 16 / 9; }
}
@media (max-width: 768px) {
    .bg { --bg-header-h: var(--bg-header-m, 75px); padding: 12px 12px 90px; }
    .bg-hero__text h1 { font-size: 22px; }
    .bg-hero__text p { font-size: 13px; }
    .bg-search__input { height: 46px; padding: 0 46px 0 46px; }
    .bg-search__go { display: none; }
    .bg-search__clear { inset-inline-end: 10px; }
    .bg-cats { margin-top: 10px; }
    .bg-cat { height: 34px; padding: 0 12px; font-size: 12.5px; }
    .bg-feat { margin-top: 14px; }
    .bg-feat__body { padding: 16px; gap: 8px; }
    .bg-feat__title { font-size: 19px; }
    .bg-feat__excerpt { font-size: 13.5px; -webkit-line-clamp: 3; }
    .bg-layout { margin-top: 16px; gap: 16px; }
    .bg-grid { grid-template-columns: 1fr; gap: 12px; }
    .bg-card__media { aspect-ratio: 16 / 9; }
    .bg-side { grid-template-columns: 1fr; }
    .bg-topbar { margin-bottom: 12px; }
    .bg-crumbs [aria-current] { max-width: 160px; }
    .bg-post__title { font-size: 22px; }
    .bg-meta--lg { font-size: 12px; gap: 10px; }
    .bg-post__cover { margin-bottom: 16px; border-radius: 16px; }
    .bg-post__cover img { max-height: 320px; }
    .bg-prose { font-size: 15.5px; line-height: 1.95; }
    .bg-prose h2 { font-size: 20px; } .bg-prose h3 { font-size: 17px; }
    .bg-post__side { grid-template-columns: 1fr; }
    .bg-cta { padding: 14px; }
    .bg-cta__btns { width: 100%; }
    .bg-cta__btns .bg-btn { flex: 1; }
    .bg-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .bg-share { padding: 14px; }
    .bg-share__btns { width: 100%; }
    .bg-like { flex: 1; }
    .bg-postnav { grid-template-columns: 1fr; }
    .bg-postnav__item.is-empty { display: none; }
    .bg-grid--related { grid-template-columns: 1fr; }
    .bg-toast { bottom: 96px; }
}
@media (prefers-reduced-motion: reduce) {
    .bg *, .bg *::before, .bg *::after { transition: none !important; animation: none !important; }
}
