/* Purple Card Carousel (PCS) - Background Bleed Fix */

.pcs-wrapper {
	position: relative;
	--edge-color: #0F0726;
	--edge-width: 160px;
	--card-radius: 24px;
	--gap: 24px;
	--w0: 451px;
	--h0: 416px;
	--w1: 280px;
	--h1: 360px;
	--w2: 220px;
	--h2: 320px;
	--w3: 180px;
	--h3: 300px;
	--inner-gradient: #0F0726;
	/* offsets for spacing */
	--offset-near: 385px;
	--offset-mid: 640px;
	--offset-far: 900px;
	--offset-hidden: 1200px;
	
	/* Fix background bleed */
	overflow: hidden !important;
	background: transparent !important;
	isolation: isolate; /* ایجاد stacking context جدید */
}

.pcs-wrapper::before,
.pcs-wrapper::after {
	content: "";
	position: absolute;
	top: 0;
	width: var(--edge-width);
	height: 100%;
	z-index: 100; /* خیلی بالا */
	pointer-events: none;
}
.pcs-wrapper::before {
	left: 0;
	background: linear-gradient(to right, var(--edge-color), rgba(15, 7, 38, 0));
}
.pcs-wrapper::after {
	right: 0;
	background: linear-gradient(to left, var(--edge-color), rgba(15, 7, 38, 0));
}

.pcs-slider {
	position: relative;
	z-index: 1;
	overflow: hidden !important; /* مهم */
	isolation: isolate;
}

.pcs-track {
	display: block;
	position: relative;
	height: calc(var(--h0) + 80px);
	padding: 24px calc(var(--edge-width) + 8px);
	overflow: hidden !important; /* کلیدی برای جلوگیری از نشت */
	isolation: isolate;
	background: transparent;
}

.pcs-slide {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	display: block;
	text-decoration: none;
	color: inherit;
	width: var(--w3);
	height: var(--h3);
	transition: transform .45s ease, opacity .35s ease, width .35s ease, height .35s ease, filter .35s ease;
	opacity: .55;
	isolation: isolate; /* جدا کردن stacking context */
	contain: layout style paint; /* performance و جلوگیری از نشت */
}

/* positions */
.pcs-slide.pcs_pos_1 {
	width: var(--w0);
	height: var(--h0);
	transform: translate(-50%, -50%) scale(1);
	z-index: 10;
	opacity: 1;
	filter: none;
}
.pcs-slide.pcs_pos_2 {
	width: var(--w1);
	height: var(--h1);
	transform: translate(calc(-50% + var(--offset-near)), -50%) scale(.94);
	z-index: 9;
	opacity: .92;
	filter: blur(.5px);
}
.pcs-slide.pcs_pos_9 {
	width: var(--w1);
	height: var(--h1);
	transform: translate(calc(-50% - var(--offset-near)), -50%) scale(.94);
	z-index: 9;
	opacity: .92;
	filter: blur(.5px);
}
.pcs-slide.pcs_pos_3 {
	width: var(--w2);
	height: var(--h2);
	transform: translate(calc(-50% + var(--offset-mid)), -50%) scale(.82);
	z-index: 8;
	opacity: .8;
	filter: blur(1px);
}
.pcs-slide.pcs_pos_8 {
	width: var(--w2);
	height: var(--h2);
	transform: translate(calc(-50% - var(--offset-mid)), -50%) scale(.82);
	z-index: 8;
	opacity: .8;
	filter: blur(1px);
}
.pcs-slide.pcs_pos_4 {
	width: var(--w3);
	height: var(--h3);
	transform: translate(calc(-50% + var(--offset-far)), -50%) scale(.7);
	z-index: 7;
	opacity: .68;
	filter: blur(2px);
}
.pcs-slide.pcs_pos_7 {
	width: var(--w3);
	height: var(--h3);
	transform: translate(calc(-50% - var(--offset-far)), -50%) scale(.7);
	z-index: 7;
	opacity: .68;
	filter: blur(2px);
}
.pcs-slide.pcs_pos_5 {
	transform: translate(calc(-50% + var(--offset-hidden)), -50%) scale(.6);
	opacity: .45;
	z-index: 6;
	filter: blur(6px);
}
.pcs-slide.pcs_pos_6 {
	transform: translate(calc(-50% - var(--offset-hidden)), -50%) scale(.6);
	opacity: .45;
	z-index: 6;
	filter: blur(6px);
}

