/* ==========================
   Posts section
   ========================== */

.thread-posts {
  margin-top: 24px;
}

.post-list {
  margin-top: 16px;
}

/* Base post card */
.post {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background-color: var(--shark-teal);
  padding: 10px; /* room on right for avatar+rec */
  margin-bottom: 12px;
  min-height: 68px;

  transition:
    border-color 0.25s ease-out,
    background-color 0.25s ease-out,
    box-shadow 0.25s ease-out,
    transform 0.12s ease-out;
}

.post:hover,
.post:focus,
.post:active {
  /* border-color: var(--accent-primary-border); */
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7);
  transform: translateY(-1px);
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.post-body {
  margin-bottom: 8px;
}

.post-body img {
  max-height: 240px;
  max-width: 100%;
  height: auto;
  width: auto;
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6);
}

/* ==========================
   Unread / seen highlight
   ========================== */

.post--unread {
  border-color: var(--accent-secondary);
  box-shadow:
    0 0 0 1px rgba(245, 155, 42, 0.6),
    0 0 16px rgba(245, 155, 42, 0.35);
}

/* When a post becomes "seen" – JS swaps to this to fade it down */
.post--seen-fade {
  transition:
    border-color 0.8s ease-out,
    background-color 0.8s ease-out,
    box-shadow 0.8s ease-out;
  border-color: var(--border-subtle);
  box-shadow: none;
}

/* ==========================
   Recs highlight
   ========================== */

.post--rec {
  border: 4px solid var(--accent-secondary);
  background: var(--shark-orange);
}

/* ==========================
   New comment toast
   ========================== */

.thread-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent-primary-border);
  background-color: var(--accent-secondary);
  color: #000;
  font-size: 0.85rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  display: none; /* shown via JS */
  white-space: nowrap;
}

/* ==========================
   New post form
   ========================== */

.new-post-form {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  position: relative; /* so emoji panel can anchor */
}

.replying-to {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-muted);
}

/* Editor box (contenteditable) */
.wysiwyg {
  width: 100%;
  min-height: 120px;
  border: 3px solid var(--accent-secondary);
  padding: 8px 10px;
  border-radius: 6px;
  background: #111111;
  color: var(--text-main);
  font-size: 0.95rem;
}

.wysiwyg:focus-visible {
  outline: 1px solid var(--accent-secondary);
  outline-offset: 1px;
}

/* Toolbar row above editor */
.wysiwyg-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.wysiwyg-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Emoji button */
.wysiwyg-emoji-btn {
  font-size: 0.9rem;
  padding: 4px 10px;
}

/* Emoji dropdown panel */
.emoji-panel {
  position: absolute;
  left: 0;
  bottom: 100%;
  transform: translateY(-6px);
  padding: 6px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 260px;
  z-index: 20;
}

.emoji-panel__item {
  border: 0;
  padding: 3px 6px;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.emoji-panel__item:hover {
  background: var(--accent-primary-soft);
}

/* Post / cancel / per-post action buttons
   (skip replied-to + Rec text controls) */
.thread-posts .new-post-form .button,
.thread-posts .post-actions .button,
.thread-posts .post-actions button:not(.post-replied-to):not(.post-rec-text) {
  background: var(--accent-primary-soft);
  color: var(--text-main);
  font-weight: 500;
}

.thread-posts .new-post-form .button:hover,
.thread-posts .post-actions .button:hover,
.thread-posts .post-actions button:not(.post-replied-to):not(.post-rec-text):hover {
  background: var(--accent-primary);
  color: var(--text-main);
}

/* Emoji toggle button */
.thread-posts .new-post-form #emoji-toggle {
  background: transparent;
  border-color: var(--accent-primary-border);
  color: var(--text-main);
  font-weight: 500;
  padding: 4px 10px;
}

.thread-posts .new-post-form #emoji-toggle:hover {
  background: var(--accent-primary-soft);
}

/* Make Cancel quieter */
.thread-posts .new-post-form #cancel-reply {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.thread-posts .new-post-form #cancel-reply:hover {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
}

#submit-post {
  color: #fff;
}

#editor {
  margin: 10px 0;
}

/* ==========================
   Avatar bubble
   ========================== */

.post-avatar-wrap {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2; /* above card contents */
}

.post-avatar {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

/* ==========================
   Image modal (avatar/header enlarge)
   ========================== */

.image-modal[hidden] {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.8);
}

.image-modal__inner {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
}

.image-modal__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75);
}

.image-modal__close {
  position: absolute;
  top: -10px;
  right: -10px;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
}

/* Header image also clickable */
.thread-header__image-wrap img {
  cursor: zoom-in;
}

/* Prevent background scroll while modal open */
body.image-modal-open {
  overflow: hidden;
}
/* ==========================
   Actions row – Reply / Delete / replied-to / Rec
   ========================== */

.post-actions {
  margin-top: 8px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.post-actions__left {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* right column: lives at the right edge, under the avatar */
.post-actions__right {
  margin-left: auto;
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

/* On very narrow screens, let right column wrap below but stay right-aligned */
@media (max-width: 600px) {
  .post-actions {
    align-items: flex-start;
  }
}

/* ==========================
   Indentation & L-shaped connectors
   ========================== */

/* Indentation for replies */
.indent-0 { margin-left: 0; }
.indent-1 { margin-left: 26px; }
.indent-2 { margin-left: 52px; }
.indent-3 { margin-left: 78px; }
.indent-4,
.indent-5 { margin-left: 104px; }

/* Reply connector */

.post.post--has-parent {
  position: relative;
}

/* Default: continuing replies in the chain –
   extends up to meet previous reply and down to the buttons */
.post.post--has-parent::before {
  content: '';
  position: absolute;

  left: -20px;
  top: -24px;   /* reach up to previous card */
  bottom: 18px; /* elbow near the Reply buttons */
  width: 20px;

  border-left: 1px solid rgba(248, 250, 252, 0.16);
  border-bottom: 1px solid rgba(248, 250, 252, 0.16);
  border-radius: 0 0 0 12px;

  pointer-events: none;
}

/* First reply under a parent – line only spans the gap,
   not into the parent card itself */
.post.post--has-parent.post--first-reply::before {
  top: -12px;
}

/* Highlight target parent when jumped to */

.post--highlight-parent {
  border-color: var(--danger-border);
  box-shadow:
    0 0 0 2px var(--danger-border);
  transform: translateY(-1px);
  transition:
    border-color 1s ease-out,
    box-shadow 1s ease-out,
    transform 1s ease-out;
}