/*
 * Single product: related products carousel (single-product/related.php)
 * and «سایر محصولات تیک۴» under the sales-stopped notice
 * (template-parts/studio/other-products.php).
 */

/* ---------- related products carousel ---------- */
.t4-rel { position: relative; }
.t4-rel__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.t4-rel__heading { min-width: 0; }
.t4-rel__kicker { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 4px; color: var(--t4-blue); font-size: 12.5px; font-weight: 800; }
.t4-rel__kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--t4-teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--t4-teal) 22%, transparent); }
.t4-rel__nav { display: flex; flex: none; gap: 8px; }
.t4-rel__nav[hidden] { display: none; }
.t4-rel__btn {
  display: grid; place-items: center; width: 46px; height: 46px; min-width: 0; min-height: 0; padding: 0;
  border: 1px solid var(--t4-line); border-radius: 50%; background: var(--t4-surface); color: var(--t4-ink);
  cursor: pointer; box-shadow: 0 10px 22px -18px #102e3c;
  transition: background .25s, color .25s, border-color .25s, transform .25s, opacity .25s;
}
.t4-rel__btn:hover:not(:disabled) { border-color: transparent; background: linear-gradient(135deg, var(--t4-blue), var(--t4-teal)); color: #fff; transform: translateY(-2px); }
.t4-rel__btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--t4-blue) 55%, transparent); outline-offset: 2px; }
.t4-rel__btn:disabled { opacity: .35; cursor: default; box-shadow: none; }
[dir="ltr"] .t4-rel__btn svg { transform: scaleX(-1); }

/* The strip: room around the cards for their lift and shadow on hover. */
.t4-rel__viewport { min-width: 0; margin-inline: -12px; }
.t4-rel__track {
  --gap: 22px;
  /* Positioned, so hidden absolute bits inside the cards (WooCommerce's screen-reader
     price text) stay inside the strip instead of widening the page on phones. */
  position: relative;
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 2 * var(--gap)) / 3); gap: var(--gap);
  margin: 0; padding: 10px 12px 20px; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: 12px;
  scrollbar-width: none;
}
.t4-rel__track::-webkit-scrollbar { display: none; }
.t4-rel__slide { min-width: 0; margin: 0; padding: 0; list-style: none; scroll-snap-align: start; }
.t4-rel__slide::before { content: none; }
.t4-rel__slide > .t4-shop-card { height: 100%; }

.t4-rel__progress { position: relative; width: min(220px, 50%); height: 4px; margin: 0 auto; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--t4-ink) 10%, transparent); }
.t4-rel__progress[hidden] { display: none; }
.t4-rel__progress i { position: absolute; inset-block: 0; inset-inline-start: calc(var(--p, 0) * (100% - var(--w, 1) * 100%)); width: calc(var(--w, 1) * 100%); border-radius: inherit; background: linear-gradient(90deg, var(--t4-blue), var(--t4-teal)); }

@media (max-width: 1100px) {
  .t4-rel__track { grid-auto-columns: calc((100% - var(--gap)) / 2); }
}
@media (max-width: 640px) {
  .t4-rel__track { --gap: 14px; grid-auto-columns: 84%; }
  .t4-rel__btn { width: 40px; height: 40px; }
}

/* ---------- sales stopped: the notice (the sidebar stays sticky) ---------- */
.t4-product-purchase.is-stopped .t4-purchase-actions > .alert-warning {
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 14px;
  border: 1px solid color-mix(in srgb, #d97706 32%, var(--t4-line)); border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, #f59e0b 15%, var(--t4-surface)), var(--t4-surface) 85%);
  color: color-mix(in srgb, #b45309 88%, var(--t4-ink)); font-size: 13.5px; font-weight: 800; line-height: 1.8; box-shadow: none;
}
.t4-product-purchase.is-stopped .t4-purchase-actions > .alert-warning::before {
  content: ""; flex: none; width: 34px; height: 34px; border-radius: 11px;
  background: #d97706 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M9.5 7v10M14.5 7v10'/%3E%3C/svg%3E") center / 18px no-repeat;
  box-shadow: 0 8px 16px -10px #d97706;
}
[data-theme="dark"] .t4-product-purchase.is-stopped .t4-purchase-actions > .alert-warning { color: #fbbf24; }


/* ---------- other Tik4 products: five compact rows under the notice ---------- */
.t4-alt {
  --alt-a: var(--t4-blue, #0078b8);
  --alt-b: var(--t4-teal, #08a4a7);
  position: relative; isolation: isolate; overflow: hidden; padding: 14px 10px 10px;
  border: 1px solid transparent; border-radius: 20px;
  background:
    linear-gradient(var(--t4-surface), var(--t4-surface)) padding-box,
    linear-gradient(150deg, color-mix(in srgb, var(--alt-a) 45%, var(--t4-line)), var(--t4-line) 45%, color-mix(in srgb, var(--alt-b) 45%, var(--t4-line))) border-box;
  box-shadow: 0 22px 44px -34px color-mix(in srgb, var(--alt-a) 60%, #102e3c);
}
.t4-alt::before {
  content: ""; position: absolute; z-index: -1; top: -110px; inset-inline-start: -80px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--alt-b) 16%, transparent), transparent);
  pointer-events: none;
}
.t4-alt__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px 8px; }
.t4-alt__title { margin: 0; color: var(--t4-ink); font-size: 15.5px; font-weight: 900; line-height: 1.6; }
.t4-alt__chip { display: inline-flex; flex: none; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--alt-b) 12%, var(--t4-surface)); color: color-mix(in srgb, var(--alt-b) 65%, var(--t4-ink)); font-size: 11px; font-weight: 800; line-height: 1.8; }
.t4-alt__chip i { position: relative; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--alt-b); }
.t4-alt__chip i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit; animation: t4alt-ping 1.9s ease-out infinite; }

