/* ==========================================================
   القسم 7: «شاهد القطعة» — مسرح الريلز
   خلفية سوداء سينمائية. الريل في المنتصف كبير ويعمل،
   والبقية على الجانبين مائلة بعمق ثلاثي الأبعاد.
   ========================================================== */

.reels {
  position: relative;
  background: var(--c-ink);
  color: var(--c-white);
  padding-block: var(--space-2xl);
  overflow: hidden;
}

/* الرأس */
.reels__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.reels__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--c-rose);
}
.reels__eyebrow::before { content: ""; width: 24px; height: 1px; background: currentColor; }
.reels__title {
  font-size: clamp(2.25rem, 1.5rem + 3.5vw, 4.25rem);
  line-height: 1.15;
  margin-top: var(--space-xs);
}
.reels__title em { font-style: normal; color: var(--c-rose); }
.reels__title div { padding-block: 0.12em 0.32em; margin-block: -0.12em -0.32em; }
.reels__lead { color: rgba(255, 255, 255, 0.7); font-size: var(--fs-sm); margin-top: var(--space-2xs); }

.reels__controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.reels__count {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.5);
  min-width: 70px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.reels__count strong { color: var(--c-white); font-weight: 400; }
.reels__arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  color: var(--c-white);
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.reels__arrow:hover { background: var(--c-white); color: var(--c-ink); }
.reels__arrow .icon { width: 20px; height: 20px; }
.reels__arrow--prev .icon { transform: rotate(-90deg); }   /* RTL: السابق يمين */
.reels__arrow--next .icon { transform: rotate(90deg); }

/* ---------- المسرح ---------- */
.reels__stage {
  position: relative;
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-inline: var(--gutter);
}
.reels__stage::-webkit-scrollbar { display: none; }

.reel {
  position: relative;
  flex-shrink: 0;
  width: min(72vw, 300px);
  aspect-ratio: 9 / 16;
  scroll-snap-align: center;
  background: #1f1a1a;
  overflow: hidden;
  isolation: isolate;
}
.reel__media,
.reel__media img,
.reel__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reel__media img + img { opacity: 0; }
/* تدرّجات للقراءة أعلى وأسفل */
.reel::before,
.reel::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  z-index: 1;
  pointer-events: none;
}
.reel::before { top: 0; height: 28%; background: linear-gradient(180deg, rgba(17, 17, 17, 0.55), rgba(17, 17, 17, 0)); }
.reel::after { bottom: 0; height: 45%; background: linear-gradient(0deg, rgba(17, 17, 17, 0.8), rgba(17, 17, 17, 0)); }

/* شريط التقدّم بأسلوب القصص */
.reel__progress {
  position: absolute;
  top: 10px;
  inset-inline: 10px;
  z-index: 2;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
}
.reel__progress span {
  position: absolute;
  inset: 0;
  background: var(--c-white);
  transform-origin: 100% 50%;
  transform: scaleX(0);
}
.reel__top {
  position: absolute;
  top: 20px;
  inset-inline: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.reel__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
}
.reel__avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c-white);
  box-shadow: 0 0 0 1.5px var(--c-rose);
}
.reel__avatar img { width: 18px; height: auto; }
.reel__brand strong { font-weight: 500; letter-spacing: 0.05em; }
.reel__tag {
  padding: 2px 10px;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  backdrop-filter: none;
}
.reel__sound {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--c-white);
}
.reel__sound .icon { width: 18px; height: 18px; }

.reel__info {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  padding: var(--space-md);
}
.reel__name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  line-height: 1.3;
}
.reel__price { font-size: var(--fs-sm); margin-block: 2px var(--space-sm); }
.reel__price s { color: rgba(255, 255, 255, 0.55); margin-inline-start: 6px; font-size: var(--fs-xs); }
.reel__price strong { font-weight: 500; }
.reel__actions { display: flex; gap: 6px; }
.reel__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: var(--fs-sm);
  font-weight: 500;
  background: var(--c-white);
  color: var(--c-ink);
  transition: background-color var(--dur-fast);
}
.reel__btn:hover { background: var(--c-nude); }
.reel__btn--ghost {
  flex: 0 0 44px;
  background: transparent;
  color: var(--c-white);
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.reel__btn--ghost:hover { background: rgba(255, 255, 255, 0.12); }
.reel__btn .icon { width: 18px; height: 18px; }

/* ستار التعتيم للريلز الجانبية (يتحكم فيه GSAP) */
.reel__dim {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--c-ink);
  opacity: 0;
  pointer-events: none;
}

/* ---------- الوضع المحسّن: مسرح ثلاثي الأبعاد ---------- */
.reels.is-enhanced .reels__stage {
  display: block;
  overflow: visible;
  height: calc(min(72vw, 300px) * 16 / 9);
  perspective: 1400px;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}
.reels.is-enhanced .reels__stage.is-dragging { cursor: grabbing; }
.reels.is-enhanced .reel {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: calc(min(72vw, 300px) / -2);
  transform-style: preserve-3d;
  will-change: transform;
}
.reels.is-enhanced .reel:not(.is-active) .reel__info,
.reels.is-enhanced .reel:not(.is-active) .reel__sound { pointer-events: none; }

@media (min-width: 1024px) {
  .reel { width: 320px; }
  .reels.is-enhanced .reels__stage { height: calc(320px * 16 / 9); }
  .reels.is-enhanced .reel { margin-left: -160px; }
}
