/* ==========================================================
   القسم 4: الأقسام — «مسرح الأقسام»
   كمبيوتر: 4 ألواح طويلة كالأكورديون؛ اللوح النشط يتّسع ويعرض
            التفاصيل، والبقية تضيق ويظهر اسمها رأسيًا.
   موبايل:  بطاقات كاملة العرض تتكدّس فوق بعضها مع الإسكرول.
   بدون جافاسكربت: 4 ألواح متساوية ومحتواها ظاهر.
   ========================================================== */

.categories {
  padding-block: var(--space-2xl) var(--space-xl);
  background: var(--c-white);
}

/* عنوان القسم (مشترك لبقية الأقسام) */
.section-head {
  text-align: center;
  margin-bottom: var(--space-lg);
}
.section-head__eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--c-muted);
}
.section-head__title {
  font-size: var(--fs-h2);
  margin-top: var(--space-2xs);
}

.categories__stage {
  display: grid;
  gap: var(--space-sm);
  padding-inline: var(--space-sm);
}

/* ---------- اللوح ---------- */
.cat-panel {
  position: relative;
  overflow: hidden;
  color: var(--c-white);
  background: var(--c-nude);
  isolation: isolate;
  min-height: 72svh;
}
.cat-panel__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.cat-panel__media img {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  max-width: none;
  object-fit: cover;
}
/* تدرّج دافئ لوضوح النص */
.cat-panel__media::after {
  content: "";
  position: absolute;
  inset: 30% 0 0;
  background: linear-gradient(180deg,
    rgba(40, 24, 21, 0) 0%,
    rgba(40, 24, 21, 0.12) 35%,
    rgba(40, 24, 21, 0.38) 70%,
    rgba(40, 24, 21, 0.6) 100%);
}
/* تعتيم عند التكدّس (موبايل) */
.cat-panel__shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #1a1110;
  opacity: 0;
  pointer-events: none;
}
/* غطاء الكشف عند الدخول */
.cat-panel__veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: var(--c-nude);
  transform-origin: 50% 0%;
  transform: scaleY(0);
  pointer-events: none;
}

/* الاسم الرأسي (يظهر في الألواح الضيقة على الكمبيوتر) */
.cat-panel__rail { display: none; }

.cat-panel__content {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  padding: var(--space-lg);
}
.cat-panel__num {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  letter-spacing: 0.15em;
  opacity: 0.85;
}
.cat-panel__title {
  font-size: clamp(2.5rem, 1.8rem + 3vw, 4.5rem);
  line-height: 1.1;
  margin-block: var(--space-2xs) var(--space-xs);
}
/* الرابط يغطي اللوح كله */
.cat-panel__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.cat-panel__desc {
  font-size: var(--fs-sm);
  max-width: 32ch;
  opacity: 0.92;
}
.cat-panel__chips {
  position: relative;
  z-index: 3;                      /* فوق الرابط الكبير */
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-block: var(--space-sm);
}
.cat-panel__chips a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding-inline: 14px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  font-size: var(--fs-xs);
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.cat-panel__chips a:hover { background: var(--c-white); color: var(--c-ink); }
.cat-panel__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 500;
}
.cat-panel__cta .icon { width: 18px; height: 18px; transform: rotate(90deg); }

/* ---------- موبايل: تكدّس البطاقات ---------- */
@media (max-width: 1023px) {
  .categories.is-enhanced .cat-panel {
    position: sticky;
    top: calc(var(--header-h-mobile) + 12px);
    transform-origin: 50% 0%;
  }
}

/* ---------- كمبيوتر: الأكورديون ---------- */
@media (min-width: 1024px) {
  .categories__stage {
    display: flex;
    gap: 6px;
    height: min(80vh, 780px);
    padding-inline: var(--gutter);
  }
  .cat-panel {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
  }
  .cat-panel__content { padding: var(--space-xl); }

  .categories.is-enhanced .cat-panel__rail {
    position: absolute;
    inset-block: var(--space-xl);
    inset-inline-start: 50%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    translate: 50% 0;
    pointer-events: none;
  }
  .cat-panel__vname {
    writing-mode: vertical-rl;
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 0.02em;
  }
  .categories.is-enhanced .cat-panel { cursor: pointer; }
}

/* قناع أسطر العنوان (SplitText): مساحة إضافية حتى لا تُقص نقاط الحروف تحت السطر */
.cat-panel__title div {
  padding-block: 0.12em 0.32em;
  margin-block: -0.12em -0.32em;
}
