/* =========================================================
   زمینه‌های همکاری — کارت‌های شیشه‌ای لایه‌لایه
   ⚠️ روی والدهای زنجیره‌ی preserve-3d (deck__card → deck__inner →
   deck__visual → iso) هرگز overflow: hidden نگذارید؛ عمق صاف می‌شود.
   ========================================================= */

.coop {
  --n: 4;
  position: relative;
  height: 420vh;
  background: var(--bg);
}

.coop__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  padding-top: calc(var(--header-h) + clamp(16px, 3vh, 40px));
  padding-bottom: clamp(24px, 5vh, 56px);
}

.coop__glow {
  position: absolute;
  z-index: -1;
  inset: auto -20% -30% -20%;
  height: 90%;
  background:
    radial-gradient(45% 50% at 50% 60%, rgba(255, 106, 0, .16), transparent 70%),
    radial-gradient(30% 30% at 20% 40%, rgba(255, 150, 70, .07), transparent 70%);
  pointer-events: none;
}

/* ---------- سرتیتر و نشانگر ---------- */
.coop__head {
  position: relative;
  z-index: 5;                      /* کارت خارج‌شونده از زیر عنوان رد شود */
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--gutter);
  margin-bottom: clamp(20px, 4vh, 44px);
}

.coop__title {
  margin: 0;
  font-size: var(--fs-h);
  font-weight: 800;
  line-height: 1.3;
  color: var(--brand);
}

.coop__steps {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.coop__step {
  position: relative;
  display: block;
  width: 44px;
  height: 24px;               /* ناحیه‌ی کلیک بزرگ، خط باریک */
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.coop__step span {
  position: absolute;
  inset: 50% 0 auto 0;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}
.coop__step span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--brand);
  transform: scaleX(var(--fill, 0));
  transform-origin: right center;
}
.coop__step:hover span { background: rgba(255, 255, 255, .3); }
.coop__step:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }

/* ---------------------------------------------------------
   دسته‌ی کارت‌ها
   --------------------------------------------------------- */
.deck {
  position: relative;
  flex: 1;
  min-height: 0;
  perspective: 1700px;
  perspective-origin: 50% 0%;
  /* بدون preserve-3d: ترتیب کارت‌ها با z-index (از JS) قطعی است، نه با مرتب‌سازی عمق مرورگر */
  /* لبه‌ی بالا نرم محو می‌شود: کارت خارج‌شونده به‌جای عبور از روی عنوان، زیر این لبه آرام ناپدید می‌شود */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 72px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 72px);
}

.deck__card {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(1100px, calc(100% - var(--gutter) * 2));
  height: min(520px, calc(100% - 50px));
  transform-style: preserve-3d;
  will-change: transform, opacity;
  pointer-events: none;
}
.deck__card.is-front { pointer-events: auto; }

.deck__inner {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(28px, 3.6vw, 60px);
  border-radius: 30px;
  background:
    radial-gradient(70% 90% at 0% 100%, rgba(255, 106, 0, .16), transparent 60%),
    linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .015) 42%),
    #150a04;                       /* کاملاً مات: متن کارت‌های پشتی نباید دیده شود */
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .1),
    0 60px 120px -50px rgba(0, 0, 0, .95),
    0 0 0 1px rgba(0, 0, 0, .4);
  transform-style: preserve-3d;
}
/* لبه‌ی نورانی بالای شیشه */
.deck__inner::before {
  content: "";
  position: absolute;
  inset: 0 12% auto 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 190, 140, .7), transparent);
}

/* ---------- متن ---------- */
.deck__copy { transform: translateZ(30px); }
.deck__title {
  margin: 0 0 clamp(16px, 2.4vh, 26px);
  font-size: var(--fs-h);
  font-weight: 800;
  line-height: 1.4;
  color: #fff;
  text-wrap: balance;
}
.deck__list { margin: 0; padding: 0; list-style: none; }
.deck__list li {
  position: relative;
  padding: clamp(9px, 1.4vh, 14px) 24px clamp(9px, 1.4vh, 14px) 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: var(--fs-t);
  font-weight: 300;
  line-height: 1.85;
  color: var(--fg-dim);
  text-wrap: pretty;
}
.deck__list li:last-child { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.deck__list li::before {
  content: "";
  position: absolute;
  right: 2px;
  top: calc(clamp(9px, 1.4vh, 14px) + .92em - 3px);
  width: 6px;
  height: 6px;
  background: var(--brand);
  transform: rotate(45deg);
}
/* ورود آبشاری بندها وقتی کارت جلو می‌آید */
.deck__list li { opacity: .35; transform: translate3d(0, 8px, 0); transition: opacity .6s var(--ease-out), transform .7s var(--ease-out); }
.deck__card.is-front .deck__list li { opacity: 1; transform: none; }
.deck__card.is-front .deck__list li:nth-child(2) { transition-delay: .07s; }
.deck__card.is-front .deck__list li:nth-child(3) { transition-delay: .14s; }
.deck__card.is-front .deck__list li:nth-child(4) { transition-delay: .21s; }

/* ---------- نور جاروبی روی شیشه ---------- */
.deck__sweep {
  position: absolute;
  inset: 0;
  border-radius: 30px;
  overflow: hidden;          /* فقط خودش؛ والد preserve-3d بماند */
  pointer-events: none;
  transform: translateZ(1px);
}
.deck__sweep::before {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 38%;
  left: -50%;
  background: linear-gradient(100deg, transparent, rgba(255, 170, 110, .10) 40%, rgba(255, 220, 190, .16) 50%, rgba(255, 170, 110, .10) 60%, transparent);
  transform: skewX(-12deg);
  opacity: 0;
}
.deck__card.is-front .deck__sweep::before { animation: sweep 1.6s var(--ease-out) .1s 1 both; }
@keyframes sweep {
  0%   { left: -50%; opacity: 0; }
  15%  { opacity: 1; }
  100% { left: 120%; opacity: 0; }
}

/* ---------------------------------------------------------
   شیء ایزومتریک لایه‌ای (هم‌خانواده‌ی کارت‌های خدمات)
   --------------------------------------------------------- */
.deck__visual {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  transform: translateZ(60px);
}
.deck__visual::before {        /* هاله‌ی زیر شیء */
  content: "";
  position: absolute;
  width: 80%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 106, 0, .22), transparent);
  transform: translateZ(-40px);
}

