/*
 * post.css — post detail page.
 */
.wg-post { max-width: 640px; margin: 0 auto; }

/* Thumbnail grid */
.wg-gallery { display: grid; gap: 6px; margin-bottom: 14px; }
.wg-gallery.wg-cols-1 { grid-template-columns: 1fr; }
.wg-gallery.wg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.wg-gallery.wg-cols-3 { grid-template-columns: repeat(3, 1fr); }

.wg-gthumb { position: relative; display: block; padding: 0; border: none; background: none; cursor: pointer; overflow: hidden; border-radius: var(--wg-radius); transition: transform .16s var(--wg-ease-spring, ease); }
.wg-gthumb:hover img { filter: brightness(1.04); }
.wg-gthumb:active { transform: scale(0.97); }
.wg-gthumb img { transition: filter .2s ease; }
@media (prefers-reduced-motion: reduce) { .wg-gthumb, .wg-gthumb img { transition: none; } .wg-gthumb:active { transform: none; } }
.wg-gallery.wg-cols-1 .wg-gthumb img {
  width: 100%; max-height: 460px; object-fit: contain;
  background: #f1f1f1; border: 1px solid var(--wg-border); border-radius: var(--wg-radius);
}
.wg-gallery:not(.wg-cols-1) .wg-gthumb { aspect-ratio: 1 / 1; }
.wg-gallery:not(.wg-cols-1) .wg-gthumb img {
  width: 100%; height: 100%; object-fit: cover;
  border: 1px solid var(--wg-border); border-radius: var(--wg-radius);
}
.wg-gmore {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 1.4rem; font-weight: 700;
  border-radius: var(--wg-radius);
}

/* Lightbox */
.wg-lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.9);
  display: flex; align-items: center; justify-content: center;
}
.wg-lightbox[hidden] { display: none; }
.wg-lightbox:not([hidden]) { animation: wg-backdrop-in .18s ease both; }
.wg-lightbox:not([hidden]) .wg-lb-img { animation: wg-lb-img-in .24s var(--wg-ease-out, ease) both; }
@keyframes wg-lb-img-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wg-lightbox:not([hidden]), .wg-lightbox:not([hidden]) .wg-lb-img { animation: none; } }
.wg-lb-img { max-width: 92vw; max-height: 88vh; object-fit: contain; }
.wg-lb-close, .wg-lb-prev, .wg-lb-next {
  position: absolute; background: none; border: none; color: #fff; cursor: pointer; line-height: 1;
}
.wg-lb-close { top: 10px; right: 16px; font-size: 2.2rem; }
.wg-lb-prev, .wg-lb-next { top: 50%; transform: translateY(-50%); font-size: 3rem; padding: 0 16px; }
.wg-lb-prev { left: 4px; }
.wg-lb-next { right: 4px; }
.wg-lb-counter { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 0.9rem; }

.wg-post-type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wg-color-dark);
  background: #e7f7ee;
  padding: 3px 8px;
  border-radius: 999px;
}
.wg-post-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 6px; }
.wg-post-price { font-size: 1.25rem; font-weight: 700; color: var(--wg-color-dark); }
/* Price line + an above-the-fold "Message seller" button on the right, so the
   contact action is reachable without scrolling to the CTA lower down. */
.wg-post-price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.wg-post-price-row .wg-btn { flex: 0 0 auto; }

/* Login-required modal (guests clicking "Message seller"). */
.wg-login-modal-body { color: var(--wg-muted); margin: 0 0 16px; line-height: 1.5; }
.wg-login-modal-actions { display: flex; flex-direction: column; gap: 8px; }
.wg-post-meta { color: var(--wg-muted); font-size: 0.85rem; margin-bottom: 16px; }
.wg-post-body { line-height: 1.6; white-space: normal; margin-bottom: 16px; }
.wg-post-comm { font-size: 0.9rem; color: var(--wg-muted); margin-bottom: 16px; }

.wg-post-seller {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--wg-border);
}
.wg-post-seller .wg-avatar {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%; object-fit: cover;
  border: 1px solid var(--wg-border);
}

/* Location block */
.wg-post-loc { margin: 8px 0 16px; }
.wg-post-loc-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px; font-size: 0.9rem;
}
.wg-post-loc-text { color: var(--wg-text); }
.wg-post-map {
  width: 100%; height: 280px;
  border: 1px solid var(--wg-border); border-radius: var(--wg-radius);
}

