.thread-view .thread-replying {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-8);
  min-width: 0;
}

.thread-view .thread-replying .locution-quote-view {
  flex: 1;
}

.thread-view .thread-heading {
  display: flex;
  align-items: center;
  gap: var(--spacing-12);
}

.thread-view .thread-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: calc(((var(--spacing-8) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2));
  height: calc(((var(--spacing-8) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2));
  padding: 0;
  margin: 0;
  border: var(--border-width-base) solid var(--border-color-base);
  border-radius: var(--border-radius-circle);
  background-color: var(--background-color-base);
  color: var(--color-base);
  cursor: pointer;
}

.thread-view .thread-collapse:hover {
  background-color: var(--background-color-interactive-subtle-hover);
}

.thread-view .thread-collapse:active {
  background-color: var(--background-color-interactive-subtle-active);
  color: var(--color-emphasized);
}

.thread-view .thread-collapse:focus {
  outline: var(--border-width-base) solid var(--border-color-transparent);
}

.thread-view .thread-collapse:focus-visible {
  outline: var(--border-width-thick) solid var(--border-color-blue-focus);
  outline-offset: var(--border-width-base);
}

.thread-view .thread-title {
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-medium-16);
  font-weight: var(--font-weight-semi-bold);
  color: var(--color-base);
  margin: 0;
}

.thread-view .thread-count {
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-medium-16);
  color: var(--color-subtle);
  background-color: var(--background-color-neutral-subtle);
  padding: var(--spacing-4);
  line-height: var(--line-height-small-22);
  border-radius: var(--border-radius-pill);
}

.thread-view .thread-author {
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-medium-16);
  font-weight: var(--font-weight-semi-bold);
  color: var(--color-base);
}

.thread-view .thread-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
}

