/* ==========================================================================
   ساسان کلینیک · صفحه‌ی نمونه‌کارها
   ۱. پرونده‌ها: همان بخش صفحه‌ی اصلی (عکس‌ها کاشی‌به‌کاشی با fx.js باز می‌شوند).
   ۲. قبل و بعد: خط وسط هر عکس کشیدنی است و وقتی کسی با آن کار ندارد، آرام تکان می‌خورد.
   ۳. مراحل کار: ردیف‌های عکس که با اسکرول پهن‌تر می‌شوند (همان اندازه‌ها و رفتار مرجع).
   بدون اسکریپت یا با «کاهش حرکت» صفحه ساده و کامل دیده می‌شود.
   ========================================================================== */

/* ---------- ۲. قبل و بعد ---------- */
.cx-gal { position: relative; background: #fff; color: var(--ink); padding-block: clamp(88px, 14vh, 150px) clamp(72px, 11vh, 120px); }
.cx-gal .sec-title em, .cx-wall .sec-title em { font-style: normal; background: linear-gradient(100deg, var(--blue) 0%, #8A6CF5 55%, #D65A83 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cx-list { display: grid; gap: clamp(64px, 11vh, 128px); margin-top: clamp(36px, 6vh, 64px); }
.cx { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 4.5vw, 72px); align-items: center; }
.cx--alt .cx__media { order: 2; }

.ba {
  position: relative; isolation: isolate; overflow: hidden; margin: 0; aspect-ratio: 3 / 2; border-radius: 22px;
  background: var(--mist-2); cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 1px rgba(13, 27, 48, .06), 0 34px 60px -34px rgba(6, 16, 34, .55);
}
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.ba__b, .ba__hw { position: absolute; inset: 0; transform: translate3d(50%, 0, 0); }
.ba__b { overflow: hidden; }
.ba__b img { transform: translate3d(-50%, 0, 0); }
.ba__b, .ba__b img, .ba__hw { will-change: transform; }
.ba__hw { z-index: 2; pointer-events: none; }
.ba__ln { position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: #fff; box-shadow: 0 0 16px rgba(6, 16, 34, .35); }
.ba__k {
  position: absolute; top: 50%; left: 0; display: grid; place-items: center; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: rgba(255, 255, 255, .97); color: var(--navy-800); pointer-events: auto; cursor: grab; touch-action: pan-y;
  box-shadow: 0 0 0 1px rgba(13, 27, 48, .08), 0 12px 26px -10px rgba(6, 16, 34, .6);
  transition: transform .5s var(--spring), color .2s;
}
.ba__k:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.ba.is-drag { cursor: grabbing; }
.ba__k svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ba.is-drag .ba__k { transform: scale(1.12); color: var(--blue); cursor: grabbing; }
@media (hover: hover) and (pointer: fine) { .ba:hover .ba__k { transform: scale(1.06); } }
.ba__lb { position: absolute; top: 14px; z-index: 1; padding: 6px 13px; border-radius: 999px; background: rgba(7, 10, 30, .6); color: #fff; font-family: var(--f-ui); font-size: .8125rem; font-weight: 600; pointer-events: none; transition: opacity .3s var(--ease-out); }
.ba__lb--b { right: 14px; }
.ba__lb--a { left: 14px; }
.ba.no-b .ba__lb--b, .ba.no-a .ba__lb--a { opacity: 0; }

.cx__seg { position: relative; display: flex; gap: 4px; width: max-content; margin: 14px auto 0; padding: 4px; border-radius: 999px; background: var(--mist); box-shadow: inset 0 0 0 1px var(--line); }
.cx__seg button { position: relative; z-index: 1; height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font-family: var(--f-ui); font-size: .875rem; font-weight: 600; color: var(--ink-2); transition: color .25s; }
.cx__seg button[aria-pressed="true"] { color: #fff; }
.cx__seg-ind { position: absolute; top: 4px; left: 0; z-index: 0; height: 34px; width: var(--w, 0); border-radius: 999px; background: var(--navy-800); box-shadow: 0 6px 14px -6px rgba(13, 27, 48, .55); transform: translate3d(var(--x, 0), 0, 0); transition: transform .55s var(--spring), width .45s var(--spring); pointer-events: none; }
.cx__seg:not(.has-ind) button[aria-pressed="true"] { background: var(--navy-800); }
html.rm .cx__seg-ind { transition: none; }

.cx__meta { display: flex; align-items: center; gap: 12px; }
.cx__n { font-family: var(--f-ui); font-size: .875rem; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cx__n::after { content: ""; display: inline-block; width: 26px; height: 1px; margin-inline-start: 12px; vertical-align: middle; background: var(--line-2); }
.cx__tag { padding: 5px 12px; border-radius: 999px; background: #E6F3FC; color: #0F6FB0; font-family: var(--f-ui); font-size: .8125rem; font-weight: 600; }
.cx[data-t="white"] .cx__tag { background: #FFF6E0; color: #9A6A00; }
.cx[data-t="restore"] .cx__tag { background: #F1ECFF; color: #5B3FC4; }
.cx[data-t="clean"] .cx__tag { background: #E4F6F0; color: #0E7A5C; }
.cx__t { margin-top: 14px; font-size: clamp(1.35rem, 1.1rem + .9vw, 1.9rem); line-height: 1.45; }
.cx__p { margin-top: 12px; max-width: 46ch; color: var(--ink-2); line-height: 2; }
.cx__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.cx__facts > div { display: flex; flex-direction: column-reverse; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--mist); box-shadow: inset 0 0 0 1px var(--line); }
.cx__facts dt { font-family: var(--f-ui); font-size: .75rem; color: var(--ink-3); }
.cx__facts dd { font-family: var(--f-ui); font-size: .9375rem; font-weight: 700; color: var(--ink); }
.cx__shade { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; font-family: var(--f-ui); }
.cx__shade-h { flex-basis: 100%; font-size: .8125rem; color: var(--ink-3); }
.cx__sw { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-size: .875rem; font-weight: 700; direction: ltr; }
.cx__sw i { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(13, 27, 48, .12); }
.cx__sw small { font-size: .75rem; font-weight: 600; color: var(--ink-3); direction: rtl; }
.cx__shade .ic { width: 18px; height: 18px; color: var(--ink-3); }
.cx__book { display: inline-flex; align-items: center; gap: 10px; margin-top: 26px; height: 48px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--navy-800); color: #fff; font-size: .9375rem; font-weight: 600; box-shadow: 0 12px 24px -14px rgba(6, 16, 34, .8); transition: transform .6s var(--spring), background-color .25s; }
.cx__book .ic { width: 18px; height: 18px; transition: transform .5s var(--spring); }
.cx__book:hover { background: var(--blue); transform: translateY(-2px); }
.cx__book:hover .ic { transform: translateX(-4px); }
.cx__book:active { transform: translateY(1px); }

/* ورود هر نمونه: عکس کمی بزرگ‌تر شروع می‌شود و متن پله‌ای بالا می‌آید (اسکریپت) */
html.motion .cx.is-pre .cx__media, html.motion .cx.is-pre .cx__info > * { opacity: 0; }

/* ---------- ۳. مراحل کار ----------
   اندازه‌ها همان مرجع است: فاصله‌ی ردیف‌ها ۰٫۵rem، فاصله‌ی عکس‌ها ۱rem، هر ردیف ۹ عکس با نسبت ۷ به ۵،
   پهنای ردیف از ۱۲۵٪ تا ۵۰۰٪ (زیر ۱۰۰۰ پیکسل: ۲۵۰٪ تا ۷۵۰٪). پهنا و ارتفاع بخش را cases.js می‌گذارد. */
/* پایین بخش فاصله ندارد: تا ردیف‌های آخر کاملاً باز نشده‌اند، زیرشان خودبه‌خود جای خالی هست (همان رفتار مرجع) */
.cx-wall { position: relative; background: #fff; color: var(--ink); padding-block: clamp(40px, 7vh, 88px) 0; }
.cx-wall:not(.is-live) { padding-bottom: clamp(48px, 8vh, 96px); }
.cx-wall__rows { position: relative; width: 100%; margin-top: clamp(28px, 5vh, 56px); padding: .5rem 0; display: flex; flex-direction: column; align-items: center; gap: .5rem; overflow: hidden; contain: layout paint; }
.cx-wall__row { flex: none; width: 125%; display: flex; gap: 1rem; }
/* داخل هر کاشی نه برش (overflow) هست و نه جای‌گذاری (position): عوض شدن پهنا در هر فریم فقط چیدمان ساده‌ی بلوکی دارد */
.cx-wall__i { flex: 1; min-width: 0; margin: 0; aspect-ratio: 7 / 5; }
.cx-wall__i img { display: block; width: 100%; height: calc(100% - 1.25rem); object-fit: cover; background: var(--mist); }
.cx-wall__i figcaption { display: flex; justify-content: space-between; gap: 8px; height: 1.25rem; padding: .25rem 0; font-family: var(--f-ui); font-size: .75rem; font-weight: 500; line-height: 1; letter-spacing: -.01em; white-space: nowrap; color: var(--ink); }
.cx-wall__i figcaption span + span { color: var(--ink-3); }
/* زیرنویس ردیفی که هنوز برای متنش جا ندارد پنهان است و با باز شدن ردیف آرام پیدا می‌شود (کلاس را cases.js می‌گذارد) */
.cx-wall__row figcaption { transition: opacity .35s var(--ease-out); }
.cx-wall__row.no-cap figcaption { opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s linear .2s; }
/* بدون حرکت: چهار ردیف ثابت با عکس‌های درشت‌تر */
.cx-wall:not(.is-live) .cx-wall__row { width: 250%; }
.cx-wall:not(.is-live) .cx-wall__row:nth-child(n+5) { display: none; }
@media (max-width: 999px) {
  .cx-wall__row { width: 250%; }
  .cx-wall:not(.is-live) .cx-wall__row { width: 500%; }
}

/* ---------- پرونده‌ها ---------- */
.cs-page#cases { padding-top: clamp(72px, 11vh, 120px); border-top: 0; }
#cases.cs-page .cs-list { margin-top: clamp(28px, 5vh, 48px); }

/* ---------- موبایل ---------- */
@media (max-width: 899px) {
  .cx, .cx--alt { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .cx--alt .cx__media { order: 0; }
  .ba { border-radius: 18px; }
  .ba__k { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  .cx__facts { gap: 8px; }
  .cx__facts > div { padding: 10px 12px; }
  .cx__book { width: 100%; justify-content: center; }
}
@media (max-width: 520px) {
  .cx__facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cx__facts dd { font-size: .875rem; }
  .cx__seg button { padding: 0 14px; }
}
