/* thread.html — page composition only; posts, composer, report dialog come from modules-community.css */

/* ---- vertical rhythm of the main column ---- */
.thread-head { margin-top: var(--sp-2); }
.thread-op, .thread-replies, .thread-compose, .thread-related { margin-top: var(--section-gap); }
.thread-op { margin-top: var(--sp-5); }

/* ---- thread header ---- */
.thread-head { display: grid; gap: var(--sp-3); min-width: 0; }
.thread-head__flags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.thread-head__flags .chip--sm { text-decoration: none; }
.thread-head__title { overflow-wrap: anywhere; text-wrap: balance; max-width: 34ch; }
@media (min-width: 900px) { .thread-head__title { font-size: var(--fs-2xl); max-width: 40ch; } }
.thread-head__meta { font-size: var(--fs-sm); gap: var(--sp-1) var(--sp-4); }
.thread-head__meta .icon { width: 16px; height: 16px; }
.thread-head__meta b { color: var(--text-strong); font-weight: var(--fw-semibold); }
.thread-head__meta .username { color: var(--text-strong); }
.thread-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
@media (max-width: 599px) {
  .thread-head__actions .btn--sm { min-height: var(--tap); }
}
/* follow toggle: two labels, aria-pressed picks one */
.follow__on { display: none; }
[data-follow][aria-pressed="true"] .follow__on { display: inline; }
[data-follow][aria-pressed="true"] .follow__off { display: none; }
[data-follow][aria-pressed="true"] { background: var(--yellow-soft); border-color: var(--yellow); color: var(--text-strong); }
[data-follow][aria-pressed="true"] .icon { fill: currentColor; }

/* ---- replies header: title · count · sort ---- */
.thread-replies { display: grid; gap: var(--sp-3); }
.thread-replies__head { flex-wrap: wrap; row-gap: var(--sp-2); margin-bottom: 0; }
.thread-replies__tools { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 599px) {
  .thread-replies__head .section-head__meta { margin-left: auto; }
  .thread-replies__tools { order: 3; flex: 1 1 100%; justify-content: space-between; margin-left: 0; }
  .thread-replies__tools .segmented { flex: 1 1 auto; }
  .thread-replies__tools .segmented__btn { flex: 1 1 0; min-height: 40px; }
  .thread-replies__tools .btn { min-height: 40px; }
}
#replies:empty { display: none; }

/* a freshly posted reply keeps clear of the sticky header when scrolled to */
.post { scroll-margin-top: calc(var(--header-h) + var(--sp-4)); }

/* ---- load more ---- */
.thread-replies .load-more { padding: var(--sp-2) 0 0; }
.thread-replies .load-more b { color: var(--text-strong); font-weight: var(--fw-semibold); }
.thread-replies .load-more [data-load-more][disabled] { opacity: .5; }
.thread-replies .load-more [data-load-more].is-loading .icon { animation: thread-spin .8s linear infinite; }
@keyframes thread-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .thread-replies .load-more [data-load-more].is-loading .icon { animation: none; } }

/* ---- composer at the end of the thread ---- */
.thread-compose { display: grid; gap: var(--sp-3); scroll-margin-top: calc(var(--header-h) + var(--sp-4)); }
.thread-compose .section-head { margin-bottom: 0; flex-wrap: wrap; }
.thread-compose .section-head__meta b { color: var(--text-strong); font-weight: var(--fw-semibold); }
.thread-compose .composer__actions { margin-left: auto; }
.thread-rules { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-sm); line-height: 1.5; color: var(--text-muted); }
.thread-rules .icon { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--text-muted); }
.thread-rules a { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; }

/* ---- related ---- */
.thread-related { display: grid; gap: var(--sp-3); }
.thread-related .section-head { margin-bottom: 0; }

/* ---- mobile: floating "Write a reply" above the tab bar (hidden once the composer is on screen) ---- */
.reply-fab {
  position: fixed; z-index: var(--z-sticky);
  right: calc(var(--sp-4) + var(--safe-right)); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-3) + var(--qdock-room, 0px));   /* above the centred quick dock */
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}
.reply-fab .btn { min-height: 48px; padding: 0 var(--sp-5); border-radius: var(--r-md); box-shadow: var(--shadow-pop); }
.reply-fab.is-away { opacity: 0; transform: translateY(8px); pointer-events: none; visibility: hidden; }
@media (min-width: 900px) { .reply-fab { display: none; } }
@media (max-width: 899px) { .thread-related { padding-bottom: calc(48px + var(--sp-4)); } }
@media (prefers-reduced-motion: reduce) { .reply-fab { transition: none; } }