.pcs-card {
	position: relative;
	width: 100%;
	height: 100%;
	border-radius: var(--card-radius);
	overflow: hidden !important; /* مهم */
	box-shadow: 0 12px 40px rgba(0,0,0,.35);
	background: #000; /* fallback background */
	isolation: isolate;
	contain: layout style paint;
}
.pcs-card__img {
	width: 100%;
	height: 100%;
	min-width: 100%;
	min-height: 100%;
	object-fit: cover !important;
	object-position: center center;
	display: block;
	position: relative;
	z-index: 1;
}
.pcs-card__img-wrap {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden !important; /* کلیدی */
	isolation: isolate;
}
.pcs-card__img-wrap::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 70%;
	background: linear-gradient(to top, var(--inner-gradient), rgba(15,7,38,0));
	pointer-events: none;
	z-index: 2;
}

.pcs-card__content {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	padding: 18px 18px 20px 18px;
	color: #fff;
	z-index: 3;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.pcs-title {
	margin: 0 0 8px 0;
	line-height: 1.35;
	color: #fff;
}
.pcs-sub {
	display: flex;
	align-items: center;
	gap: 10px;
	color: #cfd0d8;
}
.pcs-sub .pcs-sub__icon {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255,255,255,.08);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
}

/* wrapper جداگانه برای آیکون */
.pcs-icon-wrapper {
	position: absolute;
	display: inline-flex;
	flex-shrink: 0;
	z-index: 4;
}

/* ――――――― موقعیت‌های مختلف آیکون ――――――― */

/* آیکون بالا-چپ */
.pcs-icon-pos-top-left {
	top: 18px;
	left: 18px;
}

/* آیکون بالا-راست */
.pcs-icon-pos-top-right {
	top: 18px;
	right: 18px;
}

/* آیکون پایین-چپ */
.pcs-icon-pos-bottom-left {
	bottom: 20px;
	left: 18px;
}

/* آیکون پایین-راست */
.pcs-icon-pos-bottom-right {
	bottom: 20px;
	right: 18px;
}

.pcs-nav {
    position: absolute;
	top: 50%;
	transform: translateY(-50%);
    backdrop-filter: blur(4px);
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    padding: 8px !important;
    width: 44px !important;
    height: 64px !important;
    border-radius: 248px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    color: #fff !important;
    font-size: 18px;
	line-height: 44px;
	text-align: center;
	cursor: pointer;
	z-index: 200; /* خیلی بالاتر از همه */
}

.pcs-nav--prev { left: 16px; }
.pcs-nav--next { right: 16px; }
.pcs-nav svg { pointer-events: none; }

/* ――――――― تبلت: 768-991px ――――――― */
@media (min-width: 768px) and (max-width: 991px) {
  .pcs-wrapper {
    --edge-width: 56px;
    --w0: 72vw;  --h0: 54vw;
    --w1: 50vw;  --h1: 40vw;
    --w2: 42vw;  --h2: 34vw;
    --w3: 36vw;  --h3: 30vw;
    --offset-near: 40vw;
    --offset-mid:  62vw;
    --offset-far:  84vw;
    --offset-hidden: 112vw;
  }

  .pcs-slide { 
    width: auto !important; 
    max-width: none !important; 
  }

  .pcs-slide.pcs_pos_1 { width: var(--w0) !important; height: var(--h0) !important; }
  .pcs-slide.pcs_pos_2,
  .pcs-slide.pcs_pos_9 { width: var(--w1) !important; height: var(--h1) !important; }
  .pcs-slide.pcs_pos_3,
  .pcs-slide.pcs_pos_8 { width: var(--w2) !important; height: var(--h2) !important; }
  .pcs-slide.pcs_pos_4,
  .pcs-slide.pcs_pos_7 { width: var(--w3) !important; height: var(--h3) !important; }

  .pcs-track { padding: 16px calc(var(--edge-width) + 6px); }
}

