/* =========================
المنصة الخاصة بمدونتي: الفيث الشامي
   ========================= */
@font-face {
  font-family: "Mizan AR+LT";
  src: url("../fonts/mizan-ar-lt-regular.woff2") format("woff2"),
       url("../fonts/mizan-ar-lt-regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;

}
@font-face {
  font-family: "Mizan AR+LT";
  src: url("../fonts/mizan-ar-lt-medium.woff2") format("woff2"),
       url("../fonts/mizan-ar-lt-medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mizan AR+LT";
  src: url("../fonts/mizan-ar-lt-semibold.woff2") format("woff2"),
       url("../fonts/mizan-ar-lt-semibold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mizan AR+LT";
  src: url("../fonts/mizan-ar-lt-bold.woff2") format("woff2"),
       url("../fonts/mizan-ar-lt-bold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --motion-dur: .7s;
  --motion-dur-stagger: .6s;
  --motion-ease: cubic-bezier(.22,1,.36,1);

  --bg: #ececec;
  --card: #ffffff;
  --muted: #0a0a0a;
  --text: #1c1c1c;
  --soft: #f6f6f6;
  --soft-2: #f1f1f1;

  --panel: rgba(255, 255, 255, .65);

  --nav-pill: #dfe7e7;
  --nav-pill-active: #cfe0e0;
  --nav-icon-bg: #dfe7e7;

  --sidebar-bg: #f5f5f5;
  --sidecard-bg: #efefef;
  --chip-bg: #f2f2f2;
  --chip-border: rgba(0, 0, 0, .08);

  --accent: #8bb7b2;
  --shadow: 0 18px 30px rgba(0, 0, 0, .10);
  --shadow-2: 0 10px 18px rgba(0, 0, 0, .08);

  --radius: 18px;
  --radius2: 14px;
}

/* =========================
   Dark Theme
   ========================= */
/* سرعات الحركة من لوحة التحكم */
html[data-motion-speed="fast"]{
  --motion-dur: .5s;
  --motion-dur-stagger: .45s;
}
html[data-motion-speed="slow"]{
  --motion-dur: .95s;
  --motion-dur-stagger: .85s;
}

html[data-theme="dark"] {
  --bg: #0f1115;
  --card: #141820;
  --text: #f3f4f6;
  --muted: #a8b0ba;

  --panel: rgba(20, 24, 32, .72);

  --soft: #161a20;
  --soft-2: #12161d;

  --nav-pill: #1a2228;
  --nav-pill-active: #223038;
  --nav-icon-bg: #1a2228;

  --sidebar-bg: #141820;
  --sidecard-bg: #12161d;

  --chip-bg: #1a2228;
  --chip-border: rgba(255, 255, 255, .14);

  --shadow: 0 18px 34px rgba(0, 0, 0, .40);
  --shadow-2: 0 12px 22px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Mizan AR+LT", "Tajawal", "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 19px;
  /* أكبر قليلاً */
  font-weight: 500;
  /* أوضح */
  line-height: 1.65;
}

.page {
  min-height: 100%;
  padding: 28px 18px 44px;
  display: flex;
  justify-content: center;
}

.shell {
  width: min(1100px, 100%);
}

/* =========================
   TOP BAR (مصلّح: الشعار يمين / القائمة يسار)
   ========================= */
.topbar {
  direction: rtl;
  /* ✅ هذا هو المهم */
  flex-direction: row;
  /* ✅ لا تستخدم row-reverse هنا */
  background: var(--panel);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  position: relative;
  background: var(--brand-mark-bg, #2a2a2a);
  color: var(--brand-mark-fg, #fff);
  font-weight: 800;
  font-size: 14px;
  overflow: hidden;
}

.brand__logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


.brand__logo-img {
  height: 50px;
  width: auto;
  max-width: 280px;
  object-fit: contain;
  display: block;
}
html[data-theme="dark"] .brand__mark {
  background: #eaeaea;
  color: #111;
}

.brand__title {
  font-weight: 900;
  font-size: 28px;
  line-height: 1.15;
  /* ✅ أكبر */
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
  /* داخل nav */
  flex-direction: row;
  /* ✅ بالـ RTL سيبدأ من اليمين تلقائيًا */
}

.nav__chip {
  text-decoration: none;
  color: var(--text);
  background: var(--nav-pill);
  border: 1px solid rgba(0, 0, 0, .06);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  /* ✅ أكبر */
  font-weight: 800;
  /* ✅ أوضح */
}

html[data-theme="dark"] .nav__chip {
  border-color: rgba(255, 255, 255, .12);
}

.nav__chip.is-active {
  background: var(--nav-pill-active);
}

.nav__icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .08);
  background: var(--nav-icon-bg);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
}

html[data-theme="dark"] .nav__icon {
  border-color: rgba(255, 255, 255, .12);
}

.nav__icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.nav__link {
  text-decoration: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
}

/* =========================
   Theme Switch (Day/Night)
   ========================= */

/* =========================
   Font Awesome (Local) Compatibility
   =========================
   Font Awesome 7 sets a default fixed width for all icons (1.25em).
   Your UI was tuned on older behavior where icons did not force a width.
   This keeps the exact same look/spacing and prevents mis-positioning in
   absolutely-positioned icons (e.g., theme switch thumb).
*/
.fa, .fa-solid, .fa-regular, .fa-brands, .fa-classic, .fab, .far, .fas{
  --fa-width: auto;
}
.theme-switch{
  width: 72px;
  height: 36px;            /* ✅ نفس ارتفاع nav__icon */
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: var(--nav-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  box-shadow: var(--shadow-2);
  transition: background .28s var(--motion-ease), border-color .28s var(--motion-ease), box-shadow .28s var(--motion-ease), transform .15s ease;
}

.theme-switch:active{ transform: scale(.98); }

.theme-switch:focus-visible{
  outline: 2px solid rgba(139,183,178,.65);
  outline-offset: 2px;
}

/* Night (aria-pressed=true) */
.theme-switch[aria-pressed="true"]{
  border-color: rgba(255,255,255,.14);
  background: var(--nav-pill);
}

/* Thumb */
.theme-switch__thumb{
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;

  /* Day mode: thumb dark على اليمين + أيقونة شمس بيضاء */
  background: #141820;
  color: #ffffff;

  /* على اليمين (day) */
  transform: translateX(36px);

  box-shadow: 0 10px 18px rgba(0,0,0,.22);
  transition: transform .32s var(--motion-ease), background .28s var(--motion-ease), color .28s var(--motion-ease), box-shadow .28s var(--motion-ease);
}

/* Night mode: thumb أبيض على اليسار + أيقونة قمر سوداء */
.theme-switch[aria-pressed="true"] .theme-switch__thumb{
  background: #ffffff;
  color: #111827;
  transform: translateX(0);
  box-shadow: 0 10px 18px rgba(0,0,0,.45);
}

/* Icons inside thumb */
.theme-switch__thumb-ico{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 14px;
  line-height: 1;
  color: currentColor; /* ✅ يعكس اللون تلقائيًا حسب لون الـthumb */
  transition: opacity .22s ease, transform .28s var(--motion-ease);
}

.theme-switch__thumb-ico--sun{
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.theme-switch__thumb-ico--moon{
  opacity: 0;
  transform: rotate(-35deg) scale(.65);
}

/* Night: أظهر القمر وأخفِ الشمس */
.theme-switch[aria-pressed="true"] .theme-switch__thumb-ico--sun{
  opacity: 0;
  transform: rotate(35deg) scale(.65);
}

.theme-switch[aria-pressed="true"] .theme-switch__thumb-ico--moon{
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* احترام تعطيل الحركة */
html[data-motion="0"] .theme-switch,
html[data-motion="0"] .theme-switch__thumb,
html[data-motion="0"] .theme-switch__thumb-ico{
  transition: none !important;
}

@media (prefers-reduced-motion: reduce){
  .theme-switch, .theme-switch__thumb, .theme-switch__thumb-ico{
    transition: none !important;
  }
}



/* =========================
   MAIN CARD
   ========================= */
.card {
  margin-top: 18px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

/* =========================
   HERO (قديم - لو بقيت تستخدمه)
   ========================= */
.hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #0e2b3b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.hero__img {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
}

.hero__title {
  margin: 0;
  color: #fff;
  font-weight: 900;
  font-size: clamp(24px, 3.2vw, 44px);
}

.hero__subtitle {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .88);
  font-size: 15px;
}

/* =========================
   CONTENT
   ========================= */
.content {
  margin-top: 18px;
  direction: rtl;
}

.content__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 10px;
}

.content__title {
  margin: 0;
  font-size: 19px;
  /* أكبر */
  font-weight: 900;
  color: var(--text);
}

.content__title--right {
  text-align: right;
}

/* =========================
   LAYOUT
   ========================= */
.layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: start;
}

/* بدون سايد بار (الصفحة الرئيسية) */
.layout--single {
  grid-template-columns: 1fr;
}

/* =========================
   POSTS
   ========================= */
.posts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stack {
  background: var(--soft);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}

html[data-theme="dark"] .stack {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.post {
  background: var(--soft-2);
  border-radius: var(--radius2);
  padding: 16px 14px;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}

html[data-theme="dark"] .post {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.post+.post {
  margin-top: 12px;
}

.post--split {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  text-align: right;
}

.post__icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: var(--panel);
  padding: 10px;
  box-shadow: 0 10px 14px rgba(0, 0, 0, .06);
  margin: 0 auto 10px;
}

.post--split .post__icon {
  margin: 0;
  justify-self: center;
}

.post__title {
  margin: 0;
  font-weight: 900;
  font-size: 18px;
  color: var(--text);
}

.post__desc {
  margin: 8px 0 0;
  font-size: 13px;
  /* أوضح */
  line-height: 1.75;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 10px 14px rgba(0, 0, 0, .10);
  border: none;
}

.btn:hover {
  filter: brightness(.98);
}

.btn:active {
  transform: translateY(1px);
}

/* =========================
   SIDEBAR
   ========================= */
.sidebar {
  background: var(--sidebar-bg);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}

html[data-theme="dark"] .sidebar {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.sidecard {
  background: var(--sidecard-bg);
  border-radius: var(--radius);
  padding: 14px;
}

.thumbs {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.thumb {
  width: 86px;
  height: 118px;
  border-radius: 12px;
  box-shadow: 0 14px 22px rgba(0, 0, 0, .12);
  background: var(--panel);
}

.sidecard__title {
  margin: 6px 0 10px;
  font-weight: 900;
  color: var(--text);
  font-size: 17px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

/* نفس شكل التصنيفات لكن خارج السايد بار */
.chips--inline {
  justify-content: flex-end;
  margin: 0 0 16px;
  padding: 0 6px;
}

.chip {
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

.chip.is-active {
  background: var(--nav-pill);
}

.subscribe {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--text);
  padding: 8px 6px;
  border-radius: 12px;
  font-weight: 900;
}

.subscribe:hover {
  background: rgba(0, 0, 0, .04);
}

html[data-theme="dark"] .subscribe:hover {
  background: rgba(255, 255, 255, .06);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: .55;
}

/* =========================
   PROFILE SECTION (بديل استكشاف الوجود)
   ========================= */
.profile-hero {
  background: rgba(255, 255, 255, .55);
  border-radius: 16px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
  overflow: hidden;
  margin-bottom: 18px;
}

html[data-theme="dark"] .profile-hero {
  background: rgba(20, 24, 32, .55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* ✅ تساوي العمودين */
  gap: 18px;
  align-items: stretch;
  /* ✅ خلي العمودين نفس الارتفاع */
  direction: ltr;
  /* الصورة يسار والنص يمين */
}

.profile-content {
  direction: rtl;
}

.profile-photo {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #f1f1f1;
  box-shadow: var(--shadow-2);

  

  display: flex;
  flex-direction: column;

  min-height: 0;
  /* ✅ إزالة الحد الأدنى اللي كان يكبّر الصورة */
  height: 100%;
  /* ✅ يطابق ارتفاع النص */
  animation: none;
  will-change: transform;
}

.profile-photo.is-visible {
  /* ✅ إيقاف حركة الصورة (بدون تحريك لأعلى/أسفل) */
  animation: none;
}


.profile-photo__img{
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.profile-nameplate{
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 3;

  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;

  direction: rtl;

  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 18px;
  box-shadow: 0 14px 32px rgba(0,0,0,.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html[data-theme="dark"] .profile-nameplate{
  background: rgba(15, 17, 21, .68);
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 14px 32px rgba(0,0,0,.38);
}

.profile-nameplate--overlay{
  /* placeholder class for clarity */
}

.profile-nameplate__bolt{
  font-size: 16px;
  opacity: .9;
}

.profile-name{
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 900;
  font-size: 18px;
  line-height: 1.35;
  color: var(--text);
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
  flex: 1 1 auto;
}

.profile-name.tw::after{
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-inline-start: 8px;
  background: currentColor;
  border-radius: 1px;
  opacity: .85;
  transform: translateY(2px);
  animation: tw-caret 1s steps(1,end) infinite;
}

@keyframes tw-caret{
  0%,49%{ opacity: 1; }
  50%,100%{ opacity: 0; }
}

.profile-photo__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* تملأ بدون تشويه */
  object-position: center;
  display: block;
  filter: grayscale(1) contrast(1.05);
  transform: scale(1.02);
}

.profile-badge {
  position: absolute;
  inset-inline-start: 14px;
  inset-block-end: 14px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 14px 22px rgba(0, 0, 0, .12);
}

html[data-theme="dark"] .profile-badge {
  background: rgba(15, 17, 21, .72);
  border-color: rgba(255, 255, 255, .14);
}

.spark {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .05);
}

.profile-content h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 44px);
  font-weight: 900;
  color: var(--text);
}

.profile-sub {
  margin: 10px 0 0;
  color: #0a0a0a;
  line-height: 1.9;
  font-size: 19px;
}

/* Dark mode: keep profile subtitle readable */
html[data-theme="dark"] .profile-sub {
  color: var(--muted);
}

.rank {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .03);
  border: 1px solid rgba(0, 0, 0, .06);
}

html[data-theme="dark"] .rank {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .10);
}

.rank__label {
  font-weight: 900;
}

.rank__value {
  color: var(--text);
}

.profile-points {
  margin: 14px 0 0;
  padding: 0 18px 0 0;
  color: var(--text);
  line-height: 2;
}


/* Highlight sweep (RTL) */
.hl-sweep{
  --hl: rgba(255, 214, 0, .55);
  display: inline;
  padding: .03em .14em;
  border-radius: .22em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;

  background-image: linear-gradient(var(--hl), var(--hl));
  background-repeat: no-repeat;
  background-size: 0% 0.9em;            /* البداية: صفر */
  background-position: right 80%;       /* من اليمين إلى اليسار */
}

.hl-sweep.hl-run{
  animation: hl-sweep-bg 1.2s ease forwards;
}

@keyframes hl-sweep-bg{
  from{ background-size: 0% 0.9em; }
  to{ background-size: 100% 0.9em; }
}

html[data-theme="dark"] .hl-sweep{
  --hl: rgba(255, 214, 0, .42);
}

/* لو الحركة مطفّاة من لوحة التحكم: نعرضه ثابت بدل ما يختفي */
html[data-motion="0"] .hl-sweep{
  background-size: 100% 0.9em;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce){
  .hl-sweep{
    background-size: 100% 0.9em;
    animation: none !important;
  }
}

.hl-sweep.hl-run{
  animation: hl-sweep-bg 1.15s ease forwards;
  animation-delay: .15s;
}

@keyframes hl-sweep-bg{
  from{ background-size: 0% .85em; }
  to{ background-size: 100% .85em; }
}

/* لو الحركة مطفّاة من لوحة التحكم: نعرضه ثابت بدل ما يختفي */
html[data-motion="0"] .hl-sweep:not(.hl-run){
  background-size: 100% .85em;
}

@media (prefers-reduced-motion: reduce){
  .hl-sweep{
    background-size: 100% .85em;
    animation: none !important;
  }
}

.profile-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn--dark {
  background: #1f1f1f;
  border: 1px solid rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .btn--dark {
  background: #eaeaea;
  color: #111;
  border-color: rgba(255, 255, 255, .16);
}

.btn--light {
  background: rgba(255, 255, 255, .75);
  color: #1f1f1f;
  border: 1px solid rgba(0, 0, 0, .12);
}

html[data-theme="dark"] .btn--light {
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  border-color: rgba(255, 255, 255, .14);
}

/* =========================
   3 BOOKS + MORE BUTTON
   ========================= */
.thumbs--books {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.thumb--book {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  box-shadow: 0 14px 22px rgba(0, 0, 0, .12);
  background: var(--panel);
  object-fit: cover;
  display: block;
}

.more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  text-decoration: none;
  border: 1px solid rgba(0, 0, 0, .12);
  background: var(--panel);
  font-weight: 900;
  color: var(--text);
  transition: transform .15s ease, background .15s ease;
  margin-bottom: 14px;
}

html[data-theme="dark"] .more-btn {
  border-color: rgba(255, 255, 255, .14);
}

.more-btn:hover {
  background: rgba(255, 255, 255, .85);
}

html[data-theme="dark"] .more-btn:hover {
  background: rgba(255, 255, 255, .10);
}

.more-btn:active {
  transform: translateY(1px);
}

/* =========================
   REVEAL ANIMATION (Scroll)
   ========================= */
[data-reveal].reveal {
  opacity: 0;
  transform: translate3d(0,14px,0);
  transition: opacity var(--motion-dur) var(--motion-ease), transform var(--motion-dur) var(--motion-ease);
  will-change: opacity, transform;
}

[data-reveal].reveal.is-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* اتجاهات خاصة */
[data-reveal="left"].reveal {
  transform: translate3d(-36px,0,0) scale(.985);
}

[data-reveal="right"].reveal {
  transform: translate3d(36px,0,0);
}

[data-reveal="left"].reveal.is-visible,
[data-reveal="right"].reveal.is-visible{
  transform: none;
}

/* تدرّج دخول عناصر التعريف (داخل profile-content فقط) */
.profile-content[data-hero-stagger] > * {
  opacity: 0;
  transform: translate3d(0,10px,0);
  transition: opacity var(--motion-dur-stagger) var(--motion-ease), transform var(--motion-dur-stagger) var(--motion-ease);
  will-change: opacity, transform;
}

.profile-content[data-hero-stagger].is-visible > * {
  opacity: 1;
  transform: none;
  will-change: auto;
}

/* delays */
.profile-content[data-hero-stagger] > *:nth-child(1){ transition-delay: .10s; }
.profile-content[data-hero-stagger] > *:nth-child(2){ transition-delay: .18s; }
.profile-content[data-hero-stagger] > *:nth-child(3){ transition-delay: .26s; }
.profile-content[data-hero-stagger] > *:nth-child(4){ transition-delay: .34s; }
.profile-content[data-hero-stagger] > *:nth-child(5){ transition-delay: .42s; }

@keyframes floaty {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }

  100% {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {

  .profile-photo,
  .profile-photo.is-visible {
    animation: none;
  }

  [data-reveal].reveal {
    transition: none;
  }

  .profile-content[data-hero-stagger] > * {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .content__head {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .content__title--right {
    text-align: right;
    width: 100%;
  }

  .profile-grid {
    grid-template-columns: 1fr;
    direction: rtl;
  }

  .profile-photo {
    min-height: 260px;
  }
}

@media (max-width: 680px) {
  .posts {
    grid-template-columns: 1fr;
  }

  .hero__img {
    height: 210px;
  }

  .brand__title {
    font-size: 24px;
  }

  

  .brand__logo-img {
    height: 40px;
    max-width: 220px;
  }
/* على الهاتف: اجعل القائمة تحت اسم الموقع وليس بجانبه */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .brand {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .brand__text {
    text-align: center;
  }

  .nav {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .brand__logo-img {
    height: 34px;
    max-width: 180px;
  }
}


/* =========================
   Reviews Grid (مقالات/مراجعات بشكل الصورة)
   ========================= */
.reviews {
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}

html[data-theme="dark"] .reviews {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.reviews__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 4px 14px;
}

.reviews__title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0;
}

.reviews__more {
  text-decoration: none;
  font-weight: 900;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .10);
  background: rgba(255, 255, 255, .55);
  color: var(--text);
}

html[data-theme="dark"] .reviews__more {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
}

.reviews__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* بطاقة */
.review-card {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 14px 24px rgba(0, 0, 0, .08);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

html[data-theme="dark"] .review-card {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .10);
  box-shadow: 0 18px 28px rgba(0, 0, 0, .35);
}

.review-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 28px rgba(0, 0, 0, .12);
}

.review-card__link {
  display: grid;
  grid-template-columns: 190px 1fr;
  /* غلاف يسار + نص يمين */
  gap: 12px;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.review-card__media {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-card__media img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 14px 22px rgba(0, 0, 0, .12);
  background: #fff;
}

.review-card__body {
  padding: 16px 12px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  direction: rtl;
}

.review-card__title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.55;
}

.review-card__desc {
  margin: 0;
  color: #4c4c4c;
  font-size: 16px;
  line-height: 1.8;

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Dark mode: review excerpt should not be too dark */
html[data-theme="dark"] .review-card__desc {
  color: var(--muted);
}

.review-card__date {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 800;
}

/* Responsive */
@media (max-width: 900px) {
  .reviews__grid {
    grid-template-columns: 1fr;
  }

  .review-card__link {
    grid-template-columns: 150px 1fr;
  }

  .review-card__media img {
    height: 210px;
  }
}

@media (max-width: 520px) {
  .review-card__link {
    grid-template-columns: 1fr;
  }

  .review-card__media {
    padding: 12px 12px 0;
  }

  .review-card__media img {
    /* على الهاتف: غلاف كتاب (طولي) بدون قصّ */
    height: auto;
    object-fit: contain;
  }

  .review-card__body {
    padding: 14px;
  }
}

/* =========================
   Latest Articles (شكل الصورة)
   ========================= */
.latest {
  margin-top: 18px;
  padding: 8px 4px 4px;
}

.latest__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

/* عندما تكون خانة البحث موجودة: العنوان يمين / البحث يسار */
.latest__head--with-search,
.reviews__head--with-search{
  justify-content: space-between;
  align-items: center;
}

.latest__title {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
}

.latest__more {
  text-decoration: none;
  font-weight: 900;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .10);
  background: rgba(255, 255, 255, .55);
  color: var(--text);
}

html[data-theme="dark"] .latest__more {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
}

/* =========================
   Page Search (AJAX dropdown)
   ========================= */
.page-search{
  position: relative;

  /* أقصر + ثابت */
  flex: 0 0 240px;
  width: 240px;
  max-width: 240px;

  /* طبقة مستقلة (أوضح فوق الخلفية) */
  --ps-bg: rgba(255, 255, 255, .88);
  --ps-border: rgba(0, 0, 0, .12);
  --ps-divider: rgba(0, 0, 0, .06);
  --ps-hover: rgba(0, 0, 0, .045);

  /* ظل للـ input نفسه (إحساس طبقة) */
  --ps-shadow-input: 0 12px 22px rgba(0, 0, 0, .12);

  /* ظل لوحة النتائج */
  --ps-shadow-panel: 0 18px 34px rgba(0, 0, 0, .18);
}


html[data-theme="dark"] .page-search{
  --ps-bg: rgba(20, 24, 32, .78);
  --ps-border: rgba(255, 255, 255, .14);
  --ps-divider: rgba(255, 255, 255, .08);
  --ps-hover: rgba(255, 255, 255, .06);
  --ps-shadow-input: 0 16px 26px rgba(0, 0, 0, .55);
  --ps-shadow-panel: 0 22px 38px rgba(0, 0, 0, .55);
}


.page-search__input{
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--ps-border);
  background: var(--ps-bg);
  color: var(--text);
  padding: 11px 42px 11px 16px;
  font-size: 14.8px;
  font-weight: 800;
  outline: none;
  backdrop-filter: blur(8px);

  /* ✅ إحساس طبقة منفصلة */
  box-shadow: var(--ps-shadow-input);

  /* ✅ ضمان ظهور الأيقونة فوق الـ input */
  position: relative;
  z-index: 1;

  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}


.page-search__input::placeholder{
  color: rgba(0, 0, 0, .45);
}

html[data-theme="dark"] .page-search__input::placeholder{
  color: rgba(255, 255, 255, .55);
}

.page-search__input:focus{
  border-color: rgba(139, 183, 178, .60);
  box-shadow:
    0 0 0 4px rgba(139, 183, 178, .18),
    var(--ps-shadow-input);
}


html[data-theme="dark"] .page-search__input:focus{
  border-color: rgba(139, 183, 178, .55);
  box-shadow:
    0 0 0 4px rgba(139, 183, 178, .16),
    var(--ps-shadow-input);
}


.page-search__icon{
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);

  /* ✅ ثابتة ولا تختفي */
  opacity: .85;
  color: rgba(0, 0, 0, .55);

  pointer-events: none;
  transition: opacity .18s ease, color .18s ease;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;

  /* ✅ فوق الـ input دائمًا */
  z-index: 2;
}


html[data-theme="dark"] .page-search__icon{
  color: rgba(255, 255, 255, .72);
}

.page-search__icon svg{
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.page-search.is-open .page-search__icon,
.page-search:focus-within .page-search__icon{
  opacity: 1;
  color: rgba(139, 183, 178, .95);
}


.page-search__panel{
  position: absolute;
  left: 0;
  /* right: 0; */
  top: calc(100% + 10px);
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--ps-border);
  box-shadow: var(--ps-shadow-panel);
  overflow: hidden;
  z-index: 60;
  backdrop-filter: blur(10px);
}

.page-search__panel:not([hidden]){
  animation: psDrop .18s var(--motion-ease) both;
  transform-origin: 50% 0%;
}

@keyframes psDrop{
  from{ opacity: 0; transform: translateY(-6px) scale(.985); }
  to{ opacity: 1; transform: translateY(0) scale(1); }
}

.page-search__list{
  max-height: min(460px, 60vh);
  overflow: auto;
  overscroll-behavior: contain;
}

.page-search__group-title{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.6px;
  font-weight: 900;
  padding: 11px 14px;
  opacity: .86;
  border-top: 1px solid var(--ps-divider);
  background: rgba(255, 255, 255, .20);
}

html[data-theme="dark"] .page-search__group-title{
  background: rgba(0, 0, 0, .12);
}

.page-search__group-title:first-child{
  border-top: 0;
}

.page-search__item{
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  text-decoration: none;
  color: var(--text);
  border-top: 1px solid var(--ps-divider);
}

.page-search__group-title + .page-search__item{
  border-top: 0;
}

.page-search__item:hover{
  background: var(--ps-hover);
}

.page-search__item:focus-visible{
  outline: 2px solid rgba(139, 183, 178, .60);
  outline-offset: -2px;
  background: var(--ps-hover);
}

.page-search__thumb{
  width: 46px;
  height: 46px;
  border-radius: 16px;
  object-fit: cover;
  background: rgba(0, 0, 0, .06);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  flex: 0 0 auto;
}

html[data-theme="dark"] .page-search__thumb{
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.page-search__text{
  min-width: 0;
  flex: 1 1 auto;
}

.page-search__row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.page-search__title{
  font-weight: 900;
  font-size: 14.8px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-search__badge{
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(139, 183, 178, .16);
  border: 1px solid rgba(139, 183, 178, .32);
  color: var(--text);
}

html[data-theme="dark"] .page-search__badge{
  background: rgba(139, 183, 178, .14);
  border-color: rgba(139, 183, 178, .28);
}

.page-search__meta{
  margin-top: 3px;
  font-size: 12.6px;
  opacity: .74;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-search__empty{
  padding: 14px 14px;
  font-size: 13.5px;
  opacity: .78;
}

@media (max-width: 780px){
  .latest__head--with-search,
  .reviews__head--with-search{
    flex-wrap: wrap;
    align-items: flex-end;
  }
  .page-search{
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
  }
}



/* شبكة 4 أعمدة مثل الصورة */
/* ملاحظة: تم تعطيل content-visibility هنا لأنه كان يسبب تأخيرًا ملحوظًا في ظهور صور الـ lazy-loading لدى بعض المتصفحات */

.latest__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 18px;
}

/* الصفحة الرئيسية: اعرض 8 مقالات فقط */
.latest__grid>.article-card:nth-child(n+9) {
  display: none;
}

/* البطاقة */
.article-card {
  border-radius: 18px;
  position: relative;
}

.article-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.article-card__media {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 14px 26px rgba(0, 0, 0, .12);
  height: 150px;
  /* ارتفاع مشابه للصورة */
}

html[data-theme="dark"] .article-card__media {
  background: rgba(255, 255, 255, .06);
  box-shadow: 0 18px 28px rgba(0, 0, 0, .40);
}

.article-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  transition: transform .25s ease;
}

.article-card__tag {
  position: absolute;
  inset-inline-end: 12px;
  inset-block-end: 12px;
  background: rgba(255, 255, 255, .88);
  color: #1c1c1c;
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 900;
  font-size: 13px;
  border: 1px solid rgba(0, 0, 0, .08);
  text-decoration: none;
  z-index: 3;
}

html[data-theme="dark"] .article-card__tag {
  background: rgba(15, 17, 21, .72);
  color: var(--text);
  border-color: rgba(255, 255, 255, .14);
}

.article-card__title {
  margin: 12px 2px 0;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.6;
  text-align: center;
}

.article-card__date {
  display: block;
  margin-top: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
}

/* Stretched Link (لمخرجات AJAX + صفحات التصنيفات) */
.article-card__stretched{
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 18px;
  z-index: 2;
}

.article-card__stretched:focus-visible{
  outline: 2px solid rgba(139, 183, 178, .65);
  outline-offset: 3px;
}

/* Hover */
.article-card:hover .article-card__media img {
  transform: scale(1.06);
}

.article-card:focus-within .article-card__media img{
  transform: scale(1.06);
}

/* Responsive */

/* =========================
   Pubbooks – compact featured card
   ========================= */
.pubbook-feature__link{
  padding: 18px 22px;
  gap: 20px;
  min-height: 220px;
}

.pubbook-feature__body{
  padding: 6px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "badge badge"
    "title title"
    "subtitle subtitle"
    "desc desc"
    "meta cta";
  column-gap: 14px;
  row-gap: 8px;
  align-items: start;
}

.pubbook-feature__badge{ grid-area: badge; justify-self: start; }
.pubbook-feature__title{ grid-area: title; font-size: 30px; line-height: 1.35; margin-top: 0; }
.pubbook-feature__subtitle{ grid-area: subtitle; font-size: 15.5px; line-height: 1.75; }
.pubbook-feature__desc{
  grid-area: desc;
  font-size: 14.6px;
  line-height: 1.9;
  -webkit-line-clamp: 2;
  max-width: 64ch;
}

.pubbook-feature__meta{
  grid-area: meta;
  margin-top: 0;
  gap: 10px;
}

.pubbook-feature__cta{
  grid-area: cta;
  margin-top: 0;
  justify-self: end;
  align-self: center;
  padding: 10px 14px;
  font-size: 13.5px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, .16);
}

.pubbook-feature__cover{
  flex: 0 0 260px;
  width: 260px;
}

.pubbook-feature__cover img{
  height: 250px;
}

/* Mobile: stack CTA under meta */
@media (max-width: 680px){
  .pubbook-feature__body{
    grid-template-columns: 1fr;
    grid-template-areas:
      "badge"
      "title"
      "subtitle"
      "desc"
      "meta"
      "cta";
  }
  .pubbook-feature__cta{
    justify-self: start;
  }
}

@media (max-width: 1100px) {
  .latest__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .latest__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .latest__title {
    font-size: 30px;
  }
}

@media (max-width: 520px) {
  .latest__grid {
    grid-template-columns: 1fr;
  }

  .article-card__media {
    height: 190px;
  }
}

/* =========================

/* =========================
   Published Books (Home)
   ========================= */
.pubbooks {
  margin-top: 18px;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}

html[data-theme="dark"] .pubbooks {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.pubbooks__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 4px 14px;
}

.pubbooks__headText {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pubbooks__title {
  margin: 0;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
}

.pubbooks__sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pubbooks__more {
  text-decoration: none;
  font-weight: 900;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .10);
  background: rgba(255, 255, 255, .55);
  color: var(--text);
}

html[data-theme="dark"] .pubbooks__more {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
}

.pubbooks__grid {
  display: grid;
  grid-template-columns: 1.55fr .95fr;
  gap: 14px;
  align-items: stretch;
}

.pubbooks__grid.pubbooks__grid--single {
  grid-template-columns: 1fr;
}

.pubbook-feature {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, .08);
  background:
    radial-gradient(1100px 520px at 20% 10%, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg,
      var(--pubbook-g1, #0b1220),
      var(--pubbook-g2, #0b3a46) 55%,
      var(--pubbook-g3, #0a4b34)
    );
  box-shadow: 0 18px 32px rgba(0, 0, 0, .14);
}

html[data-theme="dark"] .pubbook-feature {
  border-color: rgba(255, 255, 255, .10);
  box-shadow: 0 22px 40px rgba(0, 0, 0, .48);
  background:
    radial-gradient(1100px 520px at 20% 10%, rgba(255, 255, 255, .10), rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg,
      var(--pubbook-g1-dark, #070a12),
      var(--pubbook-g2-dark, #0a2634) 55%,
      var(--pubbook-g3-dark, #082b22)
    );
}

.pubbook-feature__link {
  display: flex;
  gap: 28px;
  align-items: stretch;
  justify-content: space-between;
  padding: 22px 26px;
  /* override old compact block that forced a tall min-height */
  min-height: 0;
  color: #fff;
  text-decoration: none;
}

.pubbook-feature__body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 0;
  /* ensure actions stay at the bottom and avoid old grid layout */
  display: flex;
  flex-direction: column;
}

.pubbook-feature__cover {
  flex: 0 0 350px;
  width: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pubbook-feature__cover img {
  width: 105%;
  height: auto;
  max-height: 270px;
  object-fit: contain;
  display: block;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  transition: transform .18s ease;
}

.pubbook-feature__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .24);
  font-weight: 900;
  font-size: 13px;
}

.pubbook-feature__title {
  margin: 12px 0 0;
  font-size: 44px;
  font-weight: 900;
  line-height: 1.22;
}

.pubbook-feature__subtitle {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, .95);
  font-weight: 800;
  font-size: 21px;
  line-height: 1.7;
}

.pubbook-feature__desc {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, .88);
  font-size: 17.5px;
  line-height: 1.95;
  max-width: 82ch;

  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pubbook-feature__actions {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

/* keep the action row visually at the bottom, even if old styles leaked */
.pubbook-feature__actions > * { margin-top: 0; }

/* make all actions sit next to each other (content-sized) */
.pubbook-feature__actions > a.pubbook-feature__cta,
.pubbook-feature__actions > .pubbook-meta{
  flex: 0 0 auto;
  width: auto;
}

.pubbook-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .18);
  border: 1px solid rgba(255, 255, 255, .16);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  min-height: 38px;
}

.pubbook-meta i {
  opacity: .9;
}

.pubbook-feature__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .10);
  font-weight: 900;
  font-size: 13px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, .18);
  text-decoration: none;
  white-space: nowrap;
  min-height: 38px;
  justify-self: auto;
  align-self: auto;
  color: rgba(255, 255, 255, .96);
}

.pubbook-feature__cta:visited{ color: rgba(255, 255, 255, .96); }

.pubbook-feature__cta--primary {
  background: rgba(139, 183, 178, .32);
  border-color: rgba(139, 183, 178, .58);
}

.pubbook-feature__cta--ghost {
  background: rgba(0, 0, 0, .20);
  border-color: rgba(255, 255, 255, .20);
}

.pubbook-feature__link:hover .pubbook-feature__cta--primary {
  background: rgba(139, 183, 178, .40);
}

.pubbook-feature__link:hover .pubbook-feature__cta--ghost {
  background: rgba(0, 0, 0, .26);
}

/* لو ظهر تاريخ النشر: اجعله بسطر مستقل (تحت أزرار الشراء/التفاصيل/المؤلف) */
.pubbook-feature__actions > .pubbook-meta--date{
  flex: 0 0 100%;
  width: max-content;
}

@media (max-width: 720px){
  .pubbook-feature__actions{
    justify-content: flex-start;
  }
  .pubbook-feature__actions > .pubbook-meta--date{
    width: max-content;
  }
}

.pubbook-feature__link:hover .pubbook-feature__cover img {
  transform: translateY(-1px);
}

.pubbooks__stack {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pubbook-mini {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 14px 24px rgba(0, 0, 0, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}

html[data-theme="dark"] .pubbook-mini {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .10);
  box-shadow: 0 18px 28px rgba(0, 0, 0, .35);
}

.pubbook-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 28px rgba(0, 0, 0, .12);
}

.pubbook-mini__link {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  text-decoration: none;
  color: inherit;
}

.pubbook-mini__body {
  min-width: 0;
  direction: rtl;
}

.pubbook-mini__cover {
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pubbook-mini__cover img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  border-radius: 16px;
  box-shadow: 0 14px 22px rgba(0, 0, 0, .12);
  background: #fff;
}

.pubbook-mini__title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.55;
}

.pubbook-mini__subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pubbook-mini__row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pubbook-mini__date {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 800;
}

.pubbook-mini__cta {
  font-size: 12.5px;
  font-weight: 900;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .06);
  border: 1px solid rgba(0, 0, 0, .10);
}

html[data-theme="dark"] .pubbook-mini__cta {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .14);
}

@media (max-width: 1100px) {
  .pubbooks__grid {
    grid-template-columns: 1fr;
  }

  .pubbooks__stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }
}

@media (max-width: 680px) {
  .pubbook-feature__link {
    flex-direction: column-reverse;
    align-items: stretch;
    min-height: auto;
  }

  .pubbook-feature__title {
    font-size: 32px;
    line-height: 1.25;
  }

  .pubbook-feature__subtitle {
    font-size: 17px;
    line-height: 1.75;
  }

  .pubbook-feature__desc {
    font-size: 15.5px;
    -webkit-line-clamp: 5;
  }

  .pubbook-feature__cover {
    width: 100%;
    flex-basis: auto;
  }

  .pubbook-feature__cover img {
    max-height: 320px;
  }

  .pubbooks__stack {
    grid-template-columns: 1fr;
  }

  .pubbook-mini__link {
    grid-template-columns: 1fr;
  }

  .pubbook-mini__cover {
    width: 100%;
  }

  .pubbook-mini__cover img {
    height: 220px;
  }

  .pubbook-mini__row {
    justify-content: flex-start;
  }
}
/* =========================
   Footer (مثل الصورة)
   ========================= */
.site-footer {
  margin-top: 22px;
  border-radius: 34px;
  padding: 78px 18px 52px;
  color: #fff;
  background:
    radial-gradient(1200px 520px at 50% 0%, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, #0b0d11, #050608);
  box-shadow: 0 32px 60px rgba(0, 0, 0, .35);
  overflow: hidden;
}

.site-footer__inner {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

.site-footer__title {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 900;
  letter-spacing: 0;
}

.site-footer__desc {
  margin: 14px auto 0;
  max-width: 760px;
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
  line-height: 1.95;
}

.site-footer__social {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  direction: ltr;
  /* حتى تظهر أسماء الشبكات بشكل طبيعي */
}

.footer-social {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: rgba(255, 255, 255, .95);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .14);
  font-weight: 800;
  font-size: 14px;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
  opacity: .92;
}

.footer-social:hover {
  background: rgba(255, 255, 255, .08);
  transform: translateY(-1px);
  opacity: 1;
}

.footer-social svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.site-footer__copy {
  margin-top: 34px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, .62);
}

@media (max-width: 680px) {
  .site-footer {
    padding: 64px 16px 44px;
    border-radius: 28px;
  }

  .site-footer__desc {
    font-size: 14.5px;
  }
}


/* صفحة المقال الداخلية */
.post-meta{margin-top:6px}
.post-head{margin-top:6px;text-align:right!important}
.post-meta{margin-top:6px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-start}

/* زر/شريحة الرابط داخل الميتا: امنع لون visited الافتراضي + امنع underline */
.post-meta .pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(0,0,0,.06);
  border:1px solid rgba(0,0,0,.10);
  font-weight:800;
  font-size:13px;
  color: var(--text);
  text-decoration: none;
}
.post-meta .pill:visited{ color: var(--text); }
.post-meta .pill:hover{ filter: brightness(.98); }
html[data-theme="dark"] .post-meta .pill{
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.14);
  color: var(--text);
}
html[data-theme="dark"] .post-meta .pill:visited{ color: var(--text); }

