/* =====================================================================
   اکسپلور — شبکه‌ی کاشی (Explore) + پخش‌کننده‌ی عمودی (Reels)
   ===================================================================== */
.xp { max-width: 1280px; margin: 0 auto; padding: 14px 40px 40px; }
.xp__head { margin: 0; }
.xp__empty { padding: 60px 16px; text-align: center; color: var(--tx2); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.xp__empty .btn { margin-top: 6px; }

/* شبکه: مثل اینستاگرام — ۳ ستون، فاصله‌ی ۲، کاشی مربع، بلند = دو ردیف */
.xp__grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  grid-auto-rows: minmax(0, 1fr); grid-auto-flow: dense;
}
@media (min-width: 720px) { .xp__grid { grid-template-columns: repeat(4, 1fr); gap: 4px; } }
@media (min-width: 1120px) { .xp__grid { grid-template-columns: repeat(5, 1fr); gap: 6px; } }
.xp__tile {
  position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--n50); color: #fff; text-decoration: none;
}
.xp__tile--tall { grid-row: span 2; aspect-ratio: 1 / 2; }
.xp__tile img, .xp__tile video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.xp__tile:hover img, .xp__tile:hover video { transform: scale(1.04); }
.xp__reel { position: absolute; top: 8px; inset-inline-end: 8px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.xp__views {
  position: absolute; bottom: 8px; inset-inline-start: 8px; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
.xp__tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.35), rgba(0,0,0,0) 40%); pointer-events: none; }

/* ── پخش‌کننده ─────────────────────────────────────────────────────── */
.xp-viewer { position: fixed; inset: 0; z-index: 120; background: #000; color: #fff; }
.xp-viewer[hidden] { display: none; }
body.xp-open { overflow: hidden; }
.xp-viewer__close {
  position: absolute; top: max(10px, env(safe-area-inset-top)); inset-inline-end: 10px; z-index: 5;
  width: 44px; height: 44px; border: 0; border-radius: 0; background: rgba(0,0,0,.35); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.xp-viewer__brand { position: absolute; top: max(20px, env(safe-area-inset-top)); inset-inline-start: 16px; z-index: 4; font-size: 13px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.xp-viewer__list {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.xp-viewer__list::-webkit-scrollbar { display: none; }
.xp-item { height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; }
.xp-item__stage { position: relative; width: 100%; height: 100%; max-width: 100%; background: #000; overflow: hidden; }
.xp-item__video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.xp-item__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.25); z-index: 3; }
.xp-item__progress span { display: block; height: 100%; width: 0; background: var(--brand); }
.xp-item__mute {
  position: absolute; top: max(12px, env(safe-area-inset-top)); inset-inline-start: 50%; transform: translateX(-50%); z-index: 4;
  width: 40px; height: 40px; border: 0; border-radius: 0; background: rgba(0,0,0,.4); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.xp-item__mute .xp-ico-sound { display: none; }
.xp-item__mute.is-sound .xp-ico-sound { display: block; }
.xp-item__mute.is-sound .xp-ico-muted { display: none; }
.xp-item__paused { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 2; pointer-events: none; }
.xp-item.is-paused .xp-item__paused { display: flex; }

.xp-item__acts {
  position: absolute; inset-inline-end: 10px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 4;
  display: flex; flex-direction: column; gap: 18px; align-items: center;
}
.xp-act {
  display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: transparent; color: #fff;
  font: inherit; font-size: 11.5px; cursor: pointer; text-decoration: none; text-shadow: 0 1px 3px rgba(0,0,0,.7); padding: 0;
}
.xp-act svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.xp-act[aria-pressed="true"] svg { fill: var(--sale); stroke: var(--sale); }

.xp-item__foot {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 3; padding: 60px 72px 22px 16px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.35) 60%, rgba(0,0,0,0));
}
.xp-item__title { font-size: 15px; font-weight: 700; margin-bottom: 6px; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.xp-item__cap {
  margin: 0 0 10px; font-size: 13px; line-height: 22px; color: rgba(255,255,255,.9);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer;
}
.xp-item__cap.is-open { -webkit-line-clamp: unset; max-height: 40vh; overflow: auto; }
.xp-prod {
  display: flex; align-items: center; gap: 10px; background: var(--surf); color: var(--tx);
  border: 1px solid var(--bd); border-radius: 0; padding: 8px; text-decoration: none; max-width: 420px;
}
.xp-prod img { width: 48px; height: 60px; object-fit: cover; border-radius: 0; flex: 0 0 auto; background: var(--n50); }
.xp-prod__txt { flex: 1 1 0%; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.xp-prod__name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-prod__price { font-size: 13px; font-weight: 700; }
.xp-prod__price small { font-weight: 400; font-size: 11px; color: var(--mut); }
.xp-prod__price s { font-weight: 400; font-size: 11px; color: var(--mut); margin-inline-start: 6px; }
.xp-prod__btn { flex: 0 0 auto; height: 38px; padding: 0 14px; border-radius: 0; background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; }
.xp-prod--link { justify-content: flex-end; }

.xp-viewer__nav { display: none; }
@media (min-width: 720px) {
  /* دسکتاپ: قاب ۹:۱۶ وسط، پس‌زمینه‌ی تیره، فلش بالا/پایین */
  .xp-viewer { background: rgba(0,0,0,.94); }
  .xp-item__stage { width: min(460px, calc(100vh * 9 / 16)); height: min(100vh, calc(460px * 16 / 9)); border-radius: 0; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
  .xp-item__acts { bottom: 120px; }
  .xp-viewer__nav {
    position: absolute; inset-inline-start: 24px; width: 44px; height: 44px; border: 0; border-radius: 0;
    background: rgba(255,255,255,.14); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 5; border-radius: 0;
  }
  .xp-viewer__nav--prev { top: calc(50% - 56px); }
  .xp-viewer__nav--next { top: calc(50% + 12px); }
  .xp-viewer__nav:hover { background: rgba(255,255,255,.28); }
}
@media (max-width: 1119px) { .xp { padding: 6px 0 24px; } .xp__head { padding: 0 16px; } .xp__title { font-size: 22px !important; } .xp__lead { margin-bottom: 12px !important; } }
@media (max-width: 719px) { body.page-explore { padding-bottom: 76px; } }
