/*
 * صفحات البحث: ألوان Engage Decks وخطّه (src/styles/theme.css). داكنٌ افتراضاً مثل
 * التطبيق، وفاتحٌ بزرّ الوضع (data-theme على <html>، يضبطه سكربت الرأس من `engage.theme`).
 * والعربية من اليمين إلى اليسار بخصائص منطقية (inline-start/end) لا يمين ويسار.
 */
:root {
  --deep: #0a0a0c;
  --surface: #16161b;
  --elevated: #232329;
  --hairline: #33333d;
  --ink: #ffffff;
  --muted: #a8a8b4;
  --faint: #6e6e7c;
  --brand: #e82a72;
  --brand-ink: #ff4d8f;
  --brand-soft: rgb(232 42 114 / 0.14);
  --ok: #2ed3a7;
  --shadow: 0 30px 60px -30px rgb(0 0 0 / 0.6);
  --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --deep: #f8f8fa;
  --surface: #ffffff;
  --elevated: #f0f0f3;
  --hairline: #e0e0e6;
  --ink: #16161b;
  --muted: #55555f;
  --faint: #8a8a96;
  --brand-ink: #c4185c;
  --brand-soft: rgb(232 42 114 / 0.08);
  --ok: #12855f;
  --shadow: 0 24px 50px -28px rgb(22 22 27 / 0.25);
  color-scheme: light;
}
:root[lang='ar'] { --font: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: radial-gradient(1100px 520px at 80% -8%, var(--brand-soft), transparent 60%), var(--deep);
  color: var(--ink);
  font: 17px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; }
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 3px; border-radius: 6px; }

/* الترويسة */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--deep) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--hairline); }
.top-in { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; flex: none; margin-inline-end: auto; }
.logo img { height: 28px; width: auto; }
.logo-light { display: none; }
:root[data-theme='light'] .logo-dark { display: none; }
:root[data-theme='light'] .logo-light { display: block; }
.top nav { display: flex; gap: 20px; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); }
.tools { display: flex; align-items: center; gap: 8px; }
.tool { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding-inline: 10px; border-radius: 999px; border: 1px solid var(--hairline); background: transparent; color: var(--muted); font: 500 14px var(--font); text-decoration: none; cursor: pointer; }
.tool:hover { color: var(--ink); border-color: var(--brand); }
.tool.lang span { font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', sans-serif; }
#theme-btn { width: 38px; justify-content: center; padding: 0; }
.i-sun { display: none; }
:root[data-theme='light'] .i-sun { display: inline-flex; }
:root[data-theme='light'] .i-moon { display: none; }
.i-moon, .i-sun { display: inline-flex; }
:root:not([data-theme='light']) .i-sun { display: none; }

.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; box-shadow: 0 12px 28px -14px var(--brand); transition: transform 0.15s; }
.btn:hover { transform: translateY(-1px); }
.btn.small { padding: 8px 16px; font-size: 15px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--hairline); box-shadow: none; }