.post-title{margin:10px 0 8px;text-align:right!important}
.post-excerpt{margin:0;color:var(--muted);text-align:right!important}

.post-hero{width:100%;height:auto;display:block;border-radius:18px;margin-top:16px;object-fit:cover;max-height:460px;box-shadow:var(--shadow-2)}
@media (max-width:680px){.post-hero{max-height:380px}}

/* محاذاة النص داخل المقال (تعمل عند اختيارها من المحرر) */
.post-surface .post-body{line-height:1.9;font-size:21px;text-align:right;direction:rtl;unicode-bidi:plaintext;padding:0;}
.post-surface .post-body .align-right{text-align:right!important}
.post-surface .post-body .align-center{text-align:center!important}
.post-surface .post-body .align-left{text-align:left!important}
.post-surface .post-body .align-justify{text-align:justify!important}

/* اقتراحات من نفس التصنيف (كرتين تحت المنشور) */
.related-posts{
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(0,0,0,.08);
}
html[data-theme="dark"] .related-posts{border-top-color: rgba(255,255,255,.12);}

.related-posts__title{
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 900;
}

.related-posts__grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.related-card{
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: stretch;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.55);
  overflow: hidden;
  box-shadow: 0 10px 18px rgba(0,0,0,.10);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
html[data-theme="dark"] .related-card{
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  box-shadow: 0 14px 22px rgba(0,0,0,.35);
}
.related-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(0,0,0,.14);
}
html[data-theme="dark"] .related-card:hover{box-shadow: 0 18px 28px rgba(0,0,0,.45);}

