:root{
  --app-bg: #eef2f6;
  --nav: #1f3a5f;
  --card: #ffffff;
  --muted: #6b7280;

  --nav-offset: 78px;
}

.bg-app{ background: var(--app-bg); }

/* sticky header */
.nav-app{
  background: linear-gradient(90deg, var(--nav), #16304f);
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* cards */
.card-app{
  background: var(--card);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.footer-app{
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(6px);
}

/* layout */
.feed-layout{
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 992px){
  .feed-layout{ grid-template-columns: 1fr; }
}

/* sticky sidebars */
.sidebar-sticky{
  position: sticky;
  top: var(--nav-offset);
}

.post-author{ font-weight: 600; }
.post-meta{
  color: var(--muted);
  font-size: 12px;
}

/* attachments */
.attachments-single{
  display: flex;
  justify-content: center;
}
.att-img{
  display:block;
  border-radius: 14px;
  overflow:hidden;
  border: 1px solid rgba(0,0,0,.06);
  background: rgba(0,0,0,.02);
  cursor: zoom-in;
}
.att-img img{
  width:100%;
  height:auto;
  display:block;
}
.att-img-single{
  width: min(640px, 100%);
}

/* grid for many images */
.attachments-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 576px){
  .attachments-grid{ grid-template-columns: 1fr; }
}

/* file link */
.att-file{
  display:inline-block;
  padding:8px 10px;
  border-radius: 12px;
  background: rgba(31,58,95,0.06);
  text-decoration:none;
}

/* reactions */
.reaction-btn{
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.7);
  border-radius: 999px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.reaction-btn .label{ color: #111; }
.reaction-btn .count{
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  color: #111;
}
.reaction-btn.active-like{
  border-color: rgba(0, 140, 255, .35);
  background: rgba(0, 140, 255, .10);
}
.reaction-btn.active-dislike{
  border-color: rgba(255, 0, 90, .35);
  background: rgba(255, 0, 90, .10);
}

.reaction-btn-sm{
  padding: 5px 10px;
  font-size: 13px;
}

/* poll */
.poll-box{
  border-top: 1px solid rgba(0,0,0,.06);
  padding-top: 12px;
}
.poll-opt{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:10px 12px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 12px;
  background: rgba(255,255,255,.65);
}
.poll-opt input{ margin-top: 3px; }

.poll-res{
  padding:10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,.65);
}
.poll-res.mine{
  border-color: rgba(0, 140, 255, .35);
  background: rgba(0, 140, 255, .08);
}
.poll-bar{
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
  overflow: hidden;
}
.poll-bar-fill{
  height: 100%;
  background: rgba(31,58,95,.55);
}

/* ===== Comments ===== */
.comments-box{
  border-top: 1px solid rgba(0,0,0,.06);
  padding-top: 12px;
}
.comments-title{
  font-weight: 700;
}
.comments-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment{
  background: rgba(255,255,255,.70);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 14px;
  padding: 10px 12px;
}
.comment.is-reply{
  margin-left: 24px;
  border-left: 3px solid rgba(31,58,95,.25);
}

.comment-head{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.comment-author{ font-weight: 700; font-size: 14px; }
.comment-meta{ color: var(--muted); font-size: 12px; }
.comment-body{ margin-top: 6px; }

.comment-reply-btn{
  border: none;
  background: transparent;
  padding: 0;
  color: rgba(31,58,95,.95);
  font-size: 13px;
  text-decoration: underline;
}
.comment-reply-btn:hover{ opacity: .85; }

.comment-replies{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== Lightbox ===== */
html.lb-lock, html.lb-lock body{
  overflow: hidden;
}
.lb-overlay{
  position: fixed;
  inset: 0;
  z-index: 2000;
}
.lb-overlay.open{ display:block; }
.lb-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
}
.lb-content{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lb-img{
  max-width: min(1100px, 92vw);
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  cursor: pointer;
}
.lb-close{
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 40px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.lb-prev{ left: 18px; }
.lb-next{ right: 18px; }
.lb-counter{
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.20);
  color: #fff;
  font-size: 13px;
}

/* ===== Profile Avatar FIX (щоб НЕ обрізало) =====
   Причина: object-fit:cover або width:100% + height:auto в квадраті з overflow:hidden.
   Рішення: робимо contain для аватарки.
   Якщо треба повернути обрізання (як у соцмережах) — заміни contain на cover.
*/
.profile-avatar img,
.profile-ava img,
.user-avatar img,
.avatar img,
.avatar-wrap img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: rgba(0,0,0,.02);
}