.t4-alt__list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.t4-alt__item { margin: 0; padding: 0; list-style: none; animation: t4alt-in .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 60ms + 80ms); }
.t4-alt__item::before { content: none; }
.t4-alt__row {
  position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) 26px; align-items: center; gap: 10px;
  padding: 6px; border-radius: 13px; color: var(--t4-ink); text-decoration: none; transition: background .2s;
}
.t4-alt__row::before { content: ""; position: absolute; inset-block: 11px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: linear-gradient(var(--alt-a), var(--alt-b)); transform: scaleY(0); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.t4-alt__row:hover { background: color-mix(in srgb, var(--alt-a) 6%, var(--t4-surface)); color: var(--t4-ink); }
.t4-alt__row:hover::before,
.t4-alt__row:focus-visible::before { transform: scaleY(1); }
.t4-alt__row:focus-visible,
.t4-alt__all:focus-visible { outline: 2px solid color-mix(in srgb, var(--alt-a) 60%, transparent); outline-offset: 1px; }
.t4-alt__thumb { display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; border-radius: 12px; background: var(--t4-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t4-ink) 8%, transparent); }
.t4-alt__thumb img { display: block; width: 100%; height: 100%; margin: 0; border-radius: 0; object-fit: cover; transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.t4-alt__row:hover .t4-alt__thumb img { transform: scale(1.08); }
.t4-alt__initial { color: var(--alt-a); font-size: 16px; font-weight: 900; }
.t4-alt__text { display: grid; min-width: 0; }
/* Two lines at most, then an ellipsis. */
.t4-alt__name { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; font-size: 13px; font-weight: 800; line-height: 1.65; }
.t4-alt__sub { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 11.5px; line-height: 1.7; }
.t4-alt__price { flex: none; color: #0c9a64; font-weight: 800; }
.t4-alt__price del { margin-inline-end: 3px; color: var(--t4-muted); font-weight: 500; opacity: .8; }
.t4-alt__price ins { text-decoration: none; }
.t4-alt__kind { overflow: hidden; color: var(--t4-muted); font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.t4-alt__kind::before { content: "\00B7"; margin-inline-end: 6px; opacity: .6; }
.t4-alt__go { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--t4-muted); transition: background .2s, color .2s, transform .2s; }
.t4-alt__row:hover .t4-alt__go { background: linear-gradient(135deg, var(--alt-a), var(--alt-b)); color: #fff; transform: translateX(-2px); }
.t4-alt__all {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--t4-ink) 5%, var(--t4-surface)); color: var(--t4-ink); font-size: 12.5px; font-weight: 800; line-height: 1.6; text-decoration: none;
  transition: background .2s;
}
.t4-alt__all svg { flex: none; margin-inline-start: auto; color: var(--alt-a); transition: transform .2s; }
.t4-alt__all:hover { background: color-mix(in srgb, var(--alt-a) 9%, var(--t4-surface)); color: var(--t4-ink); }
.t4-alt__all:hover svg { transform: translateX(-3px); }
[dir="ltr"] :is(.t4-alt__go, .t4-alt__all) svg { scale: -1 1; }
[dir="ltr"] .t4-alt__row:hover .t4-alt__go { transform: translateX(2px); }
[dir="ltr"] .t4-alt__all:hover svg { transform: translateX(3px); }

@keyframes t4alt-ping { from { transform: scale(1); opacity: .7; } to { transform: scale(2.8); opacity: 0; } }
@keyframes t4alt-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .t4-alt__item, .t4-alt__chip i::after { animation: none; }
  .t4-alt__thumb img, .t4-rel__btn, .t4-alt__go, .t4-alt__row::before { transition: none; }
}