.thread-view .thread-entry::before {
  content: "";
  position: absolute;
  inset-inline-start: calc((((var(--spacing-8) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2);
  inset-block-start: 0;
  inset-block-end: 0;
  width: 1px;
  background-color: var(--border-color-subtle);
}

.thread-view .thread-entry:first-child::before {
  inset-block-start: calc(var(--spacing-12) + ((((var(--spacing-8) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2));
}

.thread-view .thread-entry:last-child::before {
  inset-block-end: auto;
  height: calc(var(--spacing-12) + ((((var(--spacing-8) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2));
}

.thread-view .thread-entry:first-child:last-child::before {
  display: none;
}

.thread-view .thread:has(.thread-compose) .thread-entry:last-child::before {
  display: block;
  inset-block-end: 0;
  height: auto;
}

.thread-view .thread:has(.thread-entry) .thread-compose {
  position: relative;
}

.thread-view .thread-compose .text-area-input, .thread-view .locution-edit-form .text-area-input {
  max-height: 64dvh !important;
}

.thread-view .thread-compose .prompt-text-rendered, .thread-view .locution-edit-form .prompt-text-rendered {
  min-height: calc(4 * var(--line-height-small-22) + 2 * var(--spacing-12) + 2 * var(--border-width-base));
}

.thread-view .thread:has(.thread-entry:last-child .locution-rail:hover) .thread-compose::before {
  background-color: var(--border-color-base);
}

.thread-view .thread:has(.thread-entry) .thread-compose::before {
  content: "";
  position: absolute;
  inset-inline-start: calc((((var(--spacing-8) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2);
  inset-block-start: calc(-1 * var(--spacing-16));
  height: calc(var(--spacing-16) + ((((var(--spacing-8) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2));
  width: 1px;
  background-color: var(--border-color-subtle);
}

@media (max-width: 479px) {
  :root[data-phone-step='down'] .thread-view .thread-collapse {
    width: calc(((var(--spacing-4) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) !important;
    height: calc(((var(--spacing-4) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) !important;
  }

:root[data-phone-step='down'] .thread-view .thread-entry::before, :root[data-phone-step='down'] .thread-view .thread:has(.thread-entry) .thread-compose::before {
    inset-inline-start: calc((((var(--spacing-4) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2) !important;
  }

:root[data-phone-step='down'] .thread-view .thread-entry:first-child::before {
    inset-block-start: calc(var(--spacing-12) + ((((var(--spacing-4) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2)) !important;
  }

:root[data-phone-step='down'] .thread-view .thread-entry:last-child::before {
    height: calc(var(--spacing-12) + ((((var(--spacing-4) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2)) !important;
  }

:root[data-phone-step='down'] .thread-view .thread:has(.thread-compose) .thread-entry:last-child::before {
    height: auto !important;
  }

:root[data-phone-step='down'] .thread-view .thread:has(.thread-entry) .thread-compose::before {
    height: calc(var(--spacing-16) + ((((var(--spacing-4) * 2) + var(--line-height-small-22)) + (var(--border-width-base) * 2)) / 2)) !important;
  }
}

.thread-view .thread-entry {
  position: relative;
  display: flex;
  gap: var(--spacing-12);
  align-items: flex-start;
  padding-block: var(--spacing-12);
}

.thread-view .thread-event {
  flex-wrap: nowrap;
  align-items: flex-start;
}

.thread-view .thread-event-body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
  min-width: 0;
  flex: 1;
}

.thread-view .thread-event-line {
  min-width: 0;
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-medium-16);
  line-height: var(--line-height-small-22);
  color: var(--color-subtle);
}

.thread-view .thread-event-line > *, .thread-view .thread-event-line > .link-view {
  display: inline;
}

.thread-view .thread-event-summary {
  color: var(--color-base);
}

.thread-view .thread-event-timestamp {
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-medium-16);
  color: var(--color-subtle);
}

.thread-view .thread-event-outcome[data-tone='green'] {
  color: var(--color-green);
}

.thread-view .thread-event-outcome[data-tone='red'] {
  color: var(--color-red);
}

.thread-view .thread-event-outcome[data-tone='gray'] {
  color: var(--color-subtle);
}

.thread-view .thread-event-note {
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-small-14);
}

.thread-view .thread-event-added {
  font-family: var(--typography-font-mono);
  font-size: var(--font-size-medium-16);
  color: var(--color-green);
}

.thread-view .thread-event-removed {
  font-family: var(--typography-font-mono);
  font-size: var(--font-size-medium-16);
  color: var(--color-red);
}

.thread-view .thread-event-object {
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-medium-16);
  overflow-wrap: anywhere;
}

.thread-view .thread-event-anchor {
  font-family: var(--typography-font-mono);
  font-size: var(--font-size-medium-16);
}

.thread-view .thread-event-object[data-unlinked], .thread-view .thread-event-anchor[data-unlinked] {
  color: var(--color-base);
}

.thread-view .thread-event-instance[data-nocturne-instances='1'] {
  display: none;
}

.thread-view .thread-event-verdicts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-8);
}

.thread-view .thread-event-body .action-gate-view {
  align-items: flex-start;
}

.thread-view .thread-event-body .action-gate-actions {
  justify-content: flex-start;
}

.thread-view .thread-event-changed {
  max-height: var(--size-256);
  overflow-y: auto;
}

.thread-view .thread-event-detail {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  margin-block: 0;
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-medium-16);
  color: var(--color-base);
}

.thread-view .thread-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
  flex: 1;
  min-width: 0;
}

.thread-view .thread-submit {
  align-self: flex-end !important;
}

.thread-view .thread-post {
  display: flex;
  gap: var(--spacing-12);
  align-items: flex-start;
}

.thread-view .thread-sign-in {
  font-family: var(--typography-font-sans);
  font-size: var(--font-size-medium-16);
  color: var(--color-subtle);
  margin: 0;
}

.thread-view .thread-compose {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
}

.thread-view .thread {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-16);
  transition: row-gap var(--transition-duration-medium) var(--transition-timing-function-system);
}

.thread-view .thread-section {
  min-width: 0;
  transition: height var(--transition-duration-medium) var(--transition-timing-function-system);
}

.thread-view .thread-section-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-16);
  min-width: 0;
  opacity: 1;
  transition: opacity var(--transition-duration-base) var(--transition-timing-function-system);
}

.thread-view:not([data-section-motion='idle']) .thread-section {
  overflow: clip;
}

.thread-view[data-section-collapsed='true'][data-section-motion='idle'] .thread-section {
  display: none;
}

.thread-view[data-section-motion='closing'] .thread-section-content, .thread-view[data-section-motion='enter-from'] .thread-section-content {
  opacity: 0;
  pointer-events: none;
}

.thread-view[data-section-collapsed='true'] .thread {
  row-gap: 0;
}

@media (prefers-reduced-motion: reduce) {
  .thread-view .thread-collapse .animated-right-down-chevron-view, .thread-view .thread-section, .thread-view .thread-section-content, .thread-view .thread {
    transition: none !important;
  }
}