/* البطل: نصٌّ وصورة على الشاشة الواسعة، والصورة تحت النصّ على الجوال */
.hero { padding-block: 64px 40px; }
.hero.with-art { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: center; }
.hero-text { max-width: 760px; }
.hero-art { margin: 0; }
.hero-art img, .hero-art video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: #0a0a0c; border-radius: 24px; border: 1px solid var(--hairline); box-shadow: var(--shadow); }
.crumbs { margin: 0 0 12px; font-size: 14px; color: var(--faint); display: flex; gap: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.eyebrow { margin: 0 0 12px; color: var(--brand-ink); font-weight: 600; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 4.6vw, 52px); line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
.lede { margin: 20px 0 0; font-size: 19px; color: var(--muted); }
.meta { margin: 18px 0 0; color: var(--faint); font-size: 15px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.fine { margin: 12px 0 0; color: var(--faint); font-size: 14px; }
:root[lang='ar'] h1, :root[lang='ar'] .eyebrow { letter-spacing: 0; line-height: 1.35; }
:root[lang='ar'] body { line-height: 1.85; }

/* المتن */
.body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; padding-bottom: 80px; }
/* minmax(0,1fr): جدول المقارنة (min-width 620) كان يمدّ العمود كلّه على الجوال، فيخرج المتن وبطاقة الكاتب عن الشاشة؛ الجدول يتمرّر في إطاره وحده */
.body > section, .body > .callout, .prose { max-width: 820px; }
.body h2 { margin: 0 0 14px; font-size: clamp(26px, 3.2vw, 34px); line-height: 1.25; letter-spacing: -0.01em; text-wrap: balance; }
:root[lang='ar'] .body h2 { letter-spacing: 0; line-height: 1.4; }
.body h3 { margin: 0 0 6px; font-size: 20px; }
.body p { margin: 0 0 14px; }
.body ul, .body ol { margin: 0 0 14px; padding-inline-start: 22px; }
.body li { margin-bottom: 6px; }

figure { margin: 0; max-width: 100% !important; }
figure img { display: block; border-radius: 16px; border: 1px solid var(--hairline); box-shadow: var(--shadow); }
figcaption { margin-top: 10px; color: var(--faint); font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; max-width: 100% !important; }
.cards:has(> .card:nth-child(4):last-child) { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px; padding: 22px; }
.card p { color: var(--muted); margin: 0; font-size: 16px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: 16px; background: var(--surface); max-width: 100% !important; }
table { width: 100%; border-collapse: collapse; min-width: 620px; font-size: 16px; }
th, td { text-align: start; vertical-align: top; padding: 14px 16px; border-bottom: 1px solid var(--hairline); }
th { font-size: 14px; color: var(--muted); background: var(--elevated); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; width: 28%; }
td.us { color: var(--ink); }
.yes { color: var(--ok); font-weight: 700; }
.note { color: var(--faint); font-size: 14px; margin-top: 10px; }

.callout { border-inline-start: 3px solid var(--brand); background: var(--brand-soft); padding: 16px 20px; border-start-end-radius: 14px; border-end-end-radius: 14px; }
.callout p:last-child { margin: 0; }

.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps > li { counter-increment: s; position: relative; padding-inline-start: 46px; margin-bottom: 18px; }
.steps > li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
:root[lang='ar'] .steps > li::before { content: counter(s, arabic-indic); }

/* الأسئلة الشائعة */
.faq details { border-bottom: 1px solid var(--hairline); padding: 16px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 18px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::after { content: '+'; color: var(--brand-ink); font-size: 22px; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq summary::-webkit-details-marker { display: none; }
.faq details div { color: var(--muted); padding-top: 10px; }

.cta-end { text-align: center; background: linear-gradient(135deg, var(--brand-soft), transparent), var(--surface); border: 1px solid var(--hairline); border-radius: 24px; padding: 48px 24px; max-width: 100% !important; }
.cta-end p { color: var(--muted); max-width: 560px; margin-inline: auto !important; }

.post-list { list-style: none; padding: 0 !important; display: grid; gap: 12px; }
.post-list a { display: grid; gap: 4px; padding: 20px; border: 1px solid var(--hairline); border-radius: 16px; background: var(--surface); text-decoration: none; color: var(--ink); }
.post-list span { color: var(--muted); font-size: 16px; }
.post-list a:has(.post-thumb) { grid-template-columns: 200px 1fr; column-gap: 20px; align-items: start; align-content: start; }
.post-list .post-thumb { grid-row: span 2; width: 200px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; }
@media (max-width: 560px) { .post-list a:has(.post-thumb) { grid-template-columns: 112px 1fr; column-gap: 14px; } .post-list .post-thumb { width: 112px; } }

/* التذييل */
.foot { border-top: 1px solid var(--hairline); padding-block: 40px; color: var(--muted); font-size: 15px; }
.foot-in { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; }
.foot-title { color: var(--ink); font-weight: 600; margin: 0 0 8px; }
.foot p { margin: 0 0 10px; }
.foot ul { list-style: none; padding: 0; margin: 0; columns: 2; }
.foot li { margin-bottom: 6px; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* الشاشات المتوسطة: الصورة تحت النصّ */
@media (max-width: 900px) {
  .hero.with-art { grid-template-columns: 1fr; gap: 28px; }
}

/* الجوال */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .top nav { display: none; }
  .top-in { gap: 10px; min-width: 0; }
  .logo { min-width: 0; flex: 0 1 auto; }
  .logo img { height: 18px; max-width: 100%; }
  .top .btn.small { display: none; }
  .tools { gap: 6px; }
  .tool.lang span { display: none; }
  .tool.lang { width: 38px; justify-content: center; padding: 0; }
  .btn.small { padding: 8px 12px; font-size: 14px; }
  .hero { padding-block: 36px 24px; }
  .lede { font-size: 17px; }
  .body { gap: 44px; }
  .foot-in { grid-template-columns: 1fr; }
  .foot ul { columns: 1; }
}
@media (max-width: 560px) { .cards:has(> .card:nth-child(4):last-child) { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* معرض الديمو: صورتان في السطر على الشاشة الواسعة، وواحدة على الجوال */
.gallery-wrap { max-width: 100% !important; }
.gallery-wrap > p { color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 8px; }
@media (max-width: 760px) { .gallery { grid-template-columns: 1fr; } }

/* الكاتب: سطره تحت العنوان، وصندوقه بعد المتن، وشارة التوثيق (١٣ أكتوبر ٢٠٢٦) */
.badge { display: inline-block; vertical-align: -0.2em; }
.meta .byline { color: inherit; font-weight: 700; text-decoration: none; }
.meta .byline:hover { text-decoration: underline; }
.author-box { margin: 40px 0 8px; padding: 22px 24px; border: 1px solid var(--hairline); border-radius: 18px; background: var(--surface); }
.author-box .eyebrow { margin: 0 0 6px; }
.author-name { margin: 0; font-size: 1.15rem; font-weight: 700; }
.author-name a { color: inherit; text-decoration: none; }
.author-role { margin: 2px 0 0; color: var(--muted); font-size: 0.95rem; }
.author-bio { margin: 10px 0 0; line-height: 1.8; }
.author-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 12px 0 0; }
.author-links a { font-weight: 700; color: var(--brand-ink, var(--brand)); }
.author-links a.partner { padding: 6px 14px; border-radius: 999px; background: var(--brand); color: #fff; text-decoration: none; }
.author-note { margin: 8px 0 0; font-size: 0.82rem; color: var(--muted); }
/* «هل حمّسك مقالي للاشتراك؟» و«اشترك الآن» إلى الباقات برمز الكاتب (طلب المالكة ١٣ أكتوبر) */
.author-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.author-cta p { margin: 0; font-weight: 700; font-size: 1.05rem; }

/* بطاقة الكاتب (١٣ أكتوبر ٢٠٢٦): عرضيةٌ بعرض المقال (طلب المالكة: «مستطيلة أكثر»)، الصورة بحروف
   الاسم في جانب والنصّ بجانبها، وشريط «اشترك الآن» في أسفلها */
.author-card {
  max-width: 820px;
  margin: 48px 0 8px;
  border-radius: 22px;
  border: 1px solid transparent;
  background:
    radial-gradient(30rem 10rem at 0% 0%, rgb(232 42 114 / 0.14), transparent 70%) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(120deg, rgb(232 42 114 / 0.75), var(--hairline) 40%, rgb(232 42 114 / 0.35)) border-box;
  overflow: hidden;
}
.ac-main { display: flex; align-items: flex-start; gap: 20px; padding: 24px 26px 20px; }
.ac-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff4d8f, #e82a72 55%, #a3124d);
  color: #fff;
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 28px -10px rgb(232 42 114 / 0.6), 0 0 0 4px var(--surface), 0 0 0 5px rgb(232 42 114 / 0.4);
}
.ac-text { min-width: 0; text-align: start; }
.ac-label { margin: 0 0 2px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; color: var(--brand-ink); }
.ac-name { margin: 0; font-size: 1.3rem; font-weight: 700; }
.ac-name a { color: inherit; text-decoration: none; }
.ac-name a:hover { text-decoration: underline; }
.ac-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.ac-dot { opacity: 0.6; }
.ac-bio { margin: 10px 0 0; line-height: 1.8; }
.ac-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 12px 0 0; }
.ac-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--hairline); color: var(--muted); transition: 0.2s; }
.ac-icon:hover { color: #fff; background: #0a66c2; border-color: #0a66c2; }
.ac-more { font-weight: 700; font-size: 0.92rem; color: var(--brand-ink); text-decoration: none; }
.ac-more:hover { text-decoration: underline; }
.author-card .author-cta {
  justify-content: space-between;
  margin: 0;
  padding: 14px 26px;
  border-top: 1px solid var(--hairline);
  background: rgb(232 42 114 / 0.08);
}
@media (max-width: 560px) {
  .ac-main { gap: 14px; padding: 20px 18px 16px; }
  .ac-avatar { width: 52px; height: 52px; font-size: 1.1rem; }
  .author-card .author-cta { padding: 14px 18px; }
}

/* غلاف المقال: صورةٌ جمالية بعرض المتن تحت العنوان */
/* داخل عمود المقال نفسه: يبدأ وينتهي حيث يبدأ النصّ وينتهي، في العربية والإنجليزية */
.body > .post-cover { margin: 0; max-width: 820px !important; }
.post-cover img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 22px; border: 1px solid var(--hairline); box-shadow: 0 30px 60px -30px rgb(232 42 114 / 0.35); }
.ac-icon.ac-chat:hover { background: var(--brand); border-color: var(--brand); }
.ac-icon + .ac-icon { margin-inline-start: -6px; }