/* ――――――― موبایل: ≤ 767px - Background Bleed Fix ――――――― */
@media (max-width: 767px) {
  .pcs-wrapper {
    --edge-width: 16px !important;
    --w0: 70vw !important;  
    --h0: 56vw !important;
    --w1: 55vw !important;  
    --h1: 46vw !important;
    --w2: 45vw !important;  
    --h2: 38vw !important;
    --w3: 38vw !important;  
    --h3: 32vw !important;
    
    --offset-near:   28vw !important;
    --offset-mid:    48vw !important;
    --offset-far:    68vw !important;
    --offset-hidden: 90vw !important;
    
    /* فیکس کلیدی برای موبایل */
    overflow: hidden !important;
    contain: layout style paint !important;
    isolation: isolate !important;
    background: transparent !important;
  }

  .pcs-card__content {
    gap: 2px;
  }

  .pcs-track { 
    padding: 12px calc(var(--edge-width) + 2px) !important;
    overflow: hidden !important; /* خیلی مهم */
    contain: layout style paint !important;
    background: transparent !important;
  }

  .pcs-slide { 
    width: auto !important; 
    max-width: none !important;
    min-width: unset !important;
    contain: layout style paint !important; /* جلوگیری از نشت */
    isolation: isolate !important;
  }

  /* کلیپ کردن slides که خارج از محدوده هستند */
  .pcs-slide.pcs_pos_5,
  .pcs-slide.pcs_pos_6 {
    clip-path: inset(0) !important; /* کلیپ محتوا */
    opacity: 0 !important; /* مخفی کامل */
    visibility: hidden !important;
  }

  .pcs-slide.pcs_pos_1 { 
    width: var(--w0) !important; 
    height: var(--h0) !important; 
  }
  .pcs-slide.pcs_pos_2,
  .pcs-slide.pcs_pos_9 { 
    width: var(--w1) !important; 
    height: var(--h1) !important; 
  }
  .pcs-slide.pcs_pos_3,
  .pcs-slide.pcs_pos_8 { 
    width: var(--w2) !important; 
    height: var(--h2) !important; 
  }
  .pcs-slide.pcs_pos_4,
  .pcs-slide.pcs_pos_7 { 
    width: var(--w3) !important; 
    height: var(--h3) !important; 
  }

  .pcs-wrapper::before,
  .pcs-wrapper::after {
    width: var(--edge-width) !important;
    z-index: 150 !important;
    background: linear-gradient(to right, var(--edge-color), rgba(15, 7, 38, 0)) !important;
  }
  .pcs-wrapper::after {
    background: linear-gradient(to left, var(--edge-color), rgba(15, 7, 38, 0)) !important;
  }

  /* فیکس خاص iOS Safari */
  .pcs-card {
    transform: translateZ(0) !important; /* hardware acceleration */
    -webkit-transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
  }
  
  .pcs-card__img {
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
  }
}

/* ――――――― موبایل خیلی کوچک: ≤ 480px ――――――― */
@media (max-width: 480px) {
  .pcs-wrapper {
    --edge-width: 12px !important;
    --offset-near: 25vw !important;
    --offset-mid: 45vw !important;
  }

  .pcs-card__content {
    gap: 2px;
  }
  
  /* دکمه‌های ناوبری خیلی کوچک در موبایل کوچک */
  .pcs-nav {
    width: 32px !important;
    height: 42px !important;
    font-size: 12px !important;
    padding: 4px !important;
  }
  
  /* آیکون محتوا خیلی کوچک */
  .pcs-sub .pcs-sub__icon {
    width: 24px !important;
    height: 24px !important;
  }
  
  .pcs-nav--prev { left: 8px !important; z-index: 250 !important; }
  .pcs-nav--next { right: 8px !important; z-index: 250 !important; }
}

/* ――――――― کنترل نمایش آیکون در دستگاه‌های مختلف ――――――― */
.pcs-icon-hide-all { display: none !important; }

/* ――――――― کنترل نمایش آیکون در دستگاه‌های مختلف ――――――― */
@media (max-width: 991px) {
  .pcs-icon-hide-tablet {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .pcs-icon-hide-mobile {
    display: none !important;
  }
}

/* ――――――― کنترل نمایش دکمه‌های ناوبری در دستگاه‌های مختلف ――――――― */
@media (max-width: 991px) {
  .pcs-nav-hide-tablet {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .pcs-nav-hide-mobile {
    display: none !important;
  }
}

@media (max-width: 991px) {
  .pcs-nav--prev { left: 10px; z-index: 250; }
  .pcs-nav--next { right: 10px; z-index: 250; }

  /* آیکون کنار توضیحات در تبلت و موبایل */
  .pcs-sub .pcs-sub__icon {
    width: 30px !important;
    height: 30px !important;
  }
}