.related-card__media{
  position: relative;
  background: rgba(0,0,0,.04);
}
html[data-theme="dark"] .related-card__media{background: rgba(255,255,255,.04);}

.related-card__media img{
  width: 110%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.related-card__ph{
  display:block;
  width:100%;
  height:100%;
}

.related-card__body{
  padding: 12px 12px 12px 14px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.related-card__kicker{
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
}

.related-card__title{
  font-size: 18px;
  font-weight: 900;
  line-height: 1.55;
}

.related-card__excerpt{
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

@media (max-width: 780px){
  .related-posts__grid{grid-template-columns: 1fr;}
}

/* تخطيط خاص لمراجعات الكتب: صورة الغلاف + جدول المحتويات في العمود الجانبي */
.side-stack{
  flex: 0 0 280px;
  width: 280px;
  position: sticky;
  top: 18px;
  display:flex;
  flex-direction:column;
  gap: 14px;
}
.review-cover{
  border-radius: 18px;
  overflow:hidden;
  box-shadow: var(--shadow-2);
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.02);
}
html[data-theme="dark"] .review-cover{
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
}
.review-cover img{
  width:100%;
  height:auto;
  display:block;
  object-fit:cover;
}

/* بيانات الكتب المنشورة (صفحة الكتاب) */
.book-metaList{
  margin:0;
  padding:0;
  list-style:none;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.book-metaItem{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:8px 10px;
  border-radius:14px;
  background:rgba(0,0,0,.03);
  border:1px solid rgba(0,0,0,.06);
}
html[data-theme="dark"] .book-metaItem{
  background:rgba(255,255,255,.05);
  border-color:rgba(255,255,255,.12);
}
.book-metaKey{
  color:var(--muted);
  font-weight:900;
  font-size:13px;
  white-space:nowrap;
}
.book-metaVal{
  color:var(--text);
  font-weight:800;
  font-size:13.5px;
  text-align:left;
}

@media (max-width:980px){
  .side-stack{flex-basis:260px;width:260px}
}
@media (max-width:860px){
  .side-stack{position:static;width:100%;max-width:100%}
}

.post-cover{border-radius:18px;overflow:hidden;margin-bottom:14px}
.post-cover img{width:100%;height:auto;display:block}
.post-surface .post-body{line-height:1.9;font-size:21px;text-align:right;direction:rtl}
.post-body iframe{width:100%;max-width:100%;aspect-ratio:16/9;height:auto;display:block;border:0;border-radius:18px;overflow:hidden}

/* صور داخل المقال (لا تتجاوز حدود المحتوى) */
.post-body img{max-width:100%;height:auto;display:block;margin:18px auto;border-radius:18px}
.post-body figure.rte-img{
  max-width:100%;
  margin:18px auto;
}
.post-body figure.rte-img img{
  display:block;
  width:100%;
  max-width:100%;
  height:auto;
  border-radius:18px;
}

/* أحجام سريعة */
.post-body figure.rte-img--lg{width:100%;display:block}
.post-body figure.rte-img--md{width:min(760px,75%);display:block}

/* صغيرة: inline-block عشان تقدر تحط صورتين جنب بعض */
.post-body figure.rte-img--sm{
  width:50%;
  max-width:420px;
  display:inline-block;
  vertical-align:top;
  box-sizing:border-box;
  padding-inline:6px;
  margin:12px 0;
}


/* صف صور جنب بعض (يُنشأ من المحرر عند الحاجة) */
.post-body .rte-img-row{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-start;justify-content:center;margin:14px 0}
.post-body .rte-img-row figure.rte-img{margin:0 !important;padding-inline:0 !important}
/* تحجيم مخصص (نِسَب) — يدعم صورتين جنب بعض */
.post-body figure[class*="rte-img--w-"]{
  display:inline-block;
  vertical-align:top;
  box-sizing:border-box;
  padding-inline:6px;
  margin:12px 0;
}
.post-body figure.rte-img--w-20{width:20%}
.post-body figure.rte-img--w-21{width:21%}
.post-body figure.rte-img--w-22{width:22%}
.post-body figure.rte-img--w-23{width:23%}
.post-body figure.rte-img--w-24{width:24%}
.post-body figure.rte-img--w-25{width:25%}
.post-body figure.rte-img--w-26{width:26%}
.post-body figure.rte-img--w-27{width:27%}
.post-body figure.rte-img--w-28{width:28%}
.post-body figure.rte-img--w-29{width:29%}
.post-body figure.rte-img--w-30{width:30%}
.post-body figure.rte-img--w-31{width:31%}
.post-body figure.rte-img--w-32{width:32%}
.post-body figure.rte-img--w-33{width:33%}
.post-body figure.rte-img--w-34{width:34%}
.post-body figure.rte-img--w-35{width:35%}
.post-body figure.rte-img--w-36{width:36%}
.post-body figure.rte-img--w-37{width:37%}
.post-body figure.rte-img--w-38{width:38%}
.post-body figure.rte-img--w-39{width:39%}
.post-body figure.rte-img--w-40{width:40%}
.post-body figure.rte-img--w-41{width:41%}
.post-body figure.rte-img--w-42{width:42%}
.post-body figure.rte-img--w-43{width:43%}
.post-body figure.rte-img--w-44{width:44%}
.post-body figure.rte-img--w-45{width:45%}
.post-body figure.rte-img--w-46{width:46%}
.post-body figure.rte-img--w-47{width:47%}
.post-body figure.rte-img--w-48{width:48%}
.post-body figure.rte-img--w-49{width:49%}
.post-body figure.rte-img--w-50{width:50%}
.post-body figure.rte-img--w-51{width:51%}
.post-body figure.rte-img--w-52{width:52%}
.post-body figure.rte-img--w-53{width:53%}
.post-body figure.rte-img--w-54{width:54%}
.post-body figure.rte-img--w-55{width:55%}
.post-body figure.rte-img--w-56{width:56%}
.post-body figure.rte-img--w-57{width:57%}
.post-body figure.rte-img--w-58{width:58%}
.post-body figure.rte-img--w-59{width:59%}
.post-body figure.rte-img--w-60{width:60%}
.post-body figure.rte-img--w-61{width:61%}
.post-body figure.rte-img--w-62{width:62%}
.post-body figure.rte-img--w-63{width:63%}
.post-body figure.rte-img--w-64{width:64%}
.post-body figure.rte-img--w-65{width:65%}
.post-body figure.rte-img--w-66{width:66%}
.post-body figure.rte-img--w-67{width:67%}
.post-body figure.rte-img--w-68{width:68%}
.post-body figure.rte-img--w-69{width:69%}
.post-body figure.rte-img--w-70{width:70%}
.post-body figure.rte-img--w-71{width:71%}
.post-body figure.rte-img--w-72{width:72%}
.post-body figure.rte-img--w-73{width:73%}
.post-body figure.rte-img--w-74{width:74%}
.post-body figure.rte-img--w-75{width:75%}
.post-body figure.rte-img--w-76{width:76%}
.post-body figure.rte-img--w-77{width:77%}
.post-body figure.rte-img--w-78{width:78%}
.post-body figure.rte-img--w-79{width:79%}
.post-body figure.rte-img--w-80{width:80%}
.post-body figure.rte-img--w-81{width:81%}
.post-body figure.rte-img--w-82{width:82%}
.post-body figure.rte-img--w-83{width:83%}
.post-body figure.rte-img--w-84{width:84%}
.post-body figure.rte-img--w-85{width:85%}
.post-body figure.rte-img--w-86{width:86%}
.post-body figure.rte-img--w-87{width:87%}
.post-body figure.rte-img--w-88{width:88%}
.post-body figure.rte-img--w-89{width:89%}
.post-body figure.rte-img--w-90{width:90%}
.post-body figure.rte-img--w-91{width:91%}
.post-body figure.rte-img--w-92{width:92%}
.post-body figure.rte-img--w-93{width:93%}
.post-body figure.rte-img--w-94{width:94%}
.post-body figure.rte-img--w-95{width:95%}
.post-body figure.rte-img--w-96{width:96%}
.post-body figure.rte-img--w-97{width:97%}
.post-body figure.rte-img--w-98{width:98%}
.post-body figure.rte-img--w-99{width:99%}
.post-body figure.rte-img--w-100{width:100%}

/* لو 100% نخليه block */
.post-body figure.rte-img--w-100{
  display:block;
  padding-inline:0;
  margin:18px auto;
}

/* محاذاة الصور (خاصة بأزرار المحاذاة داخل المحرر) */
.post-body figure.rte-img.img-align-center{
  display:block;
  margin:18px auto;
  padding-inline:0;
}
.post-body figure.rte-img.img-align-right{
  display:block;
  margin:18px 0;
  margin-left:auto;
  padding-inline:0;
}
.post-body figure.rte-img.img-align-left{
  display:block;
  margin:18px 0;
  margin-right:auto;
  padding-inline:0;
}

@media (max-width:680px){
  .post-body figure.rte-img--sm,
  .post-body figure[class*="rte-img--w-"]{
    width:100% !important;
    max-width:100%;
    display:block;
    padding-inline:0;
    margin:18px auto;
  }
  .post-body figure.rte-img--md{width:100%}
}

.post-excerpt{margin-top:0}
.post-notfound-title{margin:0 0 8px}
.post-notfound-desc{margin:0}

/* اقتباسات المقال (تصميم مثل الصورة) */
:root{--quote-line:rgba(0,0,0,.22);--quote-mark:rgba(0,0,0,.70)}
html[data-theme="dark"]{--quote-line:rgba(255,255,255,.22);--quote-mark:rgba(255,255,255,.80)}

.post-body blockquote,
.post-quote{
  position:relative;
  margin:34px auto;
  padding:28px 18px 22px;
  border-top:1px solid var(--quote-line);
  border-bottom:1px solid var(--quote-line);
  text-align:center;
  font-style:normal;
  background:transparent;
}

.post-body blockquote::before,
.post-quote::before{
  content:"\f10d";
  position:absolute;
  top:-14px;
  left:50%;
  transform:translateX(-50%);
  padding:0 12px;
  background:var(--card);
  color:var(--quote-mark);
  font-size:22px;
  font-weight:900;
  font-family:"Font Awesome 6 Free";
  line-height:1;
}

.post-body blockquote > p,
.post-quote > p{
  margin:22px auto 0;
  max-width:980px;
  font-size:clamp(22px,2.5vw,32px);
  font-weight:800;
  line-height:1.85;
  letter-spacing:.1px;
}

.post-body blockquote > p:first-child::before,
.post-quote > p:first-child::before{content:"“";color:var(--quote-mark)}
.post-body blockquote > p:first-child::after,
.post-quote > p:first-child::after{content:"”";color:var(--quote-mark)}

.post-body blockquote cite,
.post-quote cite{
  display:block;
  margin-top:14px;
  font-size:14px;
  font-weight:700;
  line-height:1.7;
  color:var(--muted);
  font-style:normal;
}

@media (max-width: 680px){
  .post-body blockquote,
  .post-quote{margin:26px auto;padding:22px 14px 18px}
  .post-body blockquote::before,
  .post-quote::before{top:-13px;font-size:20px}
  .post-body blockquote > p,
  .post-quote > p{font-size:clamp(20px,5.5vw,28px);line-height:1.8}
}

/* (1) شريط يمين + علامة اقتباس يسار */
:root{--quote-accent:#ad3103;--quote-panel-bg:rgba(0,0,0,.04);--quote-panel-border:rgba(0,0,0,.08)}
html[data-theme="dark"]{--quote-panel-bg:rgba(255,255,255,.06);--quote-panel-border:rgba(255,255,255,.14)}

.post-body blockquote.quote--bar{
  margin:26px 0;
  padding:16px 22px 16px 54px;
  border:0;
  border-right:4px solid var(--quote-accent);
  text-align:right;
  background:transparent;
}
.post-body blockquote.quote--bar::before{
  content:"❝";
  position:absolute;
  top:50%;
  left:18px;
  transform:translateY(-55%);
  padding:0;
  background:transparent;
  color:var(--quote-accent);
  font-size:34px;
  font-weight:900;
  line-height:1;
}
.post-body blockquote.quote--bar > p{
  margin:0;
  max-width:none;
  font-size:21px;
  font-weight:700;
  line-height:2.0;
  letter-spacing:0;
}
.post-body blockquote.quote--bar > p:first-child::before,
.post-body blockquote.quote--bar > p:first-child::after{content:none}
.post-body blockquote.quote--bar cite{
  margin-top:12px;
  text-align:right;
}

/* (2) صندوق رمادي بعناوين وقوائم */
.post-body blockquote.quote--panel{
  margin:22px 0;
  padding:22px 22px 18px;
  border:1px solid var(--quote-panel-border);
  border-radius:22px;
  background:var(--quote-panel-bg);
  text-align:right;
}
.post-body blockquote.quote--panel::before{content:none}
.post-body blockquote.quote--panel > p{
  margin:0;
  max-width:none;
  font-size:18px;
  font-weight:650;
  line-height:1.9;
  letter-spacing:0;
}
.post-body blockquote.quote--panel > p:first-child::before,
.post-body blockquote.quote--panel > p:first-child::after{content:none}
.post-body blockquote.quote--panel cite{color:var(--muted)}
.post-body blockquote.quote--panel h2,
.post-body blockquote.quote--panel h3,
.post-body blockquote.quote--panel h4{
  margin:0 0 10px;
  text-align:center;
  font-weight:900;
}
.post-body blockquote.quote--panel ul,
.post-body blockquote.quote--panel ol{
  margin:12px 0 0;
  padding:0 22px 0 0;
  list-style-position: inside;
}
.post-body blockquote.quote--panel li{margin:8px 0}

/* (3) الكلاسيكي: نفس الافتراضي */
.post-body blockquote.quote--classic{ text-align:center; }



/* صندوق معلومات الكاتب أسفل المقال */
.author-card{
  margin-top: 34px;
  padding: 22px 0 18px;
  border-top: 1px solid rgba(0,0,0,.18);
  border-bottom: 1px solid rgba(0,0,0,.18);
}
html[data-theme="dark"] .author-card{
  border-top-color: rgba(255,255,255,.20);
  border-bottom-color: rgba(255,255,255,.20);
}

.author-card__head{
  display: flex;
  align-items: center;
  justify-content: flex-start; /* في RTL: start = يمين */
  gap: 14px;
  margin-bottom: 12px;
}

.author-card__avatar{
  width: 62px;
  height: 62px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: var(--shadow-2);
  border: 1px solid rgba(0,0,0,.08);
}
html[data-theme="dark"] .author-card__avatar{border-color: rgba(255,255,255,.12)}

.author-card__name{
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.author-card__bio{
  margin: 0 auto;
  max-width: 900px;
  text-align: right;
  direction: rtl;
  line-height: 2.05;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.author-card__social{
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  direction: ltr;
}

.author-card__social .footer-social{
  color: var(--text);
  background: rgba(0, 0, 0, .03);
  border: 1px solid rgba(0, 0, 0, .10);
}
html[data-theme="dark"] .author-card__social .footer-social{
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .12);
}
.author-card__social .footer-social:hover{
  background: rgba(0, 0, 0, .06);
}
html[data-theme="dark"] .author-card__social .footer-social:hover{
  background: rgba(255, 255, 255, .09);
}

@media (max-width: 680px){
  .author-card{margin-top: 26px; padding: 18px 0 14px}
  .author-card__avatar{width: 54px; height: 54px; border-radius: 14px}
  .author-card__name{font-size: 20px}
  .author-card__bio{font-size: 16px; line-height: 1.95}
}

/* =========================
   Post TOC (Side Table of Contents)
   ========================= */

.post-layout{
  display:flex;
  gap:  18px;
  align-items:flex-start;
  padding: 18px;
}

.post-main{
  flex: 1 1 auto;
  min-width: 0;
}

.toc-side{
  flex: 0 0 280px;
  width: 280px;
  position: sticky;
  top: 18px;
}

.toc{
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 18px;
  background: rgba(0,0,0,.02);
  box-shadow: var(--shadow-2);
  padding: 10px 12px;
  direction: ltr;
  text-align: right;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
html[data-theme="dark"] .toc{
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
}

.toc__summary{
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px 10px;
  font-weight: 900;
  font-size: 18px;
  text-align: right;
}
.toc__summary::-webkit-details-marker{ display:none; }

.toc__summary::before{
  content: "⌃";
  font-size: 18px;
  line-height: 1;
  opacity: .75;
  transform: rotate(180deg);
  transition: transform .18s ease;
}
.toc:not([open]) .toc__summary::before{ transform: rotate(0deg); }

.toc__nav{ padding: 6px 4px 10px; text-align: right; }

.toc__list,
.toc__sub{
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Counters for 1 / 2.1 style */
.toc__list{ counter-reset: toc; }
.toc__list > .toc__item{ counter-increment: toc; }

.toc__list > .toc__item > a::before{
  content: counter(toc) ". ";
  font-weight: 700;
  opacity: .8;
}

.toc__sub{ counter-reset: tocSub; margin: 8px 0 0; padding: 0 18px 0 0; }
.toc__sub > .toc__item{ counter-increment: tocSub; }
.toc__sub > .toc__item > a::before{
  content: counter(toc) "." counter(tocSub) " ";
  font-weight: 700;
  opacity: .75;
}

.toc__item > a{
  display: block;
  padding: 6px 6px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  line-height: 1.7;
  font-weight: 650;
  text-align: right;
  direction: rtl;
}

.toc__item > a:hover{
  background: rgba(0,0,0,.05);
}
html[data-theme="dark"] .toc__item > a:hover{
  background: rgba(255,255,255,.07);
}

/* Scroll offset for headings */
.post-body h2,
.post-body h3,
.post-body h4{
  scroll-margin-top: 90px;
}

@media (max-width: 980px){
  .toc-side{ flex-basis: 260px; width: 260px; }
}

@media (max-width: 860px){
  .post-layout{ flex-direction: column; }
  .toc-side{ position: static; width: 100%; max-width: 100%; }
  .toc{ max-height: none; }
}


/* =========================
   Content Box (colored background block)
   ========================= */
.content-box{
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 18px;
  padding: 18px;
  margin: 18px 0;
}
html[data-theme="dark"] .content-box{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.14);
}

.content-box h2,
.content-box h3{
  margin-top: 0;
  text-align: right;
  font-weight: 900;
}

.content-box ul,
.content-box ol{
  margin: 12px 0 0;
}

/* =========================
   Post typography + Review sidebar behavior
   ========================= */

/* تكبير نص المحتوى داخل المقالات والمراجعات فقط */
.post-page .post-body,
.post .post-body,
.post-body{
  font-size: 20px;
}

/* في المراجعات: لا تجعل العمود الجانبي كله sticky (هذا يحبس جدول المحتويات تحت صورة الغلاف)
   بدلًا من ذلك: العمود طبيعي، وصندوق جدول المحتويات هو الذي يثبت عند التمرير */
.post-layout--review .side-stack{
  position: static;
  top: auto;
}

.post-layout--review .side-stack .toc{
  position: sticky;
  top: 18px;
}


/* خلفية بيضاء لمنطقة عرض المقال/المراجعة فقط (داخل post.php) */
.post-surface{
  background: var(--card);
  backdrop-filter: none;
}

/* روابط/جداول/أكواد داخل المقال لتظهر بشكل صحيح في الوضع الليلي */
.post-body a{
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.post-body a:hover{ filter: brightness(.98); }
html[data-theme="dark"] .post-body a:hover{ filter: brightness(1.08); }

.post-body hr{
  border: 0;
  border-top: 1px solid var(--chip-border);
  margin: 26px 0;
}

.post-body code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .95em;
  background: var(--soft);
  border: 1px solid var(--chip-border);
  padding: .12em .35em;
  border-radius: 8px;
}

.post-body pre{
  background: var(--soft);
  border: 1px solid var(--chip-border);
  border-radius: 18px;
  padding: 14px 16px;
  overflow: auto;
  line-height: 1.85;
}
.post-body pre code{
  background: transparent;
  border: 0;
  padding: 0;
}

.post-body table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 18px 0;
  background: var(--card);
  border: 1px solid var(--chip-border);
  border-radius: 18px;
  overflow: hidden;
}
.post-body th,
.post-body td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--chip-border);
  vertical-align: top;
}
.post-body th{
  background: var(--soft);
  font-weight: 900;
}
.post-body tr:last-child td{ border-bottom: 0; }
/* =========================
   Scroll To Top Button
   ========================= */
.to-top{
  position: fixed;
  inset-block-end: calc(18px + env(safe-area-inset-bottom, 0px));
  inset-inline-end: calc(18px + max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)));
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, .10);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
  z-index: 80;

  opacity: 0;
  transform: translateY(10px) scale(.98);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease, background .22s ease;
}

