/* Threading: reply-count affordance on root messages + the thread panel. */

/* --- Reply-count indicator under a root message --------------------------- */
/* The slot is a direct grid child of `.message` (areas: "sep sep sep" /
   "avatar body body"). Place it on an implicit row spanning the body columns so
   it sits under the message body, aligned with the text — not under the avatar. */
.message__thread-indicator-slot {
  grid-column: 2 / -1;
}

.message__thread-indicator-slot:empty {
  display: none;
}

.message__thread-link {
  align-items: center;
  color: var(--color-link);
  display: inline-flex;
  font-size: 0.85em;
  font-weight: 600;
  gap: 0.4em;
  margin-block-start: 0.2em;
  padding-block: 0.2em;
  padding-inline: 0;
}

.message__thread-link:hover {
  text-decoration: underline;
}

.message__thread-link-icon {
  font-size: 1em;
  line-height: 1;
}

/* --- Thread panel (right-side overlay column) ----------------------------- */
.thread-panel {
  background-color: var(--color-bg);
  border-inline-start: 1px solid var(--color-border);
  bottom: 0;
  display: flex;
  flex-direction: column;
  inline-size: min(42ch, 100vw);
  inset-inline-end: 0;
  position: fixed;
  top: var(--navbar-height, 0);
  z-index: 40;
  box-shadow:
    0 0 0 1px oklch(var(--lch-always-black) / 0.02),
    0 .4em 2.4em -1em oklch(var(--lch-always-black) / 0.3);
}

.thread-panel[hidden] {
  display: none;
}

.thread-panel__inner {
  display: flex;
  flex-direction: column;
  block-size: 100%;
  min-block-size: 0;
}

.thread-panel__header {
  align-items: center;
  border-block-end: 1px solid var(--color-border);
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  padding-block: 0.7em;
  padding-inline: 1em;
}

.thread-panel__title {
  font-size: 1em;
  font-weight: 700;
  margin: 0;
}

.thread-panel__close {
  flex: 0 0 auto;
}

.thread-panel__messages {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow-y: auto;
  padding-block: 0.5em;
  padding-inline: 0.5em;
}

/* Messages rendered inside the thread panel are NOT processed by the main-timeline
   JS formatter (which adds .message--formatted to flip visibility on), so they'd
   stay invisible. Force them visible here, and drop the per-message day separator
   (which the formatter would otherwise toggle) so it doesn't reserve blank space. */
.thread-panel .message {
  visibility: visible;
}

.thread-panel .message__day-separator {
  display: none;
}

.thread-panel__divider {
  align-items: center;
  color: var(--color-border-darker);
  display: flex;
  font-size: 0.8em;
  gap: 0.6em;
  margin-block: 0.6em;
  padding-inline: 0.5em;
}

.thread-panel__divider::before,
.thread-panel__divider::after {
  background-color: var(--color-border);
  block-size: 1px;
  content: "";
  flex: 1 1 auto;
}

.thread-panel__composer {
  border-block-start: 1px solid var(--color-border);
  flex: 0 0 auto;
  padding-block: 0.7em;
  padding-inline: 0.8em;
}

.thread-composer__row {
  width: 100%;
}

.thread-composer__input {
  min-block-size: 2.4em;
}

@media (max-width: 60ch) {
  .thread-panel {
    inline-size: 100vw;
  }
}