/* Owner notice: this post is hidden from public feeds */
.wg-hidden-note {
  background: #eef0f1; border: 1px solid #d4d4d4; color: #444;
  padding: 10px 12px; border-radius: var(--wg-radius);
  font-size: 0.9rem; margin-bottom: 12px;
}
.wg-review-note {
  padding: 10px 12px; border-radius: var(--wg-radius);
  font-size: 0.9rem; margin-bottom: 12px; font-weight: 600;
}
.wg-review-pending { background: #fff6e5; border: 1px solid #f0dcae; color: #8a6d10; }
.wg-review-rejected { background: #fdecec; border: 1px solid #f3bcbc; color: #b3261e; }

/* Admin "flagged as fake" disclaimer banner */
.wg-disclaimer {
  background: #fff4f4; border: 1px solid #f3b6b6; color: #8a1f1f;
  padding: 10px 12px; border-radius: var(--wg-radius);
  font-size: 0.9rem; font-weight: 600; margin-bottom: 12px;
}

/* Sold/closed marketplace posts: status indicator instead of a Message button */
.wg-btn-closed {
  width: auto; background: #9a9a9a; border-color: #9a9a9a; color: #fff;
  cursor: default; opacity: 1; text-transform: capitalize;
}
.wg-btn-closed:hover { background: #9a9a9a; border-color: #9a9a9a; box-shadow: none; transform: none; }

/* Share fallback menu */
.wg-share-list { display: flex; flex-direction: column; gap: 8px; }
.wg-share-list .wg-btn { width: 100%; }

/* Moderation bar: admin pin + report (modal/report styles are global in main.css) */
.wg-modbar { display: flex; align-items: center; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.wg-modbar .wg-btn { width: auto; }

/* Post stats line: date + saved count + (marketplace) chatting count */
.wg-post-stats {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px;
  color: var(--wg-muted); font-size: 0.8rem; margin: 0 0 14px;
}
.wg-post-date { white-space: nowrap; }
.wg-post-edited { font-style: italic; }
/* Anonymous author display */
.wg-avatar-anon { display: inline-flex; align-items: center; justify-content: center; background: #e6e6e6; color: #888; font-weight: 700; }
.wg-anon-tag { display: inline-block; margin-left: 6px; font-size: 0.72rem; color: var(--wg-muted); font-style: italic; }
/* Save + share actions, sitting at the end of the date/stats line */
.wg-post-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.wg-post-actions .wg-engage-btn { padding: 6px 12px; font-size: 0.8rem; }
.wg-post-actions .wg-engage-btn .wg-ico { width: 16px; height: 16px; }

/* Admin edit-history modal */
.wg-edithist { display: flex; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; }
/* Admin flag-for-review modal */
#wg-flag-text { width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--wg-border, #e4e4e4); border-radius: 10px; resize: vertical; margin-bottom: 12px; }
#wg-flag-modal .wg-btn { width: auto; }
.wg-edithist-item { border: 1px solid var(--wg-border); border-radius: var(--wg-radius); padding: 10px 12px; }
.wg-edithist-meta { font-size: 0.75rem; color: var(--wg-muted); }
.wg-edithist-prev { font-size: 0.7rem; color: var(--wg-muted); margin: 6px 0 2px; }
.wg-edithist-title { font-weight: 600; }
.wg-edithist-body-text { white-space: pre-wrap; font-size: 0.9rem; }
.wg-edithist-field { font-size: 0.85rem; color: var(--wg-text); margin-top: 2px; }
.wg-stat { display: inline-flex; align-items: center; gap: 4px; }
.wg-stat .wg-ico { width: 15px; height: 15px; }
/* Admin: clickable chat-count → who-is-chatting modal */
.wg-stat-btn { background: none; border: 0; cursor: pointer; font: inherit; color: var(--wg-color-dark); padding: 0; text-decoration: underline dotted; }
.wg-stat-btn:hover { color: var(--wg-color); }
.wg-chatters-row { padding: 10px 0; border-bottom: 1px solid var(--wg-border-soft); }
.wg-chatters-row:last-child { border-bottom: 0; }
.wg-chatters-ppl { font-size: 0.95rem; }
.wg-chatters-ppl a { color: var(--wg-color-dark); font-weight: 600; }
.wg-chatters-sep { color: var(--wg-muted); margin: 0 2px; }
.wg-chatters-tag { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; background: var(--wg-tint); color: var(--wg-muted); padding: 1px 6px; border-radius: 999px; vertical-align: middle; }
.wg-chatters-meta { font-size: 0.8rem; color: var(--wg-muted); margin-top: 3px; }

/* Shared small helpers (used on this page) */
.wg-note { font-size: 0.9rem; color: var(--wg-muted); margin: 8px 0 0; }
.wg-linkbtn {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; color: var(--wg-color); font-weight: 600;
}
.wg-linkbtn:hover { text-decoration: underline; }

/* Engagement bar */
.wg-engage {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 0; border-top: 1px solid var(--wg-border);
}
.wg-engage-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 1px solid var(--wg-border); border-radius: 999px;
  background: #fff; color: var(--wg-text); font: inherit; font-weight: 600;
  font-size: 0.85rem; cursor: pointer; line-height: 1;
  transition: background .16s ease, border-color .16s ease, color .16s ease,
              transform .14s var(--wg-ease-spring, ease), box-shadow .16s ease;
}
.wg-engage-btn:hover { background: var(--wg-surface, #f4f4f4); text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(16,24,40,0.08); }
.wg-engage-btn:active { transform: scale(0.92); }
.wg-engage-btn .wg-ico { width: 18px; height: 18px; }
.wg-engage-btn[disabled] { opacity: 0.6; cursor: default; transform: none; }
.wg-like-btn.is-on { color: var(--wg-accent-red); border-color: var(--wg-accent-red); animation: wg-like-pop .32s var(--wg-ease-spring, ease); }
.wg-like-btn.is-on .wg-ico { fill: var(--wg-accent-red); stroke: var(--wg-accent-red); }
@keyframes wg-like-pop { 0% { transform: scale(0.85); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .wg-engage-btn { transition: none; } .wg-engage-btn:hover, .wg-engage-btn:active { transform: none; } .wg-like-btn.is-on { animation: none; } }
.wg-save-btn.is-on { color: var(--wg-color-dark); border-color: var(--wg-color); }
.wg-save-btn.is-on .wg-ico { fill: var(--wg-color); stroke: var(--wg-color); }

/* Comments */
.wg-comments { margin-top: 8px; }
.wg-comments-title { font-size: 1rem; margin: 0 0 10px; }
#wg-load-earlier { display: inline-block; margin-bottom: 10px; }
.wg-comment { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--wg-border); }
.wg-comment-av {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  background: var(--wg-color); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem; overflow: hidden;
}
.wg-comment-av img { width: 100%; height: 100%; object-fit: cover; }
.wg-comment-main { flex: 1; min-width: 0; }
.wg-comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wg-comment-nick { font-weight: 700; font-size: 0.9rem; }
.wg-comment-when { color: var(--wg-muted); font-size: 0.72rem; }
.wg-comment-body { font-size: 0.92rem; line-height: 1.5; margin: 3px 0 6px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.wg-comment-actions { display: flex; align-items: center; gap: 14px; }
.wg-clike, .wg-cdelete, .wg-creply {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.78rem; color: var(--wg-muted);
}
.wg-clike { display: inline-flex; align-items: center; gap: 4px; }
.wg-clike .wg-clike-ico { font-size: 0.95rem; line-height: 1; }
.wg-clike.is-on { color: var(--wg-accent-red); }
.wg-clike[disabled] { cursor: default; }
.wg-cdelete:hover { color: var(--wg-accent-red); text-decoration: underline; }
.wg-creply { font-weight: 600; }
.wg-creply:hover { color: var(--wg-color-dark); text-decoration: underline; }

/* Replies: indented under their parent */
.wg-comment-replies { margin-left: 46px; }
.wg-comment--reply .wg-comment-av { width: 28px; height: 28px; font-size: 0.8rem; }
.wg-comment--reply { border-top: 1px dashed var(--wg-border); }
.wg-reply-form { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 6px 46px; }
.wg-reply-form textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 16px;
  border: 1px solid var(--wg-border); border-radius: var(--wg-radius); resize: vertical;
}
.wg-reply-form .wg-btn { width: auto; align-self: flex-end; padding: 7px 16px; }
.wg-comments-more { width: auto; margin: 4px 0 14px; }

/* Comment form */
.wg-comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.wg-comment-form textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--wg-border); border-radius: var(--wg-radius); resize: vertical;
}
.wg-comment-form .wg-btn { width: auto; align-self: flex-end; padding: 9px 20px; }

/* Intermediary disclaimer on marketplace post detail */
.wg-post-disclaimer {
  font-size: 0.8rem; line-height: 1.5; color: var(--wg-muted);
  background: #f7f7f7; border: 1px solid var(--wg-border); border-radius: var(--wg-radius);
  padding: 10px 12px; margin: 10px 0 14px;   /* sits just below the Message-seller button */
}

/* Structured job/housing details */
.wg-post-details { margin: 10px 0 0; display: grid; gap: 4px; }
.wg-detail-row { display: flex; gap: 8px; font-size: 0.9rem; }
.wg-detail-row dt { flex: none; min-width: 120px; color: var(--wg-muted); margin: 0; }
.wg-detail-row dd { margin: 0; font-weight: 600; }

/* Rich-text post body: safe lightweight markdown (headings, lists, quotes, links) */
.wg-rt a { color: var(--wg-color); text-decoration: underline; word-break: break-word; }
.wg-rt a.wg-tag { text-decoration: none; font-weight: 600; }
.wg-rt a.wg-tag:hover { text-decoration: underline; }
.wg-rt strong { font-weight: 700; }
.wg-rt em { font-style: italic; }
.wg-rt .wg-rt-h { margin: 16px 0 6px; line-height: 1.3; color: var(--wg-text); }
.wg-rt h3.wg-rt-h { font-size: 1.15rem; }
.wg-rt h4.wg-rt-h { font-size: 1.05rem; }
.wg-rt h5.wg-rt-h { font-size: 0.98rem; }
.wg-rt .wg-rt-list { margin: 6px 0 6px; padding-left: 22px; }
.wg-rt .wg-rt-list li { margin: 2px 0; }
.wg-rt .wg-rt-quote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--wg-color); background: #f5faf7; color: var(--wg-text); border-radius: 0 8px 8px 0; }
.wg-rt .wg-rt-hr { border: 0; border-top: 1px solid var(--wg-border); margin: 14px 0; }

/* Both-ends sale confirmation (buyer confirms → releases seller points) */
.wg-confirm-buy { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--wg-color); border-radius: var(--wg-radius); background: #f5faf7; }
.wg-confirm-buy-q { margin: 0 0 10px; font-size: 0.92rem; }
.wg-confirm-buy .wg-btn { width: auto; }
.wg-confirm-done { color: var(--wg-color-dark, #0b8f3e); font-weight: 600; }

/* On-demand AI translation control */
.wg-post-translate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.wg-translate-lang { padding: 4px 8px; border: 1px solid var(--wg-border); border-radius: var(--wg-radius); background: var(--wg-bg); font-size: 0.85rem; }
.wg-translate-tag { font-size: 0.75rem; font-weight: 600; color: #3a4bd0; background: #eef2ff; padding: 2px 8px; border-radius: 999px; }

/* ── [[btn:/path|Label]] call-to-action buttons in a post body ──────────
   Internal links only (enforced in wg_richtext). Two sizes: the default for
   an inline "here's the tool" nudge, and .wg-rt-btn-lg for the end-of-post
   call to action. */
.wg-rt-btnwrap { margin: 16px 0; text-align: center; }
.wg-rt-btnwrap.is-lg { margin: 22px 0 6px; }
.wg-rt .wg-rt-btn {
  /* .wg-btn is width:100% (mobile-first), so the small variant has to opt out
     explicitly or it renders exactly as wide as the large one. */
  display: inline-flex; width: auto; max-width: 100%;
  text-decoration: none; font-weight: 700;
  padding: 10px 20px; border-radius: 999px; color: #fff;
  transition: transform .14s var(--wg-ease-spring), box-shadow var(--wg-dur) ease;
}
.wg-rt .wg-rt-btn:hover { text-decoration: none; box-shadow: var(--wg-shadow-hover); }
.wg-rt .wg-rt-btn:active { transform: scale(.97); }
.wg-rt .wg-rt-btn:focus-visible { outline: none; box-shadow: var(--wg-focus-ring); }
.wg-rt .wg-rt-btn-lg {
  display: flex; width: 100%; padding: 16px 22px;
  font-size: 1.05rem; border-radius: 14px;
  box-shadow: var(--wg-shadow-card);
}
@media (prefers-reduced-motion: reduce) {
  .wg-rt .wg-rt-btn { transition: none; }
  .wg-rt .wg-rt-btn:active { transform: none; }
}

/* ── [[tldr]] … [[/tldr]] compact summary block ─────────────────────────
   Deliberately quieter than the body: smaller, italic, tinted. The CTA
   inside it is a nudge, not the main action — the big button lives at the
   end of the post — so it is scaled down here. */
.wg-rt-tldr {
  display: block;
  font-size: .84rem; font-style: italic; line-height: 1.6;
  color: var(--wg-muted);
  background: var(--wg-tint);
  border: 1px solid var(--wg-border-soft);
  border-radius: 12px;
  padding: 12px 14px; margin: 14px 0;
}
.wg-rt-tldr .wg-rt-h { font-size: .82rem; font-style: normal; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: var(--wg-color-dark);
  margin: 0 0 6px; }
.wg-rt-tldr .wg-rt-list { margin: 0 0 6px; padding-left: 18px; }
.wg-rt-tldr .wg-rt-list li { margin-bottom: 3px; }
.wg-rt-tldr strong { font-weight: 700; font-style: normal; }
.wg-rt-tldr .wg-rt-btnwrap { margin: 10px 0 2px; }
/* A deliberately small nudge button. */
.wg-rt .wg-rt-tldr .wg-rt-btn {
  font-size: .78rem; font-style: normal;
  padding: 6px 14px; border-radius: 999px;
}