html[data-theme="dark"] .to-top{
  border-color: rgba(255, 255, 255, .14);
}

.to-top svg{
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.to-top.is-visible{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.to-top:hover{
  background: var(--nav-pill-active);
}

.to-top:focus-visible{
  outline: 2px solid rgba(139, 183, 178, .65);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce){
  .to-top{ transition: none; }
}

/* =========================
   MOBILE TOPBAR ALIGNMENT
   - القائمة تحت الاسم (كما هو)
   - لكن بدون تمركز: محاذاة لليمين وفق RTL وفلسفة القالب
   ========================= */
@media (max-width: 680px) {
  .topbar{
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
  }

  .topbar .brand{
    width: 100%;
    min-width: 0;
    justify-content: flex-start; /* في RTL = يمين */
  }

  .topbar .nav{
    width: 100%;
    justify-content: flex-start; /* في RTL = يمين */
  }
}


@media (max-width: 720px){
  /* الهاتف: امنع الضبط (Justify) حتى لو تم اختياره من المحرر */
  .post-surface .post-body .align-justify,
  .post-surface .post-body [style*="text-align:justify"],
  .post-surface .post-body [style*="text-align: justify"]{
    text-align: right !important;
    text-align-last: right !important;
  }
}

/* ===== Security/CSP: avoid inline styles ===== */
.books-intro{
  margin:0;
  color:var(--muted);
  font-weight:800;
  line-height:1.9;
}

/* =========================
   POST (MOBILE) — كرت واحد + استغلال أعلى للعرض + حواف متساوية
   ملاحظة: هذا البلوك يتغلب على custom.php لأنه يستخدم محددات أقوى + !important
   ========================= */
@media (max-width: 680px){

  /* اجعل الكرت الخارجي Wrapper فقط */
  main.card.post-surface{
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    backdrop-filter: none !important;
  }

  /* الكرت الحقيقي في الهاتف: post-inner-card */
  .post-page > .post-inner-card.card{
    margin-top: 0 !important;
    padding: 14px 14px 12px !important; /* يمين/يسار متساوي + مساحة أكبر للنص */
    border-radius: 22px !important;
  }

  /* إزالة أي padding داخلي إضافي كان يخلق فرقًا بين الجهتين */
  .post-page > .post-inner-card.card .post-body{
    padding: 0 !important;
    padding-inline: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* لفّ الكلمات/الروابط الطويلة داخل الكرت */
  .post-page > .post-inner-card.card .post-body,
  .post-page > .post-inner-card.card .post-body *{
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* عناصر الوسائط لا تكسر العرض */
  .post-page > .post-inner-card.card .post-body img,
  .post-page > .post-inner-card.card .post-body video,
  .post-page > .post-inner-card.card .post-body iframe,
  .post-page > .post-inner-card.card .post-body svg{
    max-width: 100%;
    height: auto;
  }

  /* الصوتيات LTR: خليه يملأ عرض الكرت بدون هوامش غريبة */
  .post-page > .post-inner-card.card .post-body audio{
    width: 100%;
    display: block;
    margin: 8px 0 0;
  }

  /* الأكواد: تمرير داخلها بدل ما تكسر العرض */
  .post-page > .post-inner-card.card .post-body pre{
    max-width: 100%;
    overflow: auto;
  }

  /* الجداول: تمرير أفقي داخلها بدل كسر الكرت */
  .post-page > .post-inner-card.card .post-body table{
    width: 100% !important;
    max-width: 100% !important;
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }


  /* جدول (الخطوة / الوصف التفصيلي) على الهاتف:
     لا تسمح بتقطيع كلمة عمود "الخطوة" إلى حروف داخل الخلية.
     يتم تفعيل ذلك فقط عندما يضع الـ JS كلاس tbl--steps على الجدول. */
  .post-page > .post-inner-card.card .post-body table.tbl--steps th:first-child,
  .post-page > .post-inner-card.card .post-body table.tbl--steps td:first-child{
    overflow-wrap: normal !important;
    word-break: keep-all !important;
    hyphens: none !important;
    min-width: 92px; /* يمنع انكماش العمود لدرجة تقطيع الكلمة */
  }

  /* جدول المحتويات داخل نفس الكرت: خفف الـpadding لتوفير مساحة للنص */
  .post-page > .post-inner-card.card .toc{
    padding: 8px 10px !important;
  }
  .post-page > .post-inner-card.card .toc__summary{
    padding: 8px 4px 10px !important;
  }
  .post-page > .post-inner-card.card .toc__nav{
    padding: 6px 2px 8px !important;
  }
}


/* Perf: Font Awesome font-display */
@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:swap;src:url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/webfonts/fa-solid-900.woff2") format("woff2");}
@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:400;font-display:swap;src:url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/webfonts/fa-regular-400.woff2") format("woff2");}
@font-face{font-family:"Font Awesome 6 Brands";font-style:normal;font-weight:400;font-display:swap;src:url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/webfonts/fa-brands-400.woff2") format("woff2");}

/* =========================
   Print Style (متناسق مع تصميم الموقع)
   ========================= */
@media print{
  @page{
    size: A4;
    margin: 14mm 12mm;
  }

  :root{
    /* نفس روح الثيم لكن أوضح للطباعة */
    --bg: #ffffff;
    --card: #ffffff;
    --text: #111111;
    --muted: #444444;
    --soft: #f6f6f6;
    --soft-2: #f1f1f1;
    --accent: #2f6f6a; /* أغمق قليلًا للطباعة */
  }

  *{
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  *,*::before,*::after{
    animation: none !important;
    transition: none !important;
    filter: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html,body{
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
    color: var(--text) !important;
  }

  body{
    direction: rtl !important;
    font-family: "Mizan AR+LT","Tajawal","Inter",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif !important;
    font-size: 16px !important;
    line-height: 1.75 !important;
  }

  .page{ padding: 0 !important; }
  .shell{ width: auto !important; }

  /* ====== رأس الصفحة ====== */
  .topbar{
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 0 14px !important;
    margin: 0 0 16px !important;
    border-bottom: 1px solid rgba(0,0,0,.14) !important;
  }
  .nav,
  #themeToggle,
  .theme-switch{
    display: none !important;
  }
  .brand{
    color: var(--text) !important;
    text-decoration: none !important;
  }
  .brand__logo-img{ height: 34px !important; }
  .brand__mark{
    background: transparent !important;
    color: var(--text) !important;
    border: 1px solid rgba(0,0,0,.18) !important;
  }

  /* ====== أسطح/بطاقات ====== */
  .card{
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .post-surface{
    background: transparent !important;
    box-shadow: none !important;
  }
  .post-inner-card{
    background: var(--card) !important;
    box-shadow: none !important;
    border: 1px solid rgba(0,0,0,.14) !important;
    border-radius: 16px !important;
    padding: 18px 18px !important;
  }

  /* تبسيط التخطيط: TOC فوق ثم المحتوى */
  .post-layout{
    display: block !important;
    padding: 0 !important;
  }
  .toc-side,
  .side-stack{
    position: static !important;
    width: auto !important;
    top: auto !important;
    margin: 0 0 16px !important;
  }

  /* ====== TOC ====== */
  details.toc{
    max-height: none !important;
    overflow: visible !important;
    background: var(--soft) !important;
    border: 1px solid rgba(0,0,0,.12) !important;
    border-radius: 16px !important;
    padding: 10px 12px !important;
    break-inside: avoid !important;
  }
  details.toc:not([open]) > :not(summary){
    display: block !important; /* اطبع المحتوى حتى لو كان مغلقًا */
  }
  .toc__nav{
    max-height: none !important;
    overflow: visible !important;
  }
  .toc__summary{
    font-weight: 800 !important;
    color: var(--text) !important;
  }

  /* ====== عنوان وبيانات المقال ====== */
  .post-head{
    margin: 0 0 18px !important;
    padding: 0 0 14px !important;
    border-bottom: 1px solid rgba(0,0,0,.10) !important;
  }
  .post-title{
    font-size: 26px !important;
    line-height: 1.25 !important;
    margin: 10px 0 8px !important;
  }
  .post-excerpt{
    color: #333 !important;
    font-size: 16px !important;
    margin: 0 !important;
  }
  .post-meta .pill{
    background: transparent !important;
    border: 1px solid rgba(0,0,0,.18) !important;
    color: var(--text) !important;
    box-shadow: none !important;
  }
  .muted{ color: var(--muted) !important; }

  /* ====== المحتوى ====== */
  .post-hero,
  .post-body img{
    max-width: 100% !important;
    height: auto !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  a{
    color: var(--text) !important;
    text-decoration: underline !important;
  }
  /* إظهار رابط الخارجي بعد النص */
  .post-body a[href^="http"]::after{
    content: " (" attr(href) ")";
    font-size: 12px;
    color: #555;
    direction: ltr;
    unicode-bidi: plaintext;
    word-break: break-all;
  }

  .post-body blockquote{
    background: var(--soft) !important;
    border-right: 4px solid var(--accent) !important;
    margin: 12px 0 !important;
    padding: 10px 14px !important;
    break-inside: avoid !important;
  }

  .post-body pre{
    background: var(--soft) !important;
    border: 1px solid rgba(0,0,0,.12) !important;
    border-radius: 12px !important;
    padding: 10px 12px !important;
    overflow: visible !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    break-inside: avoid !important;
  }

  .post-body table{
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 14.5px !important;
  }
  .post-body th,
  .post-body td{
    border: 1px solid rgba(0,0,0,.22) !important;
    padding: 6px 8px !important;
    vertical-align: top !important;
  }
  .post-body th{
    background: var(--soft-2) !important;
    font-weight: 800 !important;
  }
  .post-body thead{ display: table-header-group; }
  .post-body tfoot{ display: table-footer-group; }

  /* منع تكسّر العناوين بشكل سيء */
  h1,h2,h3,h4{
    break-after: avoid-page;
    page-break-after: avoid;
  }
  p,li{
    orphans: 3;
    widows: 3;
  }

  /* عناصر واجهة لا نحتاجها في الورق */
  .to-top,
  .read-progress,
  .related-posts,
  footer,
  .site-footer{
    display: none !important;
  }

  /* بطاقة الكاتب: احتفظ بالشكل لكن بدون روابط كثيرة */
  .author-card{
    border: 1px solid rgba(0,0,0,.12) !important;
    background: #fafafa !important;
    box-shadow: none !important;
    break-inside: avoid !important;
  }
  .author-card__social{
    display: none !important;
  }

  /* الإطارات/الفيديو قد تسبب تعليق الـ preview */
  .post-body iframe,
  .post-body video{
    display: none !important;
  }
}
