/* Faz 2 — forum lists & reading surfaces */

.forum-category,
.thread-index,
.forum-board {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.forum-category-header,
.thread-index-header,
.panel-header {
  background: var(--color-surface-subtle);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  font-weight: 750;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
}

.forum-row,
.thread-index-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) auto minmax(120px, 0.7fr);
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: background var(--motion-fast);
}

.forum-row:first-child,
.thread-index-row:first-child { border-top: 0; }

.forum-row:hover,
.thread-index-row:hover {
  background: var(--color-row-hover);
}

.forum-row.is-unread {
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.forum-row-copy a,
.thread-index-row a.thread-title,
.thread-title {
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--text-md);
  line-height: 1.35;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.forum-row-copy a:hover,
.thread-title:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.forum-row-stats,
.thread-index-stats {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-align: center;
}

.forum-row-stats strong,
.thread-index-stats strong {
  display: block;
  color: var(--color-text);
  font-size: var(--text-sm);
}

.forum-row-breath,
.thread-index-last {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  min-width: 0;
}

.forum-row-breath a,
.thread-index-last a {
  color: var(--color-text);
  font-weight: 600;
}

/* Thread hero */
.thread-hero {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.thread-hero h1 {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  max-width: 100%;
  word-break: break-word;
}

/* Posts — author stays at the top of long messages */
.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.post,
html[data-density="comfortable"] .post,
html[data-density="compact"] .post {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

html[data-density="compact"] .post {
  grid-template-columns: 120px minmax(0, 1fr);
}

.post-author {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  align-self: start;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-surface-subtle);
  border-right: 1px solid var(--color-border);
  border-bottom: 0;
  text-align: center;
  position: static;
}

.post-author-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
}

.post-author img,
.post-author .avatar,
.post-avatar {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  border-radius: var(--radius-pill);
  object-fit: cover;
}

.post-body {
  padding: var(--space-4);
  max-width: 100%;
  overflow-wrap: anywhere;
  min-width: 0;
}

.post-content {
  font-size: var(--text-md);
  line-height: var(--leading-body);
  max-width: var(--content-measure);
}

.post-content a {
  word-break: break-word;
}

.post-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.post-signature {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.reply-box {
  margin-top: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}

/* Status chips in thread lists */
.thread-flags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

@media (max-width: 900px) {
  .forum-row,
  .thread-index-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .forum-row-stats,
  .thread-index-stats {
    display: flex;
    gap: var(--space-4);
    text-align: left;
  }

  .forum-row-stats strong,
  .thread-index-stats strong {
    display: inline;
    margin-right: 0.25rem;
  }

  .post,
  html[data-density="comfortable"] .post,
  html[data-density="compact"] .post {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .post-author {
    position: static;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3);
  }

  .post-author-link {
    flex-direction: row;
    align-items: center;
  }

  .post-content {
    max-width: 100%;
  }
}

/* Compact child forums */
.forum-subforums {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 1rem;
  margin-top: 0.45rem;
}

.forum-row-copy a.forum-subforum-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: auto;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  overflow: visible;
  -webkit-line-clamp: unset;
  -webkit-box-orient: initial;
}

.forum-row-copy a.forum-subforum-link:hover {
  color: var(--color-primary);
}

.forum-subforum-arrow {
  color: var(--color-primary);
  font-weight: 800;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .forum-subforums {
    gap: 0.35rem 0.75rem;
  }
}