.iso {
  --sz: clamp(190px, 19vw, 290px);
  --gap: 18px;
  position: relative;
  width: var(--sz);
  height: var(--sz);
  transform-style: preserve-3d;
  transform: rotateX(56deg) rotateZ(-40deg);
  animation: iso-bob 6s ease-in-out infinite;
}
.deck__card.is-front .iso { --gap: 32px; }
@keyframes iso-bob { 0%, 100% { translate: 0 0 0; } 50% { translate: 0 0 16px; } }

.iso__layer {
  position: absolute;
  inset: 8%;
  border-radius: 16px;
  transform: translateZ(calc(var(--i) * var(--gap)));
  transition: transform 1s var(--ease-out);
}
.iso__layer svg { display: block; width: 100%; height: 100%; overflow: visible; }

.iso__layer--board {
  background: linear-gradient(135deg, #3a1504, #1f0b03);
  box-shadow: 0 0 0 1px rgba(255, 140, 60, .32), 0 40px 60px rgba(0, 0, 0, .6);
}
.iso__layer--glass {
  background: linear-gradient(135deg, rgba(255, 255, 255, .10), rgba(255, 140, 60, .05));
  box-shadow: inset 0 0 0 1px rgba(255, 200, 160, .45), inset 0 0 30px rgba(255, 106, 0, .12);
}
.iso__layer--solid {
  inset: 18%;
  border-radius: 12px;
  background:
    linear-gradient(to top right, rgba(255, 255, 255, .14) 50%, transparent 50%),
    linear-gradient(135deg, #ff9a3d, #ff6a00 55%, #e8500c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .35), 0 24px 40px -10px rgba(255, 106, 0, .65);
}

/* رنگ‌بندی SVGها */
.iso .ln    { fill: none; stroke: rgba(255, 220, 190, .75); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.iso .ln.w  { stroke: #fff; stroke-width: 3.6; }
.iso .ln.o  { stroke: #ff6a00; stroke-width: 4; }
.iso .faint { stroke: rgba(255, 200, 160, .22); stroke-width: 1.6; }
.iso .dash  { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 1.6; stroke-dasharray: 3 4; }
.iso .fl    { fill: #ff8a2a; }
.iso .wf    { fill: #fff; }
.iso .of    { fill: #ff6a00; }
.iso .c1    { fill: #ff6a00; }
.iso .c2    { fill: #ffb26b; }
.iso .c3    { fill: #fff3e8; }
.iso .eq rect { transform-box: fill-box; transform-origin: 50% 50%; animation: iso-eq 1.2s ease-in-out infinite; }
.iso .eq rect:nth-child(2n) { animation-delay: -.4s; }
.iso .eq rect:nth-child(3n) { animation-delay: -.8s; }
@keyframes iso-eq { 0%, 100% { transform: scaleY(.6); } 50% { transform: scaleY(1.1); } }

/* ---------------------------------------------------------
   ریسپانسیو
   --------------------------------------------------------- */
@media (max-width: 1023px) {
  .coop { height: 400vh; }
  .coop__sticky { padding-top: calc(var(--header-h) + 14px); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .coop__head { margin-bottom: 16px; }
  .deck__card { height: calc(100% - 26px); margin-bottom: 0; }
  .deck__inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: center;           /* محتوا وسط کارت، نه چسبیده به بالا */
    align-items: start;
    gap: 6px;
    padding: 22px 22px 18px;
    border-radius: 24px;
  }
  .deck__sweep { border-radius: 24px; }
  .deck__visual { grid-row: 1; height: clamp(150px, 26vh, 240px); }
  .deck__copy { grid-row: 2; }
  .iso { --sz: clamp(120px, 20vh, 190px); }
  .deck__card.is-front .iso { --gap: 22px; }
  .iso__layer { border-radius: 12px; }
}

@media (max-width: 559px) {
  .coop__title { white-space: nowrap; }
  .coop__steps { gap: 6px; }
  .coop__step { width: 24px; }
  .deck__title { margin-bottom: 10px; line-height: 1.45; }
  .deck__list li { line-height: 1.75; padding: 7px 18px 7px 0; }
  .deck__list li::before { top: calc(7px + .875em - 3px); right: 0; width: 5px; height: 5px; }
}

/* گوشی‌های کوتاه */
@media (max-width: 559px) and (max-height: 700px) {
  .deck__visual { height: 112px; }
  .iso { --sz: 92px; }
  .deck__card.is-front .iso { --gap: 14px; }
  .deck__list li { line-height: 1.7; padding: 5px 16px 5px 0; }
  .deck__list li::before { top: calc(5px + .85em - 3px); }
}

@media (prefers-reduced-motion: reduce) {
  .iso, .iso .eq rect { animation: none; }
  .deck__card.is-front .deck__sweep::before { animation: none; }
  .deck__list li { transition-duration: .01s !important; transition-delay: 0s !important; }
}
