/* Home page slider (inc/slider.php + assets/js/slider.js), also shown in the admin preview.
   Each slide carries --o (its distance from the current slide, positive = to the left) and --a (that distance
   without the sign); each style below turns them into a place on the stage. --drag follows a finger (share of the width). */
.promo {
  --sw: 80cqw;          /* slide width */
  --gap: 2.2cqw;
  --pad: 18px;
  --promo-ease: cubic-bezier(.22, .8, .24, 1);
  --drag: 0;
  position: relative;
  container-type: inline-size;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}
.promo-section { padding-top: clamp(28px, 4vw, 52px); }
.section.after-promo { padding-top: clamp(28px, 4vw, 48px); }
.promo[data-style="stack"] { --sw: 64cqw; }
.promo[data-style="fade"] { --sw: 100cqw; }
@container (max-width: 640px) {
  .promo-vp { --sw: 88cqw; --gap: 3cqw; }
  .promo[data-style="stack"] .promo-vp { --sw: 76cqw; }
  .promo[data-style="fade"] .promo-vp { --sw: 100cqw; }
}

.promo-vp { position: relative; height: calc(var(--sw) * .375 + var(--pad) * 2); overflow: hidden; touch-action: pan-y; cursor: grab; }
/* The slides peeking in at the two sides fade out softly, like the product rails; the fade stops where the middle
   slide starts, so the current picture stays sharp (and a full-width style gets no fade at all). */
.promo-vp {
  --edge: max(0px, (100cqw - var(--sw)) / 2);
  mask-image: linear-gradient(to right,
    transparent 0, rgb(0 0 0 / .1) calc(var(--edge) * .3), rgb(0 0 0 / .42) calc(var(--edge) * .58), rgb(0 0 0 / .82) calc(var(--edge) * .84), #000 var(--edge),
    #000 calc(100% - var(--edge)), rgb(0 0 0 / .82) calc(100% - var(--edge) * .84), rgb(0 0 0 / .42) calc(100% - var(--edge) * .58), rgb(0 0 0 / .1) calc(100% - var(--edge) * .3), transparent 100%);
}
.promo.is-dragging .promo-vp { cursor: grabbing; }
.promo-slide {
  position: absolute; top: var(--pad); left: 50%;
  width: var(--sw); aspect-ratio: 8 / 3;
  display: block; overflow: hidden; border-radius: clamp(12px, 1.6cqw, 22px);
  background: rgba(255, 255, 255, .06);
  box-shadow: 0 16px 34px rgba(0, 8, 30, .38);
  transition: transform .75s var(--promo-ease), opacity .75s var(--promo-ease), filter .75s var(--promo-ease);
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.promo-slide picture, .promo-slide img { display: block; width: 100%; height: 100%; }
.promo-slide img { object-fit: cover; pointer-events: none; }
.promo-slide:focus-visible { outline: 3px solid var(--gold, #F0A808); outline-offset: 3px; }
.promo-slide.is-far { visibility: hidden; opacity: 0 !important; }
.promo-slide.is-jump, .promo.is-dragging .promo-slide, .promo:not(.is-ready) .promo-slide { transition: none; }
.promo-slide:not(.is-on) { cursor: pointer; }

/* شرائح: the slide in the middle, its neighbours peeking in at the sides, a little smaller and dimmer. */
.promo[data-style="peek"] .promo-slide {
  transform: translateX(calc(-50% + var(--drag) * 100cqw - var(--o) * (var(--sw) + var(--gap)))) scale(calc(1 - min(var(--a), 1) * .07));
  opacity: calc(1 - min(var(--a), 1) * .45);
}

/* كروت 3D: a fanned deck, the side cards turned towards the middle and pushed back. */
.promo[data-style="stack"] .promo-vp { perspective: 1600px; }
.promo[data-style="stack"] .promo-slide {
  z-index: calc(10 - var(--a));
  transform: translateX(calc(-50% + var(--drag) * 100cqw - var(--o) * var(--sw) * .36)) rotateY(calc(var(--o) * 20deg)) scale(calc(1 - min(var(--a), 2) * .12));
  filter: brightness(calc(1 - min(var(--a), 2) * .22));
}

/* تلاشي: one picture fades into the next while it slowly settles from a slight zoom. */
.promo[data-style="fade"] .promo-slide {
  transform: translateX(calc(-50% + var(--drag) * 30cqw));
  opacity: calc(1 - min(var(--a), 1));
  transition-duration: .9s;
  box-shadow: none;
}
.promo[data-style="fade"] .promo-slide.is-on { z-index: 2; }
.promo[data-style="fade"] .promo-slide.is-on img { animation: promo-settle calc(var(--secs, 5s) + 1s) ease-out both; }
@keyframes promo-settle { from { transform: scale(1.09); } to { transform: scale(1); } }

/* Arrows on the stage's two edges, shown when a mouse is over it. */
.promo-arrow {
  position: absolute; z-index: 20; top: calc(var(--pad) + var(--sw) * .1875); translate: 0 -50%;
  width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .96); color: #001D61; box-shadow: 0 10px 26px rgba(0, 8, 30, .4);
  cursor: pointer; opacity: 0; transform: scale(.85);
  transition: opacity .25s, transform .2s cubic-bezier(.16, 1, .3, 1), background-color .2s;
}
.promo-arrow.is-right { right: clamp(6px, 1.4cqw, 18px); }
.promo-arrow.is-left { left: clamp(6px, 1.4cqw, 18px); }
.promo-arrow .ico { width: 22px; height: 22px; }
.promo:hover .promo-arrow, .promo-arrow:focus-visible { opacity: 1; transform: none; }
.promo-arrow:hover { background: var(--gold, #F0A808); transform: scale(1.08); }
.promo-arrow:active { transform: scale(.94); }
@media (hover: none) { .promo-arrow { display: none; } }

/* Dots: the current one stretches into a bar that fills up over the chosen seconds, then the next slide comes. */
.promo-dots { display: flex; justify-content: center; align-items: center; gap: 7px; margin-top: 2px; }
.promo-dots button { position: relative; width: 9px; height: 9px; padding: 0; border: 0; border-radius: 99px; background: rgba(207, 228, 247, .32); cursor: pointer; overflow: hidden; transition: width .4s var(--promo-ease), background-color .25s; }
.promo-dots button::before { content: ""; position: absolute; inset: -10px -4px; } /* a bigger target for fingers */
.promo-dots button:hover { background: rgba(207, 228, 247, .55); }
.promo-dots button.is-on { width: 34px; background: rgba(207, 228, 247, .28); }
.promo-dots i { position: absolute; inset: 0; border-radius: inherit; background: var(--gold, #F0A808); transform-origin: right; transform: scaleX(0); }
.promo-dots button.is-on i { transform: scaleX(1); }
.promo.is-auto .promo-dots button.is-on i { animation: promo-fill var(--secs, 5s) linear both; }
.promo.is-auto.is-held .promo-dots button.is-on i { animation-play-state: paused; }
@keyframes promo-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.promo-dots button:focus-visible { outline: 2px solid var(--gold, #F0A808); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .promo-slide { transition-duration: .01s; }
  .promo[data-style="fade"] .promo-slide.is-on img { animation: none; }
}
