/* ============================================================
   ShebaKhoj theater — Facebook-style photo viewer.
   Scoped to #skTheater. Desktop: stage + right rail.
   ============================================================ */
.theater {
  position: fixed; inset: 0; z-index: 500;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  background: rgba(4, 8, 15, .94);
  backdrop-filter: blur(8px);
}
.theater[hidden] { display: none; }

/* ---------- stage ---------- */
.th-stage { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 48px 64px 40px; }
.th-media { max-width: 100%; max-height: 100%; display: grid; place-items: center; }
.th-media img, .th-media video {
  max-width: 100%; max-height: calc(100dvh - 120px);
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.th-none { font-size: 4rem; opacity: .5; }
.th-x {
  position: absolute; top: 14px; left: 16px;
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; font-size: 1.1rem;
}
.th-x:hover { background: rgba(255,255,255,.24); }
.th-x.mob { display: none; }
.th-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; font-size: 1.05rem;
}
.th-nav:hover { background: rgba(255,255,255,.24); }
.th-nav.prev { left: 14px; }
.th-nav.next { right: 14px; }
.th-count {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.75); font-size: .8rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- rail ---------- */
.th-rail {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-inline-start: 1px solid var(--line);
}
.th-post { padding: 14px 16px 10px; border-bottom: 1px solid var(--line-2); }
.th-post .th-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.th-post h3 { margin: 0 0 4px; font-size: 1rem; color: var(--ink-900); }
.th-post p { margin: 0; font-size: .9rem; line-height: 1.55; color: var(--ink-700); }
.th-post .price-row { margin: 8px 0 0; }
.th-post .price-row strong { font-size: 1.1rem; }
.th-post .post-stats { margin: 10px 0 0; padding-top: 8px; }
.th-post .post-actions { padding: 6px 0 0; }
.th-loading { display: grid; place-items: center; padding: 40px; }
.th-comments { flex: 1; overflow-y: auto; padding: 12px 16px; display: grid; gap: 12px; align-content: start; }
.th-cmt { display: flex; gap: 9px; align-items: flex-start; }
.th-cmt .avatar { width: 34px; height: 34px; font-size: .95rem; flex: none; }
.th-cmt-b { display: grid; gap: 1px; min-width: 0; background: var(--surface-2); border-radius: 4px 16px 16px 16px; padding: 8px 12px; }
.th-cmt-b b { font-size: .83rem; color: var(--ink-900); }
.th-cmt-b span { font-size: .87rem; color: var(--ink-700); overflow-wrap: anywhere; }
.th-cmt-b small { font-size: .7rem; color: var(--ink-400); margin-top: 2px; }
.th-none-sm { color: var(--ink-400); font-size: .85rem; text-align: center; margin: 18px 0; }
.th-composer {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line-2);
}
.th-composer input {
  flex: 1; min-width: 0; border: 0; outline: 0;
  background: var(--surface-2); color: var(--ink-900);
  border-radius: 999px; padding: 10px 16px;
  font: inherit; font-size: .88rem;
}
.th-composer .ms-icon-btn { background: transparent; color: var(--msgr-blue, #0084ff); font-size: 1.15rem; }
.th-composer .btn { flex: 1; }

/* ---------- mobile: FB app sheet ---------- */
@media (max-width: 900px) {
  .theater { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); overflow-y: auto; }
  .th-stage { padding: 44px 0 8px; }
  .th-media img, .th-media video { max-height: 44dvh; border-radius: 0; width: 100%; }
  .th-nav { width: 38px; height: 38px; }
  .th-nav.prev { left: 8px; }
  .th-nav.next { right: 8px; }
  .th-x { display: none; }
  .th-x.mob { display: grid; top: 8px; left: 8px; width: 38px; height: 38px; z-index: 2; }
  .th-rail { border-inline-start: 0; border-radius: 16px 16px 0 0; min-height: 50dvh; }
  .th-comments { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  .theater { backdrop-filter: none; }
}
